Add MSX, MSX2 and SG-1000 support via the blueMSX core - #1244
LokiCode404 wants to merge 3 commits into
Conversation
- Register msx, msx2, and sg1000 systems in the core registry, all pointing to the bluemsx core. Also add bluemsx as an alternative core for the coleco system. - Add @emulatorjs/core-bluemsx npm dependency. - Set system_directory in retroarch.cfg so blueMSX can locate its Machines/ and Databases/ on the virtual filesystem. Without this the directory resolved to / and the core failed to find its machine configurations (root cause of the silent content load failure). - Add MSX, MSX2 and Sega SG-1000 entries to the demo page system selector dropdown.
When the browser supports WebAssembly.Suspending (Chrome 123+, Firefox 132+, Edge), load the JSPI-compiled core (bluemsx-wasm.data) instead of the Asyncify fallback (bluemsx-legacy-wasm.data). Selection is transparent to the user.
|
Quick update — I've pushed a new commit with JSPI detection for the blueMSX core.
|
| "@emulatorjs/core-prboom": "latest", | ||
| "@emulatorjs/core-ppsspp": "latest" | ||
| "@emulatorjs/core-ppsspp": "latest", | ||
| "@emulatorjs/core-bluemsx": "latest" |
There was a problem hiding this comment.
I don't have access to the npm repo, I think, so we'll probably need to wait until this other developer is available for me to create this
ethanaobrien
left a comment
There was a problem hiding this comment.
Apologies for taking so long to review this. Only a few minor changes requested
| // blueMSX looks for Machines/ and Databases/ under RetroArch's | ||
| // system_directory. Without this the directory resolves to "/" | ||
| // and the core cannot find its machine configurations. |
There was a problem hiding this comment.
No need to have a blueMSX specific comment here (ai likes to do this lol)
There was a problem hiding this comment.
Haha, I use AI to comment out parts of the code in large projects so I don't get lost. I use my own core testing page and when it works, I integrate it into your project. Actually, that comment was for me.
| // JSPI detection: cores with dual JSPI+Asyncify builds use the | ||
| // non-legacy slot for JSPI and the legacy slot for Asyncify. | ||
| // Browsers without JSPI support automatically get the Asyncify fallback. | ||
| const jspiCores = ["bluemsx"]; |
There was a problem hiding this comment.
This should probably be in consts.js
Also btw, on JSPI detection, doesn't the backend need a toggle for this? I've never heard of this feature (probably very new), sorry about that
There was a problem hiding this comment.
Moved jspiCores over to consts.js like you said, and took out that bluemsx comment on system_directory.
JSPI is pretty new, no worries. It's a WASM thing (WebAssembly.Suspending) that lets you pause a sync call without Asyncify rewriting the whole binary. blueMSX needs it because it does sync fopen while loading the machine XML, but Asyncify also hits the Z80 loop, which runs millions of times a second and tanks performance. JSPI doesn't do that. Chrome/Firefox/Edge have it, Safari doesn't.
And yeah, the backend needs a compile flag. This isn't a runtime toggle, it's two different WASM builds (-s JSPI=1 or Asyncify). The JS side just checks if WebAssembly.Suspending exists and downloads bluemsx-wasm.data or the -legacy one. I reused the legacy slot because bluemsx doesn't use GLES3.
#46 only added it to needsAsync, so right now both files would still be full Asyncify. I can open another PR on RetroArch with USE_JSPI if you want.
Address review feedback: jspiCores lives next to requiresThreads / requiresWebGL2, and the bluemsx-specific comment on system_directory is removed. Detection still falls back to the Asyncify (-legacy) build when WebAssembly.Suspending is missing.
How to build and test
1. Clone the core source