Files
pmd-sky/include/main_02004FCC.h
cecilarmitais e6c5c87501 Decomp five leaf functions; replace four stale prototypes
Decompile from asm:

  IsMonsterIdInNormalRange          0x02056294
  Rgb8ToRgb5                        0x02004FCC
  Arm9LoadUnkFieldNa0x2029EC8       0x02029EC8
  Arm9StoreUnkFieldNa0x2029ED8      0x02029ED8
  CanMonsterBeUsedForMissionWrapper 0x02062A58

Each was extracted with extract_function.py, splitting its .s and adding the
new objects to main.lsf. PREV_MENU_ITEMS is declared alongside the two
accessors that use it, sized 0x18 from the .space in main_bss_020B3380.s.

Four prototypes previously declared from call sites are replaced by includes of
the new headers: IsMonsterIdInNormalRange in main_02056D70.c, Rgb8ToRgb5 in
main_0201E380.c, and both Arm9 accessors in overlay_31_02382820.c.

Arm9LoadUnkFieldNa0x2029EC8 keeps the two-parameter prototype that was already
declared in overlay_31_02382820.c. Its body reads only the first argument -- the
second register is overwritten with the table address before any use -- so the
function's own bytes do not distinguish a one-parameter form from a two-
parameter one, and both score 0 against the target. The call site does
distinguish them: overlay_31_02382820.c passes two arguments and already
matches, so the existing declaration is the load-bearing evidence. That object
is rebuilt here and still matches.

CanMonsterBeUsedForMission is still asm, so its prototype is provisional and
declared in the caller's header. Its second parameter is byte-width: a caller
in main_0205D1F4.s masks with and r1, r1, #0xff before the call.

No comments are added to any pmd-sky file.

Authored by Claude (Opus 5) under human direction. Confirmed by a matching
build of all five together: build/pmdsky.us/pmdsky.us.nds: OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 14:22:17 -07:00

7 lines
111 B
C

#ifndef PMDSKY_MAIN_02004FCC_H
#define PMDSKY_MAIN_02004FCC_H
void Rgb8ToRgb5(u16 *dest, u32 *color);
#endif