chore(decomp): commit in-tree banked work before the serial lane

This commit is contained in:
Drew T
2026-08-25 14:57:13 -06:00
parent b0587c573e
commit ebb83dd9ab
3 changed files with 51 additions and 149 deletions
+1 -147
View File
@@ -3360,153 +3360,7 @@ void func_80182998(void) {
}
extern u16 D_801E4BBC;
extern s16 D_80195B24[];
extern u8 D_80195B2C[];
extern void func_80186BB8(void *a0);
extern void func_80186304();
extern void func_801840E8(s32 a0);
extern s32 func_8012BEE8(s32 a0);
extern void func_801856E4(void);
extern void func_8018415C(void *a0);
extern void func_80182810(void *a0);
extern void func_801828D8();
extern void func_8012B23C(s32 a0);
extern void func_8012AD44(s32 *a0, s16 a1);
extern void func_80186F14(void *a0);
extern void func_80186C0C(void *a0);
// @class: plumbing
// @stuck: none — MATCH (189/189, pin-free, zero asm). Sole residual is the §81
// jr carve chain (operator step); see BANKING below.
//
/* func_80182A8C — ov_SC02_005_jr_80181D30, 189 ins, MATCH (match_one x14).
*
* §81 jr family: switch on *(u16*)(s0+0x34), bound sltiu $v0,$v1,6.
* jtbl_801E2E58 = 6 entries [0]->0x80182AC8 [1]->0x80182B04 [2]->0x80182B50
* [3]->0x80182B84 [4]->0x80182BA0 [5]->0x80182C84; default -> .L80182D6C.
* Raw copy: asm/ov_SC02_005/data/tail20.data.s:9 (compiler jump table — not
* named in C; the plain switch emits gcc's own table; splat dlabel name can
* never appear in the draft reloc set — §81 FALSE POSITIVE, cf. func_8015B950
* symcheck in ov_SC02_005_jr_8015AE2C.c:1531).
*
* BANKING — §53/§62/§81 3-step carve chain applies AT BANK TIME; each step
* byte-gated on its own BEFORE building the next:
* 1. tools/jr_isolate_all.py ov_SC02_005 --only func_80182A8C
* make extract BINARY=ov_SC02_005 && make build BINARY=ov_SC02_005 -> byte-identical
* 2. tools/jtbl_carve.py ov_SC02_005 --func func_80182A8C
* make extract BINARY=ov_SC02_005 && make build BINARY=ov_SC02_005 -> byte-identical
* 3. tools/harvest_verify.py --binary ov_SC02_005 --drafts <THIS WAVE'S OUTPUT> --chunk 1
* then FULL R22 (config changed => T2).
* NB do NOT harvest .run/backlog_drafts/ — docs/autopsy.md:64 shows this
* card's stored backlog draft was a stale near-miss (IMM-OFFSET/-3,
* close=1). After banking, re-run tools/autopsy.py collect so the record
* upgrades structural/near -> MATCH/integration.
* Sibling tables in the same tail20 object — jtbl_801E2E78 (:32,
* func_80185060), jtbl_801E2ED0 (:89, func_80185E80), jtbl_801E2F68 (:210,
* func_8018EA04) — belong to STILL-STUBBED functions: they stay raw and keep
* assembling byte-correct from there; do NOT carve them now. No existing
* carves in this subseg => step 2 cannot hit NON-CONTIGUOUS. Second jr here
* later => §8b additive regenerate-from-config carve.
*
* Load-bearing spellings, do NOT "clean up":
* - case 4 caches flags into local `a0` whose LAST USE precedes the call; the RMW
* re-reads memory fresh. Collapsing to one call site w/ computed arg (ternary or
* join var) re-joins the 0x80000 constant across the jal -> phantom $s1, frame 0x20.
* - case-4 join is two plain stores; a named join local moves the li's to $v1.
* - table compare reads the entry UNSIGNED: (*(u16 *)&D_80195B24[D_801E4BBC]<<16)>>17
* (decl stays s16[]); signed spelling folds to one sra and loses an instruction.
* - *(s16 *)(s0 + 0xAE) = -1 via s16 lvalue; u16 lvalue emits ori instead of addiu -1.
*/
void func_80182A8C(s32 s0) {
u32 a0;
switch (*(u16 *)(s0 + 0x34)) {
case 0:
if (*(s16 *)(s0 + 0x98) == 0) {
func_80186BB8((void *)s0);
*(u16 *)(s0 + 0x34) = 3;
if (*(u32 *)(s0 + 0xE8) & 0x40000) {
func_80186304((u8 *)s0, 0x16, 2);
*(u16 *)(s0 + 0x34) = 2;
}
}
break;
case 1:
if (*(s16 *)(s0 + 0x98) == 0) {
func_80186BB8((void *)s0);
*(u16 *)(s0 + 0x34) = 3;
if (*(u32 *)(s0 + 0xE8) & 0x20000) {
func_80186304((u8 *)s0, 0x18, 2);
*(u16 *)(s0 + 0x34) = 2;
}
}
break;
case 2:
if (*(s16 *)(s0 + 0x98) == 0) {
func_80186BB8((void *)s0);
*(u16 *)(s0 + 0x34) = 3;
*(u32 *)(s0 + 0xE8) |= 0x80000;
}
break;
case 3:
func_801840E8(*(s32 *)(s0 + 0xD4));
*(u32 *)(s0 + 0x1C) = 0;
*(u16 *)(s0 + 0x34) = 4;
break;
case 4:
if (func_8012BEE8(s0)) {
if (D_801E4BBC == 0 && *(s16 *)(s0 + 0x76) == D_80195B24[0]) {
func_801856E4();
*(u32 *)(s0 + 0x1C) = 0x180;
}
}
a0 = *(u32 *)(s0 + 0xE8);
if ((a0 & 0x80000) == 0 &&
*(s16 *)(s0 + 0x76) <= ((*(u16 *)&D_80195B24[D_801E4BBC] << 16) >> 17)) {
if ((a0 & 0x20000) != 0) {
func_80186304(s0, -0x15, 1);
} else {
func_80186304(s0, -0x17, 1);
}
*(u32 *)(s0 + 0xE8) = (*(u32 *)(s0 + 0xE8) & 0xFFF9FFFF) | 0x80000;
func_8018415C(*(void **)(s0 + 0xD4));
*(u16 *)(s0 + 0x34) = 5;
}
break;
case 5:
if (*(s16 *)(s0 + 0x98) == 0) {
if (*(u32 *)(s0 + 0xE8) & 0x1000) {
func_80182810((void *)s0);
if (*(u32 *)(s0 + 0xE8) & 0x2000) {
*(u32 *)(s0 + 0x1C) = 0x18;
} else {
*(u32 *)(s0 + 0x1C) = 0x30;
}
func_801828D8((void *)s0);
*(u32 *)(s0 + 0xE8) &= ~0x80;
*(s32 *)(s0 + 0x1C) = (s32)(s16)*(u16 *)(s0 + 0x104);
} else {
func_8012B23C(s0);
*(u32 *)(s0 + 0xE8) |= 1;
func_80186304((u8 *)s0, 0, 0);
if (*(u32 *)(s0 + 0xE8) & 0x2000) {
*(u32 *)(s0 + 0x1C) = 0x10;
} else {
*(u32 *)(s0 + 0x1C) = 0x20;
}
*(u32 *)(s0 + 0x58) = (s32)D_80195B2C | 0x40000000;
*(u16 *)(s0 + 0x5C) = 0;
*(s16 *)(s0 + 0xAE) = -1;
func_8012AD44((s32 *)s0, 1);
func_80186F14((void *)s0);
}
func_80186C0C((void *)s0);
}
break;
}
}
INCLUDE_ASM("asm/ov_SC02_005/nonmatchings/ov_SC02_005_jr_80181D30", func_80182A8C);
INCLUDE_ASM("asm/ov_SC02_005/nonmatchings/ov_SC02_005_jr_80181D30", func_80182D80);
+26 -1
View File
@@ -7808,7 +7808,32 @@ void func_80186568(s32 a0) {
INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_801867C8);
INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80186874);
extern s32 *D_80126B78;
extern u8 D_801A5BE8[];
extern u8 D_801152A8[];
extern void func_8012F14C(s32 a0, s32 a1, s32 a2);
extern s32 func_80135888(s32 a0, s32 a1, s32 a2, s32 a3);
extern void func_8012F568(s32 a0, s32 a1, s32 a2, s32 a3, s32 a4, s32 a5);
void func_80186874(s32 arg0, s32 arg1) {
register s32 rv __asm__("$2");
s32 buf1[2];
s32 buf2[2];
((void (*)(s32, s32, s32))func_8012F14C)((s32)D_80126B78 + 0x34, (s32)D_801A5BE8, (s32)buf1);
((void (*)(s32, s32, s32))func_8012F14C)((s32)D_80126B78 + 0x34, (s32)(D_801A5BE8 + 8), (s32)buf2);
if (func_80135888(*(s32 *)(arg0 + 0x20), *(s32 *)(arg0 + 0x58), (s32)buf1, (s32)buf2) != 0) {
func_8012F568(1, (*(u16 *)(arg0 + 0x70) & 0xF) != 0 ? 0x2001 : 1,
*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x12), arg1,
(s32)buf2, (s32)D_801152A8);
rv = 1;
} else {
rv = 0;
}
__asm__ __volatile__("" : "=r"(rv) : "0"(rv));
}
extern s32 func_8012CC88(s32 a0, s32 a1, s32 a2);
typedef struct {
+24 -1
View File
@@ -3277,7 +3277,30 @@ void func_80186028(s32 a0)
}
INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_801855D0", func_801860B0);
extern void func_80015978(s32 a0, s32 *a1);
extern void func_8012EFB8(s32 a0);
s32 func_801860B0(a0)
s32 a0;
{
extern void func_8012EFB8(s32 a0);
s32 sp10;
s32 v1;
func_80015978(a0 + 4, &sp10);
if ((((s32 (*)(s32, s32))func_8012EFB8)((s32)&sp10, (s32)&sp10) & 0xFFFFEFFF) != 0) {
v1 = 1;
} else {
v1 = (*(s16 *)&sp10 * 64) / 160 + 0x40;
}
if (v1 <= 0) {
v1 = 1;
} else if (v1 >= 0x80) {
v1 = 0x7F;
}
return v1;
}