Skip to content

Add blueMSX to the ASYNCIFY-required cores list - #46

Open
LokiCode404 wants to merge 1 commit into
EmulatorJS:v1.22.2from
LokiCode404:v1.22.2
Open

Add blueMSX to the ASYNCIFY-required cores list#46
LokiCode404 wants to merge 1 commit into
EmulatorJS:v1.22.2from
LokiCode404:v1.22.2

Conversation

@LokiCode404

@LokiCode404 LokiCode404 commented Jul 30, 2026

Copy link
Copy Markdown

blueMSX reads machine configuration XML files synchronously during retro_load_game() to initialize hardware emulation. Without ASYNCIFY=1 the core deadlocks on the Emscripten event loop and never reaches its main loop, causing a silent content load failure where only the RetroArch XMB menu appears.

Related Issues

None directly — this is part of adding MSX/MSX2/SG-1000 support to EmulatorJS via the blueMSX libretro core.

Related Pull Requests

blueMSX synchronously reads machine configuration XML files
during retro_load_game(). Without ASYNCIFY=1 the core deadlocks
on the Emscripten event loop and never initializes.
@LokiCode404

Copy link
Copy Markdown
Author

Pushed an update with some perf improvements for the blueMSX Emscripten build.
I found that full ASYNCIFY is a pretty significant bottleneck for this core — the Z80 CPU loop makes millions of indirect calls per second, and instrumenting all of them with save/restore code adds a lot of overhead.
What this commit adds to Makefile.emulatorjs:

  • A MIN_ASYNC path that uses ASYNCIFY_IGNORE_INDIRECT=1 and an ASYNCIFY_REMOVE list to exclude the CPU execution engine, VDP renderers, sound chip updates, and memory slot manager from instrumentation. Only the init/load path actually needs to yield.
  • A USE_JSPI mode as a third option alongside ASYNC and MIN_ASYNC. When USE_JSPI=1 is set, it uses -sJSPI=1 instead of -sASYNCIFY, which eliminates instrumentation overhead entirely — the VM handles stack switching natively.
  • JSPI added to the audio external-block exemption chain (same behavior as full ASYNC — no workarounds needed).
    And in build-emulatorjs.sh:
  • For minAsync cores (blueMSX), the script now produces two variants: JSPI → bluemsx-wasm.data for modern browsers, MIN_ASYNC → bluemsx-legacy-wasm.data as fallback.
    On the audio side, I disabled HAVE_AL for the MIN_ASYNC builds because the OpenAL codepath force-overrides ASYNC=1, which defeats the whole point. Using HAVE_RWEBAUDIO=1 instead works fine with the fake-block audio path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant