How AI Is Changing Game Decompilation: What It Can Do Now That It Couldn't Before
Why AI turned out to be good at decompiling old games, how an AI matches a function, how fast it moved from chat to agents, what it still can't do, and what it means for the games you want ported.
Decompilation was always possible in principle. What was missing was people-hours: someone had to read thousands of functions of machine code and rewrite them, one at a time, until a compiler produced the original bytes. In the last two years, developers have started handing that work to AI and checking the results automatically. This article is about what changed, why it works, where it breaks, and what it means for the games you would like to see ported.
New to this? Start here · Guides · 11 min read
What Is a Game Decompilation? Decompilation vs. Recompilation vs. Emulation, Explained
A plain-English guide to game decompilation and static recompilation: how they work, how they differ from emulation, and where AI fits in.
A quick refresher is enough to follow along. A matching decompilation rebuilds a game's source code so that, compiled with the right compiler, it produces exactly the bytes of the original program. That strict, mechanical test is the whole story of this article.
Before AI: the bottleneck was human time
Matching one function means reading assembly, writing C, compiling it, seeing which bytes differ and trying again, often many times, and then doing it for thousands of functions. Classic tools like m2c give a first draft, but a person still has to coax it into an exact match.
It also took rare skills. A developer who tried the manual route on a Game Boy Advance game wrote that they were not fluent in C or assembly, so the task needed context and intuition they did not yet have. Another developer, starting a decompilation of a 2001 Game Boy Advance game, estimates about a year of study and tooling before the actual decompiling began.
And projects run for years. The Ocarina of Time decompilation repository was created in March 2020, and our catalog still lists it as a work in progress. The most-starred decompilations in our catalog are famous games such as Super Mario 64, Ocarina of Time and Pokémon, which is what you would expect from work that needs many volunteers.
Why this problem suits AI
Matching decompilation has something most AI tasks lack: a perfect referee. The AI writes C, a compiler builds it, and a diff tool compares the result with the original bytes. It either matches or it does not. A wrong answer cannot sneak through, so nobody has to trust the model. Chris Lewis, who is decompiling Snowboard Kids 2 for the N64 with Claude, points to exactly this: the compile-and-compare check stops the AI from accepting an incorrect match.
Three more things make it a good fit:
- It is repetitive. There are thousands of functions, many of them small and similar, and a machine does not get bored or tired.
- It rewards patience. Matching is mostly trial and error: change a type, a loop, the order of two lines, then rebuild and look at the diff. An AI can run through variations that would exhaust a human volunteer.
- It is pattern work. The AI has read a great deal of C and assembly, and it can be shown the functions that were already matched in the same game. Developers include related structures and similar finished functions in the prompt as examples.
How an AI decompiles one function
This is the loop the published projects describe:
In plain steps:
- Pick a target. In Lewis's setup, a scoring script ranks the unmatched functions by difficulty, using instruction count, branches and jumps, so the easy ones go first.
- Give it context. The AI gets the function's assembly, the data structures involved and similar functions that already match.
- Draft the C. Sometimes a classic tool such as m2c seeds the first draft, sometimes the model writes it from scratch.
- Compile and compare. The project's own compiler builds the code, and a tool called objdiff reports how close the bytes are.
- Read the diff and try again. The AI sees what differs, for example a wrong register, a wrong type or a missing macro, changes the code and rebuilds. A helper called a permuter can also try mechanical variations.
- Stop. Exact match: the function is saved. Too many failed attempts: it is skipped for a human. Lewis's prompt tells Claude to give up after ten tries, though Lewis notes it sometimes makes dozens of attempts anyway.
From chat to agents: how fast it moved
| Stage | What it looked like | Reported result |
|---|---|---|
| Early 2025: chat | A person pastes one function into an AI chat and iterates. | One developer reports a 96% match on the first try for one function with Claude 3.5 Sonnet, against about 60% for DeepSeek R1. In a follow-up on 14 functions of a Sonic Advance 3 module, the first drafts averaged an 85 to 90% match. Eight functions needed only easy fixes to reach 100%, six needed hand work or help from the community. |
| Late 2025: unattended loops | A script feeds one function after another to Claude Code with no human in the loop, which Lewis calls "one-shot" decompilation. | Lewis reports more progress in three weeks than in the previous three months. Simon Willison's summary gives the match rate as rising from 20 to 25% in September to November, to 45% by 2 December. Lewis estimates about 79% of the functions are matchable, and notes that a newer model matched five of seven functions an older one had judged too hard. |
| 2026: agents with tools | The AI works inside a full toolbox, builds some of its own tools and runs for long stretches. | An AI-assisted Game Boy Advance project, Klonoa: Empire of Dreams, reported 51% of the code decompiled as of August 2026, and an AI-assisted Dance Central 3 fork reports 91.21% of its authorable functions matched. |
Giving the AI tools, not just a prompt
The 2026 projects do not simply chat with a model. The Dance Central 3 fork wraps its tools so the AI can call them:
- Ghidra, to look at the original program's decompiled code and search across more than 42,000 functions.
- m2c, to seed the first draft from the original PowerPC assembly.
- objdiff, to measure how closely the new code matches the original at the byte level.
- A permuter, to try mechanical variations on stubborn functions.
- An emulator, to run a rebuilt function next to the original and tell real logic bugs from harmless compiler differences.
It describes about 25 slash-command skills for these tools, separate working copies so several agents can work at once, and memory that persists across sessions. In the Klonoa project, the author reports that some of the tools, including a programmatic decompiler, were designed by the AI, that a permuter was built for AI use, and that an emulator let the AI explore how the game behaves while it ran. The author also writes that the AI found a hidden minigame on the "Clear Save Data" screen that had gone undiscovered for 25 years.
Beyond matching: AI writing a whole engine
Matching decompilation is the friendliest case for AI because the referee is exact. A different kind of project asks the AI to write a new engine that loads the original game's data instead. The best-known example is IW4L, a Rust and Bevy runtime for Call of Duty: Modern Warfare 2. Its README states plainly that the whole project is written by an LLM. The same README says gameplay is incomplete and to expect missing behavior, bugs and desyncs.
Here the referee is weaker. There is no original source to match byte for byte, so success is judged by whether maps load, bots play and replays agree. That is our reading, and the README's own warning about desyncs fits it. The repository was created on 13 September 2026, and by early October it had hundreds of stars, which says something about how much interest there is, though not about quality. Because the code is open, others built on it: a fork mashes Modern Warfare 2, Skate 3 and Minecraft up in a single game. Both are in our catalog:
The background on engine rewrites, Rust and Bevy is in the guide.
What AI still cannot do
- It cuts corners. In the Klonoa project, the AI at one point tried to fork the compiler itself when it got stuck, and a human had to steer it back. The perfect referee only works if the AI is not allowed to change the referee.
- It cannot see what is not in the assembly. Project-specific macros do not appear in compiled code, so the developers report the AI struggling until they are included in the prompt. The approach works best with older, simpler compilers and when similar finished functions exist to learn from.
- Its code is ugly. Lewis notes the matches often use pointer arithmetic instead of array access and control flow built on goto statements, so people still clean and document what the model produces.
- A match is not understanding. Matching proves the bytes are identical. It does not make the names, structure and comments meaningful to a human reader.
- Humans still run the project. In Klonoa, people did the compiler research, the project set-up, the function boundaries, and the code review and integration with the community.
- Some functions never fall. In a benchmark of 60 functions from two games, an AI pipeline called Mizuchi matched 74% on average, with 88% of functions giving the same result every run, but 12 functions never matched, and each function had a limit of 12 attempts because of token costs. The author notes the sample is small.
What this means for the games you care about
Decompilations used to be crowd efforts. The Klonoa write-up describes one person starting a project from scratch with an AI and the right tools, which may mean decompilations of more games, sooner, though the evidence is still young and the numbers above are early.
It also shifts what the human work is. Less of it is typing out matching code, and more is deciding what to decompile, building the tools and the referee, checking the output and making the result readable. Those are the parts we expect to matter most as the technique spreads.
Does AI change the legal picture?
Not according to one overview, which notes that using AI adds no general exception: the same questions about the country, the purpose and what is distributed apply. This is not legal advice. The basics of who owns what are in the guide.
Sources and method
The AI figures come from the posts and READMEs linked above: Chris Lewis's Snowboard Kids 2 write-up, Simon Willison's summary of it, the Sonic Advance 3 and Klonoa write-ups on the gambiconf newsletter, the Mizuchi benchmark, the Dance Central 3 fork's README and the IW4L README. All of their figures are reported by the authors themselves. Project facts about the catalog entries come from each project's own README. Our general approach is described on the methodology page.
Back to basics · Guides · 11 min read
What Is a Game Decompilation? Decompilation vs. Recompilation vs. Emulation, Explained
A plain-English guide to game decompilation and static recompilation: how they work, how they differ from emulation, and where AI fits in.
FAQ
- Why is AI good at decompiling games?
- Because the answer can be checked automatically. The AI writes C code, a compiler builds it, and a diff tool compares the result with the original bytes. A wrong answer cannot pass, so the AI can try again and again without anyone having to trust it.
- What could AI do in decompilation that was not practical before?
- Work through thousands of repetitive functions unattended. One developer describes an AI running function by function with no human in the loop, and reports more progress in three weeks than in the previous three months. These figures are self-reported by the projects.
- Can AI decompile a game on its own?
- Not entirely. People still choose the compiler, set up the project, review and clean up the code, and guard against shortcuts such as an AI trying to change the compiler itself. In a 60-function benchmark, 12 functions never matched.
- Can AI write a whole game engine?
- One project says it did. IW4L, a Rust and Bevy runtime for Call of Duty: Modern Warfare 2, states in its README that the whole project is written by an LLM. The same README says gameplay is incomplete and to expect bugs and desyncs, and there is no byte-for-byte check to prove the result is faithful.
- Does using AI change whether decompilation is legal?
- No. One legal overview notes that using AI adds no general exception, so the same questions about jurisdiction, purpose and what is distributed still apply. This is not legal advice.
Projects mentioned
Get new articles by email
Roughly monthly. No spam, unsubscribe anytime.







Comments
Loading comments…
Discussion runs on GitHub Discussions via giscus — sign in with GitHub to comment.