Files
pmd-sky/include/main_02056294.h
cecilarmitais 637d196646 Decompile 86 more callees; clear three asm files, split a fourth
asm/overlay_29_022E4BB4.s   26 functions  cleared
  asm/overlay_29_0230D088.s   25 functions  cleared
  asm/overlay_29_022EA008.s   13 functions  cleared
  asm/main_02055894.s         22 of 23      split

sub_020559D8 is at score 75 (0 structural rows, 11 register-colouring rows) and
is NOT landed, so main_02055894.s splits: asm/main_020559D8.o holds that one
function between src/main_02055770.o and src/main_02056294.o.

Five struct ground_monster members are retyped, on load-width evidence from
sub_02055E14: level, level_at_first_evo and level_at_second_evo are read ldrb
though declared s8, and iq and max_hp are read ldrsh though declared u16. The
reading validates itself -- id at 0x4 is read ldrsh and is already declared s16,
and every member whose declaration is already correct reads exactly as declared.
A cast at the read site cannot fix this: MWCC takes the load's width AND
signedness from the declared member type alone. This deviates from
pmdsky-debug's s8/u16, and it narrows ApplyGummiBoostsGroundMode's second
parameter from u16 * to s16 * -- that function is still asm, so its prototype is
now pinned by this reading rather than by its own body.

struct dungeon's `u8 field_0x1c; u8 field_0x1d;` become one s16, forced by
ldrsh/strlth at 0x1c. 0x1C is 4-aligned and 0x1E is already s16, so no padding
appears and no offset moves. No other translation unit names either field.

sub_0205B008's second parameter becomes struct ground_monster * instead of u32:
it forwards the argument straight to sub_02055894, and both asm call sites load
r1 with `ldr r1, [r0, #0x3c]`, a word out of a struct field.

src/overlay_29_022E9FC0.c declares DUNGEON_PTR with a COMPLETE type, [2] rather
than []. ov29_022EA008 scores 1025 under the incomplete form: it lets mwcc keep
DUNGEON_PTR[0] live across a store the target reloads after. [] and [2] are
compatible types, so no use site changes. struct unk_02353560 in that file grows
from 5 to 0x10 bytes and struct unk_0237C850 is new; neither is named outside it.

Twelve message ids in src/overlay_29_0230BBAC.c get an #ifdef JAPAN block. Every
other region delta across the four files is a header-driven field displacement
and needs nothing.

Thirty-five pre-existing declarations across nineteen files are removed in
favour of an include of the owning header, or corrected in place. Eleven of them
disagreed with the definition: UnkMapRelatedFunc declared with an unsigned first
parameter in four files where the switch dispatch is a signed range test, six
declared with no prototype at all and the wrong return type, and one
(sub_02055894) declared as taking a u32 where it takes a pointer.

Authored by Claude (Opus 5) under human direction. Confirmed by matching builds
in all three regions: build/pmdsky.us/pmdsky.us.nds: OK,
build/pmdsky.eu/pmdsky.eu.nds: OK, build/pmdsky.jp/pmdsky.jp.nds: OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 23:14:07 -07:00

37 lines
1.4 KiB
C

#ifndef PMDSKY_MAIN_02056294_H
#define PMDSKY_MAIN_02056294_H
#include "main_02055770.h"
#include "util.h"
#include "common.h"
bool8 sub_02055B20(s16 idx);
void sub_02055B78(s16 idx, s16 monster_id, u8 joined_at, const char *name);
s16 sub_02055CCC(struct ground_monster *mon);
struct ground_monster* sub_02055D4C(struct ground_monster *mon);
void sub_02055D7C(s16 idx, struct ground_monster *mon);
struct ground_monster* sub_02055DD0(s16 monster_id, const char *name, u8 *joined, u16 *moves, u8 flag);
void sub_02055E14(struct unk_02055E14 *dst, struct ground_monster *mon);
void sub_02055F04(struct ground_monster *mon, struct unk_02055E14 *src);
bool8 sub_02055FCC(s16 member_idx, s16 item_id);
bool8 IsMonsterNotNicknamed(struct ground_monster *mon);
void GetRecoloredGroundMonsterName(char *dst, struct ground_monster *mon, s32 mode);
void sub_02056094(char *dst, struct ground_monster *mon, bool8 is_leader);
bool8 sub_020560A4(s32 a, s32 b);
void sub_020560B8(void);
void RemoveActiveMembersFromAllTeams(void);
void RemoveActiveMembersFromSpecialEpisodeTeam(void);
void RemoveActiveMembersFromRescueTeam(void);
bool8 sub_02056228(s32 idx);
bool8 CheckTeamMemberIdx(s32 idx);
bool8 IsMonsterIdInNormalRange(s16 id);
bool8 sub_020562B8(int a);
void SetActiveTeam(enum team_id team);
void sub_02056318(u8 a);
u8 sub_0205633C(void);
bool32 sub_02056360(void);
struct team_member* GetActiveTeamMember(s32 roster_idx);
#endif