diff options
author | 2020-10-24 00:44:57 -0700 | |
---|---|---|
committer | 2020-10-24 00:44:57 -0700 | |
commit | 56f2ebaeafdcfa51c5f960a3fbf5101d23a4d3ff (patch) | |
tree | c6ef19294dacab5f9906876d3c79a6b70d304425 /scripts/src/main.lua | |
parent | 6bac5bb8c2b3081b1fbe95d8ca48261d18f8e835 (diff) |
Emscripten: Allow memory size to grow at runtime when targeting WebAssembly as there is no longer a performance hit
Diffstat (limited to 'scripts/src/main.lua')
-rw-r--r-- | scripts/src/main.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 6ae28487563..46f23a256e5 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -148,8 +148,6 @@ end .. " -s USE_SDL=2" .. " -s USE_SDL_TTF=2" .. " --memory-init-file 0" - .. " -s ALLOW_MEMORY_GROWTH=0" - .. " -s TOTAL_MEMORY=268435456" .. " -s DISABLE_EXCEPTION_CATCHING=2" .. " -s EXCEPTION_CATCHING_WHITELIST=\"['__ZN15running_machine17start_all_devicesEv','__ZN12cli_frontend7executeEiPPc','__ZN8chd_file11open_commonEb','__ZN8chd_file13read_metadataEjjRNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE','__ZN8chd_file13read_metadataEjjRNSt3__26vectorIhNS0_9allocatorIhEEEE','__ZNK19netlist_mame_device19base_validity_checkER16validity_checker']\"" .. " -s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__ZN15running_machine30emscripten_get_running_machineEv', '__ZN15running_machine17emscripten_get_uiEv', '__ZN15running_machine20emscripten_get_soundEv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey', '__ZN15running_machine15emscripten_saveEPKc', '__ZN15running_machine15emscripten_loadEPKc', '__ZN15running_machine21emscripten_hard_resetEv', '__ZN15running_machine21emscripten_soft_resetEv', '__ZN15running_machine15emscripten_exitEv']\"" @@ -175,6 +173,19 @@ end if _OPTIONS["WEBASSEMBLY"] then emccopts = emccopts .. " -s WASM=" .. _OPTIONS["WEBASSEMBLY"] + else + emccopts = emccopts + .. " -s WASM=1" + end + + if _OPTIONS["WEBASSEMBLY"]~=nil and _OPTIONS["WEBASSEMBLY"]=="0" then + -- define a fixed memory size because allowing memory growth disables asm.js optimizations + emccopts = emccopts + .. " -s ALLOW_MEMORY_GROWTH=0" + .. " -s TOTAL_MEMORY=268435456" + else + emccopts = emccopts + .. " -s ALLOW_MEMORY_GROWTH=1" end if _OPTIONS["ARCHOPTS"] then |