forked from FWGS/xash3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxash3d.sh
54 lines (47 loc) · 1.3 KB
/
xash3d.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
SCRIPT_DIR=$(cd "$(dirname -- "$0")" && pwd)
SCRIPT_NAME=$(basename "$0")
IS64BIT=$(getconf LONG_BIT)
if [ "$IS64BIT" = "64" ]; then
LIBPREFIX="lib32"
else
LIBPREFIX="lib"
fi
if [ -z "$GAMEEXE" ]; then
GAMEEXE=${SCRIPT_NAME%.*} # strip extension(not required, but do anyway)
fi
# Check if Xash3D FWGS installed in system
if [ "$SCRIPT_DIR" = "bin" ]; then
# Run it from lib/xash3d/ directory with Steam HL basedir if XASH3D_BASEDIR is not set
if [ -z "$XASH3D_BASEDIR" ]; then
if [ -d "$HOME/.steam/steam/steamapps/common/Half-Life/" ]; then
export XASH3D_BASEDIR="$HOME/.steam/steam/steamapps/common/Half-Life/"
else
export XASH3D_BASEDIR="$PWD"
fi
fi
GAMEROOT=${PWD}/../${LIBPREFIX}/${GAMEEXE}
echo "Xash3D FWGS is installed in system. Game directory is set to: $XASH3D_BASEDIR"
else
GAMEROOT="$SCRIPT_DIR"
fi
#determine platform
UNAME=$(uname)
if [ "$UNAME" = "Darwin" ]; then
# prepend our lib path to DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="${GAMEROOT}:$DYLD_LIBRARY_PATH"
else
# prepend our lib path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${GAMEROOT}:$LD_LIBRARY_PATH"
fi
# and launch the game
if ! cd "$GAMEROOT"; then
echo "Failed cd to $GAMEROOT"
exit
fi
STATUS=42
while [ $STATUS -eq 42 ]; do
${DEBUGGER} "${GAMEROOT}"/"${GAMEEXE}" "$@"
STATUS=$?
done
exit $STATUS