]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
Setup JS before init
authorLock l00p <hakzstudios@gmail.com>
Sat, 30 Sep 2023 01:20:12 +0000 (01:20 +0000)
committerLock l00p <hakzstudios@gmail.com>
Sat, 30 Sep 2023 01:20:12 +0000 (01:20 +0000)
misc/buildfiles/emscripten/prejs.js [new file with mode: 0644]
misc/tools/all/xonotic.subr

diff --git a/misc/buildfiles/emscripten/prejs.js b/misc/buildfiles/emscripten/prejs.js
new file mode 100644 (file)
index 0000000..cf84adb
--- /dev/null
@@ -0,0 +1,21 @@
+//current command in ascii decimal
+let currentcmd = [0,0,0] 
+let cmditerate = 0
+runcmd = function() {}
+Module['arguments'] = "-xonotic"
+Module['preRun'] = function(){
+    function stdin(){
+    //if current command is default, it just returns 0, code for null
+    if(currentcmd == [0,0,0]){
+        return 0
+    }
+    //it iterates through the cmd
+    cmditerate = cmditerate + 1;
+    if(cmditerate - 1 > currentcmd.length - 1) {currentcmd = [0,0,0]; return 0}
+    return currentcmd[cmditerate - 1]
+
+    }; 
+    var stdout = null; 
+    var stderr = null; 
+    FS.init(stdin,stdout,stderr);
+}
\ No newline at end of file
index 86fc27ea0a021ff4271d32fb94739ae07496a566..6e20f7ec61ef6c800071c243b84f4befbddd58e6 100755 (executable)
@@ -43,7 +43,7 @@ case "$cmd" in
                        
                fi      
                export CC="emcc"
-               export CC="$CC -DSUPPORTIPV6 -sUSE_SDL=2 -sUSE_LIBJPEG=1"
+               export CC="$CC -DSUPPORTIPV6"
                while :; do
                        case "$1" in
                                -0)
@@ -310,7 +310,7 @@ case "$cmd" in
                        verbose emmake make $MAKEFLAGS clean
                fi
                for T in $TARGETS; do
-                       verbose emmake make $MAKEFLAGS LDFLAGS_EXTRA='-sSINGLE_FILE -sFULL_ES2 -sUSE_ZLIB -sINITIAL_MEMORY=100MB' EXE_UNIXSDL="darkplaces-emscripten.html" DP_SSE=0 CFLAGS_EXTRA="-I../../../../misc/builddeps/emscripten/d0_blind_id/include -L../../../../misc/builddeps/emscripten/d0_blind_id/lib -Wl,-rpath,../../../../misc/builddeps/emscripten/d0_blind_id/lib -I../../../../misc/builddeps/emscripten/gmp/include -L../../../../misc/builddeps/emscripten/gmp/lib -Wl,-rpath,../../../../misc/builddeps/emscripten/gmp/lib -L../../../../misc/builddeps/emscripten/jpeg/lib/ -Wl,-rpath,../../../../misc/builddeps/emscripten/jpeg/lib/ -I../../../../misc/builddeps/emscripten/jpeg/include/ -sUSE_SDL=2 -sUSE_ZLIB=1 -DUSE_GLES2 " LIBM="" LIBZ="" LIBJPEG="" STRIP=: "$@" "$T"
+                       verbose emmake make $MAKEFLAGS LDFLAGS_EXTRA='--pre-js ../../../../misc/buildfiles/emscripten/prejs.js -sSINGLE_FILE -sFULL_ES2 -sUSE_ZLIB -sINITIAL_MEMORY=100MB' EXE_UNIXSDL="darkplaces-emscripten.html" DP_SSE=0 CFLAGS_EXTRA="-I../../../../misc/builddeps/emscripten/d0_blind_id/include -L../../../../misc/builddeps/emscripten/d0_blind_id/lib -Wl,-rpath,../../../../misc/builddeps/emscripten/d0_blind_id/lib -I../../../../misc/builddeps/emscripten/gmp/include -L../../../../misc/builddeps/emscripten/gmp/lib -Wl,-rpath,../../../../misc/builddeps/emscripten/gmp/lib -L../../../../misc/builddeps/emscripten/jpeg/lib/ -Wl,-rpath,../../../../misc/builddeps/emscripten/jpeg/lib/ -I../../../../misc/builddeps/emscripten/jpeg/include/ -sUSE_SDL=2 -sUSE_ZLIB=1 -DUSE_GLES2 " LIBM="" LIBZ="" LIBJPEG="" STRIP=: "$@" "$T"
                done
                for T in $BAD_TARGETS; do
                        $ECHO "Warning: discarded invalid client $T."