Static Recompilation: How Console Games Run in the Browser
Static recompilation turns old console and PC binaries into portable code. Here's how WebAssembly and WebGPU make full games playable in a browser tab.

The best thing to happen to game preservation in a decade isn't a better emulator. It's a compiler. When a full 2004 racing game — complete with online free roam, controller support, and 120 fps widescreen rendering — shows up running in a browser tab, the natural reaction is to assume someone built a very clever emulator. They didn't. They did something stranger and, I'd argue, much more important: they ran the original game's machine code backwards through a decompiler of sorts, turned it into C, and rebuilt it as a WebAssembly module. That's static recompilation, and it's quietly becoming the most practical way to make old software run anywhere.
Emulation vs recompilation: a fork in the road
Emulators answer the question "how do we run this binary?" by recreating the machine it expected. Your host CPU pretends to be a MIPS or PowerPC chip, instruction by instruction, cycle by cycle. It works — MAME, Dolphin, and PCSX2 are miracles — but you pay for it forever. Every frame, you're translating instructions for hardware that stopped existing fifteen years ago, and timing quirks of the original silicon become bugs you have to lovingly reproduce.
Static recompilation takes the opposite bet. Instead of interpreting the binary at runtime, you analyze it once, offline, and lift it into a portable language — usually C. The output isn't a simulator of the old hardware. It's a new program that computes the same things. You compile that with clang, target whatever you want, and the result runs at native speed. When the target is wasm32, the result runs in Chrome.
The lineage here is worth knowing. Projects like N64: Recompiled and XenonRecomp proved the pattern on console titles, and NFSU2Recomp applied the same idea to the x86 PC build of Need for Speed: Underground 2 — translating the original executable into C that was then forked and wired up to WebGPU, Web Audio, and modern input APIs. That last step is the part web developers should pay attention to, because it's the part that looks most like our day jobs: an asset pipeline, a rendering backend, and a networking layer.
Why x86-to-C is harder than it sounds
Lifting a console ROM is almost civilized compared to lifting a PC executable. An N64 binary is a flat image running on bare metal with a fixed memory map. A 2004 PC game is a PE file built by an optimizing compiler, making indirect calls through vtables, jumping through import tables, and freely mixing code and data in ways that make static analysis genuinely hard.
The core problem is that machine code has lost all its type information. The recompiler sees call eax and has to figure out what eax could possibly point to — which function pointers flow into that register, from which tables, populated where. Get it wrong and you either miss code paths (the game crashes on the third race) or misclassify data as code (the disassembler garbles everything downstream). This is why these projects lean on interactive analysis in tools like IDA or Ghidra, plus manual annotation, plus a lot of playtesting.
The output is not pretty C. It looks something like this:
// Simplified flavor of recompiler output
void sub_4A12C0(CPUState *cpu) {
uint32_t eax = cpu->reg[0];
uint32_t ecx = cpu->reg[1];
eax = mem_read32(cpu, ecx + 0x14);
if (eax != 0) {
cpu->reg[0] = ((FnPtr)mem_read32(cpu, eax + 0x08))(cpu);
}
cpu->reg[0] = eax;
}
Registers become struct fields, memory becomes a big byte array, and control flow becomes functions calling functions. Nobody would write this by hand, and nobody has to maintain it by hand either — it's an intermediate artifact. What matters is that it's compilable, and once it compiles for one target, it compiles for all of them. That's the payoff.
WebAssembly is the easy part
Here's the contrarian bit, earned: getting recompiled C to build as a .wasm module is the least interesting engineering in the whole project. Emscripten and clang's wasm target have been solid for years. If your code is portable C with no inline assembly and no hard assumptions about pointer size beyond 32-bit, it mostly just compiles. We've written before about cases where WebAssembly isn't faster than JavaScript, but this is squarely in wasm's wheelhouse: tight numeric loops, a single big linear memory, no DOM chatter. JIT-warm JavaScript can't touch it.
The real work is everything the game calls out to. The original binary thinks it has Direct3D 9, DirectInput, and the Windows audio stack. In the browser it has none of those. So the port has to build a shim layer: every graphics call the game makes gets intercepted and re-expressed in a modern API the browser understands. This is where WebGPU earns its keep — it's the first web graphics API with a low enough level of abstraction that you can map a fixed-function-ish early-2000s pipeline onto it without drowning in overhead. The reported result — up to 120 fps in widescreen, with free roam and online races — is not something WebGL would have delivered comfortably.
One caveat worth flagging for practitioners: WebGPU support is still uneven. On Linux, Chromium users frequently need to launch with flags like --enable-unsafe-webgpu --use-angle=vulkan to get a working adapter. "Runs in the browser" currently means "runs great in Chrome and Firefox on the right OS with the right GPU drivers." That's a real distribution story, but it's not yet a universal one.

