Previous 199869 Revisions Next

r45123 Monday 22nd February, 2016 at 07:03:38 UTC by Justin Kerk
Emscripten cleanup (nw)
[scripts/src]main.lua
[src/osd/modules/sound]js_sound.js

trunk/scripts/src/main.lua
r253634r253635
8787   configuration { "asmjs" }
8888      targetextension ".bc" 
8989      if os.getenv("EMSCRIPTEN") then
90         local emccopts = ""
91         emccopts = emccopts .. " -O3"
92         emccopts = emccopts .. " -s USE_SDL=2"
93         emccopts = emccopts .. " --memory-init-file 0"
94         emccopts = emccopts .. " -s ALLOW_MEMORY_GROWTH=0"
95         emccopts = emccopts .. " -s TOTAL_MEMORY=268435456"
96         emccopts = emccopts .. " -s DISABLE_EXCEPTION_CATCHING=2"
97         emccopts = emccopts .. " -s EXCEPTION_CATCHING_WHITELIST='[\"__ZN15running_machine17start_all_devicesEv\"]'"
98         emccopts = emccopts .. " -s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z12js_get_soundv', '__ZN10ui_manager12set_show_fpsEb', '__ZNK10ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio']\""
99         emccopts = emccopts .. " --pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js"
100         emccopts = emccopts .. " --post-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/sdl/emscripten_post.js"
101         emccopts = emccopts .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx@bgfx"
102         emccopts = emccopts .. " --embed-file " .. _MAKE.esc(MAME_DIR) .. "shaders/gles@shaders/gles"
90103         postbuildcommands {
91            os.getenv("EMSCRIPTEN") .. "/emcc -O3 -s DISABLE_EXCEPTION_CATCHING=2 -s USE_SDL=2 --memory-init-file 0 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -s EXCEPTION_CATCHING_WHITELIST='[\"__ZN15running_machine17start_all_devicesEv\"]' -s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__Z14js_get_machinev', '__Z9js_get_uiv', '__Z12js_get_soundv', '__ZN10ui_manager12set_show_fpsEb', '__ZNK10ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio']\" $(TARGET) -o " .. _MAKE.esc(MAME_DIR) .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".js --pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js --post-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/sdl/emscripten_post.js --embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx@bgfx --embed-file " .. _MAKE.esc(MAME_DIR) .. "shaders/gles@shaders/gles",
104            os.getenv("EMSCRIPTEN") .. "/emcc " .. emccopts .. " $(TARGET) -o " .. _MAKE.esc(MAME_DIR) .. _OPTIONS["target"] .. _OPTIONS["subtarget"] .. ".js",
92105         }
93106      end
94107
trunk/src/osd/modules/sound/js_sound.js
r253634r253635
185185};
186186
187187function sample_count() {
188      //TODO get someone to call this from the emulator,
189      //so the emulator can do proper audio buffering by
190      //knowing how many samples are left:
191      if (!context) {
192         //Use impossible value as an error code:
193         return -1;
194      }
195      var count = rear - start;
196      if (start > rear) {
197         count += bufferSize;
198      }
199      return count;
188   //TODO get someone to call this from the emulator,
189   //so the emulator can do proper audio buffering by
190   //knowing how many samples are left:
191   if (!context) {
192      //Use impossible value as an error code:
193      return -1;
194   }
195   var count = rear - start;
196   if (start > rear) {
197      count += bufferSize;
198   }
199   return count;
200200}
201201
202202return {


Previous 199869 Revisions Next


© 1997-2024 The MAME Team