Files
pmd-sky/include/main_020037B4.h
cecilarmitais 967fe53b74 Decompile 17 more callees; clear two asm files; enum item_id gains ITEM_INVALID
Two .s files cleared entirely, so main.lsf loses both objects:

  asm/overlay_29_022FB678.s  AreEntitiesAdjacent, IsHero, ov29_022FB718,
                             ov29_022FB83C, ov29_022FB920, ov29_022FB984,
                             ov29_022FB98C, ov29_022FB9BC
  asm/main_02003328.s        TaskProcBoot, EnableAllInterrupts, sub_02003620,
                             sub_02003704, sub_02003754, sub_02003780,
                             sub_020037A4, GetTime, DisableAllInterrupts

main_02003328 lands as TWO objects, not one. GetTime calls EnableAllInterrupts,
which precedes it in address order, and at -O4,s MWCC folds a callee whose body
it has already seen: in one translation unit GetTime's two bl EnableAllInterrupts
become the inlined body. So GetTime and DisableAllInterrupts go to a new
src/main_020037B4.c; the other seven merge into src/main_0200330C.c.
DisableAllInterrupts is not inlined in the same run because it is defined after
GetTime, which is the same rule seen from the other side.

enum item_id gains ITEM_INVALID = -1, placed as MONSTER_INVALID is in
enum monster_id. Under -enum min an enum with no negative enumerator is
unsigned, so a field of that type compiles to ldrh where AuraBowIsActive's
target has ldrsh; a cast at the call site cannot fix it, which was measured.
Range becomes -1..1399, still two bytes. VERIFIED IN ISOLATION -- added alone,
nothing else changed, all three ROMs still matching -- so it is byte-neutral for
existing code, the same standard ENTITY_NONE and MONSTER_INVALID were held to.

Five call-site declarations are replaced by an include of the owning header.
Two were wrong, not merely redundant: ov29_022FB984 was declared void where it
returns bool8, and ov29_022FB98C was an unprototyped extern int for a function
that returns nothing and takes two struct entity *.

Authored by Claude (Opus 5) under human direction. Each function was measured at
decomp.me score 0 in every region it exists in and re-measured by an independent
verifier. Confirmed by matching builds of 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:13:38 -07:00

10 lines
177 B
C

#ifndef PMDSKY_MAIN_020037B4_H
#define PMDSKY_MAIN_020037B4_H
#include "main_0200330C.h"
float GetTime(void);
u16 DisableAllInterrupts(void);
#endif //PMDSKY_MAIN_020037B4_H