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:
@@ -133,6 +133,30 @@ cp -r "$VENDOR_DIR/libwinevbs/wine/include/"* "$DEPS_DIR/include/libwinevbs/wine
|
||||
cp -r "$VENDOR_DIR/libwinevbs/atl/include/"* "$DEPS_DIR/include/libwinevbs/atl/include/"
|
||||
cp -r "$VENDOR_DIR/libwinevbs/atlmfc/include/"* "$DEPS_DIR/include/libwinevbs/atlmfc/include/"
|
||||
|
||||
# --- libpinmame (the real ROM/hardware emulation core VPinMAME.Controller --
|
||||
# --- wraps on every other platform; validated end-to-end for wasm32 by this
|
||||
# --- project's own pinmame-wasm spike - see patches/pinmame/ for the 3
|
||||
# --- portability fixes it needed. ARCH=wasm32 (not x86/x64/arm64/aarch64)
|
||||
# --- makes its own CMakeLists.txt skip the asmjit-based ARM7 JIT backend and
|
||||
# --- fall back to its portable interpreter, exactly as it already does for
|
||||
# --- 32-bit arm targets - no patch needed for that part. libpinmame's
|
||||
# --- CMakeLists.txt lives at cmake/libpinmame/ but its source paths are all
|
||||
# --- relative to the repo root, so upstream's own CI copies it there first;
|
||||
# --- mirrored here rather than patched, to stay a plain file copy diff-free.
|
||||
if ! cache_check "$VENDOR_DIR/pinmame" "built-${PINMAME_SHA}"; then
|
||||
echo "== Building libpinmame for wasm32 =="
|
||||
cp "$VENDOR_DIR/pinmame/cmake/libpinmame/CMakeLists.txt" "$VENDOR_DIR/pinmame/CMakeLists.txt"
|
||||
( cd "$VENDOR_DIR/pinmame" && emcmake cmake -DPLATFORM=linux -DARCH=wasm32 \
|
||||
-DBUILD_STATIC=ON -DBUILD_SHARED=OFF -DCMAKE_BUILD_TYPE=Release -B build \
|
||||
&& cmake --build build --target pinmame_static -- -j"$NUM_PROCS" )
|
||||
echo "built-${PINMAME_SHA}" > "$VENDOR_DIR/pinmame/.cache-sha"
|
||||
fi
|
||||
|
||||
cp "$VENDOR_DIR/pinmame/build/libpinmame.a" "$DEPS_DIR/lib/"
|
||||
mkdir -p "$DEPS_DIR/include/pinmame"
|
||||
cp "$VENDOR_DIR/pinmame/src/libpinmame/libpinmame.h" "$DEPS_DIR/include/pinmame/"
|
||||
cp "$VENDOR_DIR/pinmame/src/libpinmame/PinMAMEPlugin.h" "$DEPS_DIR/include/pinmame/"
|
||||
|
||||
echo ""
|
||||
echo "== build-deps.sh complete: $DEPS_DIR =="
|
||||
ls -la "$DEPS_DIR/lib"
|
||||
|
||||
@@ -80,9 +80,11 @@ apply_patches() {
|
||||
mkdir -p "$VENDOR_DIR"
|
||||
fetch_pinned "vpinball" "https://github.com/vpinball/vpinball" "$VPINBALL_SHA" "$VENDOR_DIR/vpinball"
|
||||
fetch_pinned "libwinevbs" "https://github.com/vpinball/libwinevbs" "$LIBWINEVBS_SHA" "$VENDOR_DIR/libwinevbs"
|
||||
fetch_pinned "pinmame" "https://github.com/vpinball/pinmame" "$PINMAME_SHA" "$VENDOR_DIR/pinmame"
|
||||
|
||||
apply_patches "vpinball" "$VENDOR_DIR/vpinball"
|
||||
apply_patches "libwinevbs" "$VENDOR_DIR/libwinevbs"
|
||||
apply_patches "pinmame" "$VENDOR_DIR/pinmame"
|
||||
|
||||
echo ""
|
||||
echo "== Setup complete =="
|
||||
|
||||
@@ -20,6 +20,17 @@ SDL_IMAGE_SHA=bec9134a26c7d0f31b36d6083c25296e04cabff5
|
||||
SDL_TTF_SHA=a1ce3670aec736ecbf0936c43f2f0cc53aa61e5b
|
||||
FREEIMAGE_SHA=b1613452a0c3849d43ac877b154cf51ff9e078d3
|
||||
|
||||
# PinMAME (the real ROM/hardware emulation core VPinMAME.Controller wraps on
|
||||
# every other platform). Mirrors vpinball's own platforms/config.sh pin
|
||||
# exactly (like LIBWINEVBS_SHA/SDL_SHA above) - vpinball's plugins/pinmame/
|
||||
# glue code is written against this specific libpinmame API surface (e.g.
|
||||
# PinmameSetMsgAPI), so a newer/older pinmame commit than this one won't
|
||||
# necessarily still match it. Validated end-to-end for wasm32 by this
|
||||
# project's own pinmame-wasm spike (compiles + runs the full driver database
|
||||
# under Emscripten - see patches/pinmame/ for the 3 portability fixes that
|
||||
# spike needed; re-verified against this exact pinned commit).
|
||||
PINMAME_SHA=23321ec7de6dfd563a1c64153bc75f26e5059b9f
|
||||
|
||||
# Emscripten SDK version already validated by both spikes
|
||||
# (spikes/libwinevbs-wasm and spikes/sdl3-gles3-wasm).
|
||||
EMSDK_VERSION=6.0.8
|
||||
|
||||
Reference in New Issue
Block a user