Files
pmd-sky/include/main_02055770.h
cecilarmitais c482e2dfdb Decompile 59 more callees; clear five asm files entirely
asm/main_020504BC.s          28 functions  cleared
  asm/main_0200D1F0.s          11 functions  cleared
  asm/main_02052060.s          10 functions  cleared
  asm/overlay_29_02320788.s     8 functions  cleared
  asm/main_020559D8.s           1 function   cleared
  asm/overlay_29_022E34A8.s     1 of 9       remainder -> overlay_29_022E2B68.s

sub_02050CF8 and sub_02050D84 are in translation units of their own,
src/main_02050CF8.c and src/main_02050D84.c, and that is load-bearing rather
than tidiness. Both call BitstreamDebug, which is four bytes -- an empty body --
and is one of the other 26 functions of the same asm file. Compiled beside it at
-O4,s, mwcc inlines the call away and each function comes out two instructions
short; the ROM then shifts and 33 of 37 sbins stop matching. Retail emits a real
bl there, so retail compiled these two apart from BitstreamDebug. Separate
objects reproduce that, and the pool -- five words and the predicated
ldrne/ldreq pair -- was never the problem.

asm/main_bss_022AB0AC.s declares a second global at 0x022AB918. Two objects of
different size share that address: the record TEAM_NAME (0x14 bytes, 0x10 under
JAPAN) and _022AB918, its leading name buffer (0xC, 8 under JAPAN). Four
functions load both, which needs two distinct (symbol, addend) pool keys; one
symbol gives one word and leaves them four bytes short. No .space is added and
no later symbol moves, so the bss layout and the ROM are untouched -- confirmed
by building that one-line change alone against the previous commit.

ov29_022E34A8_EU exists only in the EUROPE build, so its definition and its
prototype both carry #ifdef EUROPE; its single call site was already inside one.
Note that extracting it left an orphan #endif in the remainder file, because it
was the first function in its .s and sat inside a region conditional -- the tool
takes the opening directive with the function and leaves the closing one behind.

struct bag_items loses fill2/fill3/fill4 for the members behind them, so struct
bulk_item moves above it and two accessors return struct bulk_item *.
struct unk_020517F4 splits u8[8] into u8[4] + s32, forced by a 32-bit load at
offset 4. struct bitstream::ptr becomes u8 * -- CopyBitsTo and CopyBitsFrom read
it with ldrb, and char * under -char signed emits ldrsb. sub_02051FF0 and
LoadFileFromRom take a const char * path, not a u32 id; src/ground_bg.c already
declared the latter correctly.

Seventeen call-site-derived declarations are removed in favour of an include of
the owning header.

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:41 -07:00

51 lines
1.1 KiB
C

#ifndef PMDSKY_MAIN_02055770_H
#define PMDSKY_MAIN_02055770_H
#include "util.h"
#include "common.h"
struct unk_02055E14_18 {
u32 field_0x0[3];
};
struct unk_02055E14_2a {
u16 field_0x0[12];
};
struct unk_02055E14 {
u16 field_0x0;
u8 field_0x2[2];
u8 field_0x4;
u8 field_0x5;
u8 field_0x6;
u8 field_0x7;
s16 field_0x8;
u8 field_0xa;
u8 field_0xb;
s16 field_0xc;
s16 field_0xe;
u8 field_0x10[2];
u8 field_0x12[2];
s32 field_0x14;
struct unk_02055E14_18 field_0x18;
u8 field_0x24;
u8 field_0x25;
s16 field_0x26;
s16 field_0x28;
struct unk_02055E14_2a field_0x2a;
char field_0x42[10];
};
struct ground_monster* GetHero(void);
struct ground_monster* GetPartner(void);
struct ground_monster* GetMainCharacter1(void);
struct ground_monster* GetMainCharacter2(void);
struct ground_monster* GetMainCharacter3(void);
s16 sub_02055894(struct ground_monster *member);
s16 GetFirstMatchingMemberIdx(s16 monster_id);
s16 GetFirstEmptyMemberIdx(s16 monster_id);
void sub_020559D8(s16 *idxs);
#endif