PS2 Web Recomp: PS2 games recompiled to WebAssembly
PS2 Web Recomp is an open-source project (MIT License) that runs PlayStation 2 games in the browser by translating them ahead of time, instead of emulating the main CPU while you play. It was shared on Hacker News on October 12, 2026.
Facts on this page come from the project's README, as read on October 14, 2026.
How it works
Recompilation. A tool called eerecomp reads the game's executable, follows its control flow to find the functions, and emits C++ for them in units of 16 KiB of guest code. That C++ is compiled to WebAssembly, so the PS2's main CPU, the Emotion Engine, is never interpreted. The output keeps the R5900 CPU's quirks: 128-bit registers and the multimedia instructions that work on them, branch delay slots, and the PS2's floating point unit, which has no infinities or denormals and rounds differently from IEEE.
A small PS2 kernel. The operating system calls the game makes are answered by high-level emulation: threads, semaphores, interrupt handlers and the channel that connects the main CPU to the I/O processor. The I/O processor runs the game's own modules – the sound driver, the disc streaming code and the controller and memory card drivers that ship on the disc – on an interpreter of its R3000 CPU. The disc is read over HTTP Range requests, so only the executable is downloaded up front.
Vector units, graphics and sound. Most 3D work on a PS2 happens in microprograms on vector unit 1. Those seen during a test run are compiled ahead of time into SIMD C++; any new one is translated into a WebAssembly module on the spot. The Graphics Synthesizer's 4 MB of video memory lives on the GPU, and drawing is done by WebGPU compute shaders, at one, two or three times the native resolution. The sound chip is reimplemented with its 48 voices, and movies are decoded by an implementation of the PS2's MPEG-2 decoder.
Which games run?
Two games have been brought up so far:
- Gran Turismo 4 – the first title, chosen because it is one of the most demanding games on the system: it uses both vector units, relies on exact floating point behaviour for its replays and license tests, and reads rendered images back as palettes. It plays from boot through the opening movie, the menus and races, with music and sound effects, and saves to a memory card kept in the browser. A race runs at full speed – 50 frames per second for the PAL release – in Chrome on a laptop's integrated GPU at twice the PS2's resolution.
- God of War II – ported through the same scripts with no game-specific code. It plays from the menus through its cutscenes into combat, and holds 60 frames per second in heavy combat at the PS2's resolution in Chrome; at twice the resolution it runs at 48 to 60, limited by the laptop's integrated GPU.
God of War II also found two bugs Gran Turismo 4 never triggered. One was in the recompiler: when a branch was the last instruction of a 16 KiB unit, the next instruction could run twice. The other was in vector unit timing: the game's microcode reads clip flags three instructions after the instruction that sets them, while the model made them visible only after four. It also needed an I/O processor hardware timer for its sound driver, a boot path like the BIOS gives, a module loaded from memory instead of the disc, and a DMA mode the first game never used. Each fix is generic, so the next game benefits.
How it was made fast
- The first race ran at 3 frames per second natively; moving graphics to WebGPU compute shaders and compiling the vector unit programs brought it to about 70.
- The GPU renderer first submitted around 650 compute dispatches per frame; reordering texture uploads brought that to about 80.
- A 16 MB cache of recently uploaded textures on the GPU cut the data sent per frame by about 60 percent in Gran Turismo 4.
- At three times the native resolution, shader fixes took the frame rate from 23 to 48–50 frames per second on the same integrated GPU.
Why you can't play it on a website
The project's README is explicit: the generated C++ and the built WebAssembly are translations of the game's executable, so they belong to the game's owners – keep them on your own machine and do not publish them. It also warns that anyone who can reach the server can load the game. That is why we do not host PS2 Web Recomp games, and why you should be wary of any site that does.
If you want to play a disc image you own in the browser right now, ourbrowser emulator takes a different route: it is an emulator, and your file is read locally without being uploaded.
What you need to try it yourself
- git, CMake, Ninja, a C++20 compiler (clang preferred) and Python 3; 7-Zip if your disc image is a
.7z. - Linux on x86-64 is where everything has been run; the scripts also build on macOS on Apple silicon with a newer bash than the system one.
- About 300 MB of disk space per game for generated code and builds. The disc image is linked, not copied.
- A disc image of a game you own.
- A browser with WebGPU: Chrome and Edge have it on Windows and macOS; on Linux it must be enabled in Chrome's flags. Without WebGPU a software renderer takes over, which is fine for menus and far too slow for 3D.
One script, port.sh, does the whole job: it reads the boot program named on the disc, translates it, then runs the game headless a few times to discover functions reached through pointers, adding them until a run finds no new ones. God of War II goes from disc image to page in three and a half minutes on an 8-core laptop. A step-by-step guide based on our own local tests is coming.
Saves and controls
The page keeps a memory card in the browser's storage, so progress survives a reload, and can export or import it as a .ps2 file in the layout PCSX2 uses. On a keyboard, Z, X, A and S are cross, circle, square and triangle; Enter and Backspace are start and select; the arrow keys are the D-pad. Gamepads work through the browser, phones get on-screen controls, and the same build can also run in a native window.
Recompilation vs emulation
| PS2 Web Recomp | Browser emulator (Play!) | |
|---|---|---|
| Main CPU | Translated ahead of time to WebAssembly | Emulated while you play |
| Per-game work | Each game is ported once on your machine | Load any supported disc image |
| What a website hosts | Nothing – the project says the output belongs to the game's owners and must stay on your machine | Only the emulator; you load your own file locally |
A separate project with a similar name, PS2Recomp(GPL-3.0), is a static recompiler and runtime for making native PC ports rather than browser builds.
PS2 Web Recomp FAQ
Can I play PS2 Web Recomp games online?
No. The project produces a web page on your own machine from a disc image you own. Its README says the generated code belongs to the game's owners and must not be published, so the builds are meant to stay on your own machine.
Which games does PS2 Web Recomp support?
Two games have been brought up so far: Gran Turismo 4 and God of War II. Other games can be tried with the same scripts, but most will stop at something not implemented yet.
Is PS2 Web Recomp an emulator?
Partly. The main CPU code is translated ahead of time into WebAssembly instead of being emulated, while the rest of the console – the operating system, the I/O processor, the vector units, graphics and sound – is handled by an emulation runtime.
Does it work on a Mac?
The scripts build on macOS on Apple silicon (with a newer bash than the system one), and Chrome and Edge have WebGPU on macOS. Everything has been run on Linux on x86-64.
What happens if I try a game that is not supported?
It will most likely stop at a system call or I/O processor library function that nobody has implemented yet – logged as "[sys] unhandled syscall" or "[iop] missing <library> #<n>" – or use a graphics feature the renderer does not handle yet.
Source: snuri00/ps2-web-recomp on GitHub.