Show HN: PS2 games statically recompiled to WebAssembly
A new project statically recompiles PlayStation 2 games into WebAssembly so they can run in a browser or as native binaries, modeling key hardware components like vector units and the graphics synthesizer rather than doing cycle-accurate emulation. Commenters dive into technical trade-offs around timing accuracy, performance on devices ranging from old netbooks to the Steam Deck, and graphics API choices such as WebGPU vs legacy OpenGL. The work also raises broader questions about how AI-assisted recompilation affects game preservation, piracy risk, and long-term incentives for commercial game development.
Technical approach & accuracy
- Static AOT recompilation of PS2 “EE” code to WebAssembly / native; each basic block decrements a cycle budget.
- Timing is approximate, not cycle-accurate; interrupts, DMA, timers, vblank are delivered at block boundaries.
- Commenters note most games sync on interrupts/semaphores, so this works for many titles; timing bugs surface as specific edge cases to fix.
- VU1 microprograms are captured when first uploaded via DMA, compiled AOT per game; unseen ones are JIT-compiled to WASM.
- Some PS2 pipeline quirks are modeled: flag latency, PS2-style non‑IEEE floats with clamping, and VU1 on its own thread.
- GS (graphics) is emulated with WebGPU compute shaders; texture sampling is a major GPU bottleneck. GS frontend and VU1 each occupy large CPU shares.
Performance & platform targets
- Browser build runs well on a reasonably strong iGPU at 1x–2x resolution; integrated GPUs can be GPU-bound.
- Native Linux build uses Vulkan via wgpu + SDL2 (window, audio, gamepad). On Steam Deck, 1x resolution is the realistic target; multi-threaded native host is still in progress.
- Discussion about targeting older APIs like OpenGL 2.1 / WebGL 1 vs newer WebGPU/WebGL 2.0 for broader hardware, with tradeoffs in complexity and “token cost.”
Controllers & input fidelity
- Strong concern about losing pressure-sensitive PS2 buttons (e.g., in Gran Turismo).
- Some report success using specific PS2‑to‑PS3 adapters and modern controllers with correct curves; others find mappings unsatisfying or ergonomically bad.
Distribution, legality & hosting
- Author cannot legally host compiled game builds; users must convert their own ISOs locally.
- Suggestion to run the recompiler itself in WASM so conversion happens client-side, avoiding distribution of copyrighted assets.
- Hosting full games in-browser is compared to other gray-area archives; expectation of possible takedowns.
AI, trust, and terminology
- Mixed reactions to AI-enabled recompilations: excitement at technical progress vs frustration about impacts on programming as a profession.
- Skepticism about projects claiming “no emulation” while still interpreting some cores (e.g., IOP) or heavily modeling hardware.
- Complaints that some “native ports” are just emulators bundled with ROMs, making it harder to find genuine recompilations.
- Security concerns: native decomps could hide malware; some argue WASM is relatively safer, but emulator/ROM ecosystems have long had trust issues.
Piracy, incentives, and game preservation
- Debate over whether easy recompilation/rehosting undercuts incentives to make big-budget games.
- Counterpoints: piracy has existed for decades; people still buy games, and older titles often aren’t sold or supported anyway.
- Several see recomps as preservation tools and a way to replay classics natively across platforms, including embedded devices and handheld PCs.