From 5db150e565eda367703e4e1cdaa59ba004387d36 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 15 Jun 2025 09:11:44 +0500 Subject: [PATCH] engine: launcher: get rid of Emscripten load library hacks, mount IDBFS into /rwdir --- engine/common/launcher.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/engine/common/launcher.c b/engine/common/launcher.c index d75bc6e4..0ab717e2 100644 --- a/engine/common/launcher.c +++ b/engine/common/launcher.c @@ -14,14 +14,16 @@ GNU General Public License for more details. */ #if XASH_ENABLE_MAIN +#include "build.h" +#include "common.h" + #if XASH_SDLMAIN #include #endif + #if XASH_EMSCRIPTEN #include #endif -#include "build.h" -#include "common.h" #ifndef XASH_GAMEDIR #define XASH_GAMEDIR "valve" // !!! Replace with your default (base) game directory !!! @@ -45,23 +47,22 @@ static int Sys_Start( void ) Q_strncpy( szGameDir, XASH_GAMEDIR, sizeof( szGameDir )); #if XASH_EMSCRIPTEN -#ifdef EMSCRIPTEN_LIB_FS - // For some unknown reason emscripten refusing to load libraries later - COM_LoadLibrary( "menu", 0 ); - COM_LoadLibrary( "server", 0 ); - COM_LoadLibrary( "client", 0 ); -#endif -#if XASH_DEDICATED - // NodeJS support for debug +#if !XASH_DEDICATED + EM_ASM( try { + FS.mkdir( '/rwdir' ); + FS.mount( IDBFS, { root: '.' }, '/rwdir' ); + } catch( e ) { };); +#else // XASH_DEDICATED EM_ASM(try { FS.mkdir( '/xash' ); FS.mount( NODEFS, { root: '.'}, '/xash' ); - FS.chdir( '/xash' ); } catch( e ) { };); -#endif -#elif XASH_IOS +#endif // XASH_DEDICATED +#endif // XASH_EMSCRIPTEN + +#if XASH_IOS IOS_LaunchDialog(); -#endif +#endif // XASH_IOS return Host_Main( szArgc, szArgv, szGameDir, 0, Sys_ChangeGame ); }