Streaming two gigabytes into a tab
Code is a few megabytes. Assets are the other 95% of a game, and this is where a browser port becomes a web engineering problem in the most familiar sense. A mid-2000s open-world racer ships with gigabytes of geometry, textures, audio, and FMV. Nobody is downloading that on a landing page. So you build what every game-streaming and large-site team already knows how to build: a lazy, ranged, cached asset pipeline.
The shape of it usually looks like this: the original asset archives get repacked into chunked bundles, an index maps "asset the engine just asked for" to "byte range in some bundle," and the virtual filesystem layer fetches over HTTP with range requests, caching aggressively in the Cache Storage API or IndexedDB so the second visit is instant. The engine thinks it's reading from a DVD; it's actually reading from a service worker. If you've ever worked on streaming geodata pipelines, the architecture is the same animal — content-addressed chunks, an index, and a client that pretends the network is a disk.
- Repack once, fetch forever: convert original archives into fixed-size chunks so HTTP range requests and CDN caching do the heavy lifting.
- Prefetch by prediction: the garage, the first district, and the menu music are needed in the first minute; the airport district can wait.
- Transcode ruthlessly: 2004-era uncompressed audio and video become Opus and modern codecs. The player can't tell; the bandwidth bill can.
- Cache like you mean it: a returning player should pay near-zero network cost. Immutable content-hashed bundles make this trivial.
Multiplayer the original never had
The most impressive part of the browser port isn't that the game runs — it's that strangers are doing burnouts around each other in free roam. Underground 2's online services died years ago. The port resurrects multiplayer the only way that actually works for dead games: replace the dead service, not the game. The recompiled code still makes its original networking calls; the shim layer redirects them to a modern backend, and suddenly a 2004 game has crews, shared free-roam sessions, and join-a-friend links.
This is a pattern with legs far beyond nostalgia. Any piece of software with a dead network dependency — old games, dead SaaS clients, abandoned multiplayer tools — is a candidate for the same surgery: recompile or wrap the client, reimplement the protocol against a server you control. The Hacker News thread fantasized about SimCity 2000 where every neighboring city is run by a real player. That's not a pipe dream; it's a weekend project on top of exactly this architecture. State sync for a handful of cars in a shared world is well-trodden ground — WebRTC data channels or a small authoritative WebSocket server both do the job at this scale.
An emulator preserves the machine. A recompilation preserves the software — and it's the software people actually miss.
Where the contrarian claim breaks down
I said recompilation beats emulation for preservation, and I believe it — but let's be honest about the costs. An emulator generalizes: one Dolphin runs thousands of GameCube games. A recompilation is artisanal. Each title is its own reverse-engineering campaign, months of analysis for one binary, and the result only ever runs that one game. If your goal is archiving a whole library, emulators win on throughput and it isn't close.
There's also the elephant in the room: legality. The recompiled code sits in a gray-to-hostile zone depending on jurisdiction, and hosting the original game's assets — the cars, the map, the Snoop Dogg track — is not gray at all. Underground 2 is abandonware in the practical sense (you cannot buy it anywhere; music licensing likely keeps it that way), but abandonware is a folk concept, not a legal one. Commenters predicting a takedown are probably right, and the project itself keeps a "rights holders" contact address ready, which tells you the author knows it too. The technique is sound and lawful when you own the binary or the rights; the specific instance lives on borrowed time.
And one more honest limit: recompilation shines when the target hardware is wildly different from the source — that's exactly when emulation is most expensive. For faithful reproduction of timing-sensitive behavior (speedrun-legit accuracy, hardware bugs as features), cycle-accurate emulation remains the only correct answer. These two approaches aren't rivals so much as answers to different questions: "run it well everywhere" versus "run it exactly."
What web developers should take from this
Strip away the nostalgia and you're left with a stack that should look familiar: wasm as a portable compile target, WebGPU as a real rendering backend, HTTP range requests and Cache Storage as a filesystem, WebSocket/WebRTC as a resurrected network service. None of that is exotic. Teams already ship Python this way — we covered how Pyodide runs real CPython in the browser using the same Emscripten toolchain. A racing game is a harder demo of the same thesis: the browser is a deployment target for serious native code, not a document viewer with delusions.
The browser tab playing Underground 2 at 120 fps with friends in free roam is doing something no amount of venture-funded game-streaming infrastructure managed: zero install, instant share-by-URL, works on a phone. That's the actual story. The toolchain for resurrecting native software as web software exists now, it's mostly open source, and the hard parts — decompilation, shim layers, streaming assets — are engineering problems, not research problems. Expect to see a lot more of it, takedown notices and all.


