From eeff5eeaaa0fd19c78e06ac7ab3df0db9bba0766 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Mon, 17 Aug 2026 12:12:33 -0600 Subject: [PATCH] feat(decomp): propagate func_80188828 (gate lane) --- config/dedup.us.yaml | 7 ++ src/ov_SC03_014/ov_SC03_014_jr_801848E4.c | 61 +------------- src/ov_SC03_015/ov_SC03_015_jr_801848E4.c | 2 +- src/shared/engine_core.h | 96 +++++++++++++++++++++++ 4 files changed, 105 insertions(+), 61 deletions(-) diff --git a/config/dedup.us.yaml b/config/dedup.us.yaml index d6cb6fa17..26b37eae4 100644 --- a/config/dedup.us.yaml +++ b/config/dedup.us.yaml @@ -15125,3 +15125,10 @@ groups: func: DEFINE_func_80187300 vram: 0x80187300 binaries: [ov_SC03_014, ov_SC03_015] + - id: E_func_80188828 + tier: h_exact + hash: 6519c0248710a61cee3abf042e62d39251e20359 + source: src/shared/engine_core.h + func: DEFINE_func_80188828 + vram: 0x80188828 + binaries: [ov_SC03_014, ov_SC03_015] diff --git a/src/ov_SC03_014/ov_SC03_014_jr_801848E4.c b/src/ov_SC03_014/ov_SC03_014_jr_801848E4.c index fd9fda7af..da542ee49 100644 --- a/src/ov_SC03_014/ov_SC03_014_jr_801848E4.c +++ b/src/ov_SC03_014/ov_SC03_014_jr_801848E4.c @@ -4649,66 +4649,7 @@ L_da8: #include "common.h" -extern void func_8013CABC(void); -extern void func_801890F8(void *a0); -extern s32 func_8012BEE8(s32 a0); -extern void func_80188A80(s32 a0); -extern void func_801889B4(s32 a0); -extern s32 func_801846E4(void); - -/* Already declared in the destination TU (src/ov_SC03_014/ov_SC03_014_jr_801848E4.c:2530) - * as `extern int func_80178970(void);`. Adopting that exact spelling (law 2) and - * calling through a function-pointer cast (same idiom the TU already uses at - * func_80187EA8 for func_8012C218) to pass the self argument without redeclaring - * the symbol with a conflicting prototype. */ -extern int func_80178970(void); - -extern s32 D_801EAC90; - -void func_80188828(s32 a0) { - s32 self; - - self = a0; - - if (*(s32 *)(self + 0x1C) == 0x30) { - func_8013CABC(); - } else if (*(s32 *)(self + 0x1C) == 0x10) { - func_801890F8((void *)*(s32 *)(self + 0xD0)); - } - - if (*(u16 *)(self + 0x84) & 1) { - *(u16 *)(*(s32 *)(self + 0x64) + 6) = *(u16 *)(*(s32 *)(self + 0x64) + 6) - 3; - *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) = - *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) - 3; - *(u16 *)(self + 6) = *(u16 *)(self + 6) - 3; - } else { - *(u16 *)(*(s32 *)(self + 0x64) + 6) = *(u16 *)(*(s32 *)(self + 0x64) + 6) + 3; - *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) = - *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) + 3; - *(u16 *)(self + 6) = *(u16 *)(self + 6) + 3; - } - - { - s32 t; - t = D_801EAC90; - *(u16 *)(self + 0x84) = *(u16 *)(self + 0x84) + 1; - if (t == 0) { - D_801EAC90 = func_801846E4(); - } - } - - if (func_8012BEE8(self) && D_801EAC90) { - func_80188A80(self); - } else { - if (*(s32 *)(self + 0x1C) < 0x48) { - if ((*(u16 *)(self + 0x84) & 3) == 0) { - func_801889B4(self); - } - } - } - - ((void (*)(s32))func_80178970)(self); -} +DEFINE_func_80188828() /* dedup: shared engine-core @0x80188828 (src/shared) */ INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_801848E4", func_801889B4); diff --git a/src/ov_SC03_015/ov_SC03_015_jr_801848E4.c b/src/ov_SC03_015/ov_SC03_015_jr_801848E4.c index a6de945eb..7e1283002 100644 --- a/src/ov_SC03_015/ov_SC03_015_jr_801848E4.c +++ b/src/ov_SC03_015/ov_SC03_015_jr_801848E4.c @@ -3680,7 +3680,7 @@ void func_80188634(void *a0) { INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_801848E4", func_80188670); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_801848E4", func_80188828); +DEFINE_func_80188828() /* dedup: shared engine-core @0x80188828 (src/shared) */ INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_801848E4", func_801889B4); diff --git a/src/shared/engine_core.h b/src/shared/engine_core.h index 01632b619..390b8da53 100644 --- a/src/shared/engine_core.h +++ b/src/shared/engine_core.h @@ -65234,6 +65234,54 @@ func_8012C658(0x3DE, 0, a0); \ } +#define DEFINE_func_80188828() \ + extern void func_8013CABC(void); \ + extern void func_801890F8(void *a0); \ + extern s32 func_8012BEE8(s32 a0); \ + extern void func_80188A80(s32 a0); \ + extern void func_801889B4(s32 a0); \ + extern s32 func_801846E4(void); \ + extern int func_80178970(void); \ + extern s32 D_801EAC90; \ + void func_80188828(s32 a0) { \ + s32 self; \ + self = a0; \ + if (*(s32 *)(self + 0x1C) == 0x30) { \ + func_8013CABC(); \ + } else if (*(s32 *)(self + 0x1C) == 0x10) { \ + func_801890F8((void *)*(s32 *)(self + 0xD0)); \ + } \ + if (*(u16 *)(self + 0x84) & 1) { \ + *(u16 *)(*(s32 *)(self + 0x64) + 6) = *(u16 *)(*(s32 *)(self + 0x64) + 6) - 3; \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) = \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) - 3; \ + *(u16 *)(self + 6) = *(u16 *)(self + 6) - 3; \ + } else { \ + *(u16 *)(*(s32 *)(self + 0x64) + 6) = *(u16 *)(*(s32 *)(self + 0x64) + 6) + 3; \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) = \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) + 3; \ + *(u16 *)(self + 6) = *(u16 *)(self + 6) + 3; \ + } \ + { \ + s32 t; \ + t = D_801EAC90; \ + *(u16 *)(self + 0x84) = *(u16 *)(self + 0x84) + 1; \ + if (t == 0) { \ + D_801EAC90 = func_801846E4(); \ + } \ + } \ + if (func_8012BEE8(self) && D_801EAC90) { \ + func_80188A80(self); \ + } else { \ + if (*(s32 *)(self + 0x1C) < 0x48) { \ + if ((*(u16 *)(self + 0x84) & 3) == 0) { \ + func_801889B4(self); \ + } \ + } \ + } \ + ((void (*)(s32))func_80178970)(self); \ + } + #endif #define DEFINE_func_80128EA8() \ @@ -159873,4 +159921,52 @@ func_8012C658(0x3DE, 0, a0); \ } +#define DEFINE_func_80188828() \ + extern void func_8013CABC(void); \ + extern void func_801890F8(void *a0); \ + extern s32 func_8012BEE8(s32 a0); \ + extern void func_80188A80(s32 a0); \ + extern void func_801889B4(s32 a0); \ + extern s32 func_801846E4(void); \ + extern int func_80178970(void); \ + extern s32 D_801EAC90; \ + void func_80188828(s32 a0) { \ + s32 self; \ + self = a0; \ + if (*(s32 *)(self + 0x1C) == 0x30) { \ + func_8013CABC(); \ + } else if (*(s32 *)(self + 0x1C) == 0x10) { \ + func_801890F8((void *)*(s32 *)(self + 0xD0)); \ + } \ + if (*(u16 *)(self + 0x84) & 1) { \ + *(u16 *)(*(s32 *)(self + 0x64) + 6) = *(u16 *)(*(s32 *)(self + 0x64) + 6) - 3; \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) = \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) - 3; \ + *(u16 *)(self + 6) = *(u16 *)(self + 6) - 3; \ + } else { \ + *(u16 *)(*(s32 *)(self + 0x64) + 6) = *(u16 *)(*(s32 *)(self + 0x64) + 6) + 3; \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) = \ + *(u16 *)(*(s32 *)(*(s32 *)(self + 0x64) + 0x20) + 8) + 3; \ + *(u16 *)(self + 6) = *(u16 *)(self + 6) + 3; \ + } \ + { \ + s32 t; \ + t = D_801EAC90; \ + *(u16 *)(self + 0x84) = *(u16 *)(self + 0x84) + 1; \ + if (t == 0) { \ + D_801EAC90 = func_801846E4(); \ + } \ + } \ + if (func_8012BEE8(self) && D_801EAC90) { \ + func_80188A80(self); \ + } else { \ + if (*(s32 *)(self + 0x1C) < 0x48) { \ + if ((*(u16 *)(self + 0x84) & 3) == 0) { \ + func_801889B4(self); \ + } \ + } \ + } \ + ((void (*)(s32))func_80178970)(self); \ + } + #endif