mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-29 05:41:47 -05:00
0fbdb572100ecaabd2d86f5e4db0f3ee77943ac4
Decompile from asm: ov29_02349688 0x02349688 SetTargetMonsterNotFoundFlag 0x023496C4 GetTargetMonsterNotFoundFlag 0x023496D8 GetMissionTargetEnemy 0x02349620 The first three read and write the two dungeon flags at 0x1 and 0x3; GetMissionTargetEnemy returns enemy_species[0]. No new types. The previous commit left thirteen functions unlanded because they failed four checksums with no compile error, and recorded the elimination so far. Bisecting found a one-function reproducer, GetMissionEnemyMinionGroup, and disassembling the object the real build emits identifies the cause. The scratch and the real build disagree, and the scratch was wrong. For enemy_species[index + 1] the target computes the index first -- add r0, r0, #1, then add r0, r1, r0, lsl #1, then add #0x700 and ldrsh [r0, #0x6e]. The real build folds the constant into the displacement instead, giving add r0, r1, r0, lsl #1, add #0x700, ldrsh [r0, #0x70], one instruction shorter and the same address. Same compiler, same flags, same C: the difference is the context. The scratch used a cut-down struct dungeon carrying only the offsets these functions touch, and against that struct the compiler emits the target's form; against the real header it folds. That invalidates the scratch verification for the whole cluster, not just this function. Score 0 against an invented struct is not evidence about a build that uses the real one, even when every offset and size matches -- and they do, which was confirmed separately by compile-time assertions against the real headers. So the thirteen are not near-matches to iterate on; they need re-verifying against a faithful context before any C is judged. A preprocessed context is obtainable -- mwccarm -E on a file including dungeon.h and mission.h, with LM_LICENSE_FILE set, yields 9200 lines that reproduce the real build's view -- but that output does not yet compile as scratch context on its own, failing at a typedef, so wiring it up is unfinished. The four here were each verified by a matching build rather than by the scratch: three of them alone, GetMissionTargetEnemy alone, and all four together. No comments are added to any pmd-sky file. Authored by Claude (Opus 5) under human direction. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pokémon Mystery Dungeon: Explorers of Sky
This is a WIP disassembly of Pokémon Mystery Dungeon: Explorers of Sky. For instructions on how to set up the repository, please read INSTALL.md. For information on how to contribute changes, see CONTRIBUTING.md.
This repository builds the following ROMs:
- pmdsky.us.nds
sha1: 5fa96ca8d8dd6405d6cd2bad73ed68bc73a9d152 - pmdsky.eu.nds
sha1: c838a5adf1ed32d2da8454976e5b1a1aa189c139 - pmdsky.jp.nds
sha1: 7785138dd343b6f2d0f2c9cadc26b4aa927161d7
For contacts and other pret projects, see pret.github.io.
Description
Languages
Assembly
66.3%
C
18%
C++
7.1%
Boogie
4.3%
sed
1.5%
Other
2.8%