summarylogtreecommitdiffstats
path: root/xash3d.sh
blob: 7661218ce1b68b8ae13f74e8dc96d9105d38fc9c (plain)
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=${PWD##*/}
IS64BIT=$(getconf LONG_BIT)

if [ "$IS64BIT" == "64" ]; then
	LIBPREFIX="lib32"
else
	LIBPREFIX="lib"
fi

if [ "$SCRIPT_DIR" == "bin" ]; then
# Xash3D SDL is installed in system, so run it from lib/xash3d/ directory with Steam HL basedir if XASH3D_BASEDIR is not set
	if [ -z "$XASH3D_BASEDIR" ]; then
		export XASH3D_BASEDIR="$HOME/.steam/steam/steamapps/common/Half-Life/"
	fi
	echo "Xash3D SDL is installed in system."
fi
        GAMEROOT=/usr/lib/xash3d


#determine platform
UNAME=`uname`
if [ "$UNAME" == "Darwin" ]; then
	# prepend our lib path to LD_LIBRARY_PATH
	export DYLD_LIBRARY_PATH=${GAMEROOT}:$DYLD_LIBRARY_PATH
elif [ "$UNAME" == "Linux" ]; then
	# prepend our lib path to LD_LIBRARY_PATH
	export LD_LIBRARY_PATH=${GAMEROOT}:$LD_LIBRARY_PATH
elif [ "$UNAME" == "FreeBSD" ]; then
	export LD_LIBRARY_PATH=${GAMEROOT}:$LD_LIBRARY_PATH
fi

if [ -z $GAMEEXE ]; then
	if [ "$UNAME" == "Darwin" ]; then
		GAMEEXE=xash3d
	elif [ "$UNAME" == "Linux" ]; then
		GAMEEXE=xash3d
	elif [ "$UNAME" == "FreeBSD" ]; then
		GAMEEXE=xash3d
	fi
fi

ulimit -n 2048

# and launch the game
cd "$GAMEROOT"

STATUS=42
while [ $STATUS -eq 42 ]; do
	${DEBUGGER} "${GAMEROOT}"/${GAMEEXE} $@
	STATUS=$?
done
exit $STATUS