mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-28 05:07:58 -05:00
580644e6465e927e151de16fe42d31c6f77f1ffa
Decompile sub_02065050 (0x02065050), the resolver that rewrites a script entity id in place and reports which storage it maps to. It redirects the four special ids 0x2E-0x31 through SPECIAL_ACTORS, then dispatches on the entity's kind field: kind 1 resolves the player slot from script variable 0x34, kind 2 resolves a team member from variables 0x35 and 0x36, kind 3 range-checks against the loaded unit or adventure NPC list, and anything else handles the appointed leader. It merges into src/main_02064FFC.c; asm/main_02065050.s splits, with sub_0206549C moving verbatim into asm/main_0206549C.s. Two type declarations are corrected, both diagnosed from the load instruction rather than assumed. Storing to a field cannot reveal its signedness -- strh is the same either way -- so neither error was observable until something read these fields, and this is the first decompiled function that does. enum script_entity_id gains ENTITY_NONE = -1. Under -enum min an enum with no negative enumerator is unsigned, so the SPECIAL_ACTORS redirect slots compiled to ldrh where the target has ldrsh. An explicit (s16) cast does not help: the destination store is 16-bit, so the compiler folds the conversion away. The name follows EPISODE_NONE = -1, already in this file. The sentinel was verified in isolation, with no other change in the tree, and the ROM still matches -- it is byte-neutral everywhere else and only affects code that reads such a field. struct unk_020A7FF0 field_0x0 becomes s16 for the same reason. It was declared u16 when the struct was introduced for sub_02065B14, which only reads field_0x8 -- genuinely unsigned, ldrh. Both resolvers read field_0x0 with ldrsh. sub_02055410 is declared as taking the member index rather than void. The argument is already in r0 from GetAppointedLeaderMemberIdx, so the call needs no register move, which is what leaves r0 occupied across the sentinel comparison. Declared void, the function is otherwise identical but allocates that constant to r0 instead of r1. The nine functions this calls that had no declaration are declared alongside; parameter names are positional where only the call site is understood. No comments are added to any pmd-sky file. Authored by Claude (Opus 4.8) under human direction. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. Co-Authored-By: Claude Opus 4.8 <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%