Concept

Decompilation

Decompilation is the reverse of compilation: turning machine code back into source code a person can read. In game preservation, a decomp project rebuilds a game's source in C or C++ until compiling it produces a byte-identical copy of the original executable.

Matching decompilation

Most console decomp projects are matching decompilations. Contributors pick a function from the disassembly, write C that they believe produced it, and compile it with the same compiler and flags the original developers used. The function counts as done only when the output bytes match exactly. Progress is measured as the share of code that matches, and projects publish that figure in their READMEs.

What a decomp is used for

A finished decompilation documents how the game works, makes deep mods possible and serves as the base for native ports. Ship of Harkinian for Ocarina of Time, SpaghettiKart for Mario Kart 64 and Dusklight for Twilight Princess were all built on decompilations. Those ports are separate projects; the decomp itself usually builds only the original console executable.

Decompilation versus recompilation

Recompilation produces runnable code automatically but leaves it unreadable. Decompilation produces readable code but takes years of manual work. Many current projects use both: recompilation for a working port early, decompilation for long-term understanding.