hn.today

God of War on PSP, recompiled to WebAssembly and running in the browser

github.com131 points69 comments
Screenshot of God of War on PSP, recompiled to WebAssembly and running in the browser

A hobby project translates PSP MIPS executables ahead-of-time into C++, compiles them to WebAssembly, and links them with a small high-level emulation of the PSP OS and graphics so games run in the browser without a traditional emulator. God of War: Chains of Olympus and Ghost of Sparta boot, run menus, cutscenes and combat at around 55-60 FPS in Chrome and Firefox, support up to 4× the PSP's native 480×272 resolution, and play audio (ATRAC3+ decoded via FFmpeg, ADPCM voices via a reimplemented synthesizer). Movie playback is currently skipped, no game data is included, and users must supply decrypted game executables (tools or PPSSPP can dump these).

The core work is PSPRecomp-driven static recompilation, a small HLE kernel that implements threads, file I/O and streaming disc data over HTTP range requests, and a GE decoder that emits WebGL2 draw calls with framebuffers mapped to VRAM. Key engineering fixes delivered playable speed: batching swaps to vblank, using performance.now only when profiling, per-draw small index buffers to avoid Firefox GPU validation stalls, minimizing stencil/alpha full-screen copies, and running the GE on a worker with OffscreenCanvas so frame cost is the busier thread. Ghost of Sparta required PGD/KIRK DRM decryption and a lighting fix. Building a page requires git, CMake, Ninja, a C++20 toolchain, Emscripten, a PSP decrypter, and cross-origin-isolated hosting headers for SharedArrayBuffer.

Read on github.com69 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.