Package: sandboxgamemaker / 2.5+dfsg-5

linux_launcher.patch Patch series | download
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
157
158
159
160
161
162
163
164
165
166
167
Description: Takes new sandbox_unix_usr script from upstream
Author: Scott Howard <showard314@gmail.com>
Index: sandboxgamemaker/sandbox_unix_usr
===================================================================
--- sandboxgamemaker.orig/sandbox_unix_usr	2010-03-06 18:12:29.716723720 -0500
+++ sandboxgamemaker/sandbox_unix_usr	2010-03-06 20:10:04.306721374 -0500
@@ -1,32 +1,133 @@
 #!/bin/bash
-#This script should not be launched unless sandbox installed in /usr/local/sandbox 
 # SANDBOX_DIR should refer to the directory in which sandbox is placed.
 #SANDBOX_DIR=~/sandbox
-SANDBOX_DIR=/usr/local/sandbox
-HOME_DIR=${HOME}/.platinumarts
+#SANDBOX_DIR=.
+SANDBOX_DIR=/usr/share/sandboxgamemaker
 
-#SANDBOX_OPTIONS="-r"
-SANDBOX_OPTIONS="-q${HOME_DIR} -r"
-#The -k's add two folders in the user's home as package dirs, just so he can make replacements for the contents on his side, easier
-
-case $(uname -m) in
-i386|i486|i586|i686)
-  MACHINE_BIT=32
-  ;;
-*)
-  MACHINE_BIT=64 #assume 64bit otherwise
-  ;;
-esac
+SANDBOX_OPTIONS=""
+SANDBOX_MODULE="fps"
+SANDBOX_HOME="${HOME}/.platinumarts"
+SANDBOX_TYPE="client"
+
+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: ssp, fps, rpg, movie"
+         echo "  --server      launch dedicated server binary instead"
+         echo "  --master      launch a masterserver for server registration"
+         echo "            NOTE: compiled masterserver not included"
+         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>      turns of shaders (0), or sets shader precision to <num> - 1 (1-3)"
+         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-2010 - 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\""
+      ;;
+      "-k"|"-i"|"-m"|"-r"|"-l"|"-x")
+         SANDBOX_OPTIONS+=" $tag\"$argument\""
 
-if [ -x ${SANDBOX_DIR}/bin/sandbox_client_${MACHINE_BIT}_fps ]
-then
-	cd ${SANDBOX_DIR}
-	exec ./bin/sandbox_client_${MACHINE_BIT}_fps ${SANDBOX_OPTIONS} $*
-else
-	echo "A problem was encountered, please check which of the following it is."
-	echo "1) an executable does not exist for your architecture; $(uname -m)"
-	echo "2) the executable was moved"
-	echo "3) There isn't an executable"
-	echo "4) There's an executable present, but has incorrect permissions (needs rwxr-xr-x or similar)"
-	exit 1
-fi
+      ;;
+      "--")
+         case $argument in
+         "server")
+            SANDBOX_TYPE="server"
+         ;;
+         "master")
+            SANDBOX_TYPE="master"
+         ;;
+         esac
+      ;;
+      *)
+         SANDBOX_OPTIONS+=" $1"
+      ;;
+   esac
+
+   shift
+done
+
+function failed {
+   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 "install the sdl, sdlimage and sdlmixer DEVELOPMENT libraries and use \"cd src && make install\" to compile a binary"
+   echo "NOTE: sandbox is installed in ${SANDBOX_DIR}"
+   exit 1
+}
+
+
+cd ${SANDBOX_DIR}
+case ${SANDBOX_TYPE} in
+   "client")
+      if [ -a /usr/lib/sandboxgamemaker/sandbox_client_${SANDBOX_MODULE} ]
+      then
+         eval /usr/lib/sandboxgamemaker/sandbox_client_${SANDBOX_MODULE} -q${SANDBOX_HOME} -r ${SANDBOX_OPTIONS}
+      else
+         failed
+      fi
+   ;;
+   "server")
+      if [ -a /usr/lib/sandboxgamemaker/sandbox_server_${SANDBOX_MODULE} ]
+      then
+         eval /usr/lib/sandboxgamemaker/sandbox_server_${SANDBOX_MODULE} -q${SANDBOX_HOME} ${SANDBOX_OPTIONS}
+      else
+         failed
+      fi
+   ;;
+   "master")
+      if [ -a /usr/lib/sandboxgamemaker/sandbox_master ]
+      then
+         eval /usr/lib/sandboxgamemaker/sandbox_master
+      else
+         failed
+      fi
+   ;;
+esac