From ee2be394226d5f379758e6b1e6d71be9b281162d Mon Sep 17 00:00:00 2001 From: Lock l00p Date: Sat, 30 Sep 2023 03:51:29 +0000 Subject: [PATCH] Attempt to embed data folder --- misc/buildfiles/emscripten/prejs.js | 3 ++- misc/buildfiles/emscripten/shell.html | 1 + misc/tools/all/xonotic.subr | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/buildfiles/emscripten/prejs.js b/misc/buildfiles/emscripten/prejs.js index 836974aa..c911cf19 100644 --- a/misc/buildfiles/emscripten/prejs.js +++ b/misc/buildfiles/emscripten/prejs.js @@ -10,9 +10,10 @@ cmd = function(input){ } return 0 } +Module['preInit'] = function(){FS.mount(IDBFS,{},"/")} Module['arguments'] = ["-xonotic"] //pipes output to console -Module['print'] = function(text){console.log(text)} +Module['print'] = function(text){console.log(text); FS.syncfs()} Module['preRun'] = function(){ function stdin(){ //if current command is default, it just returns 0, code for null diff --git a/misc/buildfiles/emscripten/shell.html b/misc/buildfiles/emscripten/shell.html index 4b3b1d23..b7d7f4e9 100644 --- a/misc/buildfiles/emscripten/shell.html +++ b/misc/buildfiles/emscripten/shell.html @@ -4,6 +4,7 @@ + Xonotic diff --git a/misc/tools/all/xonotic.subr b/misc/tools/all/xonotic.subr index 108decc4..473604de 100755 --- a/misc/tools/all/xonotic.subr +++ b/misc/tools/all/xonotic.subr @@ -310,7 +310,7 @@ case "$cmd" in verbose emmake make $MAKEFLAGS clean fi for T in $TARGETS; do - verbose emmake make $MAKEFLAGS LDFLAGS_EXTRA='--pre-js ../../../../misc/buildfiles/emscripten/prejs.js --shell-file ../../../../misc/buildfiles/emscripten/shell.html -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 --shell-file ../../../../misc/buildfiles/emscripten/shell.html --embed-file ../../../../data@data -sSINGLE_FILE -sFULL_ES2 -sUSE_ZLIB -sALLOW_MEMORY_GROWTH -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." -- 2.39.2