Add ROM upload, local table library, engine bump, and UX/responsiveness fixes

- Bump @valknar/vpinball-wasm to 0.3.2 (PinMAME ROM support, MsgBox fix)
- Add optional PinMAME ROM .zip upload alongside .vpx tables
- Persist uploaded tables/ROMs in IndexedDB so users don't have to
  re-upload on later visits, with a library list on the landing page
- Fix Insert Coin key mismatch with the engine's real coin-door gating
  (now bound to 4, matching the shared table scripts) and surface it
  in the controls legend and "Tap to Start" hint
- Make the landing page, staging panel, and in-game HUD responsive for
  portrait phone widths; drop the landscape hint since portrait plays fine
- Replace the separate STATS HUD toggle with an FPS row in the info panel

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N9JmzRBZenapVkFWjw9jmG
This commit is contained in:
2026-08-23 20:15:41 +02:00
co-authored by Claude Sonnet 5
parent 5b30442c4a
commit 35fb68c916
21 changed files with 472 additions and 99 deletions
+18
View File
@@ -33,9 +33,15 @@ export interface UsePinballInstanceResult {
start: () => void;
}
export interface RomSelection {
gameName: string;
romData: ArrayBuffer;
}
export function usePinballInstance(
canvasRef: React.RefObject<HTMLCanvasElement | null>,
tableData: ArrayBuffer | undefined,
rom: RomSelection | undefined,
): UsePinballInstanceResult {
// Computed once at mount (not inside the effect below) so the WebGL2-
// unsupported case is derived initial state rather than a setState call
@@ -73,6 +79,18 @@ export function usePinballInstance(
instance.dispose();
return;
}
if (rom) {
try {
// Must run before start() — Controller.Run() reads the ROM
// file synchronously at table-init time. A bad/mismatched ROM
// zip fails cleanly inside the engine rather than here, so this
// is defensive against loadRom() itself throwing (e.g. a
// corrupt zip), not something expected to fire routinely.
instance.loadRom(rom.gameName, rom.romData);
} catch (err) {
console.error("Failed to load ROM:", err);
}
}
instanceRef.current = instance;
setLoadTimeMs(performance.now() - startedAt);
setStatus("ready");