KiraPatch DS is my Gen 4 follow-up to KiraPatch.
I am building this workspace to support Nintendo DS Pokemon ROM inspection first, then legality-preserving shiny-odds patching once I lock onto one clean ROM at a time.
In this README, I talk about games as:
Pokemon - Diamond (EU)Pokemon - Diamond (NA)
I do that to keep the wording clean and avoid making it sound like I am distributing anything. Internally, the tool still fingerprints the exact dumped revision before I patch anything.
The project currently includes:
- a Python CLI for inspecting
.ndsand.srlfiles - header parsing for Nintendo DS ROMs
- CRC32 and SHA-1 fingerprinting
- FAT and overlay table parsing
- folder scanning for incoming ROM dumps
- JSON catalog export for ROM triage
- ARM9 and overlay extraction for reverse engineering
- heuristic ARM/Thumb analysis for candidate shiny-related code regions
- a live per-ROM profile for
Pokemon - Diamond (EU) Rev 5 - an experimental internal-cave ARM9 patch path for the exact fingerprint of
Pokemon - Diamond (EU) Rev 5
Right now, patch support is limited to that one exact Diamond EU Rev 5 fingerprint. Other Gen 4 dumps can still be inspected, cataloged, extracted, and analyzed, but I do not claim patch support for them yet.
What is still in progress:
- shiny-rate validation on the new internal-cave Diamond builds
- broader encounter-path validation beyond the currently confirmed starter and wild paths
- support for
Pokemon - Pearl (EU),Pokemon - Platinum (EU), and HGSS
My first active research target is Pokemon - Diamond (EU).
More specifically, I am currently tracing the EU Rev 5 Diamond dump in .nds/, because it is smaller than the later 128 MB games and gives me the cleanest first pass at the Gen 4 shiny-generation flow.
For Pokemon - Diamond (EU) Rev 5, I have already confirmed:
- an exact shiny XOR compare inside ARM9
- the specific create-mon wrapper, callsite, and core path I am currently targeting
- a reusable shiny-check predicate helper in ARM9
- a validated internal ARM9 code cave at
0xF5CBCwith0x58bytes available for the hook - a Python patch pipeline that can patch the exact supported Diamond EU Rev 5 dump without growing ARM9 and still update the DS header CRC16
- MelonDS smoke-test success for starter selection, completing the opening battle, and basic wild encounters on the internal-cave builds
What I have not confirmed yet is the actual observed shiny frequency on the new working internal-cave builds, so I am still treating the odds side as active validation work.
The detailed reverse-engineering notes live in notes/diamond_eu_rev5.md.
Gen 4 is a larger target than Gen 3:
- ROMs are DS containers instead of flat GBA images
- the executable layout includes ARM9, ARM7, and overlays
- per-version support needs tighter fingerprinting before I patch anything
My first milestone is to make incoming dumps easy to inspect, catalog, extract, and analyze so reverse-engineering stays organized.
kirapatch_ds.py: simple launchersrc/kirapatch_ds/cli.py: CLI entrypointsrc/kirapatch_ds/nds.py: DS ROM parsing, FAT parsing, and overlay parsingsrc/kirapatch_ds/extract.py: extraction helpers for ARM binaries and overlay payloadssrc/kirapatch_ds/analysis.py: heuristic and exact ARM/Thumb analysis helperssrc/kirapatch_ds/catalog.py: scan and export helperssrc/kirapatch_ds/profiles.py: per-ROM patch registrysrc/kirapatch_ds/patcher.py: experimental patch pipelinenotes/diamond_eu_rev5.md: current reverse-engineering notes for the first targettests/test_nds.py: unit teststests/test_catalog.py: unit teststests/test_extract.py: unit teststests/test_analysis.py: unit teststests/test_patcher.py: unit tests
Inspect one ROM:
python kirapatch_ds.py inspect ".nds\\Pokemon - Diamond (EU) Rev 5.nds"Scan the dumps folder:
python kirapatch_ds.py scanWrite a JSON catalog:
python kirapatch_ds.py catalogExtract ARM9, ARM7, and overlays for one ROM:
python kirapatch_ds.py extract ".nds\\Pokemon - Diamond (EU) Rev 5.nds"Run the analysis pass for the current target:
python kirapatch_ds.py analyzeBuild an experimental test ROM for the currently supported Diamond dump:
python kirapatch_ds.py patch ".nds\\Pokemon - Diamond (EU) Rev 5.nds" --odds 16Inspect as JSON:
python kirapatch_ds.py inspect ".nds\\Pokemon - Diamond (EU) Rev 5.nds" --jsonAt the moment, patch is only expected to succeed on the exact fingerprinted Pokemon - Diamond (EU) Rev 5 target. If I point it at another dump, the tool should refuse to patch it instead of guessing.
- Drop dumped Gen 4 ROMs into
.nds/. - Run
python kirapatch_ds.py scanto verify the files are readable. - Run
python kirapatch_ds.py catalogto writemanifests/rom_catalog.json. - Extract the chosen target with
python kirapatch_ds.py extract. - Run
python kirapatch_ds.py analyzeto rank and confirm the code regions I care about. - Add a dedicated patch profile for that exact fingerprint.
- Build and test a ROM-specific hook before I expand support.
For development, I am treating 1/16 and 1/64 as practical test builds.
I am not treating 1/4096 as a manual validation build, because brute-force resets at that rate are not realistic during active hook development.
My next technical milestone is:
- keep
Pokemon - Diamond (EU)as the first traced target - confirm actual shiny generation frequency on the working internal-cave Diamond hook
- map which gift, static, and other encounter paths still need explicit coverage
- only then expand the support surface to
Pokemon - Pearl (EU),Pokemon - Platinum (EU), and HGSS