summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/source/initialsetup/compilingmame.rst4
-rw-r--r--scripts/genie.lua49
-rw-r--r--scripts/src/main.lua57
3 files changed, 48 insertions, 62 deletions
diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst
index f5be3a636f9..84dd21dd00c 100644
--- a/docs/source/initialsetup/compilingmame.rst
+++ b/docs/source/initialsetup/compilingmame.rst
@@ -314,8 +314,8 @@ above in All Platforms.
Emscripten Javascript and HTML
------------------------------
-First, download and install Emscripten 1.37.29 or later by following the
-instructions at the `official site <https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html>`_.
+First, download and install Emscripten 2.0.25 or later by following the
+instructions at the `official site <https://emscripten.org/docs/getting_started/downloads.html>`_.
Once Emscripten has been installed, it should be possible to compile MAME
out-of-the-box using Emscripten’s **emmake** tool. Because a full MAME
diff --git a/scripts/genie.lua b/scripts/genie.lua
index b2d3d475533..a42b488a38c 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -1155,13 +1155,54 @@ configuration { "asmjs" }
}
buildoptions_cpp {
"-std=c++17",
- "-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 EXCEPTION_CATCHING_ALLOWED=\"['_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']\"",
}
linkoptions {
"-Wl,--start-group",
- "-r",
- }
+ "-O" .. _OPTIONS["OPTIMIZE"],
+ "-s USE_SDL=2",
+ "-s USE_SDL_TTF=2",
+ "--memory-init-file 0",
+ "-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']\"",
+ "-s EXPORTED_RUNTIME_METHODS=\"['cwrap']\"",
+ "-s ERROR_ON_UNDEFINED_SYMBOLS=0",
+ "-s USE_WEBGL2=1",
+ "-s LEGACY_GL_EMULATION=1",
+ "-s GL_UNSAFE_OPTS=0",
+ "--pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js",
+ "--post-js " .. _MAKE.esc(MAME_DIR) .. "scripts/resources/emscripten/emscripten_post.js",
+ "--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/chains@bgfx/chains",
+ "--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/effects@bgfx/effects",
+ "--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/shaders/essl@bgfx/shaders/essl",
+ "--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/bgfx@artwork/bgfx",
+ "--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/slot-mask.png@artwork/slot-mask.png",
+ }
+ if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
+ linkoptions {
+ "-g" .. _OPTIONS["SYMLEVEL"],
+ "-s DEMANGLE_SUPPORT=1",
+ }
+ end
+ if _OPTIONS["WEBASSEMBLY"] then
+ linkoptions {
+ "-s WASM=" .. _OPTIONS["WEBASSEMBLY"],
+ }
+ else
+ linkoptions {
+ "-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
+ linkoptions {
+ "-s ALLOW_MEMORY_GROWTH=0",
+ "-s TOTAL_MEMORY=268435456",
+ }
+ else
+ linkoptions {
+ "-s ALLOW_MEMORY_GROWTH=1",
+ }
+ end
archivesplit_size "20"
configuration { "android*" }
diff --git a/scripts/src/main.lua b/scripts/src/main.lua
index 04cccabc0c0..c76fa1da227 100644
--- a/scripts/src/main.lua
+++ b/scripts/src/main.lua
@@ -73,62 +73,7 @@ end
targetextension ".exe"
configuration { "asmjs" }
- targetextension ".bc"
- if os.getenv("EMSCRIPTEN") then
- local emccopts = ""
- .. " -O" .. _OPTIONS["OPTIMIZE"]
- .. " -s USE_SDL=2"
- .. " -s USE_SDL_TTF=2"
- .. " --memory-init-file 0"
- .. " -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']\""
- .. " -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['cwrap']\""
- .. " -s ERROR_ON_UNDEFINED_SYMBOLS=0"
- .. " -s USE_WEBGL2=1"
- .. " -s LEGACY_GL_EMULATION=1"
- .. " -s GL_UNSAFE_OPTS=0"
- .. " --pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js"
- .. " --post-js " .. _MAKE.esc(MAME_DIR) .. "scripts/resources/emscripten/emscripten_post.js"
- .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/chains@bgfx/chains"
- .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/effects@bgfx/effects"
- .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/shaders/essl@bgfx/shaders/essl"
- .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/bgfx@artwork/bgfx"
- .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/slot-mask.png@artwork/slot-mask.png"
-
- if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
- emccopts = emccopts
- .. " -g" .. _OPTIONS["SYMLEVEL"]
- .. " -s DEMANGLE_SUPPORT=1"
- 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
- emccopts = emccopts .. " " .. _OPTIONS["ARCHOPTS"]
- end
-
- postbuildcommands {
- --os.getenv("EMSCRIPTEN") .. "/emcc " .. emccopts .. " $(TARGET) -o " .. _MAKE.esc(MAME_DIR) .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".js",
- os.getenv("EMSCRIPTEN") .. "/emcc " .. emccopts .. " $(TARGET) -o " .. _MAKE.esc(MAME_DIR) .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".html",
- }
- end
+ targetextension ".html"
configuration { }