Curriculum

What "Matching" Really Means

The Decomp LoopConcept · no code to write

What "matching" really means

Decompiling isn't translation — it's reconstruction under proof. The retail game shipped as PowerPC machine code. Your job is to write C that, when fed to the exact compiler the original developers used (Metrowerks CodeWarrior GC/2.0), produces byte-identical machine code. Not similar. Identical.

That's a much stronger claim than "behaves the same." Two functions can compute the same answer with completely different instructions. A match means your C and the original C compiled to the same bytes — which is the closest thing to a proof that you recovered what the developers actually wrote.

The compiler is the authority

There is no opinion here. You don't argue about whether x * 4 "should" become a shift — you compile it and look. If MWCC emits slwi r3,r3,2 and the target is slwi r3,r3,2, that line matches. If it doesn't, the C isn't right yet, no matter how clean it reads. The compiler is the ground truth, every single time.

Match % is a real number, not a vibe

In a typical decomp project, the truth of how well a function matches is one field in the build's report.json (generated by decomp-toolkit / dtk):

{ "fuzzy_match_percent": 95.3 }

That percentage is computed by comparing your compiled object against the retail object, instruction by instruction. Diff tools (you'll meet them soon) help you locate where you diverge, but they don't certify the score — report.json does. When someone says "that function is at 100%," they mean fuzzy_match_percent == 100 in the report.

100% vs. the value of a clean near-match

The goal is 100%: every byte accounted for. But a function sitting at 95% or 98% is not a failure — it's a near-match, and near-matches are informative. The remaining few percent are a concentrated clue about one wrong type, one wrong idiom, or one mis-modeled struct. A clean 95% that reads like plausible C is often a better starting point than a contorted 100% nobody can maintain.

You'll spend most of your time in that last stretch — from "close" to "exact" — and learning to read what the gap is telling you is the real skill this chapter teaches.

Got it? Lock it in and move on. Mark read & continue