mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-21 09:45:29 -05:00
Clears asm/main_02003DB8.s, main_0200BC60.s, main_020276C0.s, main_020278C4.s, main_02048C5C.s, main_0204FA70.s, main_0205A340.s, main_0205B39C.s, main_0205B478.s and twelve overlay_29 files, with their .inc headers and main.lsf entries. sub_02048C5C lands in its own translation unit (extract_function.py -nm) rather than merging into src/main_02048BB4.c: at -O4,s MWCC inlines ReadStringSave when its body is visible in the same TU, which made the function 16 bytes too long and shifted every overlay anchored below it. Shared types corrected from the asm rather than from a guess: - dungeon.h: four u8 field_0x2cb0c..f -> one u32 field_0x2cb0c (retail emits ldr/str, not ldrb/strb) - window.h: struct unk_022A7A6C extended past 0xC; WindowBlock::unk24 u32 -> void * - main_02029A50.h: unkStruct_02029A50 gains u8 unk26 - dg_random.h includes dungeon_mode.h; struct unk_022E9298 moved verbatim into dungeon_range.h - sub_0205B0A0 retyped (void *) -> (s32) 26 stale call-site externs across 20 files replaced with includes. Several disagreed with the definition: sub_0205B39C was declared void(void*,void*) where it is u8*(const s8*,s32), and three files declared CalcStatusDuration with s32* where it takes const s16*. asm/main_bss_020B3380.s gains a zero-length alias _022AAE74_2 at the same address as _022AAE74. MWCC keys literal-pool entries on (symbol, addend) and dedups, so the two identical .word entries the target holds require two distinct C symbols; .space is untouched, so the layout is unchanged. Authored by Claude (Opus 5) under human direction. Every landed function was byte-compared against the assembly it replaced at object level before building (build-tools/landcheck.sh), then 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>
26 lines
494 B
C
26 lines
494 B
C
#ifndef PMDSKY_MAIN_02027648_H
|
|
#define PMDSKY_MAIN_02027648_H
|
|
|
|
#include "util.h"
|
|
#include "window.h"
|
|
#include "main_02029A50.h"
|
|
|
|
struct unk_022A7B1C {
|
|
u8 field_0x0;
|
|
unkStruct_02029A50 field_0x4;
|
|
#ifndef JAPAN
|
|
s8 field_0x2c;
|
|
#endif
|
|
};
|
|
|
|
extern struct unk_022A7B1C _022A7B1C[20];
|
|
|
|
void InitRender3dElement64(WindowBlock *elem);
|
|
void InitWindowTrailer(CursorParams *params);
|
|
|
|
u32 sub_02027624(s32 window_id);
|
|
s32 NewWindowScreenCheck(s32 a, s32 b);
|
|
s32 NewWindow(s32 a, s32 b);
|
|
|
|
#endif
|