Decompile UFixedPoint64CmpLt (0x02001A30) from asm. It compares two 64-bit
values held as high/low word pairs and returns whether the first is less than
the second.
asm/main_02001A30.s held only this function, so the file and its .inc are
removed rather than split, the function merges into the adjacent
src/main_020018D0.c, and main.lsf drops asm/main_02001A30.o.
Three details of the interface are read off the target rather than assumed,
each tested with the others held fixed. The four words arrive as separate
parameters: a 2-word struct passed by value makes the compiler push all four
argument registers and reload them, which the target does not do. Those
parameters are unsigned: the comparisons select movlo/movhi, where signed high
words give movlt/movgt. The return is word-sized: a u8-width return such as
bool8 appends and r0, r0, #0xff, which the target does not have. BOOL is used
rather than int because it is the tree's word-sized boolean, and it produces
the same bytes.
src/main_02001BB4.c declared this function from its call site, before it was
decompiled. That declaration is replaced by an include of the header. It was
never visible to the compiler at the same time as the definition, so the two
disagreeing prototypes could not be caught by a build; its parameter types were
signed, which does not describe this function.
No comments are added to any pmd-sky file.
Authored by Claude (Opus 4.8, amended by Opus 5) 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>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Decompile eight ground-mode setters from asm into src/main_02065B3C.c:
SetActorTalkMainAndActorTalkSub, SetActorTalkMain, SetActorTalkSub,
SetActorEventMain, SetRandomRequestNpcs1And2, SetRandomRequestNpc03KindVar,
SetAllEventNpcs and SetNewFriendActor.
Identify the global they write, _020B0B08, as a 28-byte table of slots keyed by
the special members of enum script_entity_id (ENTITY_TALK_MAIN 46 through
ENTITY_NPC_DEMO_PARTNER 59). Every slot offset is corroborated by both a writer
above and the reader that resolves it at the matching entity id: sub_0206549C,
reached via GetScriptEntityMonsterId, and sub_02065050, reached via
GetActorMatchingStorageId. Name the type struct special_actors and relabel the
symbol _020B0B08 -> SPECIAL_ACTORS at its definition in
asm/main_rodata_020A2808.s and at every reference.
Extracting the block splits asm/main_0205EDA4.s: the trailing functions move
verbatim into asm/main_02065BD8.s, the affected .inc files are regenerated, and
main.lsf gains the two new objects.
Add enum script_entity_id to include/enums.h, taken from pmdsky-debug, since
struct special_actors refers to it.
No comments are added to any pmd-sky file; comments cannot be checked by the
matching build, so the code is left to stand on its own.
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>
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>