diff --git a/Makefile b/Makefile index a28dc1025..d4dba124c 100644 --- a/Makefile +++ b/Makefile @@ -439,6 +439,11 @@ build/src/%.o: src/%.c # pattern recipe reads $(CC1FLAGS), so this overrides it for just build/src/boot.o): build/src/boot.o: CC1FLAGS := -quiet -O0 -G0 -mips1 -mcpu=3000 -mgas -msoft-float -fgnu-linker +# Phase-19 T1: same per-file -O0 mechanism for the ov_SC01_077 -O0 cluster (16 contiguous fns +# vram 0x8013B568..0x8013C98C, prologue sig 21F0A003). Split into its own .c by the splat config +# (config/splat.ov_SC01_077.yaml) so this override reaches just that .o. +build/src/ov_SC01_077/ov_SC01_077_o0.o: CC1FLAGS := -quiet -O0 -G0 -mips1 -mcpu=3000 -mgas -msoft-float -fgnu-linker + # link (the .ld pulls in the .o by path) + objcopy to the raw PS-X EXE image. $(OUT): $(OBJS) $(ASSET_OBJS) $(LD_SCRIPT) @set -e diff --git a/config/splat.ov_SC01_077.yaml b/config/splat.ov_SC01_077.yaml index 77ea1f3f8..f06b68259 100644 --- a/config/splat.ov_SC01_077.yaml +++ b/config/splat.ov_SC01_077.yaml @@ -51,7 +51,15 @@ segments: vram: 0x80128158 align: 4 subsegments: - - [0x0, c, ov_SC01_077] # code: vram 0x80128158..0x80186AD0 (file 0x0..0x5E978) + # Phase-19 T1: per-file -O0 split (src/boot.c precedent). The 16 contiguous functions + # vram 0x8013B568..0x8013C98C were compiled -O0 (prologue sig 21F0A003); gcc-2.7.2 has no + # per-function optimize pragma, so they need their own -O0 .o (the Makefile forces + # CC1FLAGS=-O0 on ov_SC01_077_o0.o). A single object's .text can't be split around a middle + # object, so before/after are DISTINCT objects: before -> ov_SC01_077_a (smaller, asm paths + # rewritten), after KEEPS the ov_SC01_077 name (the bulk matched C + asm paths unchanged). + - [0x0, c, ov_SC01_077_a] # -O2 before: vram 0x80128158..0x8013B568 (file 0x0..0x13410) + - [0x13410, c, ov_SC01_077_o0] # -O0 cluster: 16 fns vram 0x8013B568..0x8013C98C (file 0x13410..0x14834) + - [0x14834, c, ov_SC01_077] # -O2 after: vram 0x8013C98C..0x80186AD0 (file 0x14834..0x5E978) - [0x5E978, data, tail] # data tail (word-aligned bulk): file 0x5E978..0xB29D4 - [0xB29D4, bin, trailing] # final 3 bytes (EOF 0xB29D7 not word-aligned; spimdisasm drops # a trailing partial word and a <4-byte `data` carve emits nothing, diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md new file mode 100644 index 000000000..d356e6086 --- /dev/null +++ b/phase-ends/CURRENT_PHASE.md @@ -0,0 +1,36 @@ +# CURRENT PHASE — Phase 19: Scale the toolkit (wave-harvest at scale + cheap front-loaded levers) + +**Started:** 2026-06-20 · **Generation:** Gen2 (11th phase) · **Plan approved (gate 1):** Drew, 2026-06-20 +**Effort:** Max (planning/synthesis) · xHigh (T1/T2 execution) · **Ultracode for T3 wave batches** (prompt at the transition, R26/R27) +**Plan file:** `~/.claude/plans/plan-mode-enabled-max-golden-truffle.md` + +## Scope decisions (Drew, gate 1) +- **Bounded flywheel** — T1 + T2 + **2–3 wave batches of 50**, bank gains, close at a clean checkpoint with a Phase-20 backlog. (Not open-ended; not infra-only.) +- **gcc-research spike (T4) = CONDITIONAL in-phase** — runs ONLY if the waves plateau on a residual class blocking meaningful reach. + +## Baseline at phase start (verified this session) +- Fleet **56.64%** byte-identical-from-source (194,839 / 344,010); 136/136 binaries byte-identical; 1450 dedup groups (0 failed); 0 NON_MATCHING. +- `ov_SC01_077`: 1719/2586 = 66.5%, 867 INCLUDE_ASM stubs remaining; clean-rebuild SHA `d19c9580…`. +- Staged: `.run/harvest_wave_p18s1.js` (120 tractable reach-134 targets; P18 ran 31). Ghidra-C cache `.run/ghidra_c/` = 300 fns (fresh). + +## Tasks +- [x] **T1 — Per-file -O0 split-file lever** — DONE (re-scoped by Drew: bank infra + 6, defer rest). The 3-object split works (`ov_SC01_077_a` before / `ov_SC01_077_o0` -O0 / `ov_SC01_077` after — a single object's .text can't be split around a middle object). **6/16 -O0 fns matched** byte-perfect (`func_8013B568/B7F4/BD34/C360/C938/C964`). **DEFERRED to Phase 20:** the 10 remaining -O0 fns hit an indexed-global `%lo`-folding codegen quirk (gcc-source research, R17 — our cc1 materializes the address, the original folds %lo); AND the ×134 per-overlay rollout (engine_core.h compiles -O2, can't carry -O0 fns → each overlay needs its own -O0 split). Two findings corrected the Phase-18 backlog's "afternoon, free ×134" premise (R14). +- [ ] **T2 — Recovery tooling.** `tools/cast_call_sites.py` (call-site fn-ptr casts) + implicit-int propagate-first. Build/validate on `.run/drafts-p18s1/` near-misses. +- [ ] **T3 — Scale waves (2–3 batches of 50, Ultracode).** Regen Ghidra-C for fresh targets, `gen_harvest_targets.py` manifest, Step-1 wave prompt → recovery (T2) → gate → `dedup_propagate` ×134 → checkpoint → improve. Each batch = a progress report. +- [ ] **T4 — (CONDITIONAL) gcc-research spike.** Only on a blocking residual class (loop-guard order `func_8012C2D0`; §10 schedule `func_8014F2E0`). +- [ ] **PhaseEnd** — verify all checkboxes (P7), demonstrate milestone, write `PhaseEnd_Phase19.md` (+ `## Plain-English Recap`, R25; Phase-20 backlog), archive worklog (R19). + +## Milestone (gate 2, Drew confirms) +-O0 lever banked + recovery tooling proven + toolkit scaled across 2–3 batches of 50, fleet up materially (target +3–5%, ~56.6% → ~60%), 136/136 byte-identical from clean (R22), 0 NON_MATCHING (G4), closed at a clean checkpoint with a Phase-20 backlog. + +## Progress log +*(append one line per task as completed)* +- 2026-06-20 — Phase started; plan approved (gate 1); task list built (R28); CURRENT_PHASE.md created. Beginning T1. +- 2026-06-20 — T1: built + proved the 3-object -O0 split infra; matched 6/16 -O0 fns (ov_SC01_077 d19c9580). Two consults with Drew on T1 scope: (1) full -O0 rollout chosen, then (2) on discovering the remaining fns are research-grade (the %lo quirk), Drew chose "bank 6 + infra, defer rest to Phase 20." Fleet unchanged (the 6 are ov_SC01_077-local until rollout). Verified main/resident/ov_SC01_077/+2 byte-identical. Committed checkpoint. → T2. + +## Blockers +*(none)* + +## Notes / carried to Phase 20 +- **The -O0 lever completion (NEW, from T1):** infra is built + proven in ov_SC01_077 (the 3-object split). Remaining: (a) **match the 10 indexed-global -O0 fns** — blocked by the `%lo`-folding quirk (our cc1 materializes `lui;addiu;addu;sw 0(reg)`; original folds `lui;addu;sw %lo(sym)(reg)`); needs gcc-2.7.2 source research (R17/§17), maybe unsteerable from C. Stubs: func_8013B598/B6A0/B7AC/B83C/BC7C/BCDC/BD74/C08C/C0F8/C414. (b) **The ×134 rollout** — each overlay needs its own -O0 split (uniform offsets 0x13410/0x14834, shared bodies header); engine_core.h can't carry -O0 fns. ~+0.6% fleet when complete. (c) the 2 -O0 outliers (func_80144B9C giant + func_801457A4). +- Most giants (28 reach-134 >150-ins); per-overlay unique remainder (×1); comprehension/emulator actor-field naming; Wine/CC1PSX (parked); public flip (Phase 14, Gen3+). diff --git a/src/ov_SC01_077/ov_SC01_077.c b/src/ov_SC01_077/ov_SC01_077.c index fd09d1275..ab779e70d 100644 --- a/src/ov_SC01_077/ov_SC01_077.c +++ b/src/ov_SC01_077/ov_SC01_077.c @@ -31,1335 +31,6 @@ extern s32 func_80175820(void); /* derive-decl, arity 0 extern s32 func_801758FC(void); /* derive-decl, arity 0 */ /* ==== end canonical-sig layer ==================================================== */ -DEFINE_func_80128158() /* dedup: shared engine-core @0x80128158 (src/shared) */ - -DEFINE_func_80128178() /* dedup: shared engine-core @0x80128178 (src/shared) */ - -DEFINE_func_80128198() /* dedup: shared engine-core @0x80128198 (src/shared) */ - -DEFINE_func_801281B8() /* dedup: shared engine-core @0x801281B8 (src/shared) */ - -DEFINE_func_801281D8() /* dedup: shared engine-core @0x801281D8 (src/shared) */ - -DEFINE_func_801281F8() /* dedup: shared engine-core @0x801281F8 (src/shared) */ - -extern s32 D_801D7F90; - -s32 func_80128218(void) { - return D_801D7F90; -} - -DEFINE_func_80128228() /* dedup: shared engine-core @0x80128228 (src/shared) */ - -DEFINE_func_80128248() /* dedup: shared engine-core @0x80128248 (src/shared) */ - -DEFINE_func_80128268() /* dedup: shared engine-core @0x80128268 (src/shared) */ - -extern u16 D_800B99F6; -extern void (*D_80186DB4[])(void); - -void func_80128288(void) { - u32 v1; - v1 = D_800B99F6; - if (v1 < 9) { - D_80186DB4[v1](); - } -} - -DEFINE_func_801282CC() /* dedup: shared engine-core @0x801282CC (src/shared) */ - -DEFINE_func_801282EC() /* dedup: shared engine-core @0x801282EC (src/shared) */ - -DEFINE_func_8012832C() /* dedup: shared engine-core @0x8012832C (src/shared) */ - - -DEFINE_func_80128420() /* dedup: shared engine-core @0x80128420 (src/shared) */ - -DEFINE_func_801284B8() /* dedup: shared engine-core @0x801284B8 (src/shared) */ - -DEFINE_func_801284F0() /* dedup: shared engine-core @0x801284F0 (src/shared) */ - -DEFINE_func_8012853C() /* dedup: shared engine-core @0x8012853C (src/shared) */ - -DEFINE_func_80128564() /* dedup: shared engine-core @0x80128564 (src/shared) */ - -DEFINE_func_801285D4() /* dedup: shared engine-core @0x801285D4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801285E4); - -/* HANDWRITTEN scratchpad-stack-switch sequencer: stores $sp at the scratchpad slot - * 0x1F8003FC and repoints $sp into the D-cache scratchpad before each engine call, - * restoring it after. Manipulating $sp is not expressible in C; full inline asm - * (manages its own frame). Signature pinned by engine_core.h: void func_80128678(void). */ -DEFINE_func_80128678() /* dedup: shared engine-core @0x80128678 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128714); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801287B8); - -extern void func_8001ABBC(s32 a0, s32 a1, void *a2, s32 a3, s32 sp10); -extern s32 D_801D7F90; -extern u8 D_800AEFD0; - -s32 func_801288B0(void) { - func_8001ABBC(0, 0, &D_800AEFD0, D_801D7F90, 0); -} - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801288E8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128940); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128998); - -extern s32 D_801D7F90; -extern u8 D_800AECB8; -extern void func_8001ABBC(s32 a0, s32 a1, void *a2, s32 a3, s32 a4); - -s32 func_801289F0(void) { - func_8001ABBC(0, 0, &D_800AECB8, D_801D7F90, 0); -} - -M2C_UNK func_80010DE0(); /* extern */ -extern void func_80011B7C(int); -extern void func_80011C10(void); -extern u16 D_800B99F6; -extern s16 D_800B9A00; -extern M2C_UNK (*D_80186AF0)(); -extern s16 (*D_80186AF4)(); - -void func_80128A28(void) { - s16 temp_v0; - - switch (D_800B99F6) { /* irregular */ - case 1: - D_80186AF0(); - /* fallthrough */ - case 0: - func_80011C10(); - return; - case 2: - temp_v0 = D_80186AF4(); - if (temp_v0 != 0) { - if (temp_v0 < 0) { - func_80011B7C(0); - D_800B9A00 = 1; - return; - } - func_80010DE0(); - } else { - return; - } - break; - } -} - - -M2C_UNK func_80010DE0(); /* extern */ -extern void func_80011B7C(int); -extern void func_80011C10(void); -extern void func_8002AEF8(void); -s32 func_8002AF08(); /* extern */ -extern void func_800CFBBC(void); -s32 func_800CFBE8(); /* extern */ -extern u16 D_800B99F6; -extern M2C_UNK (*D_80186AFC)(); -extern s32 (*D_80186B00)(); -extern s32 D_801D9480; - -void func_80128AF4(void) { - switch (D_800B99F6) { /* irregular */ - case 0: - D_801D9480 = func_8002AF08(); - func_80011C10(); - return; - case 1: - D_80186AFC(); - func_80011C10(); - return; - case 2: - if ((D_80186B00() << 0x10) != 0) { - if (D_801D9480 == 1) { - if (func_800CFBE8() != 0) { - func_800CFBBC(); - func_80011B7C(0x13); - } else { - func_80011B7C(4); - } - } else { - func_80010DE0(); - } - func_8002AEF8(); - } - return; - } -} - - -DEFINE_func_80128C14() /* dedup: shared engine-core @0x80128C14 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128C98); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128CFC); - -DEFINE_func_80128D60() /* dedup: shared engine-core @0x80128D60 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128DB4); - -DEFINE_func_80128EA8() /* dedup: shared engine-core @0x80128EA8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80128ED8); - -M2C_UNK func_8001534C(M2C_UNK, M2C_UNK *, M2C_UNK, M2C_UNK, s32, s32); /* extern */ -M2C_UNK func_800153CC(M2C_UNK, u16, M2C_UNK, M2C_UNK, s32, s32); /* extern */ -extern M2C_UNK D_801D7F94; - -void func_80128FAC(u16 *arg0) { - func_8001534C(4, &D_801D7F94, 0x80, 0x90, 0, 0); - func_800153CC(5, *arg0, 0xA8, 0x90, 0x40, 0); -} - - -DEFINE_func_80129010() /* dedup: shared engine-core @0x80129010 (src/shared) */ - -extern u8 *func_8012913C(s32 a0); - -u8 *func_801290DC(s32 a0, u8 *a1) { - u8 *v1 = func_8012913C(a0 & 0xFFFF); - - if (v1 != 0) { - *(u16 *)(v1 + 0x6) = *(u16 *)(a1 + 0x0); - *(u16 *)(v1 + 0xA) = *(u16 *)(a1 + 0x2); - *(u16 *)(v1 + 0xE) = *(u16 *)(a1 + 0x4); - } - return v1; -} - - -/* Callees — canonical-consistent sigs. - * func_8001D074: canonical `void func_8001D074(s32, s32)`; widened return to s32 - * (byte-neutral, §3a-1) because this fn uses the result. - * func_801291C0: canonical `u8 *func_801291C0(void)` (engine_core.h DEFINE_func_801291C0). - * func_8001CC3C: arity-4 from m2c/asm read-before-write $a0-$a3; void->s32 byte-neutral. - */ -DEFINE_func_8012913C() /* dedup: shared engine-core @0x8012913C (src/shared) */ - - -DEFINE_func_801291C0() /* dedup: shared engine-core @0x801291C0 (src/shared) */ - -extern void func_80129258(void); -extern void func_80129248(s16 a0); - -void func_80129220(void) { - func_80129258(); - func_80129248(1); -} - -DEFINE_func_80129248() /* dedup: shared engine-core @0x80129248 (src/shared) */ - -DEFINE_func_80129258() /* dedup: shared engine-core @0x80129258 (src/shared) */ - -DEFINE_func_8012927C() /* dedup: shared engine-core @0x8012927C (src/shared) */ - -DEFINE_func_801292C8() /* dedup: shared engine-core @0x801292C8 (src/shared) */ - -DEFINE_func_8012931C() /* dedup: shared engine-core @0x8012931C (src/shared) */ - -DEFINE_func_80129350() /* dedup: shared engine-core @0x80129350 (src/shared) */ - -DEFINE_func_80129374() /* dedup: shared engine-core @0x80129374 (src/shared) */ - -DEFINE_func_80129398() /* dedup: shared engine-core @0x80129398 (src/shared) */ - -DEFINE_func_80129428() /* dedup: shared engine-core @0x80129428 (src/shared) */ - -DEFINE_func_8012943C() /* dedup: shared engine-core @0x8012943C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012944C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012956C); - - -DEFINE_func_801298F4() /* dedup: shared engine-core @0x801298F4 (src/shared) */ - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801299C8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80129C40); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80129CF8); - -DEFINE_func_80129FF4() /* dedup: shared engine-core @0x80129FF4 (src/shared) */ - -extern u8 D_80126948[]; -void func_8012A048(void *a0, s32 a1, u8 a2); - -void func_8012A018(s32 a0, s32 a1) -{ - func_8012A048(D_80126948, a0, a1); -} - -DEFINE_func_8012A048() /* dedup: shared engine-core @0x8012A048 (src/shared) */ - -DEFINE_func_8012A094() /* dedup: shared engine-core @0x8012A094 (src/shared) */ - -DEFINE_func_8012A0E0() /* dedup: shared engine-core @0x8012A0E0 (src/shared) */ - -DEFINE_func_8012A100() /* dedup: shared engine-core @0x8012A100 (src/shared) */ - -DEFINE_func_8012A110() /* dedup: shared engine-core @0x8012A110 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012A1BC); - -DEFINE_func_8012A2F4() /* dedup: shared engine-core @0x8012A2F4 (src/shared) */ - -DEFINE_func_8012A304() /* dedup: shared engine-core @0x8012A304 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012A328); - - -struct Q16 { s32 a, b, c, d; }; - -extern s32 D_801151D4; -extern struct BigCopy D_80114EE8; - -void func_8012A418(void) { - struct Q16 *src; - struct Q16 *dst; - struct Q16 *end; - - src = (struct Q16 *)D_801151D4; - dst = &D_80114EE8; - end = src + 10; - do { - *dst = *src; - src++; - dst++; - } while (src != end); - *(s32 *)dst = *(s32 *)src; -} - - -typedef struct { s32 w[8]; } Vec8; - -extern s32 D_801151D4; -extern Vec8 D_80114F24; - -void func_8012A464(void) -{ - D_80114F24 = *(Vec8 *)(*(s32 *)&D_801151D4 + 0x3C); -} - -DEFINE_func_8012A4BC() /* dedup: shared engine-core @0x8012A4BC (src/shared) */ - -DEFINE_func_8012A568() /* dedup: shared engine-core @0x8012A568 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012A598); - -DEFINE_func_8012A5F8() /* dedup: shared engine-core @0x8012A5F8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012A62C); - -DEFINE_func_8012A68C() /* dedup: shared engine-core @0x8012A68C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012A6D0); - -DEFINE_func_8012A758() /* dedup: shared engine-core @0x8012A758 (src/shared) */ - -DEFINE_func_8012A79C() /* dedup: shared engine-core @0x8012A79C (src/shared) */ - -DEFINE_func_8012A7D4() /* dedup: shared engine-core @0x8012A7D4 (src/shared) */ - - -DEFINE_func_8012A828() /* dedup: shared engine-core @0x8012A828 (src/shared) */ - -DEFINE_func_8012A860() /* dedup: shared engine-core @0x8012A860 (src/shared) */ - -DEFINE_func_8012A8B0() /* dedup: shared engine-core @0x8012A8B0 (src/shared) */ - -DEFINE_func_8012A8E8() /* dedup: shared engine-core @0x8012A8E8 (src/shared) */ - -DEFINE_func_8012A908() /* dedup: shared engine-core @0x8012A908 (src/shared) */ - -DEFINE_func_8012A988() /* dedup: shared engine-core @0x8012A988 (src/shared) */ - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012AAAC); - -extern void func_8012AAAC(void); -extern M2C_UNK D_80186E48; - -void func_8012ACA0(void *arg0) { - M2C_FIELD(arg0, M2C_UNK **, 0x90) = &D_80186E48; - M2C_FIELD(arg0, s32 *, 0x94) = 0; - M2C_FIELD(arg0, s32 *, 0x9C) = 0; - M2C_FIELD(arg0, s16 *, 0x9A) = 0; - M2C_FIELD(arg0, u16 *, 0x72) = (u16) (M2C_FIELD(arg0, u16 *, 0x72) & 0xF9FF); - func_8012AAAC(); -} - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012ACE0); - -DEFINE_func_8012AD44() /* dedup: shared engine-core @0x8012AD44 (src/shared) */ - -DEFINE_func_8012AD50() /* dedup: shared engine-core @0x8012AD50 (src/shared) */ - - -void func_8012AD64(s32 *a0, s16 a1) { - *(s16*)((s32)a0 + 0x34) = a1; -} - -DEFINE_func_8012AD6C() /* dedup: shared engine-core @0x8012AD6C (src/shared) */ - -DEFINE_func_8012AD80() /* dedup: shared engine-core @0x8012AD80 (src/shared) */ - -DEFINE_func_8012ADE4() /* dedup: shared engine-core @0x8012ADE4 (src/shared) */ - -DEFINE_func_8012AE00() /* dedup: shared engine-core @0x8012AE00 (src/shared) */ - -extern s32 func_80135888(s32 a0, s32 a1, s32 a2, s32 a3); -extern s32 func_800132BC(s32 a0, s32 a1); - -/* LOAD-BEARING: the 8-byte sp+0x18->sp+0x20 copy is an alignment-2 struct copy - (3 shorts written, then copied) -> gcc emits lwl/lwr/swl/swr. An aligned-2 - base-type typedef did NOT reproduce it; only a short-only struct (align 2) does. */ - -DEFINE_func_8012AF0C() /* dedup: shared engine-core @0x8012AF0C (src/shared) */ - -DEFINE_func_8012B030() /* dedup: shared engine-core @0x8012B030 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012B0B4); - -DEFINE_func_8012B14C() /* dedup: shared engine-core @0x8012B14C (src/shared) */ - -DEFINE_func_8012B178() /* dedup: shared engine-core @0x8012B178 (src/shared) */ - -DEFINE_func_8012B1B4() /* dedup: shared engine-core @0x8012B1B4 (src/shared) */ - -DEFINE_func_8012B200() /* dedup: shared engine-core @0x8012B200 (src/shared) */ - -DEFINE_func_8012B21C() /* dedup: shared engine-core @0x8012B21C (src/shared) */ - -DEFINE_func_8012B23C() /* dedup: shared engine-core @0x8012B23C (src/shared) */ - -DEFINE_func_8012B260() /* dedup: shared engine-core @0x8012B260 (src/shared) */ - -DEFINE_func_8012B2CC() /* dedup: shared engine-core @0x8012B2CC (src/shared) */ - -DEFINE_func_8012B370() /* dedup: shared engine-core @0x8012B370 (src/shared) */ - -DEFINE_func_8012B414() /* dedup: shared engine-core @0x8012B414 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012B4B8); - -DEFINE_func_8012B608() /* dedup: shared engine-core @0x8012B608 (src/shared) */ - -DEFINE_func_8012B6D4() /* dedup: shared engine-core @0x8012B6D4 (src/shared) */ - -DEFINE_func_8012B70C() /* dedup: shared engine-core @0x8012B70C (src/shared) */ - -DEFINE_func_8012B744() /* dedup: shared engine-core @0x8012B744 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012B77C); - -DEFINE_func_8012B864() /* dedup: shared engine-core @0x8012B864 (src/shared) */ - -DEFINE_func_8012B8A4() /* dedup: shared engine-core @0x8012B8A4 (src/shared) */ - -DEFINE_func_8012B8E4() /* dedup: shared engine-core @0x8012B8E4 (src/shared) */ - - - -/* canonical data externs (per pre-resolved sigs); asm loads them lh -> (s16) cast at use */ -extern u16 D_80126B66; -extern u16 D_80126B5E; -/* callee func_8004CFEC, linked as symbol "ratan2" (config/symbols.us.txt: 0x8004CFEC); - * canonical s32(s32,s32) -- matches the banked sibling func_8012B8E4 in engine_core.h */ -extern s32 ratan2(s32 a0, s32 a1); - -s32 func_8012BA10(s32 arg0, s32 arg1) { - register s32 d __asm__("$16"); /* $s0 -- pinned: divisor, live across the jal */ - register s32 s1ang __asm__("$17"); /* $s1 -- pinned: ptr+0x12 angle, live across the jal */ - s32 u5; s32 u6; s32 iVar4; s32 q; s32 t; - d = arg1; - s1ang = *(s16 *)(*(s32 *)(arg0 + 0x20) + 0x12); - u5 = (ratan2(*(s16 *)(arg0 + 0xE) - (s16)D_80126B66, (s16)D_80126B5E - *(s16 *)(arg0 + 6)) - 0x400) & 0xFFF; - __asm__ __volatile__("" : : "r"(u5)); /* scheduling barrier: anchor u5 before the (s16)d cast */ - d = (s16)d; - u6 = s1ang & 0xFFF; - if (u6 == u5) return 0; - iVar4 = u5 - u6; - if (iVar4 > 0x800) { t = u6 + 0x1000; iVar4 = u5 - t; } - if (iVar4 < -0x800) { t = u6 - 0x1000; iVar4 = u5 - t; } - if (iVar4 >= 0) { q = iVar4 / d; if (q == 0) q = 1; } - else { q = iVar4 / d; if (q == 0) q = -1; } - return q; -} - - - -DEFINE_func_8012BB3C() /* dedup: shared engine-core @0x8012BB3C (src/shared) */ - - -DEFINE_func_8012BC60() /* dedup: shared engine-core @0x8012BC60 (src/shared) */ - -DEFINE_func_8012BCCC() /* dedup: shared engine-core @0x8012BCCC (src/shared) */ - -DEFINE_func_8012BD14() /* dedup: shared engine-core @0x8012BD14 (src/shared) */ - -DEFINE_func_8012BD3C() /* dedup: shared engine-core @0x8012BD3C (src/shared) */ - -DEFINE_func_8012BDBC() /* dedup: shared engine-core @0x8012BDBC (src/shared) */ - -DEFINE_func_8012BE54() /* dedup: shared engine-core @0x8012BE54 (src/shared) */ - -DEFINE_func_8012BE98() /* dedup: shared engine-core @0x8012BE98 (src/shared) */ - - -DEFINE_func_8012BEE8() /* dedup: shared engine-core @0x8012BEE8 (src/shared) */ - -DEFINE_func_8012BF10() /* dedup: shared engine-core @0x8012BF10 (src/shared) */ - -void func_8012BF4C(s32 *a0, s32 a1) { - *(s32*)((s32)a0 + 0x1C) = a1; -} - -DEFINE_func_8012BF54() /* dedup: shared engine-core @0x8012BF54 (src/shared) */ - -/* func_8012BF68: lhu 0x5C; andi 0x7FFF; sh 0x5C; jr (sh in delay slot) - * void form: no return value => no extra andi v0,0xffff truncation past the mask. */ -DEFINE_func_8012BF68() /* dedup: shared engine-core @0x8012BF68 (src/shared) */ - -DEFINE_func_8012BF7C() /* dedup: shared engine-core @0x8012BF7C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012BFA8); - -DEFINE_func_8012C044() /* dedup: shared engine-core @0x8012C044 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012C098); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012C0EC); - -DEFINE_func_8012C194() /* dedup: shared engine-core @0x8012C194 (src/shared) */ - -DEFINE_func_8012C1B8() /* dedup: shared engine-core @0x8012C1B8 (src/shared) */ - -DEFINE_func_8012C1DC() /* dedup: shared engine-core @0x8012C1DC (src/shared) */ - -DEFINE_func_8012C218() /* dedup: shared engine-core @0x8012C218 (src/shared) */ - -DEFINE_func_8012C284() /* dedup: shared engine-core @0x8012C284 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012C2D0); - -DEFINE_func_8012C31C() /* dedup: shared engine-core @0x8012C31C (src/shared) */ - -DEFINE_func_8012C354() /* dedup: shared engine-core @0x8012C354 (src/shared) */ - -DEFINE_func_8012C438() /* dedup: shared engine-core @0x8012C438 (src/shared) */ - -DEFINE_func_8012C51C() /* dedup: shared engine-core @0x8012C51C (src/shared) */ - - -DEFINE_func_8012C588() /* dedup: shared engine-core @0x8012C588 (src/shared) */ - - - -extern u8 D_80126720[]; -extern s32 func_8012C890(s32 a0, s32 a1, s32 a2); - -struct S8012C658 { - u16 unk0; - u16 unk2; - u16 unk4; - s16 unk6; - s16 unk8; - s16 unkA; - s16 unkC; - s16 unkE; - s32 unk10; -}; - -s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2) { - struct S8012C658 sp; - s32 var_v0; - u16 *var_a1; - u16 *end; - u16 *param; - - if ((arg2 != 0) && (*(u16 *)(arg2 + 0x0) != 0)) { - sp.unk0 = *(u16 *)(arg2 + 0x6); - sp.unk2 = *(u16 *)(arg2 + 0xA); - sp.unk4 = *(u16 *)(arg2 + 0xE); - } else { - sp.unk4 = 0; - sp.unk2 = 0; - sp.unk0 = 0; - } - sp.unk6 = (s16)arg0; - sp.unk8 = (s16)arg1; - sp.unkA = 0; - sp.unk10 = 0; - sp.unkE = 0; - sp.unkC = 0x7FFF; - param = &sp.unk0; - end = (u16 *)D_80126720; - if (arg2 == 0) { - var_a1 = (u16 *)((u8 *)end - 0x6480); - } else { - var_a1 = (u16 *)(arg2 + 0x10C); - } - while (var_a1 != end) { - if (*var_a1 == 0) { - goto found; - } - var_a1 = (u16 *)((u8 *)var_a1 + 0x10C); - } - var_a1 = 0; -found: - var_v0 = 0; - if (var_a1 != 0) { - var_v0 = ((s32 (*)(u16 *, u16 *))func_8012C890)(param, var_a1); - } - return var_v0; -} - - -DEFINE_func_8012C724() /* dedup: shared engine-core @0x8012C724 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012C750); - -DEFINE_func_8012C820() /* dedup: shared engine-core @0x8012C820 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012C890); - -DEFINE_func_8012CAE4() /* dedup: shared engine-core @0x8012CAE4 (src/shared) */ - - -DEFINE_func_8012CB64() /* dedup: shared engine-core @0x8012CB64 (src/shared) */ - - -extern void func_8012CC88(s32 a, s32 b, s32 c); -extern u8 D_800D3918[]; - -void func_8012CBA4(s32 a0) { - func_8012CC88(a0, 0, (s32)D_800D3918); -} - -extern void func_8012CC88(s32 a, s32 b, s32 c); -extern u8 D_800D3918[]; - -void func_8012CBCC(s32 a0) { - func_8012CC88(a0, 1, (s32)D_800D3918); -} - -DEFINE_func_8012CBF4() /* dedup: shared engine-core @0x8012CBF4 (src/shared) */ - -DEFINE_func_8012CC1C() /* dedup: shared engine-core @0x8012CC1C (src/shared) */ - -DEFINE_func_8012CC40() /* dedup: shared engine-core @0x8012CC40 (src/shared) */ - -DEFINE_func_8012CC64() /* dedup: shared engine-core @0x8012CC64 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012CC88); - -DEFINE_func_8012CE2C() /* dedup: shared engine-core @0x8012CE2C (src/shared) */ - -DEFINE_func_8012CEB0() /* dedup: shared engine-core @0x8012CEB0 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012CFA8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012D098); - -DEFINE_func_8012D38C() /* dedup: shared engine-core @0x8012D38C (src/shared) */ - -DEFINE_func_8012D3AC() /* dedup: shared engine-core @0x8012D3AC (src/shared) */ - -DEFINE_func_8012D3B4() /* dedup: shared engine-core @0x8012D3B4 (src/shared) */ - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012D4B4); - -DEFINE_func_8012D5DC() /* dedup: shared engine-core @0x8012D5DC (src/shared) */ - -DEFINE_func_8012D5E4() /* dedup: shared engine-core @0x8012D5E4 (src/shared) */ - -DEFINE_func_8012D624() /* dedup: shared engine-core @0x8012D624 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012D664); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012D714); - -extern void func_8012F568(s32 a0, s32 a1, s32 a2, s32 a3, s32 a4, s32 a5); -extern void func_8014C978(void); -extern M2C_UNK D_80186E60; -extern M2C_UNK D_80186E68; - -s32 func_8012DB84(void) -{ - func_8014C978(); - func_8012F568(1, 0xC001, 0, 0x3E8, &D_80186E60, &D_80186E68); -} - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012DBD0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012DDA4); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012DE2C); - -DEFINE_func_8012DEB8() /* dedup: shared engine-core @0x8012DEB8 (src/shared) */ - -DEFINE_func_8012DF34() /* dedup: shared engine-core @0x8012DF34 (src/shared) */ - -DEFINE_func_8012DFBC() /* dedup: shared engine-core @0x8012DFBC (src/shared) */ - -DEFINE_func_8012DFCC() /* dedup: shared engine-core @0x8012DFCC (src/shared) */ - -DEFINE_func_8012DFD4() /* dedup: shared engine-core @0x8012DFD4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E014); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E138); - -s32 func_8012E27C(void) { - return 1; -} - -DEFINE_func_8012E284() /* dedup: shared engine-core @0x8012E284 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E28C); - -DEFINE_func_8012E32C() /* dedup: shared engine-core @0x8012E32C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E364); - -DEFINE_func_8012E470() /* dedup: shared engine-core @0x8012E470 (src/shared) */ - -DEFINE_func_8012E4C8() /* dedup: shared engine-core @0x8012E4C8 (src/shared) */ - -DEFINE_func_8012E504() /* dedup: shared engine-core @0x8012E504 (src/shared) */ - -DEFINE_func_8012E544() /* dedup: shared engine-core @0x8012E544 (src/shared) */ - -DEFINE_func_8012E57C() /* dedup: shared engine-core @0x8012E57C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E5CC); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E688); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E778); - -DEFINE_func_8012E88C() /* dedup: shared engine-core @0x8012E88C (src/shared) */ - -DEFINE_func_8012E8A8() /* dedup: shared engine-core @0x8012E8A8 (src/shared) */ - -DEFINE_func_8012E8C4() /* dedup: shared engine-core @0x8012E8C4 (src/shared) */ - -DEFINE_func_8012E8E0() /* dedup: shared engine-core @0x8012E8E0 (src/shared) */ - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012E9C0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012EA90); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012EC04); - -DEFINE_func_8012EECC() /* dedup: shared engine-core @0x8012EECC (src/shared) */ - -DEFINE_func_8012EF34() /* dedup: shared engine-core @0x8012EF34 (src/shared) */ - -DEFINE_func_8012EF70() /* dedup: shared engine-core @0x8012EF70 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012EFB8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F038); - -DEFINE_func_8012F0BC() /* dedup: shared engine-core @0x8012F0BC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F14C); - -DEFINE_func_8012F1A4() /* dedup: shared engine-core @0x8012F1A4 (src/shared) */ - -DEFINE_func_8012F214() /* dedup: shared engine-core @0x8012F214 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F274); - -DEFINE_func_8012F2E8() /* dedup: shared engine-core @0x8012F2E8 (src/shared) */ - -DEFINE_func_8012F374() /* dedup: shared engine-core @0x8012F374 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F40C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F49C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F568); - -DEFINE_func_8012F5F4() /* dedup: shared engine-core @0x8012F5F4 (src/shared) */ - - - -struct S80131E00; -DEFINE_func_8012F68C() /* dedup: shared engine-core @0x8012F68C (src/shared) */ - - -extern void func_80131B14(void); -extern void func_80131CA8(int a0, int a1); - -void func_8012F75C(s32 a0) { - *(u8 *)(a0 + 0xC1) = 3; - if (*(s32 *)(a0 + 0xB4) & 0x4) { - func_80131B14(); - *(s32 *)(a0 + 0x1C) = 0x10; - *(s16 *)(a0 + 0x98) = 0; - } - func_80131CA8(a0, 6); -} - -DEFINE_func_8012F7B4() /* dedup: shared engine-core @0x8012F7B4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F828); - -DEFINE_func_8012F87C() /* dedup: shared engine-core @0x8012F87C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F8C8); - -DEFINE_func_8012F91C() /* dedup: shared engine-core @0x8012F91C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012F968); - -DEFINE_func_8012FB54() /* dedup: shared engine-core @0x8012FB54 (src/shared) */ - -DEFINE_func_8012FC30() /* dedup: shared engine-core @0x8012FC30 (src/shared) */ - -DEFINE_func_8012FCA4() /* dedup: shared engine-core @0x8012FCA4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012FCC4); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8012FDA8); - -struct S80131E00; -DEFINE_func_8012FE70() /* dedup: shared engine-core @0x8012FE70 (src/shared) */ - -DEFINE_func_8012FF00() /* dedup: shared engine-core @0x8012FF00 (src/shared) */ - -DEFINE_func_8012FF4C() /* dedup: shared engine-core @0x8012FF4C (src/shared) */ - -DEFINE_func_8012FF98() /* dedup: shared engine-core @0x8012FF98 (src/shared) */ - -DEFINE_func_8013001C() /* dedup: shared engine-core @0x8013001C (src/shared) */ - -DEFINE_func_80130088() /* dedup: shared engine-core @0x80130088 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801300F4); - -DEFINE_func_801301E8() /* dedup: shared engine-core @0x801301E8 (src/shared) */ - - - -struct S80131E00; - -DEFINE_func_80130278() /* dedup: shared engine-core @0x80130278 (src/shared) */ - - -DEFINE_func_80130314() /* dedup: shared engine-core @0x80130314 (src/shared) */ - -DEFINE_func_80130360() /* dedup: shared engine-core @0x80130360 (src/shared) */ - -DEFINE_func_801303A0() /* dedup: shared engine-core @0x801303A0 (src/shared) */ - - -DEFINE_func_801303EC() /* dedup: shared engine-core @0x801303EC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130438); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130514); - -DEFINE_func_801305CC() /* dedup: shared engine-core @0x801305CC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130650); - -DEFINE_func_80130740() /* dedup: shared engine-core @0x80130740 (src/shared) */ - -DEFINE_func_801307B0() /* dedup: shared engine-core @0x801307B0 (src/shared) */ - -DEFINE_func_80130858() /* dedup: shared engine-core @0x80130858 (src/shared) */ - -DEFINE_func_80130898() /* dedup: shared engine-core @0x80130898 (src/shared) */ - -DEFINE_func_801308DC() /* dedup: shared engine-core @0x801308DC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130974); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130A18); - -DEFINE_func_80130AC4() /* dedup: shared engine-core @0x80130AC4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130AF0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130C08); - -extern void (*D_80186EAC[])(void); - -void func_80130D0C(void *a0) { - D_80186EAC[*(u8 *)((s32)a0 + 0xC1)](); -} - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80130D48); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131170); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801312D0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131340); - - -/* Canonical sigs (consistent with src/ov_SC01_077/ov_SC01_077.c + engine_core.h): - * - func_80131CA8: canonical 'extern void func_80131CA8(int, int)' (overlay .c L742, - * engine_core.h). Its $v0 return IS used here (asm: jal ...; bnez $v0), so cast at the - * call site to read it -- the codebase's own idiom (engine_core.h L17026: - * ((s32 (*)(int, int))func_80131CA8)(arg0, 0x2C)). Byte-neutral, no sig conflict. - * - func_8012C218: canonical 'void func_8012C218(void *a0)' (DEFINE_func_8012C218). - * - func_8002A04C: main-EXE callee (src/800.c), undeclared in this TU -> declare locally, - * arity 1 (asm: jal func_8002A04C; delay-slot a0=s0). No conflict. - */ -DEFINE_func_801319E0() /* dedup: shared engine-core @0x801319E0 (src/shared) */ - - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131A34); - -DEFINE_func_80131AC8() /* dedup: shared engine-core @0x80131AC8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131B14); - -DEFINE_func_80131C78() /* dedup: shared engine-core @0x80131C78 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131CA8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131CF4); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80131D68); - -extern void (*D_80186FEC[])(struct S80131E00 *a0); - -void func_80131E00(struct S80131E00 *a0, s32 a1) { - a0->field_B0 = a1; - D_80186FEC[a1](a0); -} - -DEFINE_func_80131E38() /* dedup: shared engine-core @0x80131E38 (src/shared) */ - -struct S80131E00; -DEFINE_func_80131E7C() /* dedup: shared engine-core @0x80131E7C (src/shared) */ - -DEFINE_func_80131EE4() /* dedup: shared engine-core @0x80131EE4 (src/shared) */ - -extern void (*D_80187044[])(void); - -void func_80131EEC(void *a0) { - D_80187044[*(u16 *)((s32)a0 + 0x2)](); -} - -extern void (*D_8018708C[])(void); - -void func_80131F28(void *a0) { - D_8018708C[*(u16 *)((s32)a0 + 0x2)](); -} - -extern void (*D_80187094[])(void); - -void func_80131F64(s32 *a0) { - D_80187094[*(u16 *)((s32)a0 + 2)](); -} - -extern s32 (*D_8018709C[])(); - -s32 func_80131FA0(s16 *a0) { - return D_8018709C[(u16)a0[1]](); -} - -extern s32 (*D_801870A4[])(); - -s32 func_80131FDC(s16 *a0) { - return D_801870A4[(u16)a0[1]](); -} - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80132018); - -DEFINE_func_801320D0() /* dedup: shared engine-core @0x801320D0 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801320D8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80132144); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801321B0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013221C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80132288); - -DEFINE_func_8013240C() /* dedup: shared engine-core @0x8013240C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801325B8); - -DEFINE_func_8013277C() /* dedup: shared engine-core @0x8013277C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80132784); - -DEFINE_func_80132DC4() /* dedup: shared engine-core @0x80132DC4 (src/shared) */ - -extern void Square0(s32 *a0, s32 *a1); -extern s16 D_80126CAC; -extern s16 D_80126CB0; - -s32 func_80132E6C(s16 *a0) { - s32 in[3]; - s32 out[3]; - in[0] = a0[3] - D_80126CAC; - in[1] = 0; - in[2] = a0[7] - D_80126CB0; - Square0(in, out); - return out[0] + out[2]; -} - -DEFINE_func_80132EC4() /* dedup: shared engine-core @0x80132EC4 (src/shared) */ - -DEFINE_func_80132EF4() /* dedup: shared engine-core @0x80132EF4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80132F40); - -DEFINE_func_80133060() /* dedup: shared engine-core @0x80133060 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801330E0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80133298); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013339C); - -DEFINE_func_8013361C() /* dedup: shared engine-core @0x8013361C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801336E8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013373C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80133784); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80133AB0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80133CD4); - -typedef struct { s16 x, y, z; } Vec3s; - -s32 func_80134310(Vec3s *a0, Vec3s *a1, s32 a2) { - return a0->x * a1->x + a0->y * a1->y + a0->z * a1->z + a2; -} - -DEFINE_func_8013435C() /* dedup: shared engine-core @0x8013435C (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801343C4); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80134510); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801345F8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801347A0); - -DEFINE_func_80134A28() /* dedup: shared engine-core @0x80134A28 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80134A74); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80134C20); - -DEFINE_func_80134FB8() /* dedup: shared engine-core @0x80134FB8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135004); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135168); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135260); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135480); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135888); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135A4C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135D20); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80135EB0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136334); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801365B8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136824); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136A94); - -DEFINE_func_80136BC4() /* dedup: shared engine-core @0x80136BC4 (src/shared) */ - -DEFINE_func_80136C1C() /* dedup: shared engine-core @0x80136C1C (src/shared) */ - -DEFINE_func_80136C3C() /* dedup: shared engine-core @0x80136C3C (src/shared) */ - -DEFINE_func_80136C44() /* dedup: shared engine-core @0x80136C44 (src/shared) */ - -DEFINE_func_80136C4C() /* dedup: shared engine-core @0x80136C4C (src/shared) */ - -extern unsigned short D_800B99F0; -extern void (*D_801870C8[])(void); - -void func_80136C54(void) -{ - D_801870C8[D_800B99F0](); -} - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136C90); - -DEFINE_func_80136D00() /* dedup: shared engine-core @0x80136D00 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136D08); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136DFC); - -DEFINE_func_80136EC4() /* dedup: shared engine-core @0x80136EC4 (src/shared) */ - -DEFINE_func_80136ECC() /* dedup: shared engine-core @0x80136ECC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80136F3C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80137030); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80137178); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801372B0); - -DEFINE_func_801375EC() /* dedup: shared engine-core @0x801375EC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80137614); - -DEFINE_func_8013767C() /* dedup: shared engine-core @0x8013767C (src/shared) */ - -DEFINE_func_801376C8() /* dedup: shared engine-core @0x801376C8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801376E8); - -DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ - -DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801378F0); - -DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ - -DEFINE_func_801379EC() /* dedup: shared engine-core @0x801379EC (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801379FC); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80137B80); - -DEFINE_func_80137BD8() /* dedup: shared engine-core @0x80137BD8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80137D08); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80137DD4); - -DEFINE_func_80137FD8() /* dedup: shared engine-core @0x80137FD8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801380E0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801387B8); - -/* func_80138948: sh 7 @0x4; sb 0 @0x1F; sb 0 @0xD (store order = source order). */ -DEFINE_func_80138948() /* dedup: shared engine-core @0x80138948 (src/shared) */ - -DEFINE_func_8013895C() /* dedup: shared engine-core @0x8013895C (src/shared) */ - -DEFINE_func_80138AB4() /* dedup: shared engine-core @0x80138AB4 (src/shared) */ - -DEFINE_func_80138B88() /* dedup: shared engine-core @0x80138B88 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80138BE0); - -DEFINE_func_80138C30() /* dedup: shared engine-core @0x80138C30 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80138C60); - -DEFINE_func_80138D58() /* dedup: shared engine-core @0x80138D58 (src/shared) */ - -DEFINE_func_80138DB8() /* dedup: shared engine-core @0x80138DB8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80138DE0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80138ED0); - -DEFINE_func_8013914C() /* dedup: shared engine-core @0x8013914C (src/shared) */ - -DEFINE_func_801391F0() /* dedup: shared engine-core @0x801391F0 (src/shared) */ - -DEFINE_func_80139220() /* dedup: shared engine-core @0x80139220 (src/shared) */ - -DEFINE_func_801392C8() /* dedup: shared engine-core @0x801392C8 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801392FC); - -extern void func_80059888(void *a0, s32 a1, s32 a2, s32 a3); - -typedef struct { - s16 f0; - s16 f2; - s16 f4; - s16 f6; -} Stk801395D4; - -void func_801395D4(void * a0) -{ - Stk801395D4 sp10; - u16 mul; - u16 base; - sp10.f0 = *(u16 *)(a0 + 0x38); - mul = *(u16 *)(a0 + 0x12); - base = *(u16 *)(a0 + 0x3A); - sp10.f4 = 0x38; - sp10.f6 = 0xC; - sp10.f2 = base + mul * 12; - func_80059888(&sp10, 0, 0, 0); -} - -DEFINE_func_80139634() /* dedup: shared engine-core @0x80139634 (src/shared) */ - - -DEFINE_func_80139680() /* dedup: shared engine-core @0x80139680 (src/shared) */ - - -DEFINE_func_80139788() /* dedup: shared engine-core @0x80139788 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_801397B0); - -DEFINE_func_80139914() /* dedup: shared engine-core @0x80139914 (src/shared) */ - - -DEFINE_func_80139954() /* dedup: shared engine-core @0x80139954 (src/shared) */ - -DEFINE_func_801399A8() /* dedup: shared engine-core @0x801399A8 (src/shared) */ - - -DEFINE_func_801399F0() /* dedup: shared engine-core @0x801399F0 (src/shared) */ - -DEFINE_func_80139A34() /* dedup: shared engine-core @0x80139A34 (src/shared) */ - -DEFINE_func_80139A44() /* dedup: shared engine-core @0x80139A44 (src/shared) */ - -DEFINE_func_80139A68() /* dedup: shared engine-core @0x80139A68 (src/shared) */ - -DEFINE_func_80139A8C() /* dedup: shared engine-core @0x80139A8C (src/shared) */ - -DEFINE_func_80139B18() /* dedup: shared engine-core @0x80139B18 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_80139BE0); - -DEFINE_func_80139C7C() /* dedup: shared engine-core @0x80139C7C (src/shared) */ - - -DEFINE_func_80139D04() /* dedup: shared engine-core @0x80139D04 (src/shared) */ - - -DEFINE_func_80139DC8() /* dedup: shared engine-core @0x80139DC8 (src/shared) */ - -DEFINE_func_80139DEC() /* dedup: shared engine-core @0x80139DEC (src/shared) */ - -DEFINE_func_80139DF4() /* dedup: shared engine-core @0x80139DF4 (src/shared) */ - -DEFINE_func_80139E84() /* dedup: shared engine-core @0x80139E84 (src/shared) */ - -DEFINE_func_80139F0C() /* dedup: shared engine-core @0x80139F0C (src/shared) */ - -DEFINE_func_80139FBC() /* dedup: shared engine-core @0x80139FBC (src/shared) */ - -DEFINE_func_80139FE8() /* dedup: shared engine-core @0x80139FE8 (src/shared) */ - -DEFINE_func_8013A0A4() /* dedup: shared engine-core @0x8013A0A4 (src/shared) */ - -DEFINE_func_8013A164() /* dedup: shared engine-core @0x8013A164 (src/shared) */ - -DEFINE_func_8013A1E8() /* dedup: shared engine-core @0x8013A1E8 (src/shared) */ - -DEFINE_func_8013A250() /* dedup: shared engine-core @0x8013A250 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013A2BC); - -DEFINE_func_8013A378() /* dedup: shared engine-core @0x8013A378 (src/shared) */ - - -struct S8013A4C4; - -DEFINE_func_8013A380() /* dedup: shared engine-core @0x8013A380 (src/shared) */ - - -DEFINE_func_8013A448() /* dedup: shared engine-core @0x8013A448 (src/shared) */ - -DEFINE_func_8013A4C4() /* dedup: shared engine-core @0x8013A4C4 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013A530); - -DEFINE_func_8013A860() /* dedup: shared engine-core @0x8013A860 (src/shared) */ - -DEFINE_func_8013A8B0() /* dedup: shared engine-core @0x8013A8B0 (src/shared) */ - -DEFINE_func_8013A8BC() /* dedup: shared engine-core @0x8013A8BC (src/shared) */ - - -DEFINE_func_8013A8FC() /* dedup: shared engine-core @0x8013A8FC (src/shared) */ - - -DEFINE_func_8013A9B4() /* dedup: shared engine-core @0x8013A9B4 (src/shared) */ - -DEFINE_func_8013A9F8() /* dedup: shared engine-core @0x8013A9F8 (src/shared) */ - -DEFINE_func_8013AA24() /* dedup: shared engine-core @0x8013AA24 (src/shared) */ - -DEFINE_func_8013AB54() /* dedup: shared engine-core @0x8013AB54 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013AD38); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013AF20); - -DEFINE_func_8013B204() /* dedup: shared engine-core @0x8013B204 (src/shared) */ - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B274); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B568); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B598); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B6A0); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B7AC); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B7F4); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013B83C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013BC7C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013BCDC); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013BD34); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013BD74); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013C08C); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013C0F8); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013C360); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013C414); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013C938); - -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077", func_8013C964); - extern void func_80016714(void *a0, s32 a1); extern s32 D_801D9568; extern s32 D_801269D4; diff --git a/src/ov_SC01_077/ov_SC01_077_a.c b/src/ov_SC01_077/ov_SC01_077_a.c new file mode 100644 index 000000000..72cf7cf3c --- /dev/null +++ b/src/ov_SC01_077/ov_SC01_077_a.c @@ -0,0 +1,1331 @@ +#include "common.h" +#include "../shared/engine_core.h" + +/* ==== Phase-17 canonical-sig layer (tools/derive_canonical_sigs.py) =================== + * ONE byte-neutral canonical signature per undeclared-stub conflict callee, so the parallel + * hand-matching wave declares each shared callee consistently and the one-big-TU build stops + * failing on `conflicting types` (hand-matching-process.md §7c). Form: s32 return (void->s32 + * byte-neutral, §3a-1) + s32 params (matched bodies cast int->ptr), arity from Ghidra-C + asm + * read-before-write $a0-$a3 (agree on all 14 cached; 6 stubs call-site-validated). LOCAL to + * this TU on purpose (reach-1 names like func_801809BC differ across overlays, so NOT in the + * shared engine_core.h). Whole-binary harvest_verify byte-gate remains the sole arbiter (G3/P9). */ +extern s32 func_8016EC0C(s32 a0, s32 a1); /* match-first, arity 2 */ +extern s32 func_8012B4B8(s32 a0); /* match-first, arity 1 */ +extern s32 func_801670E4(s32 a0, s32 a1, s32 a2, s32 a3); /* derive-decl, arity 4 */ +extern s32 func_80169A4C(s32 a0, s32 a1); /* match-first, arity 2 */ +extern s32 func_8016A8FC(s32 a0); /* match-first, arity 1 */ +extern s32 func_8012B8E4(s32 a0, s32 a1); /* match-first, arity 2 */ +extern s32 func_8015E1B8(s32 a0); /* match-first, arity 1 */ +extern s32 func_8015EE08(s32 a0); /* match-first, arity 1 */ +extern s32 func_8015F7D4(s32 a0); /* match-first, arity 1 */ +extern s32 func_80160B34(s32 a0); /* match-first, arity 1 */ +extern s32 func_80165140(s32 a0); /* match-first, arity 1 */ +extern s32 func_80161CD0(s32 a0, s32 a1); /* match-first, arity 2 */ +extern s32 func_80175268(s32 a0); /* match-first, arity 1 */ +extern s32 func_8017EC7C(s32 a0); /* match-first, arity 1 */ +extern s32 func_801809BC(s32 a0, s32 a1); /* match-first, arity 2 */ +extern s32 func_8012DE2C(s32 a0); /* derive-decl, arity 1 */ +extern s32 func_8012DDA4(void); /* derive-decl, arity 0 */ +extern s32 func_801759D8(void); /* derive-decl, arity 0 */ +extern s32 func_80175820(void); /* derive-decl, arity 0 */ +extern s32 func_801758FC(void); /* derive-decl, arity 0 */ +/* ==== end canonical-sig layer ==================================================== */ + +DEFINE_func_80128158() /* dedup: shared engine-core @0x80128158 (src/shared) */ + +DEFINE_func_80128178() /* dedup: shared engine-core @0x80128178 (src/shared) */ + +DEFINE_func_80128198() /* dedup: shared engine-core @0x80128198 (src/shared) */ + +DEFINE_func_801281B8() /* dedup: shared engine-core @0x801281B8 (src/shared) */ + +DEFINE_func_801281D8() /* dedup: shared engine-core @0x801281D8 (src/shared) */ + +DEFINE_func_801281F8() /* dedup: shared engine-core @0x801281F8 (src/shared) */ + +extern s32 D_801D7F90; + +s32 func_80128218(void) { + return D_801D7F90; +} + +DEFINE_func_80128228() /* dedup: shared engine-core @0x80128228 (src/shared) */ + +DEFINE_func_80128248() /* dedup: shared engine-core @0x80128248 (src/shared) */ + +DEFINE_func_80128268() /* dedup: shared engine-core @0x80128268 (src/shared) */ + +extern u16 D_800B99F6; +extern void (*D_80186DB4[])(void); + +void func_80128288(void) { + u32 v1; + v1 = D_800B99F6; + if (v1 < 9) { + D_80186DB4[v1](); + } +} + +DEFINE_func_801282CC() /* dedup: shared engine-core @0x801282CC (src/shared) */ + +DEFINE_func_801282EC() /* dedup: shared engine-core @0x801282EC (src/shared) */ + +DEFINE_func_8012832C() /* dedup: shared engine-core @0x8012832C (src/shared) */ + + +DEFINE_func_80128420() /* dedup: shared engine-core @0x80128420 (src/shared) */ + +DEFINE_func_801284B8() /* dedup: shared engine-core @0x801284B8 (src/shared) */ + +DEFINE_func_801284F0() /* dedup: shared engine-core @0x801284F0 (src/shared) */ + +DEFINE_func_8012853C() /* dedup: shared engine-core @0x8012853C (src/shared) */ + +DEFINE_func_80128564() /* dedup: shared engine-core @0x80128564 (src/shared) */ + +DEFINE_func_801285D4() /* dedup: shared engine-core @0x801285D4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801285E4); + +/* HANDWRITTEN scratchpad-stack-switch sequencer: stores $sp at the scratchpad slot + * 0x1F8003FC and repoints $sp into the D-cache scratchpad before each engine call, + * restoring it after. Manipulating $sp is not expressible in C; full inline asm + * (manages its own frame). Signature pinned by engine_core.h: void func_80128678(void). */ +DEFINE_func_80128678() /* dedup: shared engine-core @0x80128678 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128714); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801287B8); + +extern void func_8001ABBC(s32 a0, s32 a1, void *a2, s32 a3, s32 sp10); +extern s32 D_801D7F90; +extern u8 D_800AEFD0; + +s32 func_801288B0(void) { + func_8001ABBC(0, 0, &D_800AEFD0, D_801D7F90, 0); +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801288E8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128940); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128998); + +extern s32 D_801D7F90; +extern u8 D_800AECB8; +extern void func_8001ABBC(s32 a0, s32 a1, void *a2, s32 a3, s32 a4); + +s32 func_801289F0(void) { + func_8001ABBC(0, 0, &D_800AECB8, D_801D7F90, 0); +} + +M2C_UNK func_80010DE0(); /* extern */ +extern void func_80011B7C(int); +extern void func_80011C10(void); +extern u16 D_800B99F6; +extern s16 D_800B9A00; +extern M2C_UNK (*D_80186AF0)(); +extern s16 (*D_80186AF4)(); + +void func_80128A28(void) { + s16 temp_v0; + + switch (D_800B99F6) { /* irregular */ + case 1: + D_80186AF0(); + /* fallthrough */ + case 0: + func_80011C10(); + return; + case 2: + temp_v0 = D_80186AF4(); + if (temp_v0 != 0) { + if (temp_v0 < 0) { + func_80011B7C(0); + D_800B9A00 = 1; + return; + } + func_80010DE0(); + } else { + return; + } + break; + } +} + + +M2C_UNK func_80010DE0(); /* extern */ +extern void func_80011B7C(int); +extern void func_80011C10(void); +extern void func_8002AEF8(void); +s32 func_8002AF08(); /* extern */ +extern void func_800CFBBC(void); +s32 func_800CFBE8(); /* extern */ +extern u16 D_800B99F6; +extern M2C_UNK (*D_80186AFC)(); +extern s32 (*D_80186B00)(); +extern s32 D_801D9480; + +void func_80128AF4(void) { + switch (D_800B99F6) { /* irregular */ + case 0: + D_801D9480 = func_8002AF08(); + func_80011C10(); + return; + case 1: + D_80186AFC(); + func_80011C10(); + return; + case 2: + if ((D_80186B00() << 0x10) != 0) { + if (D_801D9480 == 1) { + if (func_800CFBE8() != 0) { + func_800CFBBC(); + func_80011B7C(0x13); + } else { + func_80011B7C(4); + } + } else { + func_80010DE0(); + } + func_8002AEF8(); + } + return; + } +} + + +DEFINE_func_80128C14() /* dedup: shared engine-core @0x80128C14 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128C98); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128CFC); + +DEFINE_func_80128D60() /* dedup: shared engine-core @0x80128D60 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128DB4); + +DEFINE_func_80128EA8() /* dedup: shared engine-core @0x80128EA8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80128ED8); + +M2C_UNK func_8001534C(M2C_UNK, M2C_UNK *, M2C_UNK, M2C_UNK, s32, s32); /* extern */ +M2C_UNK func_800153CC(M2C_UNK, u16, M2C_UNK, M2C_UNK, s32, s32); /* extern */ +extern M2C_UNK D_801D7F94; + +void func_80128FAC(u16 *arg0) { + func_8001534C(4, &D_801D7F94, 0x80, 0x90, 0, 0); + func_800153CC(5, *arg0, 0xA8, 0x90, 0x40, 0); +} + + +DEFINE_func_80129010() /* dedup: shared engine-core @0x80129010 (src/shared) */ + +extern u8 *func_8012913C(s32 a0); + +u8 *func_801290DC(s32 a0, u8 *a1) { + u8 *v1 = func_8012913C(a0 & 0xFFFF); + + if (v1 != 0) { + *(u16 *)(v1 + 0x6) = *(u16 *)(a1 + 0x0); + *(u16 *)(v1 + 0xA) = *(u16 *)(a1 + 0x2); + *(u16 *)(v1 + 0xE) = *(u16 *)(a1 + 0x4); + } + return v1; +} + + +/* Callees — canonical-consistent sigs. + * func_8001D074: canonical `void func_8001D074(s32, s32)`; widened return to s32 + * (byte-neutral, §3a-1) because this fn uses the result. + * func_801291C0: canonical `u8 *func_801291C0(void)` (engine_core.h DEFINE_func_801291C0). + * func_8001CC3C: arity-4 from m2c/asm read-before-write $a0-$a3; void->s32 byte-neutral. + */ +DEFINE_func_8012913C() /* dedup: shared engine-core @0x8012913C (src/shared) */ + + +DEFINE_func_801291C0() /* dedup: shared engine-core @0x801291C0 (src/shared) */ + +extern void func_80129258(void); +extern void func_80129248(s16 a0); + +void func_80129220(void) { + func_80129258(); + func_80129248(1); +} + +DEFINE_func_80129248() /* dedup: shared engine-core @0x80129248 (src/shared) */ + +DEFINE_func_80129258() /* dedup: shared engine-core @0x80129258 (src/shared) */ + +DEFINE_func_8012927C() /* dedup: shared engine-core @0x8012927C (src/shared) */ + +DEFINE_func_801292C8() /* dedup: shared engine-core @0x801292C8 (src/shared) */ + +DEFINE_func_8012931C() /* dedup: shared engine-core @0x8012931C (src/shared) */ + +DEFINE_func_80129350() /* dedup: shared engine-core @0x80129350 (src/shared) */ + +DEFINE_func_80129374() /* dedup: shared engine-core @0x80129374 (src/shared) */ + +DEFINE_func_80129398() /* dedup: shared engine-core @0x80129398 (src/shared) */ + +DEFINE_func_80129428() /* dedup: shared engine-core @0x80129428 (src/shared) */ + +DEFINE_func_8012943C() /* dedup: shared engine-core @0x8012943C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012944C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012956C); + + +DEFINE_func_801298F4() /* dedup: shared engine-core @0x801298F4 (src/shared) */ + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801299C8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80129C40); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80129CF8); + +DEFINE_func_80129FF4() /* dedup: shared engine-core @0x80129FF4 (src/shared) */ + +extern u8 D_80126948[]; +void func_8012A048(void *a0, s32 a1, u8 a2); + +void func_8012A018(s32 a0, s32 a1) +{ + func_8012A048(D_80126948, a0, a1); +} + +DEFINE_func_8012A048() /* dedup: shared engine-core @0x8012A048 (src/shared) */ + +DEFINE_func_8012A094() /* dedup: shared engine-core @0x8012A094 (src/shared) */ + +DEFINE_func_8012A0E0() /* dedup: shared engine-core @0x8012A0E0 (src/shared) */ + +DEFINE_func_8012A100() /* dedup: shared engine-core @0x8012A100 (src/shared) */ + +DEFINE_func_8012A110() /* dedup: shared engine-core @0x8012A110 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012A1BC); + +DEFINE_func_8012A2F4() /* dedup: shared engine-core @0x8012A2F4 (src/shared) */ + +DEFINE_func_8012A304() /* dedup: shared engine-core @0x8012A304 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012A328); + + +struct Q16 { s32 a, b, c, d; }; + +extern s32 D_801151D4; +extern struct BigCopy D_80114EE8; + +void func_8012A418(void) { + struct Q16 *src; + struct Q16 *dst; + struct Q16 *end; + + src = (struct Q16 *)D_801151D4; + dst = &D_80114EE8; + end = src + 10; + do { + *dst = *src; + src++; + dst++; + } while (src != end); + *(s32 *)dst = *(s32 *)src; +} + + +typedef struct { s32 w[8]; } Vec8; + +extern s32 D_801151D4; +extern Vec8 D_80114F24; + +void func_8012A464(void) +{ + D_80114F24 = *(Vec8 *)(*(s32 *)&D_801151D4 + 0x3C); +} + +DEFINE_func_8012A4BC() /* dedup: shared engine-core @0x8012A4BC (src/shared) */ + +DEFINE_func_8012A568() /* dedup: shared engine-core @0x8012A568 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012A598); + +DEFINE_func_8012A5F8() /* dedup: shared engine-core @0x8012A5F8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012A62C); + +DEFINE_func_8012A68C() /* dedup: shared engine-core @0x8012A68C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012A6D0); + +DEFINE_func_8012A758() /* dedup: shared engine-core @0x8012A758 (src/shared) */ + +DEFINE_func_8012A79C() /* dedup: shared engine-core @0x8012A79C (src/shared) */ + +DEFINE_func_8012A7D4() /* dedup: shared engine-core @0x8012A7D4 (src/shared) */ + + +DEFINE_func_8012A828() /* dedup: shared engine-core @0x8012A828 (src/shared) */ + +DEFINE_func_8012A860() /* dedup: shared engine-core @0x8012A860 (src/shared) */ + +DEFINE_func_8012A8B0() /* dedup: shared engine-core @0x8012A8B0 (src/shared) */ + +DEFINE_func_8012A8E8() /* dedup: shared engine-core @0x8012A8E8 (src/shared) */ + +DEFINE_func_8012A908() /* dedup: shared engine-core @0x8012A908 (src/shared) */ + +DEFINE_func_8012A988() /* dedup: shared engine-core @0x8012A988 (src/shared) */ + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012AAAC); + +extern void func_8012AAAC(void); +extern M2C_UNK D_80186E48; + +void func_8012ACA0(void *arg0) { + M2C_FIELD(arg0, M2C_UNK **, 0x90) = &D_80186E48; + M2C_FIELD(arg0, s32 *, 0x94) = 0; + M2C_FIELD(arg0, s32 *, 0x9C) = 0; + M2C_FIELD(arg0, s16 *, 0x9A) = 0; + M2C_FIELD(arg0, u16 *, 0x72) = (u16) (M2C_FIELD(arg0, u16 *, 0x72) & 0xF9FF); + func_8012AAAC(); +} + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012ACE0); + +DEFINE_func_8012AD44() /* dedup: shared engine-core @0x8012AD44 (src/shared) */ + +DEFINE_func_8012AD50() /* dedup: shared engine-core @0x8012AD50 (src/shared) */ + + +void func_8012AD64(s32 *a0, s16 a1) { + *(s16*)((s32)a0 + 0x34) = a1; +} + +DEFINE_func_8012AD6C() /* dedup: shared engine-core @0x8012AD6C (src/shared) */ + +DEFINE_func_8012AD80() /* dedup: shared engine-core @0x8012AD80 (src/shared) */ + +DEFINE_func_8012ADE4() /* dedup: shared engine-core @0x8012ADE4 (src/shared) */ + +DEFINE_func_8012AE00() /* dedup: shared engine-core @0x8012AE00 (src/shared) */ + +extern s32 func_80135888(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_800132BC(s32 a0, s32 a1); + +/* LOAD-BEARING: the 8-byte sp+0x18->sp+0x20 copy is an alignment-2 struct copy + (3 shorts written, then copied) -> gcc emits lwl/lwr/swl/swr. An aligned-2 + base-type typedef did NOT reproduce it; only a short-only struct (align 2) does. */ + +DEFINE_func_8012AF0C() /* dedup: shared engine-core @0x8012AF0C (src/shared) */ + +DEFINE_func_8012B030() /* dedup: shared engine-core @0x8012B030 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012B0B4); + +DEFINE_func_8012B14C() /* dedup: shared engine-core @0x8012B14C (src/shared) */ + +DEFINE_func_8012B178() /* dedup: shared engine-core @0x8012B178 (src/shared) */ + +DEFINE_func_8012B1B4() /* dedup: shared engine-core @0x8012B1B4 (src/shared) */ + +DEFINE_func_8012B200() /* dedup: shared engine-core @0x8012B200 (src/shared) */ + +DEFINE_func_8012B21C() /* dedup: shared engine-core @0x8012B21C (src/shared) */ + +DEFINE_func_8012B23C() /* dedup: shared engine-core @0x8012B23C (src/shared) */ + +DEFINE_func_8012B260() /* dedup: shared engine-core @0x8012B260 (src/shared) */ + +DEFINE_func_8012B2CC() /* dedup: shared engine-core @0x8012B2CC (src/shared) */ + +DEFINE_func_8012B370() /* dedup: shared engine-core @0x8012B370 (src/shared) */ + +DEFINE_func_8012B414() /* dedup: shared engine-core @0x8012B414 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012B4B8); + +DEFINE_func_8012B608() /* dedup: shared engine-core @0x8012B608 (src/shared) */ + +DEFINE_func_8012B6D4() /* dedup: shared engine-core @0x8012B6D4 (src/shared) */ + +DEFINE_func_8012B70C() /* dedup: shared engine-core @0x8012B70C (src/shared) */ + +DEFINE_func_8012B744() /* dedup: shared engine-core @0x8012B744 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012B77C); + +DEFINE_func_8012B864() /* dedup: shared engine-core @0x8012B864 (src/shared) */ + +DEFINE_func_8012B8A4() /* dedup: shared engine-core @0x8012B8A4 (src/shared) */ + +DEFINE_func_8012B8E4() /* dedup: shared engine-core @0x8012B8E4 (src/shared) */ + + + +/* canonical data externs (per pre-resolved sigs); asm loads them lh -> (s16) cast at use */ +extern u16 D_80126B66; +extern u16 D_80126B5E; +/* callee func_8004CFEC, linked as symbol "ratan2" (config/symbols.us.txt: 0x8004CFEC); + * canonical s32(s32,s32) -- matches the banked sibling func_8012B8E4 in engine_core.h */ +extern s32 ratan2(s32 a0, s32 a1); + +s32 func_8012BA10(s32 arg0, s32 arg1) { + register s32 d __asm__("$16"); /* $s0 -- pinned: divisor, live across the jal */ + register s32 s1ang __asm__("$17"); /* $s1 -- pinned: ptr+0x12 angle, live across the jal */ + s32 u5; s32 u6; s32 iVar4; s32 q; s32 t; + d = arg1; + s1ang = *(s16 *)(*(s32 *)(arg0 + 0x20) + 0x12); + u5 = (ratan2(*(s16 *)(arg0 + 0xE) - (s16)D_80126B66, (s16)D_80126B5E - *(s16 *)(arg0 + 6)) - 0x400) & 0xFFF; + __asm__ __volatile__("" : : "r"(u5)); /* scheduling barrier: anchor u5 before the (s16)d cast */ + d = (s16)d; + u6 = s1ang & 0xFFF; + if (u6 == u5) return 0; + iVar4 = u5 - u6; + if (iVar4 > 0x800) { t = u6 + 0x1000; iVar4 = u5 - t; } + if (iVar4 < -0x800) { t = u6 - 0x1000; iVar4 = u5 - t; } + if (iVar4 >= 0) { q = iVar4 / d; if (q == 0) q = 1; } + else { q = iVar4 / d; if (q == 0) q = -1; } + return q; +} + + + +DEFINE_func_8012BB3C() /* dedup: shared engine-core @0x8012BB3C (src/shared) */ + + +DEFINE_func_8012BC60() /* dedup: shared engine-core @0x8012BC60 (src/shared) */ + +DEFINE_func_8012BCCC() /* dedup: shared engine-core @0x8012BCCC (src/shared) */ + +DEFINE_func_8012BD14() /* dedup: shared engine-core @0x8012BD14 (src/shared) */ + +DEFINE_func_8012BD3C() /* dedup: shared engine-core @0x8012BD3C (src/shared) */ + +DEFINE_func_8012BDBC() /* dedup: shared engine-core @0x8012BDBC (src/shared) */ + +DEFINE_func_8012BE54() /* dedup: shared engine-core @0x8012BE54 (src/shared) */ + +DEFINE_func_8012BE98() /* dedup: shared engine-core @0x8012BE98 (src/shared) */ + + +DEFINE_func_8012BEE8() /* dedup: shared engine-core @0x8012BEE8 (src/shared) */ + +DEFINE_func_8012BF10() /* dedup: shared engine-core @0x8012BF10 (src/shared) */ + +void func_8012BF4C(s32 *a0, s32 a1) { + *(s32*)((s32)a0 + 0x1C) = a1; +} + +DEFINE_func_8012BF54() /* dedup: shared engine-core @0x8012BF54 (src/shared) */ + +/* func_8012BF68: lhu 0x5C; andi 0x7FFF; sh 0x5C; jr (sh in delay slot) + * void form: no return value => no extra andi v0,0xffff truncation past the mask. */ +DEFINE_func_8012BF68() /* dedup: shared engine-core @0x8012BF68 (src/shared) */ + +DEFINE_func_8012BF7C() /* dedup: shared engine-core @0x8012BF7C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012BFA8); + +DEFINE_func_8012C044() /* dedup: shared engine-core @0x8012C044 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012C098); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012C0EC); + +DEFINE_func_8012C194() /* dedup: shared engine-core @0x8012C194 (src/shared) */ + +DEFINE_func_8012C1B8() /* dedup: shared engine-core @0x8012C1B8 (src/shared) */ + +DEFINE_func_8012C1DC() /* dedup: shared engine-core @0x8012C1DC (src/shared) */ + +DEFINE_func_8012C218() /* dedup: shared engine-core @0x8012C218 (src/shared) */ + +DEFINE_func_8012C284() /* dedup: shared engine-core @0x8012C284 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012C2D0); + +DEFINE_func_8012C31C() /* dedup: shared engine-core @0x8012C31C (src/shared) */ + +DEFINE_func_8012C354() /* dedup: shared engine-core @0x8012C354 (src/shared) */ + +DEFINE_func_8012C438() /* dedup: shared engine-core @0x8012C438 (src/shared) */ + +DEFINE_func_8012C51C() /* dedup: shared engine-core @0x8012C51C (src/shared) */ + + +DEFINE_func_8012C588() /* dedup: shared engine-core @0x8012C588 (src/shared) */ + + + +extern u8 D_80126720[]; +extern s32 func_8012C890(s32 a0, s32 a1, s32 a2); + +struct S8012C658 { + u16 unk0; + u16 unk2; + u16 unk4; + s16 unk6; + s16 unk8; + s16 unkA; + s16 unkC; + s16 unkE; + s32 unk10; +}; + +s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2) { + struct S8012C658 sp; + s32 var_v0; + u16 *var_a1; + u16 *end; + u16 *param; + + if ((arg2 != 0) && (*(u16 *)(arg2 + 0x0) != 0)) { + sp.unk0 = *(u16 *)(arg2 + 0x6); + sp.unk2 = *(u16 *)(arg2 + 0xA); + sp.unk4 = *(u16 *)(arg2 + 0xE); + } else { + sp.unk4 = 0; + sp.unk2 = 0; + sp.unk0 = 0; + } + sp.unk6 = (s16)arg0; + sp.unk8 = (s16)arg1; + sp.unkA = 0; + sp.unk10 = 0; + sp.unkE = 0; + sp.unkC = 0x7FFF; + param = &sp.unk0; + end = (u16 *)D_80126720; + if (arg2 == 0) { + var_a1 = (u16 *)((u8 *)end - 0x6480); + } else { + var_a1 = (u16 *)(arg2 + 0x10C); + } + while (var_a1 != end) { + if (*var_a1 == 0) { + goto found; + } + var_a1 = (u16 *)((u8 *)var_a1 + 0x10C); + } + var_a1 = 0; +found: + var_v0 = 0; + if (var_a1 != 0) { + var_v0 = ((s32 (*)(u16 *, u16 *))func_8012C890)(param, var_a1); + } + return var_v0; +} + + +DEFINE_func_8012C724() /* dedup: shared engine-core @0x8012C724 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012C750); + +DEFINE_func_8012C820() /* dedup: shared engine-core @0x8012C820 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012C890); + +DEFINE_func_8012CAE4() /* dedup: shared engine-core @0x8012CAE4 (src/shared) */ + + +DEFINE_func_8012CB64() /* dedup: shared engine-core @0x8012CB64 (src/shared) */ + + +extern void func_8012CC88(s32 a, s32 b, s32 c); +extern u8 D_800D3918[]; + +void func_8012CBA4(s32 a0) { + func_8012CC88(a0, 0, (s32)D_800D3918); +} + +extern void func_8012CC88(s32 a, s32 b, s32 c); +extern u8 D_800D3918[]; + +void func_8012CBCC(s32 a0) { + func_8012CC88(a0, 1, (s32)D_800D3918); +} + +DEFINE_func_8012CBF4() /* dedup: shared engine-core @0x8012CBF4 (src/shared) */ + +DEFINE_func_8012CC1C() /* dedup: shared engine-core @0x8012CC1C (src/shared) */ + +DEFINE_func_8012CC40() /* dedup: shared engine-core @0x8012CC40 (src/shared) */ + +DEFINE_func_8012CC64() /* dedup: shared engine-core @0x8012CC64 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012CC88); + +DEFINE_func_8012CE2C() /* dedup: shared engine-core @0x8012CE2C (src/shared) */ + +DEFINE_func_8012CEB0() /* dedup: shared engine-core @0x8012CEB0 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012CFA8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012D098); + +DEFINE_func_8012D38C() /* dedup: shared engine-core @0x8012D38C (src/shared) */ + +DEFINE_func_8012D3AC() /* dedup: shared engine-core @0x8012D3AC (src/shared) */ + +DEFINE_func_8012D3B4() /* dedup: shared engine-core @0x8012D3B4 (src/shared) */ + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012D4B4); + +DEFINE_func_8012D5DC() /* dedup: shared engine-core @0x8012D5DC (src/shared) */ + +DEFINE_func_8012D5E4() /* dedup: shared engine-core @0x8012D5E4 (src/shared) */ + +DEFINE_func_8012D624() /* dedup: shared engine-core @0x8012D624 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012D664); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012D714); + +extern void func_8012F568(s32 a0, s32 a1, s32 a2, s32 a3, s32 a4, s32 a5); +extern void func_8014C978(void); +extern M2C_UNK D_80186E60; +extern M2C_UNK D_80186E68; + +s32 func_8012DB84(void) +{ + func_8014C978(); + func_8012F568(1, 0xC001, 0, 0x3E8, &D_80186E60, &D_80186E68); +} + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012DBD0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012DDA4); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012DE2C); + +DEFINE_func_8012DEB8() /* dedup: shared engine-core @0x8012DEB8 (src/shared) */ + +DEFINE_func_8012DF34() /* dedup: shared engine-core @0x8012DF34 (src/shared) */ + +DEFINE_func_8012DFBC() /* dedup: shared engine-core @0x8012DFBC (src/shared) */ + +DEFINE_func_8012DFCC() /* dedup: shared engine-core @0x8012DFCC (src/shared) */ + +DEFINE_func_8012DFD4() /* dedup: shared engine-core @0x8012DFD4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E014); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E138); + +s32 func_8012E27C(void) { + return 1; +} + +DEFINE_func_8012E284() /* dedup: shared engine-core @0x8012E284 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E28C); + +DEFINE_func_8012E32C() /* dedup: shared engine-core @0x8012E32C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E364); + +DEFINE_func_8012E470() /* dedup: shared engine-core @0x8012E470 (src/shared) */ + +DEFINE_func_8012E4C8() /* dedup: shared engine-core @0x8012E4C8 (src/shared) */ + +DEFINE_func_8012E504() /* dedup: shared engine-core @0x8012E504 (src/shared) */ + +DEFINE_func_8012E544() /* dedup: shared engine-core @0x8012E544 (src/shared) */ + +DEFINE_func_8012E57C() /* dedup: shared engine-core @0x8012E57C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E5CC); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E688); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E778); + +DEFINE_func_8012E88C() /* dedup: shared engine-core @0x8012E88C (src/shared) */ + +DEFINE_func_8012E8A8() /* dedup: shared engine-core @0x8012E8A8 (src/shared) */ + +DEFINE_func_8012E8C4() /* dedup: shared engine-core @0x8012E8C4 (src/shared) */ + +DEFINE_func_8012E8E0() /* dedup: shared engine-core @0x8012E8E0 (src/shared) */ + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012E9C0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012EA90); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012EC04); + +DEFINE_func_8012EECC() /* dedup: shared engine-core @0x8012EECC (src/shared) */ + +DEFINE_func_8012EF34() /* dedup: shared engine-core @0x8012EF34 (src/shared) */ + +DEFINE_func_8012EF70() /* dedup: shared engine-core @0x8012EF70 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012EFB8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F038); + +DEFINE_func_8012F0BC() /* dedup: shared engine-core @0x8012F0BC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F14C); + +DEFINE_func_8012F1A4() /* dedup: shared engine-core @0x8012F1A4 (src/shared) */ + +DEFINE_func_8012F214() /* dedup: shared engine-core @0x8012F214 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F274); + +DEFINE_func_8012F2E8() /* dedup: shared engine-core @0x8012F2E8 (src/shared) */ + +DEFINE_func_8012F374() /* dedup: shared engine-core @0x8012F374 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F40C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F49C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F568); + +DEFINE_func_8012F5F4() /* dedup: shared engine-core @0x8012F5F4 (src/shared) */ + + + +struct S80131E00; +DEFINE_func_8012F68C() /* dedup: shared engine-core @0x8012F68C (src/shared) */ + + +extern void func_80131B14(void); +extern void func_80131CA8(int a0, int a1); + +void func_8012F75C(s32 a0) { + *(u8 *)(a0 + 0xC1) = 3; + if (*(s32 *)(a0 + 0xB4) & 0x4) { + func_80131B14(); + *(s32 *)(a0 + 0x1C) = 0x10; + *(s16 *)(a0 + 0x98) = 0; + } + func_80131CA8(a0, 6); +} + +DEFINE_func_8012F7B4() /* dedup: shared engine-core @0x8012F7B4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F828); + +DEFINE_func_8012F87C() /* dedup: shared engine-core @0x8012F87C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F8C8); + +DEFINE_func_8012F91C() /* dedup: shared engine-core @0x8012F91C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012F968); + +DEFINE_func_8012FB54() /* dedup: shared engine-core @0x8012FB54 (src/shared) */ + +DEFINE_func_8012FC30() /* dedup: shared engine-core @0x8012FC30 (src/shared) */ + +DEFINE_func_8012FCA4() /* dedup: shared engine-core @0x8012FCA4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012FCC4); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8012FDA8); + +struct S80131E00; +DEFINE_func_8012FE70() /* dedup: shared engine-core @0x8012FE70 (src/shared) */ + +DEFINE_func_8012FF00() /* dedup: shared engine-core @0x8012FF00 (src/shared) */ + +DEFINE_func_8012FF4C() /* dedup: shared engine-core @0x8012FF4C (src/shared) */ + +DEFINE_func_8012FF98() /* dedup: shared engine-core @0x8012FF98 (src/shared) */ + +DEFINE_func_8013001C() /* dedup: shared engine-core @0x8013001C (src/shared) */ + +DEFINE_func_80130088() /* dedup: shared engine-core @0x80130088 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801300F4); + +DEFINE_func_801301E8() /* dedup: shared engine-core @0x801301E8 (src/shared) */ + + + +struct S80131E00; + +DEFINE_func_80130278() /* dedup: shared engine-core @0x80130278 (src/shared) */ + + +DEFINE_func_80130314() /* dedup: shared engine-core @0x80130314 (src/shared) */ + +DEFINE_func_80130360() /* dedup: shared engine-core @0x80130360 (src/shared) */ + +DEFINE_func_801303A0() /* dedup: shared engine-core @0x801303A0 (src/shared) */ + + +DEFINE_func_801303EC() /* dedup: shared engine-core @0x801303EC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130438); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130514); + +DEFINE_func_801305CC() /* dedup: shared engine-core @0x801305CC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130650); + +DEFINE_func_80130740() /* dedup: shared engine-core @0x80130740 (src/shared) */ + +DEFINE_func_801307B0() /* dedup: shared engine-core @0x801307B0 (src/shared) */ + +DEFINE_func_80130858() /* dedup: shared engine-core @0x80130858 (src/shared) */ + +DEFINE_func_80130898() /* dedup: shared engine-core @0x80130898 (src/shared) */ + +DEFINE_func_801308DC() /* dedup: shared engine-core @0x801308DC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130974); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130A18); + +DEFINE_func_80130AC4() /* dedup: shared engine-core @0x80130AC4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130AF0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130C08); + +extern void (*D_80186EAC[])(void); + +void func_80130D0C(void *a0) { + D_80186EAC[*(u8 *)((s32)a0 + 0xC1)](); +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80130D48); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131170); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801312D0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131340); + + +/* Canonical sigs (consistent with src/ov_SC01_077/ov_SC01_077.c + engine_core.h): + * - func_80131CA8: canonical 'extern void func_80131CA8(int, int)' (overlay .c L742, + * engine_core.h). Its $v0 return IS used here (asm: jal ...; bnez $v0), so cast at the + * call site to read it -- the codebase's own idiom (engine_core.h L17026: + * ((s32 (*)(int, int))func_80131CA8)(arg0, 0x2C)). Byte-neutral, no sig conflict. + * - func_8012C218: canonical 'void func_8012C218(void *a0)' (DEFINE_func_8012C218). + * - func_8002A04C: main-EXE callee (src/800.c), undeclared in this TU -> declare locally, + * arity 1 (asm: jal func_8002A04C; delay-slot a0=s0). No conflict. + */ +DEFINE_func_801319E0() /* dedup: shared engine-core @0x801319E0 (src/shared) */ + + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131A34); + +DEFINE_func_80131AC8() /* dedup: shared engine-core @0x80131AC8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131B14); + +DEFINE_func_80131C78() /* dedup: shared engine-core @0x80131C78 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131CA8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131CF4); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80131D68); + +extern void (*D_80186FEC[])(struct S80131E00 *a0); + +void func_80131E00(struct S80131E00 *a0, s32 a1) { + a0->field_B0 = a1; + D_80186FEC[a1](a0); +} + +DEFINE_func_80131E38() /* dedup: shared engine-core @0x80131E38 (src/shared) */ + +struct S80131E00; +DEFINE_func_80131E7C() /* dedup: shared engine-core @0x80131E7C (src/shared) */ + +DEFINE_func_80131EE4() /* dedup: shared engine-core @0x80131EE4 (src/shared) */ + +extern void (*D_80187044[])(void); + +void func_80131EEC(void *a0) { + D_80187044[*(u16 *)((s32)a0 + 0x2)](); +} + +extern void (*D_8018708C[])(void); + +void func_80131F28(void *a0) { + D_8018708C[*(u16 *)((s32)a0 + 0x2)](); +} + +extern void (*D_80187094[])(void); + +void func_80131F64(s32 *a0) { + D_80187094[*(u16 *)((s32)a0 + 2)](); +} + +extern s32 (*D_8018709C[])(); + +s32 func_80131FA0(s16 *a0) { + return D_8018709C[(u16)a0[1]](); +} + +extern s32 (*D_801870A4[])(); + +s32 func_80131FDC(s16 *a0) { + return D_801870A4[(u16)a0[1]](); +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80132018); + +DEFINE_func_801320D0() /* dedup: shared engine-core @0x801320D0 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801320D8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80132144); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801321B0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013221C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80132288); + +DEFINE_func_8013240C() /* dedup: shared engine-core @0x8013240C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801325B8); + +DEFINE_func_8013277C() /* dedup: shared engine-core @0x8013277C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80132784); + +DEFINE_func_80132DC4() /* dedup: shared engine-core @0x80132DC4 (src/shared) */ + +extern void Square0(s32 *a0, s32 *a1); +extern s16 D_80126CAC; +extern s16 D_80126CB0; + +s32 func_80132E6C(s16 *a0) { + s32 in[3]; + s32 out[3]; + in[0] = a0[3] - D_80126CAC; + in[1] = 0; + in[2] = a0[7] - D_80126CB0; + Square0(in, out); + return out[0] + out[2]; +} + +DEFINE_func_80132EC4() /* dedup: shared engine-core @0x80132EC4 (src/shared) */ + +DEFINE_func_80132EF4() /* dedup: shared engine-core @0x80132EF4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80132F40); + +DEFINE_func_80133060() /* dedup: shared engine-core @0x80133060 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801330E0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80133298); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013339C); + +DEFINE_func_8013361C() /* dedup: shared engine-core @0x8013361C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801336E8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013373C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80133784); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80133AB0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80133CD4); + +typedef struct { s16 x, y, z; } Vec3s; + +s32 func_80134310(Vec3s *a0, Vec3s *a1, s32 a2) { + return a0->x * a1->x + a0->y * a1->y + a0->z * a1->z + a2; +} + +DEFINE_func_8013435C() /* dedup: shared engine-core @0x8013435C (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801343C4); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80134510); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801345F8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801347A0); + +DEFINE_func_80134A28() /* dedup: shared engine-core @0x80134A28 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80134A74); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80134C20); + +DEFINE_func_80134FB8() /* dedup: shared engine-core @0x80134FB8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135004); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135168); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135260); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135480); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135888); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135A4C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135D20); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80135EB0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136334); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801365B8); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136824); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136A94); + +DEFINE_func_80136BC4() /* dedup: shared engine-core @0x80136BC4 (src/shared) */ + +DEFINE_func_80136C1C() /* dedup: shared engine-core @0x80136C1C (src/shared) */ + +DEFINE_func_80136C3C() /* dedup: shared engine-core @0x80136C3C (src/shared) */ + +DEFINE_func_80136C44() /* dedup: shared engine-core @0x80136C44 (src/shared) */ + +DEFINE_func_80136C4C() /* dedup: shared engine-core @0x80136C4C (src/shared) */ + +extern unsigned short D_800B99F0; +extern void (*D_801870C8[])(void); + +void func_80136C54(void) +{ + D_801870C8[D_800B99F0](); +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136C90); + +DEFINE_func_80136D00() /* dedup: shared engine-core @0x80136D00 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136D08); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136DFC); + +DEFINE_func_80136EC4() /* dedup: shared engine-core @0x80136EC4 (src/shared) */ + +DEFINE_func_80136ECC() /* dedup: shared engine-core @0x80136ECC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80136F3C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80137030); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80137178); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801372B0); + +DEFINE_func_801375EC() /* dedup: shared engine-core @0x801375EC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80137614); + +DEFINE_func_8013767C() /* dedup: shared engine-core @0x8013767C (src/shared) */ + +DEFINE_func_801376C8() /* dedup: shared engine-core @0x801376C8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801376E8); + +DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ + +DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801378F0); + +DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ + +DEFINE_func_801379EC() /* dedup: shared engine-core @0x801379EC (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801379FC); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80137B80); + +DEFINE_func_80137BD8() /* dedup: shared engine-core @0x80137BD8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80137D08); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80137DD4); + +DEFINE_func_80137FD8() /* dedup: shared engine-core @0x80137FD8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801380E0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801387B8); + +/* func_80138948: sh 7 @0x4; sb 0 @0x1F; sb 0 @0xD (store order = source order). */ +DEFINE_func_80138948() /* dedup: shared engine-core @0x80138948 (src/shared) */ + +DEFINE_func_8013895C() /* dedup: shared engine-core @0x8013895C (src/shared) */ + +DEFINE_func_80138AB4() /* dedup: shared engine-core @0x80138AB4 (src/shared) */ + +DEFINE_func_80138B88() /* dedup: shared engine-core @0x80138B88 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80138BE0); + +DEFINE_func_80138C30() /* dedup: shared engine-core @0x80138C30 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80138C60); + +DEFINE_func_80138D58() /* dedup: shared engine-core @0x80138D58 (src/shared) */ + +DEFINE_func_80138DB8() /* dedup: shared engine-core @0x80138DB8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80138DE0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80138ED0); + +DEFINE_func_8013914C() /* dedup: shared engine-core @0x8013914C (src/shared) */ + +DEFINE_func_801391F0() /* dedup: shared engine-core @0x801391F0 (src/shared) */ + +DEFINE_func_80139220() /* dedup: shared engine-core @0x80139220 (src/shared) */ + +DEFINE_func_801392C8() /* dedup: shared engine-core @0x801392C8 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801392FC); + +extern void func_80059888(void *a0, s32 a1, s32 a2, s32 a3); + +typedef struct { + s16 f0; + s16 f2; + s16 f4; + s16 f6; +} Stk801395D4; + +void func_801395D4(void * a0) +{ + Stk801395D4 sp10; + u16 mul; + u16 base; + sp10.f0 = *(u16 *)(a0 + 0x38); + mul = *(u16 *)(a0 + 0x12); + base = *(u16 *)(a0 + 0x3A); + sp10.f4 = 0x38; + sp10.f6 = 0xC; + sp10.f2 = base + mul * 12; + func_80059888(&sp10, 0, 0, 0); +} + +DEFINE_func_80139634() /* dedup: shared engine-core @0x80139634 (src/shared) */ + + +DEFINE_func_80139680() /* dedup: shared engine-core @0x80139680 (src/shared) */ + + +DEFINE_func_80139788() /* dedup: shared engine-core @0x80139788 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_801397B0); + +DEFINE_func_80139914() /* dedup: shared engine-core @0x80139914 (src/shared) */ + + +DEFINE_func_80139954() /* dedup: shared engine-core @0x80139954 (src/shared) */ + +DEFINE_func_801399A8() /* dedup: shared engine-core @0x801399A8 (src/shared) */ + + +DEFINE_func_801399F0() /* dedup: shared engine-core @0x801399F0 (src/shared) */ + +DEFINE_func_80139A34() /* dedup: shared engine-core @0x80139A34 (src/shared) */ + +DEFINE_func_80139A44() /* dedup: shared engine-core @0x80139A44 (src/shared) */ + +DEFINE_func_80139A68() /* dedup: shared engine-core @0x80139A68 (src/shared) */ + +DEFINE_func_80139A8C() /* dedup: shared engine-core @0x80139A8C (src/shared) */ + +DEFINE_func_80139B18() /* dedup: shared engine-core @0x80139B18 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_80139BE0); + +DEFINE_func_80139C7C() /* dedup: shared engine-core @0x80139C7C (src/shared) */ + + +DEFINE_func_80139D04() /* dedup: shared engine-core @0x80139D04 (src/shared) */ + + +DEFINE_func_80139DC8() /* dedup: shared engine-core @0x80139DC8 (src/shared) */ + +DEFINE_func_80139DEC() /* dedup: shared engine-core @0x80139DEC (src/shared) */ + +DEFINE_func_80139DF4() /* dedup: shared engine-core @0x80139DF4 (src/shared) */ + +DEFINE_func_80139E84() /* dedup: shared engine-core @0x80139E84 (src/shared) */ + +DEFINE_func_80139F0C() /* dedup: shared engine-core @0x80139F0C (src/shared) */ + +DEFINE_func_80139FBC() /* dedup: shared engine-core @0x80139FBC (src/shared) */ + +DEFINE_func_80139FE8() /* dedup: shared engine-core @0x80139FE8 (src/shared) */ + +DEFINE_func_8013A0A4() /* dedup: shared engine-core @0x8013A0A4 (src/shared) */ + +DEFINE_func_8013A164() /* dedup: shared engine-core @0x8013A164 (src/shared) */ + +DEFINE_func_8013A1E8() /* dedup: shared engine-core @0x8013A1E8 (src/shared) */ + +DEFINE_func_8013A250() /* dedup: shared engine-core @0x8013A250 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013A2BC); + +DEFINE_func_8013A378() /* dedup: shared engine-core @0x8013A378 (src/shared) */ + + +struct S8013A4C4; + +DEFINE_func_8013A380() /* dedup: shared engine-core @0x8013A380 (src/shared) */ + + +DEFINE_func_8013A448() /* dedup: shared engine-core @0x8013A448 (src/shared) */ + +DEFINE_func_8013A4C4() /* dedup: shared engine-core @0x8013A4C4 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013A530); + +DEFINE_func_8013A860() /* dedup: shared engine-core @0x8013A860 (src/shared) */ + +DEFINE_func_8013A8B0() /* dedup: shared engine-core @0x8013A8B0 (src/shared) */ + +DEFINE_func_8013A8BC() /* dedup: shared engine-core @0x8013A8BC (src/shared) */ + + +DEFINE_func_8013A8FC() /* dedup: shared engine-core @0x8013A8FC (src/shared) */ + + +DEFINE_func_8013A9B4() /* dedup: shared engine-core @0x8013A9B4 (src/shared) */ + +DEFINE_func_8013A9F8() /* dedup: shared engine-core @0x8013A9F8 (src/shared) */ + +DEFINE_func_8013AA24() /* dedup: shared engine-core @0x8013AA24 (src/shared) */ + +DEFINE_func_8013AB54() /* dedup: shared engine-core @0x8013AB54 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013AD38); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013AF20); + +DEFINE_func_8013B204() /* dedup: shared engine-core @0x8013B204 (src/shared) */ + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_a", func_8013B274); + +/* func_8013B568..func_8013C964 (16 contiguous fns) moved to ov_SC01_077_o0.c — built -O0 (Phase-19 T1). */ diff --git a/src/ov_SC01_077/ov_SC01_077_o0.c b/src/ov_SC01_077/ov_SC01_077_o0.c new file mode 100644 index 000000000..259d19e85 --- /dev/null +++ b/src/ov_SC01_077/ov_SC01_077_o0.c @@ -0,0 +1,73 @@ +#include "common.h" + +/* Phase-19 T1: the -O0 cluster (16 contiguous fns vram 0x8013B568..0x8013C98C, prologue sig + * 21F0A003 = -O0 frame pointer). Split into its own .c so the Makefile forces CC1FLAGS=-O0 on + * ov_SC01_077_o0.o (src/boot.c precedent). A single object's .text can't be split around a middle + * object, so the overlay code is 3 objects: ov_SC01_077_a (before) / ov_SC01_077_o0 (this, -O0) / + * ov_SC01_077 (after). Data externs hoisted + deconflicted; intra-cluster callees forward-declared. + * + * 6/16 matched here (reach-134, but the ×134 fleet rollout is DEFERRED to Phase 20: -O0 functions + * can't propagate via engine_core.h — that header compiles -O2 in other overlays — so each overlay + * needs its own -O0 split). + * + * 10 stubs DEFERRED to Phase 20: they hit an -O0 codegen quirk — for indexed global access + * `arr[i]=x`, our cc1 materializes the address (lui;addiu;addu;sw 0(reg)) while the original folds + * %lo (lui;addu idx;sw %lo(sym)(reg), 1 ins shorter). That's gcc address-splitting behavior our cc1 + * reproduces differently at -O0; cracking it is gcc-source research (Phase-18 §17 / R17 territory), + * not a C-form fix. The 6 matched below are scalar-store / pointer-loop / simple-call (no index). */ +extern s32 D_80187270; +extern s32 D_801DAB24; +extern s32 D_801DAAC0; + +void func_8013B83C(s32 a0, s32 a1, s32 a2); +void func_8013BD74(void *a0, s32 a1); + +void func_8013B568(s32 arg0) { + D_80187270 = arg0; +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013B598); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013B6A0); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013B7AC); + +void func_8013B7F4(s32 a0, s32 a1) { + func_8013B83C(a0, a1, D_801DAB24); +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013B83C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013BC7C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013BCDC); + +void func_8013BD34(s32 a0) { + func_8013BD74(&D_801DAAC0, a0); +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013BD74); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013C08C); + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013C0F8); + +void func_8013C360(s32 a0) { + s32 *p; + u32 i; + p = (s32 *)(a0 + 0x10); + for (i = 0; i < *(u32 *)(a0 + 8); i++) { + *(s32 *)(*(s32 *)p) = *(s32 *)((s32)p + 4); + p = (s32 *)((s32)p + 0xC); + } +} + +INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_o0", func_8013C414); + +void func_8013C938(void) { + D_801DAAC0 = 1; +} + +void func_8013C964(void) { + D_801DAAC0 = 0; +}