Skip to content

Yokimitsuro/khdays-decomp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,291 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

khdays-decomp

A work-in-progress matching decompilation of Kingdom Hearts 358/2 Days (Nintendo DS). The goal is C source that recompiles to a binary byte-for-byte identical to the original game code.

Disclaimer

This repository does NOT contain the game ROM, any game assets, or any of the original binary/assembly. An existing, legally-obtained copy of the game is required to extract and build it.

This repository is a matching decompilation only. It does not contain or produce a playable build or any redistributable game binary, and building it requires an original, legally-obtained copy of the game. All trademarks and the original game are property of their respective owners.

Status

This project is in an early bootstrapping phase. Progress is intentionally split into separate categories so inline ASM placeholders and SDK byte-match identifications are not counted as real C decompilation.

Category Count Meaning
Real C-decompiled matched functions 14,223 / ~23,240 (~61.2% by function count) Functions implemented in C and verified byte-exact
Real C-decompiled matched bytes 1,514,918 / 4,728,790 (~32.04% by code bytes) The honest metric — matches how decomp.dev reports progress. Function-count % is inflated because most decomped functions are small trampolines and setters; large semantic functions are still ASM stubs. Counts byte-exact C only: asm_stubs/ and nonmatching/ are both excluded.
Inline ASM / ASM stub matched functions 2,322 / ~23,240 (~10.0%) Temporary ASM-based placeholders under src/asm_stubs/; useful for matching, not counted as C decompilation
SDK/library byte-match identifications 364 / ~23,240 (~1.6%) NitroSDK or library functions identified separately by byte matching
Named but not decompiled 6,331 / ~23,240 (~27.2%) Functions known to the project but not implemented as C
Total known functions 23,240 Function index for the EU YKGP target
Region EU (YKGP)
Compiler CodeWarrior mwccarm 3.0 build 139 Fully-decompiled modules: ov001, ov028, ov290, ov300, ov302. A few precompiled-middleware translation units (e.g. the ov028 anti-tamper crypto core) build with an older mwccarm via a per-file compiler override (config/arm9/file_compilers.json).

The current counts are generated by python tools/audit_progress.py. See docs/PROGRESS_POLICY.md for what counts as real decompiled progress.

Progress reporting policy

Only real C implementations are counted as C-decompiled progress.

Inline ASM, ASM stubs, INLINE_ASM, NON_MATCHING, or similar placeholder code may be used temporarily for bootstrapping and verification, but these are not counted as decompiled C progress.

SDK/library byte-match identifications are tracked separately from game-code decompilation. See sdk/README.md for the SDK identification workflow.

Repository layout

src/auto/           real C leaf functions (byte-exact, no external calls)
src/calls/          real C functions with calls (byte-exact)
src/asm_stubs/auto/   ASM / inline-asm bootstrap stubs, leaf functions
src/asm_stubs/calls/  ASM / inline-asm bootstrap stubs with calls
config/             dsd project config (symbols / delinks / relocs per module)
macros/             assembler macros (function.inc)
tools/              Python tooling (extraction, matching, candidate finders)
sdk/                NitroSDK byte-match identification harness (see sdk/README.md)
build/              generated manifests and reports; build output is git-ignored

Files under src/asm_stubs/ may match the original bytes, but they are temporary ASM-based matches (asm void, __asm, hand-written ARM) that were used to bootstrap the project. They are counted separately from real C decompilation progress, see docs/PROGRESS_POLICY.md.

The ROM, the extracted data (dsd_extract/, asm/), build artifacts, and the proprietary toolchain are intentionally not tracked; see .gitignore. Some temporary ASM stubs or handwritten inline assembly may exist while the project is being bootstrapped. These are not original extracted assembly files and are not counted as real C-decompiled progress.

Building / verifying

You need your own copy of the game plus the toolchain (see CONTRIBUTING.md for setup). Then, to verify a single function:

python tools/getcand.py func_XXXXXXXX        # prints disasm + the verify command
python tools/match.py <your.c> <...>          # compiles and byte-compares

A green >>> MATCH <<< means your C reproduces the original exactly.

Toolchain

  • dsd - DS ROM extraction / delinking
  • mwccarm 3.0 (CodeWarrior for Nintendo DS) - the matching compiler
  • arm-none-eabi-as (GNU binutils) - assembling the not-yet-decompiled .s
  • Python 3 with capstone, pyelftools, ndspy

See the Nintendo DS decompilation guide.

Contributing

Contributions are very welcome; see CONTRIBUTING.md. Every matching function must pass byte-exact verification, and public C decompilation progress only counts real C implementations. Progress per module and how to claim one is in PROGRESS.md.

License

The decompilation and tooling in this repository are dedicated to the public domain under CC0 1.0. This applies only to the contributors' own work; the original game and its assets remain the property of their owners.

About

Work-in-progress matching decompilation of Kingdom Hearts 358/2 Days (Nintendo DS)

Topics

Resources

License

Contributing

Stars

18 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors