Petari: Rebuilding Super Mario Galaxy One Matching Binary at a Time
A clean-room decompilation project where C++ types, compiler quirks, and Wii-era systems all have to line up perfectly before the code can be trusted.
- Petari is defined by matching builds, not by a playable port, so every source choice is judged against the original binary.
- The repo turns compiler behavior into a first-class design constraint, which makes tiny type decisions part of the reconstruction work.
- Its camera, area, animation, and audio systems show how the game’s feel can be rebuilt as exact technical evidence.
- The clean-room rules are not just process theater, they are part of how the project protects provenance and preservation value.
Why matching the binary matters
Petari is not trying to make Super Mario Galaxy easier to run or easier to port. It is trying to reconstruct the original source tree so precisely that the compiler produces the same machine code the Wii shipped with. That changes everything. A line of code is not “right” because it works. It is right only when it matches the evidence.
That makes the project feel closer to restoration than remixing. The team is not inventing a new game loop. They are rebuilding the one Nintendo already wrote, then proving the reconstruction by comparing output against the retail binary.
The clean-room rules that shape the repo
The repository draws a hard line around process. Its README and contribution guidance reject AI-generated code, and the project frames that as a clean-room safeguard, not a style preference. In a decompilation effort, provenance matters as much as correctness.
That matters because the repo is not just a codebase. It is a historical reconstruction effort. The goal is to preserve how the game was built, not just what it does when it runs.
The compiler is part of the story
Petari targets the old CodeWarrior toolchain and C++98-era behavior, which means language details become binary details. The CONTRIBUTING guidance calls out a simple but brutal example: int and s32 both hold 32-bit values, but they can mangle differently. In a matching build project, that difference is real.
// Same size, different meaning to the compiler in this project.
int value;
s32 signed_value;
// In a matching-build workflow, original type choice matters
// because symbol mangling and layout can change the output binary.
That is why Petari feels unusually exacting. The code is not being judged only at runtime. It is being judged by the compiler, the linker, and the diffing tools in between.
Inside the game’s hidden systems
Once the binary-matching frame is clear, the interesting part is the game itself. The repo’s headers reveal the systems that make Galaxy feel alive: camera, area objects, animation, and audio. These are not decorative subsystems. They are the machinery that makes spherical movement, shifting gravity, skeletal motion, and Wii-specific feedback feel coherent frame after frame.
The camera code is especially revealing. `CameraContext` manages view and projection state, while `Camera` classes and translators connect data chunks to runtime behavior. That tells you the game is not just drawing a scene. It is continuously translating authored intent into a moving 3D point of view.
Area logic does a different kind of work. `AreaObj` and `AreaObjMgr` define invisible volumes for triggers, boundaries, gravity, and hazards. In a game built around unusual spaces, those volumes are part of the level design language.
How Galaxy’s camera and volumes solve a weird world
This is where Petari becomes more than a code archaeology project. It exposes how Super Mario Galaxy solves a problem ordinary platformers never have to face: the world is constantly reorienting under the player. A flat platformer can assume up is stable. Galaxy cannot.
That is why `CameraContext` and `AreaObj` matter together. One manages what the player sees. The other manages what the world means. Camera motion, spatial triggers, and volume logic all have to agree or the illusion collapses.
| Question | Ordinary platformer | Galaxy-style reconstruction |
|---|---|---|
| What does the world assume? | A stable floor and a stable up direction. | A shifting gravity field and changing local orientation. |
| What does the camera protect? | Basic framing of the action. | Player readability across curved spaces and moving reference frames. |
| What does a volume mean? | Mostly a trigger or hazard. | A rule that can redefine movement, gravity, or visibility. |
| What does success look like? | The game feels correct. | The source, compiler output, and runtime behavior all agree. |
Why the Korean revisions matter
Petari targets `RMGK01` and `RMGK02`, which is a practical reverse-engineering choice, not trivia. Different revisions can expose different clues, cleaner symbol boundaries, or better starting points for reconstruction. In this kind of work, version selection is part of the strategy.
That matters because decompilation is cumulative. One revision can teach the structure. Another can help validate it. The project’s exact targets tell you it is optimizing for evidence, not nostalgia.
What Petari says about preservation
The clean-room stance gives Petari a clear identity. It is collaborative, technically demanding, and unapologetically strict. That combination makes it feel less like fan labor and more like a preservation lab with source code as its artifact.
The larger lesson is simple. You do not need to guess how a masterpiece was built when you can recover it one verified subsystem at a time. Petari’s real achievement is not just that it points toward a source tree. It shows how much design intent lives inside compiler output, type choices, and invisible engine systems.





