mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-28 05:07:58 -05:00
ac61cc341cac14b0ce3e530ef9822e4a05ffeff4
Decompile GetHeroMemberIdx, GetPartnerMemberIdx, GetMainCharacter1MemberIdx, GetMainCharacter2MemberIdx and GetMainCharacter3MemberIdx from asm/main_02054E4C.s. Each returns the index of a TEAM_MEMBER_TABLE_PTR->members entry when that entry's is_valid bit is set, or -1 otherwise: hero is index 0, partner index 1, and the GetMainCharacter functions choose the index by game mode -- 2/3/4 during a special episode, 0/1/none otherwise. They are the index returning counterparts of the pointer accessors in the previous commit and merge into a new src/main_0205567C.c. The return type is u32. This matters: with a signed int return, the compiler recognises `valid ? 0 : -1` as the idiom -(!valid) and emits an arithmetic negate, but the target uses a conditional-move select. Under u32, -1 is 0xFFFFFFFF, the negate idiom no longer applies, and the compiler emits the select the target has. The distinction is only observable for hero, whose index is the constant 0; for the others the index is non-zero or runtime, so both signednesses produce the select. The whole family is typed u32 for consistency, and sub_02065050, which calls two of these, was rebuilt to confirm the type change leaves it byte-identical. No new names are introduced. struct team_member_table, struct ground_monster and TEAM_MEMBER_TABLE_PTR already exist in the tree, and the five function names were already labelled; this commit only fills in bodies. 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%