Add real PinMAME (VPinMAME.Controller) integration for ROM-based tables

Statically links the real PinMAME emulation core (libpinmame) instead of
leaving VPinMAME.Controller creation to fail, which was crashing table
scripts on ROM-based tables before they could spawn a ball. PinMAME's own
run_game()->cpu_run() loop is split into a one-shot init, a per-frame step,
and a one-shot teardown (patches/pinmame/0004) so it runs cooperatively on
the same frame callback as vpinball's own loop instead of on a real
std::thread, which hard-aborts under Emscripten's single-threaded runtime -
three smaller wasm32 portability fixes to libpinmame itself round out the
patch set (0001-0003). Adds pinball.loadRom() to supply a ROM zip, written
to the table-relative pinmame/roms/ path vpinball's own plugin already
checks. Confirmed against a real community ROM-based table: Controller
creation and game identification succeed, and a missing ROM now fails
cleanly instead of crashing the page - actual ROM-driven gameplay is still
unconfirmed since no ROM was available (or sought out) to test with.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SoSarxLgY33Kax5UNXcafZ
This commit is contained in:
2026-08-23 12:09:35 +02:00
co-authored by Claude Sonnet 5
parent d91ef0c96d
commit 9479cea280
13 changed files with 756 additions and 8 deletions
+13
View File
@@ -35,6 +35,19 @@ export interface PinballInstance {
* session with a different table).
*/
loadTable(vpxBytes: ArrayBuffer): void;
/**
* Makes a ROM zip available to PinMAME (VPinMAME.Controller) for a
* ROM-based ("SS"/real-hardware) table's Controller.Run() call - written
* to /tables/pinmame/roms/<gameName>.zip, the table-relative convention
* PinMAME's plugin already looks for before any global settings path.
* gameName is the short ROM/game name the table's own script passes to
* LoadVPM (e.g. "hvymetal"), not the table's display title. Must be
* called before start() (or loadTable(), if switching tables) since
* Controller.Run() reads the filesystem synchronously at table-init
* time. ROM files are copyrighted - only supply ones you're legally
* entitled to use.
*/
loadRom(gameName: string, romZipBytes: ArrayBuffer): void;
/** Start the simulation's main loop. No-op if already running. */
start(): void;
/** Stop the simulation; the engine tears down (script Exit event, settings save) on its next step. */