cecilarmitais 580644e646 Decomp sub_02065050; make two script-entity fields signed
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>
2026-08-16 13:45:13 -07:00
2026-04-08 09:53:43 +02:00
2026-07-31 18:03:24 -04:00
2024-06-23 16:59:48 -05:00
2024-12-28 02:25:07 -06:00
2026-08-01 12:46:55 -04:00
2026-07-16 07:36:58 -07:00
2025-06-10 23:35:01 -04:00
…
…

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:

For contacts and other pret projects, see pret.github.io.

Description
Decompilation of Pokémon Mystery Dungeon: Explorers of Sky
Readme 335 MiB
Languages
Assembly 66.3%
C 18%
C++ 7.1%
Boogie 4.3%
sed 1.5%
Other 2.8%