Grandia, in code
you can read.

I've taken every function of the original PlayStation game and turned its machine code back into readable C++ code. Then I linked it all together in an explorer, so you can follow the game from the first boot logo to the final boss, in an easy-to-follow and detailed way. The explorer also has a search, so you can quickly find what you're looking for.

title/title_screen.cpp · TitleScreen::run()

GameState TitleScreen::run()
{
    // Original: run_title_menu (TITLE.EXE 0x800426CC).
    prepare();
    services_.request_resource(2, 2000);
    subscreen_x_ = 16;
    subscreen_y_ = 48;
    selection_ = ContinueEntry;
    services_.wait_vertical_blank(2);
    services_.set_display_mask(true);

    // One frame per pass until something sets the command.
    while (command_ == Command::None) {
        swap_display_and_read_pads();
        check_debug_controls();
        switch (phase_) {
        case Phase::LogoReveal: advance_logo_phase(); break;
        case Phase::PressStart: advance_press_start_phase(); break;
        case Phase::Menu:
            handle_menu_input();
            draw_menu();
            break;
        case Phase::Options: subscreens_.update_options(*this); break;
        case Phase::InsertDisc: subscreens_.update_insert_disc(*this); break;
        }
        graphics_.present_frame();
    }
    shut_down();
    return static_cast<GameState>(command_);
}

The same routine, hand-rewritten as a class: named phases, named fields, and a comment for every original routine it replaces.

6,084functions in the explorer
2,335reviewed reconstructions with plain-English summaries
550,031MIPS instructions lifted from 9 overlay programs
11hand-written guide chapters

It started with a few mods for a group of kids.

I run a few kids' groups where I live, some for role-playing games and one where we watch series and films together. I like sharing my hobbies, so I introduced them to Grandia, and we've been playing it together whenever we have time. Well, they play and I watch.

The emulator was a bit wonky, though. Edges and resolution didn't look great, you couldn't skip a cutscene even when you'd already seen it, and without a map or minimap at least one of them really struggled to find his way around.

So I wanted to make a few mods to fix those things. Without a good idea of how the game works, and without any readable code, I couldn't get them working properly. I didn't even know there was a modding scene at the time. I'd done a bit of work with the people behind the GoldenEye decomp before, so I thought, what the hell, let's try decompiling Grandia too.

How it was made

One of my jobs is in the tech industry, and I wanted to bring that way of working to Grandia: clear goals, automated pipelines, testing and verification at every step. I knew from the start what I was aiming for, which was the full game running natively on PC, using DirectX and modern graphics cards and storage directly.

I do use AI, and I'd rather be honest about that. Turning machine code into C++ is mostly pattern recognition, so I used it for the first rough translation and for writing a lot of the code later on. But that translation is only a starting point. Most of the work has been designing how the whole thing fits together, setting up the automation and deciding what it should look for, then reading the code, checking the results and checking them again.

Every address and instruction was verified against the original before I trusted it, and I've gone through the game visually as well. I made the calls on what to rebuild and how, like replacing the old disc loading with a new loading system and moving to memory management that suits a PC. The presentation, what goes in and what stays out, and how all of it is documented are my choices too.

How the code gets from the disc to something readable.

01

Disc

Five main programs and nine overlays the game loads from the CD as it runs.

SCUS_944.57 · TITLE.EXE · FIELD.EXE · BATTLE.EXE
02

Reconstruct

Main programs are reconstructed by hand and reviewed again and again against the original machine code.

recon/ · decomp_status.tsv
03

Lift

Overlays are lifted to C++ by a program, one function at a time, straight from their machine code.

build_overlays.py
04

Verification

Every lifted function runs side by side with the original MIPS code. All 3,749 matched, with 48 billion events compared across all test runs, and functions are broken on purpose to prove the checks catch mistakes.

verify/run.py
05

Read

Raw addresses get real names, calls through the main program's table read like services.VSync, and every name links to its function.

readable/ · explorer/

The explorer links the whole game together.

The guide chapters walk through how Grandia works, one system at a time. Every function has its own page with its code, what calls it, what it calls and which memory it touches. You can also browse the game's own data, including the party, items, magic, enemies, shops, all 448 maps and every line of dialogue.

You can try the whole explorer right here.

This is the complete explorer: every guide chapter, every function of the game, the rewritten classes and the game data. Click any name to follow it, or use the search box. It loads about 3 MB to start and fetches each part of the game as you open it.

grandia code explorer Open full screen ↗

Start with “The title screen” chapter, already open.

Follow any blue name to its function page: code, callers, callees and memory.

Search for words like “press start” or “damage”.

Browse the party, items, magic, enemies and shops.

Try it here, or download it.The whole explorer plus all 2,430 C++ files, about a million lines: the readable main programs, the hand-written rewrite and the machine-lifted overlays, so you can dig into every part of the code. Open explorer/index.html in any browser. The game itself isn't included.
Download the code ↓30 MB zip

Every function is checked against the original.

Going from machine code to C++ means making a lot of assumptions, so I built a test setup where nothing gets trusted until it has been verified. Every lifted overlay function ran side by side with the original MIPS code, and all 3,749 of them matched, with 48 billion events compared across all test runs. I also broke functions on purpose to make sure the checks would actually catch a mistake.

Machine-verified3,680 / 3,749

Every block that can run was reached and matched.

Blocks reached101,879 / 102,104

99.78% of the blocks that can run ran during testing.

Unreachable code 2,119 blocks

In 719 functions, proved never to run, so they're left out of the totals.

Mutations caught105 / 107

Of the two missed, one changes nothing observable and one sits in a block no trial reached.

Census coverage3,875 / 3,875

Every body in the overlay census is inside a lifted function.

There's also a rewrite that reads like a modern program.

Next to the faithful reconstruction, I've been rewriting the main systems so they read like a normal program, with classes for things like the title screen, the field and the battle objects. Each method says which original routine it replaces, so you can open both side by side in the explorer. All of it compiles cleanly at /W4 /WX.

GameSoundEffectTitleScreenFieldSessionFieldFrameFieldScript MapEventsFieldEncountersPartyMovementSaveBlockBattleSessionBattleObject TurnGaugeEnemyTurnGaugePartyControllerEnemyControllerBattleHitPendingDamageMoviePlayer

What's next

  1. All main-program functions summarised2,335 one-line summaries
  2. All nine overlays lifted and verified3,749 functions, zero mismatches
  3. Plain-English summaries for the overlays30 batches of about 150 functions
  4. Field menus: items, equipment, save and load
  5. Sound and disc services, more field classes