Kingdom Hearts Re:coded
TechnologyNative C/C++ port (engine reimplementation)
Available forWindows, Linux, macOS
View official projectAbout the project
Kingdom Hearts Re:coded es un videojuego de acción y aventura en 2010.
Official project information
Kingdom Hearts Re:coded decompilation
A matching decompilation of Kingdom Hearts Re:coded (Nintendo DS, US BK9E and EU BK9P).
Every counted function is C that compiles to the original bytes exactly.
Multi-region merge
One decomp for both regions, merged from ricky074game/kh-recoded-decomp
(US BK9E) and Yokimitsuro/khrecoded-decomp (EU BK9P),
maintained by @ricky074game and @Yokimitsuro.
No ROM, assets or original binaries are included. You need your own legally obtained copy of the game to build or verify anything.
Progress
<!-- regions:start -->| Region | C code bytes | % | Functions |
|---|---|---|---|
US BK9E | 1,548,820 / 1,768,220 | 87.6% | 10,021 / 10,359 |
EU BK9P | 1,690,130 / 1,771,024 | 95.4% | 10,486 / 10,625 |
| US verified original assembly (not C) | 22,966 | 1.3% | 171 |
| EU verified library code (hand-written ARM: MobiClip, NitroSDK, MSL, DS Protect; not C) | 71,242 | 4.0% | 136 |
| EU C + verified library code | 1,761,372 / 1,771,024 | 99.5% | |
| Shared (same function, matched in both) | 1,481,296 | 83.6% of EU | 9,363 |
8,188 shared functions are stored once in src/ and built for both regions; 1,175 still have separate EU copies. 658 matched functions are US-only so far and 1,123 are EU-only. EU numbers come from eu/tools/audit_progress.py; per-module EU detail is in eu/PROGRESS.md.
US detail:
| Matched | Total | % | |
|---|---|---|---|
| ARM9 code (C bytes) | 1,548,820 | 1,768,220 | 87.6% |
| ARM9 core + autoloads | 331,652 | 370,004 | 89.6% |
| ARM9 overlays (105) | 1,217,168 | 1,398,216 | 87.1% |
| Functions | 10,021 | 10,359 | 96.7% |
| Data bytes (.rodata/.data/.bss) | 228,100 | 228,140 | 99.98% |
Updated 2026-10-29. Per-module numbers are in PROGRESS.md.
- Only C that rebuilds byte-for-byte counts as C. Original SDK/MSL assembly that rebuilds byte-for-byte is listed in its own row (
asm_matches.json) and never added to the C numbers. - Data counts when the C data objects link byte-exact. Most of it is generated arrays and pointer tables still waiting for real types and names.
linkrebuilds all 108 ARM9 modules from objects and packs a ROM identical to the original.- ARM7 is extracted but not analysed yet, so it is not counted.
Quick start (Windows)
Python 3.12+.
python -m pip install -r requirements.txt
python tools/compile_match.py install
python tools/khrecoded.py setup --rom "C:\path\to\recoded.nds"
python tools/khrecoded.py check --profile full
python tools/khrecoded.py progress
Matching a single function:
python tools/match_tool.py show ov001 func_ov001_02070e98 # target asm + Ghidra view
python tools/match_tool.py try ov001 func_ov001_02070e98 src/ov001/.../File_02070e98.c
| Command | What it does |
|---|---|
khrecoded.py progress | Recompiles every match from scratch and updates PROGRESS.md |
khrecoded.py link | Links C objects + delinked objects into a byte-exact ROM |
khrecoded.py check --profile ci | ROM-free checks (what CI runs) |
khrecoded.py check --profile strict | Everything, including the full linked ROM |
EU (BK9P) builds from the same checkout. Shared functions compile from src/; EU-only code lives in eu/:
python tools/khrecoded.py eu setup --rom "C:\path\to\recoded_eu.nds"
python tools/khrecoded.py eu gate # links all 108 EU modules and checks them against the ROM
python tools/khrecoded.py eu progress
Toolchain
- dsd 0.12.1: extraction and delinking
- CodeWarrior
mwccarm4.0 build 1036 and 3.0 build 139,mwldarm - Ghidra for reference decompiles
- khdays-decomp (CC0): shared engine code from 358/2 Days is ported where the bytes match
Contributing
See CONTRIBUTING.md. Every match must pass byte-exact verification.
License
Original code and tooling: MIT. The EU code in eu/ was released under
CC0 by Yokimitsuro; see eu/THIRD_PARTY_NOTICES.md for shared code.
No rights are granted to the game, its assets, trademarks, or the proprietary SDK and compiler.