File: sandbox_unix

package info (click to toggle)
sandboxgamemaker 2.7.1%2Bdfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: wheezy
  • size: 5,868 kB
  • sloc: cpp: 104,572; ansic: 1,446; makefile: 809; sh: 285
file content (156 lines) | stat: -rw-r--r-- 5,274 bytes parent folder | download | duplicates (2)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash
# SANDBOX_DIR should refer to the directory in which sandbox is placed, the default should be good enough.
#SANDBOX_DIR=~/sandbox
#SANDBOX_DIR=/usr/local/sandbox
SANDBOX_DIR=/usr/share/sandboxgamemaker

SANDBOX_OPTIONS=""
SANDBOX_MODULE="fps"
SANDBOX_HOME="${HOME}/.platinumarts"
SANDBOX_TYPE="client"
SANDBOX_PREFIX="sandbox"
SANDBOX_EXEC=""

while [ $# -ne 0 ]
do
	case $1 in
		"-h"|"-?"|"-help"|"--help")
			echo ""
			echo "Sandbox Linux Launching Script"
			echo "Example: ./sandbox_unix -gssp -t1"
			echo ""
			echo "   Script Arguments"
			echo "  -h|-?|-help|--help	show this help message"
			echo "  -g<string>		set gamemode to <string> (default: fps)"
			echo "				available modes: fps, krs, movie, rpg, ssp"
			echo "  --launcher		start the graphical launcher GUI"
			echo "  --server		launch dedicated server binary instead"
			echo "  --master		launch a masterserver for server registration"
			echo "				NOTE: compiled masterserver not included"
			echo "  --debug		starts the debug build(s) inside GDB"
			echo "				note that all arguments passed to this script will be"
			echo "				passed to sandbox when run is invokved in gdb."
			echo "				it's recommended that you do this in windowed mode (-t0)"
			echo ""
			echo "   Client Options"
			echo "  -q<string>		use <string> as the home directory (default: ~/.platinumarts)"
			echo "  -k<string>		mounts <string> as a package directory"
			echo "  -r<string>		executes <string> before launching, use instead of arguments such as -t, -a, -h, etc"
			echo "  -t<num>		sets fullscreen to <num>"
			echo "  -d<num>		runs a dedicated server (0), or a listen server (1)"
			echo "  -w<num>		sets window width, height is set to width * 3 / 4 unless also provided"
			echo "  -h<num>		sets window height, width is set to height * 4 / 3 unless also provided"
			echo "  -z<num>		sets depth (z) buffer bits (do not touch)"
			echo "  -b<num>		sets colour bits (usually 32 bit)"
			echo "  -a<num>		sets anti aliasing to <num>"
			echo "  -v<num>		sets vsync to <num> -- -1 for auto"
			echo "  -t<num>		sets fullscreen to <num>"
			echo "  -s<num>		sets stencil buffer bits to <num> (do not touch)"
			echo "  -f<num>		sets renderpath/shader precision"
			echo "		0 - turns shaders off"
			echo "		1 - 3 sets shader precision for ASM/GLSL renderpath"
			echo "		4 - 6 sets shader precision for GLSL renderpath"
			echo "  -l<string>		loads map <string> after initialisation"
			echo "  -x<string>		executes script <string> after initialisation"
			echo ""
			echo "  Server Options"
			echo "  NOTE: the dedicated server binary uses initserver.cfg, which overrides the below"
			echo "  -u<num>		sets the upload rate to <num>"
			echo "  -c<num>		sets the maximum amount of clients (max: 127 humans)"
			echo "  -i<string>		sets the server's ip address (use with caution)"
			echo "  -j<num>		sets the port to use for server connections"
			echo "  -m<string>		sets the masterserver's URL to <string>"
			echo "  -q<string>		use <string> as the home directory (default: ~/.platinumarts)"
			echo "  -k<string>		mounts <string> as a package directory"
			echo ""
			echo "Sandbox Script by Kevin \"Hirato Kirata\" Meyer"
			echo "(c) 2008-2011 - zlib/libpng licensed"
			echo ""

			exit 1
		;;
	esac

	tag=$(expr substr "$1" 1 2)
	argument=$(expr substr "$1" 3 1022)

	case $tag in
		"-g")
			SANDBOX_MODULE=$argument
		;;
		"-q")
			SANDBOX_HOME="\"$argument\""
		;;
		"--")
			case $argument in
			"server")
				SANDBOX_TYPE="server"
			;;
			"master")
				SANDBOX_TYPE="master"
			;;
			"launcher")
				SANDBOX_TYPE="launcher"
			;;
			"debug")
				SANDBOX_PREFIX="debug"
				SANDBOX_EXEC="gdb --args"
			;;
			esac
		;;
		*)
			SANDBOX_OPTIONS+=" \"$tag$argument\""
		;;
	esac

	shift
done

function failed {
	echo ""
	echo "A problem was encountered, please check which of the following it is."
	echo "1) there's no ${SANDBOX_TYPE} for module ${SANDBOX_MODULE}"
	echo "2) There isn't an available executable for your architecture; $(uname -m)"
	echo "3) the executable was moved"
	echo "please make sure that /usr/lib/sandboxgamemaker/${SANDBOX_PREFIX}_${SANDBOX_TYPE}_${SANDBOX_MODULE} exists. If it doesn't..."
	echo "install the sdl, sdl-image and sdl-mixer DEVELOPMENT libraries and use \"make -C ${SANDBOX_DIR}/src install\" to compile a binary"
	echo ""
	exit 1
}


cd ${SANDBOX_DIR}
case ${SANDBOX_TYPE} in
	"client")
		if [ -a /usr/lib/sandboxgamemaker/${SANDBOX_PREFIX}_client_${SANDBOX_MODULE} ]
		then
			eval ${SANDBOX_EXEC} /usr/lib/sandboxgamemaker/${SANDBOX_PREFIX}_client_${SANDBOX_MODULE} -q${SANDBOX_HOME} -r ${SANDBOX_OPTIONS}
		else
			failed
		fi
	;;
	"server")
		if [ a /usr/lib/sandboxgamemaker/${SANDBOX_PREFIX}_server_${SANDBOX_MODULE} ]
		then
			eval ${SANDBOX_EXEC} /usr/lib/sandboxgamemaker/${SANDBOX_PREFIX}_server_${SANDBOX_MODULE}  -q${SANDBOX_HOME} ${SANDBOX_OPTIONS}
		else
			failed
		fi
	;;
 	"master")
		if [ -a /usr/lib/sandboxgamemaker/sandbox_master ]
		then
			eval ${SANDBOX_EXEC} /usr/lib/sandboxgamemaker/${SANDBOX_PREFIX}_master
		else
			failed
		fi
	;;
	"launcher")
		if [ -a /usr/lib/sandboxgamemaker/sandboxgamemaker_glauncher ]
 		then
			eval ${SANDBOX_EXEC} /usr/lib/sandboxgamemaker/sandboxgamemaker_glauncher
 		else
 			failed
 		fi
	;;
esac