feat(t5): Claude wave t5g — 42 banked (sonnet 37/44, opus 4/4, +recovery); fleet 213 passed, 0 failed of 213 (P31 S62 T5)

This commit is contained in:
Drew T
2026-08-27 10:20:47 -06:00
parent 963519799d
commit 71f00b16d1
19 changed files with 1304 additions and 45 deletions
+47 -2
View File
@@ -3614,7 +3614,30 @@ void func_80180BA0(void *a0) {
INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005_jr_8017ED5C", func_80180BDC);
INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005_jr_8017ED5C", func_80180C98);
#include "common.h"
extern s32 func_8012C1B8(void);
extern void func_8001C214(s32 a0, s32 a1);
extern void func_8012A828(s32 a0, void *a1);
extern void func_80143994(s32 a0, s32 a1);
extern s32 D_801C6B18;
extern s32 D_801BC4A0;
void func_80180C98(s32 param_1) {
s32 v0;
v0 = func_8012C1B8();
*(s32 *)(param_1 + 0x20) = v0;
if (v0 != 0) {
func_8001C214(v0, (s32)&D_801C6B18);
*(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = 0;
func_8012A828(param_1, &D_801BC4A0);
func_80143994(param_1, 0x3000);
*(s32 *)(param_1 + 0x1C) = 1;
*(s16 *)(param_1 + 2) = *(s16 *)(param_1 + 2) + 1;
}
}
#include "common.h"
@@ -3659,7 +3682,29 @@ void func_80180D9C(s32 a0) {
}
INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005_jr_8017ED5C", func_80180E24);
extern s32 func_8012C1B8(void);
extern void func_8001C214(s32 a0, s32 a1);
extern void func_8012A828(s32 a0, void *a1);
extern void func_80143994(s32 a0, s32 a1);
void func_80180E24(s32 param_1)
{
extern s32 D_801C97C0[];
extern u8 D_801BC578[];
s32 v0;
v0 = func_8012C1B8();
*(s32 *)(param_1 + 0x20) = v0;
if (v0 != 0) {
func_8001C214(v0, (s32)D_801C97C0);
*(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = 0;
func_8012A828(param_1, D_801BC578);
func_80143994(param_1, 0x3000);
*(s32 *)(param_1 + 0x1C) = 1;
*(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1;
}
}
extern s32 D_801BC718;
+42 -3
View File
@@ -3420,9 +3420,32 @@ s32 func_80180614(s32 a0) {
}
INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006_jr_8017ED5C", func_80180674);
s32 func_80180674(s32 a0) {
s16 v = *(s16 *)(a0 + 0x104);
if (v != 0) {
*(s16 *)(a0 + 0x104) = 0;
func_8002D4C8(0x45F, 0);
}
return v;
}
s32 func_801806B8(s32 a0) {
if (*(s16 *)(a0 + 0x10A) != 0) {
u16 next = *(u16 *)(a0 + 0x106) - 0x10;
*(s16 *)(a0 + 0x106) = next;
*(s16 *)(a0 + 0x108) = next;
if ((s16)next < 0) {
*(s16 *)(a0 + 0x106) = 0;
*(s16 *)(a0 + 0x108) = 0;
}
*(u16 *)(a0 + 0x10A) = *(u16 *)(a0 + 0x10A) - 3;
return 0;
}
*(s16 *)(a0 + 0x100) = 0;
return 1;
}
INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006_jr_8017ED5C", func_801806B8);
@@ -3442,7 +3465,23 @@ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006_jr_8017ED5C", func_801806B
DEFINE_func_80180710() /* dedup: shared engine-core @0x80180710 (src/shared) */
INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006_jr_8017ED5C", func_80180734);
extern s16 func_8017DA9C(void);
s32 func_80180734(s32 a0) {
if ((s16) func_8017DA9C() < 0x100) {
return 1;
}
*(u16 *)(a0 + 0x100) = func_8017DA9C() & 0xFF;
return 0;
}
extern s16 func_8017DA9C(void);
+98 -3
View File
@@ -3647,7 +3647,20 @@ void func_80183274(s32 *a0) {
INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8018173C", func_80183310);
INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8018173C", func_801834EC);
void func_801834EC(s32 arg0)
{
func_80147AD4(arg0, 0, 0, 0);
func_801473EC((s32 *)arg0);
func_80172414(arg0);
if (--*(s32 *)(arg0 + 0x204) == -1) {
*(u16 *)(*(s32 *)(arg0 + 0x20) + 0x10) = 0;
func_80146D90(arg0);
*(s32 *)(arg0 + 0x204) = 0x10;
*(u8 *)(arg0 + 0x4D) -= 1;
*(u8 *)(arg0 + 0x214) += 1;
}
}
void func_80183574(void *arg0) {
@@ -4959,7 +4972,33 @@ s32 func_80185D58(s32 a0) {
}
INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8018173C", func_80185E00);
extern unsigned char D_801202A0[];
extern void func_8012C218(void *a0);
void func_80185E00(void)
{
unsigned char *puVar2;
unsigned int uVar3;
unsigned int uVar4;
int iVar1;
uVar3 = 0;
uVar4 = 0x29;
puVar2 = D_801202A0;
iVar1 = 0;
__asm__ __volatile__("" : "=r"(uVar4) : "0"(uVar4));
do {
if ((*(unsigned short *)(D_801202A0 + iVar1) != 0) &&
(*(unsigned short *)(D_801202A0 + iVar1) != uVar4)) {
func_8012C218(puVar2);
}
puVar2 = puVar2 + 0x10c;
uVar3 = uVar3 + 1;
iVar1 = iVar1 + 0x10c;
} while (uVar3 < 0x60);
return;
}
extern s32 func_8012E504(s32 a0, s32 a1);
@@ -5091,7 +5130,63 @@ DEFINE_func_8018621C() /* dedup: shared engine-core @0x8018621C (src/shared) */
DEFINE_func_8018623C() /* dedup: shared engine-core @0x8018623C (src/shared) */
INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8018173C", func_8018626C);
#include "common.h"
extern s32 D_801270D0;
extern s32 D_801270CC;
extern s32 D_8018F2F0;
extern s32 D_80126D50;
extern u16 D_80126B5E;
extern u16 D_80126B62;
extern u16 D_80126B66;
extern u8 D_800D3918[];
extern u8 D_800D391C[];
extern s32 ratan2(s32 a0, s32 a1);
extern void func_8012B0B4(unsigned int *param_1, int param_2, int param_3);
extern s32 func_8012C51C(void *a0, s32 a1);
typedef struct {
s16 f0;
s16 f1;
s16 f2;
s16 f3;
s16 f4;
s16 f5;
s16 f6;
s16 f7;
s32 f8;
} Pkt_8018626C;
void func_8018626C(void) {
s32 *ctr = &D_801270D0;
Pkt_8018626C pkt;
s16 pos[3];
s32 buf[2];
s32 angle;
*ctr = *ctr + 1;
if (*ctr >= 0x3C && D_801270CC < D_8018F2F0 && D_80126D50 == 0) {
*ctr = 0;
pos[0] = D_80126B5E;
pos[1] = D_80126B62;
pos[2] = D_80126B66;
angle = ratan2(*(s16 *)D_800D391C - (s16)D_80126B66, (s16)D_80126B5E - *(s16 *)D_800D3918);
func_8012B0B4((unsigned int *)buf, (angle - 0x400) & 0xFFF, 0x110);
pkt.f1 = -0x1004;
pkt.f3 = 0x2F;
pkt.f4 = 0x400;
pkt.f5 = 0;
pkt.f6 = 0x7FFF;
pkt.f8 = 0;
pkt.f7 = 0;
pkt.f0 = (s16)buf[0];
pkt.f2 = (s16)(buf[0] >> 16);
if (func_8012C51C(&pkt, 0) != 0) {
D_801270CC = D_801270CC + 1;
}
}
}
extern void (*D_8018F2F4[])(void);
+196 -3
View File
@@ -6844,7 +6844,28 @@ void func_80181454(s32 p) {
}
INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801814DC);
extern s32 func_800291B4(s32 arg);
extern void func_8012BD14(s32 a0);
extern void func_8012A828(s32 a0, void *a1);
extern u8 D_801BAEF0[];
void func_801814DC(s32 a0) {
if ((func_800291B4(0xCC) & 0xFF) == 1) {
*(s32 *)(*(s32 *)(a0 + 0x20) + 4) &= 0x7FFFFFFF;
if (((s32 (*)(s32))func_8012BD14)(a0) <= 0x10000) {
*(s16 *)(a0 + 0x2) = 2;
func_8012A828(a0, D_801BAEF0);
}
}
if ((func_800291B4(0xCC) & 0xFF) == 0xF) {
*(s16 *)(a0 + 0xE) -= 0x100;
*(s32 *)(*(s32 *)(a0 + 0x20) + 4) &= 0x7FFFFFFF;
*(s16 *)(a0 + 0x2) = 3;
func_8012A828(a0, D_801BAEF0);
}
}
extern void func_8012B14C(s32 a0, s32 a1);
extern void func_800291A0(s32 a0, s32 a1);
@@ -7463,7 +7484,39 @@ s32 func_801827E8(s32 a0, s32 a1, s16 a2, s16 a3, s32 a4) {
}
INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801828B0);
#include "common.h"
extern u16 D_800B99DA;
extern s16 D_80190C40[];
extern u8 *func_8012913C(s32 a0);
extern void func_8012B0B4(u32 *param_1, s32 param_2, s32 param_3);
extern s32 rand(void);
void func_801828B0(s32 a0) {
s32 obj;
s16 *tbl;
register s32 q __asm__("$16");
u32 buf[2];
s32 v;
obj = a0;
if ((D_800B99DA & 3) == 0) {
for (tbl = D_80190C40; *tbl != -1; tbl++) {
q = (s32)func_8012913C(0x22);
if (q != 0) {
func_8012B0B4(buf, *tbl, rand() % 80 + 0x118);
v = (s32)buf[0];
*(u16 *)(q + 0x6) = *(u16 *)(obj + 0x6) + v;
*(u16 *)(q + 0xE) = *(u16 *)(obj + 0xE) + (v >> 16);
*(u16 *)(q + 0xA) = *(u16 *)(obj + 0xA) + 0x40;
*(s32 *)(q + 0x14) = (rand() % 9) * 0x10000 - 0x100000;
*(u16 *)(q + 0x34) = (rand() & 1) | 0x7FF0;
*(u16 *)(*(s32 *)(q + 0x20) + 0x2C) = 0xC008;
}
}
}
}
extern s32 D_801F782C;
extern s32 D_801F76CC;
@@ -7482,7 +7535,147 @@ s32 func_801829FC(void)
}
INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_80182A44);
/* func_80182A44 — 146 ins, ov_SC03_006, TU src/ov_SC03_006/ov_SC03_006_jr_8017AE2C.c
*
* The per-frame tick of the SC03_006 sequence: pushes the current camera triple
* (D_80126B5E/62/66) through func_8013B598, then runs a 3-state machine on
* D_801F782C (0 = init, 1 = draw-only, 2 = animate+draw).
*
* ===== THE TWO LEVERS (each byte-measured with tools/match_one.py) =====
*
* (1) THE INNER 2-WAY DISPATCH IS AN if-CHAIN, NOT A `switch`. Target:
* beq $v1,$a0,.L80182B5C ; slti $v0,$v1,2 ; beqz $v0,default ; bnez $v1,default
* i.e. a case-node tree rooted at 1 with a left leaf 0 and NO right child.
* A `switch (D_801F76CC) { case 0: ... case 1: ... }` CANNOT produce that:
* gcc-2.7.2 stmt.c:5360 `balance_case_nodes` only splits when `i > 2`, so a
* TWO-node list is left LINEAR (root = case 0), and emit_case_nodes'
* "right child, no left" arm then emits a bare `do_jump_if_equal` pair —
* `beqz`/`beq`, two tests, no `slti` (145 ins, −1). Writing the three tests
* out longhand as nested `if`s reproduces the tree exactly. Cf. §222-2,
* which uses an EMPTY leading case to buy the median split at THREE nodes;
* at two nodes there is no case-label spelling that reaches this shape.
* (The OUTER switch on D_801F782C is a real 3-node switch — i == 3 takes
* stmt.c's `npp = &(*npp)->right` middle-split, root = 1, hence
* `beq $v1,$a0` first and the `.L80182AA8` right-subtree block.)
*
* (2) THE ±1/+2 ARMS TAKE THE ADDRESS THROUGH A POINTER. Target:
* lui $v1,%hi ; addiu $v1,%lo ; lw $v0,0($v1) ... sw $v0,0($v1)
* — `&D_801F76F4` materialised into a register in BOTH arms, with cross_jump
* merging the ONE-instruction `sw $v0,0($v1)` tail (§162: one side falls
* through into the label ⇒ find_cross_jump's minimum is 1). Spelling the
* arms as plain `D_801F76F4 -= 1;` / `+= 2;` emits the gas-macro folded form
* instead (`lw $v0,SYM` → lui/lw %lo; `sw $v0,SYM` → lui $at/sw %lo), whose
* shared tail is TWO instructions — 145 ins, and that is the whole −1.
* A block-local `s32 *p = &D_801F76F4;` per arm is enough; the `volatile`
* of ov_SC03_006.c:220's remat lever also matches but is not needed here,
* and §153's integration caution says to gate the PLAIN variant.
* Note the other two D_801F76F4 references (the `= 0` at 80182B4C and the
* `>= 0x71` read at 80182C10) are SINGLE-use and stay folded — do not
* convert them.
*
* (3) `case 1:` and the tail of `case 2:` are the same six-instruction
* func_8017F510 call; gcc cross-jumps them into the shared .L80182C44, so
* write both longhand and let the compiler merge (§88a/§162).
*
* Declarations follow the destination TU: D_801F782C/D_801F76CC as `s32`
* (L7468-7469), D_801F76A8 as `u32` (L7491 — a differing file-scope decl would
* conflict on splice), func_8017F498/func_8017F510 verbatim from L5833/L5847,
* func_8013C9C4 from L1299, D_80126B5E/62/66 as `u16` from L1782/L2722/L2734.
* `(D_800B99DC & 7) + 3` is the same RNG-reseed idiom as ov_SC03_014_o0c.c:2889.
*
* MEASURED: tools/match_one.py -> MATCH (146 ins);
* tools/symcheck.py -> SYMS-OK, 23 symbols agree.
* match_one is the CANDIDATE gate — finish on the whole-binary SHA1.
*/
#include "common.h"
extern u16 D_80126B5E;
extern u16 D_80126B62;
extern u16 D_80126B66;
extern u16 D_800B99DC;
extern s32 D_801F782C;
extern s32 D_801F76CC;
extern s32 D_801F76D0;
extern s32 D_801F76D4;
extern s32 D_801F76D8;
extern s32 D_801F76F4;
extern u32 D_801F76A8;
extern s32 D_801F7848;
extern s32 D_801BA07C;
extern u8 D_8018CD3C[];
extern void func_8013B598(s32 a0, u16 *a1);
extern void func_8013C0F8(s32 a0);
extern void func_8017F498(s32 a0);
extern void func_8017F510(s32 arg0, s32 arg1, s32 arg2);
extern s32 func_80029178(s32 arg);
extern void func_8013C9C4(void *a0);
extern void func_8013CB84(void);
extern void func_80182C8C(void);
extern void func_800D06E8(void);
void func_80182A44(void) {
u16 sp10[3];
sp10[0] = D_80126B5E;
sp10[1] = D_80126B62;
sp10[2] = D_80126B66;
func_8013B598(0, sp10);
switch (D_801F782C) {
case 0:
func_8013C0F8((s32)&D_801BA07C);
func_8017F498((s32)&D_801F76D8);
D_801F782C = D_801F782C + 1;
if ((func_80029178(0x121) & 0xFF) != 0) {
D_801F782C = 3;
}
break;
case 1:
func_8017F510((s32)&D_801F7848, (s32)&D_801BA07C, (s32)&D_801F76D8);
break;
case 2:
if (D_801F76CC != 1) {
if (D_801F76CC >= 2) {
break;
}
if (D_801F76CC != 0) {
break;
}
D_801F76D0 = 0;
D_801F76D4 = 1;
D_801F76F4 = 0;
D_801F76CC = 1;
}
if (--D_801F76D4 == 0) {
func_8013C9C4(D_8018CD3C);
D_801F76D4 = (D_800B99DC & 7) + 3;
}
D_801F76A8 = D_801F76A8 + 0x100;
D_801F76D0 = D_801F76D0 + 1;
if (D_801F76D0 >= 0x39) {
if ((D_801F76D0 & 1) != 0) {
s32 *p = &D_801F76F4;
*p = *p - 1;
} else {
s32 *p = &D_801F76F4;
*p = *p + 2;
}
D_801F76D8 = 0;
if (D_801F76F4 >= 0x71) {
D_801F76CC = D_801F76CC + 1;
}
}
func_8017F510((s32)&D_801F7848, (s32)&D_801BA07C, (s32)&D_801F76D8);
break;
}
func_8013CB84();
func_80182C8C();
func_800D06E8();
}
// @class: regalloc-order
+6 -1
View File
@@ -3322,7 +3322,12 @@ DEFINE_func_8017BEAC() /* dedup: shared engine-core @0x8017BEAC (src/shared) */
DEFINE_func_8017BEB4() /* dedup: shared engine-core @0x8017BEB4 (src/shared) */
INCLUDE_ASM("asm/ov_SC03_011/nonmatchings/ov_SC03_011_jr_8017AE2C", func_8017BEBC);
extern s32 func_80146994(s32 a0, s32 a1, s32 a2, s32 a3);
void func_8017BEBC(s32 arg0, s32 arg1) {
func_80146994(0x29, 0, arg0, arg1);
}
extern s32 D_80126B58;
extern s32 func_8014C050(s32 a0, s32 a1);
+77 -3
View File
@@ -4868,7 +4868,43 @@ void func_8017FC44(s32 a0)
void func_8017FD28(void) {
}
INCLUDE_ASM("asm/ov_SC03_011/nonmatchings/ov_SC03_011_jr_8017C730", func_8017FD30);
void func_8017FD30(s32 param_1)
{
s16 sVar1;
s32 iVar2;
s16 sVar3;
if (*(s32 *)(param_1 + 0x1C) == 0) {
if (*(s16 *)(param_1 + 0x84) == 0) {
func_8002D4C8(0x54F, 0);
*(s16 *)(param_1 + 0x84) = 1;
}
*(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) =
*(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) & 0xFFF;
sVar1 = *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10);
if ((sVar1 != 0) && (sVar1 < 0xC01)) {
*(s16 *)(param_1 + 2) = 1;
*(s16 *)(param_1 + 0x84) = 0;
} else {
if (*(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) == 0xF70) {
*(s32 *)(param_1 + 0x1C) = 0xA;
}
iVar2 = *(s32 *)(param_1 + 0x20);
sVar1 = *(s16 *)(iVar2 + 0x10);
sVar3 = sVar1;
if (sVar1 < 0xF81) {
*(s16 *)(iVar2 + 0x10) = sVar3 + -0x10;
} else {
*(s16 *)(iVar2 + 0x10) = sVar3 + -0x40;
}
}
} else {
*(s32 *)(param_1 + 0x1C) = *(s32 *)(param_1 + 0x1C) + -1;
*(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) =
*(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) + 4;
}
}
void func_8017FE30(s32 a0) {
u8 *p;
@@ -4912,7 +4948,34 @@ void func_8017FEF8(int param_1)
}
INCLUDE_ASM("asm/ov_SC03_011/nonmatchings/ov_SC03_011_jr_8017C730", func_8017FF48);
#include "common.h"
extern s32 func_80029504(void);
extern void func_8012C194(void);
extern u8 D_80185500;
extern void func_8001CB6C(u8 *a0, s32 a1, s32 a2, s32 a3);
extern s32 func_80029178(s32 a0);
extern s32 func_8012AD50(void *a0);
void func_8017FF48(s32 a0) {
s32 s1;
s32 s0;
s1 = func_80029504();
s0 = ((s32 (*)(void))func_8012C194)();
if (s0 != 0) {
*(s32 *)(a0 + 0x20) = s0;
func_8001CB6C((u8 *)s0, (s32)&D_80185500, 0x2F0, 0x198);
*(u8 *)(s0 + 0x27) = 0x3C;
if ((u32)(s1 - 0x3B6) < 0x32) {
if ((func_80029178(0xBD) & 0xFF) == 0) {
*(s32 *)(s0 + 4) |= 0x80000000;
}
}
func_8012AD50((void *)a0);
}
}
extern s32 func_80029504(void);
extern s32 func_80029178(s32 a0);
@@ -5109,7 +5172,18 @@ void func_801803B0(void) {
void func_80180414(void) {
}
INCLUDE_ASM("asm/ov_SC03_011/nonmatchings/ov_SC03_011_jr_8017C730", func_8018041C);
extern void func_8012E88C(u8 *a0);
extern void func_8012A828(s32 a0, void *a1);
extern void func_80178CBC(s32 arg0, s32 arg1);
extern u8 D_8018570C;
void func_8018041C(void *a0) {
*(u16 *)((s32)a0 + 2) = 3;
func_8012E88C((u8 *)a0);
func_8012A828((s32)a0, *(void **)((u8 *)*(s32 *)((u8 *)a0 + 0xD0) + 8));
func_80178CBC((s32)a0, (s32)&D_8018570C);
}
extern int func_80178970(void);
extern void func_80029124(s32, s32);
+96 -1
View File
@@ -4605,7 +4605,102 @@ void func_8018150C(s32 a0) {
}
INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_8017DF98", func_80181850);
#include "common.h"
extern void func_8012A828(s32 a0, void *a1);
extern void func_8012B23C(s32 a0);
extern void func_8002D4C8(s32 a0, s32 a1);
extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3);
extern s32 func_8004787C(s32 a0);
extern s32 func_80047948(s32 a0);
extern s32 func_8012C658(s32 a0, s32 a1, s32 a2);
extern void func_80180B44(s32);
extern void func_80184E9C(s32 a0, s32 a1, s32 a2);
extern u16 D_80126B96;
extern u8 D_80126B5C;
extern s32 D_80126B64;
extern u8 D_801ADC24[];
extern u8 D_801AE824[];
extern u8 D_8018F8E4[];
extern s16 D_8018F970;
extern s16 D_8018F978;
extern s8 D_8018F980[];
extern s16 D_8018F988;
typedef struct { s16 vx, vy, vz, pad; } SV_80181850;
void func_80181850(s32 a0) {
SV_80181850 sp10;
s32 i;
s32 prim;
u16 t;
if (*(s16 *)(a0 + 0xDE) >= 0x1000) {
t = *(u16 *)(a0 + 0x34);
*(s16 *)(a0 + 2) = t;
if (t == 0x16) {
func_8012A828(a0, D_801AE824);
func_8012B23C(a0);
*(s16 *)(a0 + 0x16) = -0x1E;
*(s32 *)(a0 + 0x10) = (*(s32 *)&D_80126B5C - *(s32 *)(a0 + 4)) >> 5;
*(s32 *)(a0 + 0x18) = (D_80126B64 - *(s32 *)(a0 + 0xC)) >> 5;
*(s32 *)(a0 + 0x58) = (s32)D_8018F8E4 | 0x40000000 | 0x20000000;
} else {
func_8012A828(a0, D_801ADC24);
*(s32 *)(a0 + 0x1C) = 0x14;
}
}
*(u16 *)(a0 + 0x84) = *(u16 *)(a0 + 0x84) + 1;
if (*(s16 *)(a0 + 0x84) == 0xF) {
((void (*)(s32, s32))func_80180B44)(a0, 7);
func_8002D4C8(0x55D, 0);
}
if (*(s16 *)(a0 + 0x84) == 0x23) {
((void (*)(s32, s32))func_80180B44)(a0, 7);
func_8002D4C8(0x55D, 0);
}
if (*(s16 *)(a0 + 0x84) == 0x2D) {
func_8002D4C8(0x55E, 0);
func_8012A828(a0, D_801ADC24);
*(s16 *)(a0 + 0x98) = 0;
}
*(s32 *)(a0 + 0x1C) = *(s32 *)(a0 + 0x1C) + 1;
if (*(s32 *)(a0 + 0x1C) > 0x2D) {
*(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) += *(u16 *)(a0 + 0xDC);
*(u16 *)(a0 + 0xDE) += *(u16 *)(a0 + 0xDC);
if (func_8012D5E4(a0, (s32)&D_8018F970, (s32)&D_8018F978, 0x1C) == 1) {
D_80126B96 = 0x400A;
}
func_80184E9C(a0, (s32)&D_8018F970, (s32)&D_8018F978);
if (func_8012D5E4(a0, (s32)&D_8018F970, (s32)D_8018F980, 0x1C) == 1) {
D_80126B96 = 0x400A;
}
func_80184E9C(a0, (s32)&D_8018F970, (s32)D_8018F980);
if (func_8012D5E4(a0, (s32)&D_8018F970, (s32)&D_8018F988, 0x1C) == 1) {
D_80126B96 = 0x400A;
}
func_80184E9C(a0, (s32)&D_8018F970, (s32)&D_8018F988);
sp10.vx = ((u32)(func_8004787C(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12)) * 17)) >> 7;
sp10.vy = 0x10;
sp10.vz = ((u32)(func_80047948(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12)) * 17)) >> 7;
for (i = 0; i < 2; i++) {
prim = func_8012C658(0xFE, 1, a0);
if (prim != 0) {
*(u16 *)(prim + 6) = *(u16 *)(a0 + 6) + (sp10.vx * 5) / 8;
*(u16 *)(prim + 0xE) = *(u16 *)(a0 + 0xE) + (sp10.vz * 5) / 8;
*(s32 *)(prim + 0x10) = *(s32 *)(prim + 0x10) * (sp10.vz << 9);
*(s32 *)(prim + 0x18) = *(s32 *)(prim + 0x18) * -(sp10.vx << 9);
((void (*)(s32, s32))func_80180B44)(prim, 5);
}
}
}
}
extern void func_8012A828(s32 a0, void *a1);
extern s32 func_8012C588(s32 a0, s32 a1);
+16 -2
View File
@@ -3902,7 +3902,15 @@ void func_801748E4(void) {
DEFINE_func_801748EC() /* dedup: shared engine-core @0x801748ec (src/shared) */
INCLUDE_ASM("asm/ov_SC03_107/nonmatchings/ov_SC03_107_jr_80171B4C", func_8017496C);
#include "common.h"
extern void (*D_80185B1C[])(void);
s32 func_8017496C(void *a0)
{
D_80185B1C[*(u8 *)((s32)a0 + 4)]();
}
DEFINE_func_801749A8() /* dedup: shared engine-core @0x801749a8 (src/shared) */
@@ -3966,7 +3974,13 @@ DEFINE_func_80174ED4() /* dedup: shared engine-core @0x80174ed4 (src/shared) */
DEFINE_func_80174EF0() /* dedup: shared engine-core @0x80174ef0 (src/shared) */
INCLUDE_ASM("asm/ov_SC03_107/nonmatchings/ov_SC03_107_jr_80171B4C", func_80174F28);
extern void (*D_80185B28[])(void*);
s32 func_80174F28(void* a0)
{
D_80185B28[*(u8*)((s32)a0 + 0x4)](a0);
}
DEFINE_func_80174F64() /* dedup: shared engine-core @0x80174f64 (src/shared) */
+53 -2
View File
@@ -5876,7 +5876,52 @@ void func_8017CDB0(void) {
}
INCLUDE_ASM("asm/ov_SC03_107/nonmatchings/ov_SC03_107_jr_801789AC", func_8017CDD8);
#include "common.h"
extern s32 D_80126954;
extern s32 D_8012695C;
extern s16 D_80126968;
extern s16 D_8012696A;
extern s16 D_8012696C;
extern s16 D_80126976;
extern s16 D_80126978;
extern s16 D_8012697A;
extern s16 D_80126960;
extern s16 D_80126962;
extern u16 D_801269E8;
extern u16 D_801269EA;
extern u8 D_80126948[];
extern s16 D_80126940;
extern s16 D_801274E8;
extern Blk8 D_801274F0;
extern void func_8012A018(s32 a0, s32 a1);
extern void func_8012A094(s32 a0);
extern void func_8017CF0C(void *a0);
void func_8017CDD8(void) {
D_80126954 = 0x190;
D_8012695C = 0x258;
D_80126968 = 0x71;
D_8012696A = 0xC00;
D_8012696C = 0;
D_80126976 = 0;
D_80126978 = -0x32;
D_8012697A = 0;
func_8012A018((s32)func_8017CF0C, 0);
*(Blk8 *)&D_801274E8 = *(Blk8 *)&D_80126940;
func_8012A094((s32)D_80126948);
func_8017CF0C(D_80126948);
func_8012A094((s32)D_80126948);
*(Blk8 *)&D_801274E8 = D_801274F0;
D_80126968 = D_801269E8;
D_80126960 = D_801269E8;
D_8012696A = D_801269EA;
D_80126962 = D_801269EA;
}
@@ -5938,7 +5983,13 @@ void func_8017D280(s32 param_1, s16 *param_2) {
}
INCLUDE_ASM("asm/ov_SC03_107/nonmatchings/ov_SC03_107_jr_801789AC", func_8017D418);
s32 func_8017D418(s16 *arg0, s16 *arg1) {
if (arg0[0] < arg1[0] || arg1[1] < arg0[0] || arg0[2] < arg1[2]) {
return 0;
}
return arg1[3] >= arg0[2];
}
void func_8017D474(s32 a0, s32 a1, s32 a2) {
*(u16 *)(a0 + 0xA0) = *(u16 *)(a2 + 8);
+91 -4
View File
@@ -4436,7 +4436,30 @@ extern s32 func_8012AD50(void *a0);
void func_80181028(void) {
}
INCLUDE_ASM("asm/ov_SC03_116/nonmatchings/ov_SC03_116_jr_8017AE2C", func_80181030);
extern void func_801812AC(s32 a0, void *a1, void *a2, s32 a3, s32 a4);
extern u16 D_8018631C[];
extern void func_8002D4C8(s32 a0, s32 a1);
extern s32 func_8012AD50(void *a0);
void func_80181030(s32 a0)
{
s16 buf[2];
s32 color;
color = 0x4020F0;
*(u16 *)(a0 + 0xFC) = *(u16 *)(a0 + 0xFC) + 1;
buf[0] = 0;
buf[1] = *(u16 *)(a0 + 0xFC);
func_801812AC(a0, buf, D_8018631C, 1, color);
if (*(s16 *)(a0 + 0xFC) >= 0x20) {
*(u16 *)(a0 + 0xFE) = 1;
*(u16 *)(a0 + 0x100) = 0;
func_8002D4C8(4, 0xA27);
func_8002D4C8(0xA28, 0);
func_8012AD50((void *)a0);
}
}
extern s32 func_8012AD50(void *a0);
extern void func_8012BF4C(s32 *a0, s32 a1);
@@ -4492,7 +4515,42 @@ void func_8018117C(s32 a0)
}
INCLUDE_ASM("asm/ov_SC03_116/nonmatchings/ov_SC03_116_jr_8017AE2C", func_80181204);
extern void func_8012C098(void *param_1);
extern void func_801812AC(s32 a0, void *a1, void *a2, s32 a3, s32 a4);
extern u16 D_8018631C[];
void func_80181204(s32 a0)
{
s16 buf[2];
u8 comp[4];
s32 t;
u8 m;
s32 color;
t = *(u16 *)(a0 + 0x100) - 8;
*(u16 *)(a0 + 0x100) = t;
m = (u8)t;
comp[0] = t;
if (m != 0) {
if (comp[0] < 0x20) {
comp[1] = comp[0];
} else {
comp[1] = 0x20;
}
if (comp[0] < 0x40) {
comp[2] = comp[0];
} else {
comp[2] = 0x40;
}
buf[0] = 0;
buf[1] = 0x20;
color = *(s32 *)comp;
func_801812AC(a0, buf, D_8018631C, 0, color);
} else {
func_8012C098((void *)a0);
}
}
extern s32 func_80017758(void *a0, void *a1);
extern s32 func_80017DC4(void *a0, void *a1);
@@ -4570,9 +4628,38 @@ void func_801814B0(void *a0) {
}
INCLUDE_ASM("asm/ov_SC03_116/nonmatchings/ov_SC03_116_jr_8017AE2C", func_801814EC);
void func_801814EC(void *a0)
{
extern s32 func_8012C194(void);
extern void func_8001CF00(s32 a0);
extern void func_8012C098(void *param_1);
extern s32 func_8012AD50(void *a0);
s32 iVar1;
iVar1 = func_8012C194();
*(s32 *)((s32)a0 + 0x20) = iVar1;
if (iVar1 != 0) {
func_8001CF00(iVar1);
*(s16 *)((s32)a0 + 0xA) = -0x100;
*(s16 *)((s32)a0 + 0x6) = 0;
*(s16 *)((s32)a0 + 0xE) = 0x1EC0;
func_8012AD50(a0);
} else {
func_8012C098(a0);
}
}
void func_80181550(void *a0)
{
extern void func_8012AD44(s32 *a0, s16 a1);
if (*(s16 *)((s32)a0 + 0x70) != 0) {
func_8012AD44((s32 *)a0, 6);
}
}
INCLUDE_ASM("asm/ov_SC03_116/nonmatchings/ov_SC03_116_jr_8017AE2C", func_80181550);
#include "common.h"
+25 -2
View File
@@ -3329,7 +3329,18 @@ void func_8017BF20(void *a0) {
}
INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017BF58);
extern void func_80183228(void *a0);
extern void func_80171A1C(u8 *a0);
extern s32 func_80174650(s32 a0);
void func_8017BF58(void *a0) {
if (((s32 (*)(void *))func_80183228)(a0) == 0) {
return;
}
func_80171A1C(a0);
func_80174650((s32)a0);
}
DEFINE_func_8017BF98() /* dedup: shared engine-core @0x8017BF98 (src/shared) */
@@ -3353,7 +3364,19 @@ void func_8017C004(void *a0) {
}
INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017C03C);
extern s32 func_801831D0(void *a0);
extern void func_80171A1C(u8 *a0);
extern s32 func_80174650(s32 a0);
void func_8017C03C(void *a0) {
s32 s0 = (s32)a0;
if (func_801831D0(a0) == 0) {
return;
}
func_80171A1C((u8 *)s0);
func_80174650(s0);
}
DEFINE_func_8017C07C() /* dedup: shared engine-core @0x8017C07C (src/shared) */
+58 -2
View File
@@ -3881,7 +3881,58 @@ s32 func_8018219C(s32 arg0)
}
INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017FB84", func_8018226C);
extern void func_8001CA1C(s32, s32);
extern s32 func_80143970(s32 a0);
extern void func_8012AD44(s32 *a0, s16 a1);
extern u8 D_8018DE80;
extern void func_801851C8(s32 a0);
extern void func_80182910(void *a0);
extern void func_80185C08(void);
extern void func_80185C2C(s32 a0);
void func_8018226C(s32 a0)
{
register s32 self __asm__("$17") = a0;
s32 s0;
s32 q;
u16 *p;
s32 t;
s0 = *(s32 *)(self + 0x20);
((void (*)(void *, void *))func_8001CA1C)((void *)s0, &D_8018DE80);
*(u16 *)(self + 0x6) = *(u16 *)(self + 0x6) - 0x10;
*(u16 *)(self + 0xA) = *(u16 *)(self + 0xA) - 0xA0;
*(u16 *)(s0 + 0x18) = 0x2C00;
*(u16 *)(s0 + 0x1A) = 0x1C00;
*(u32 *)(s0 + 0x4) = *(u32 *)(s0 + 0x4) | 0x1000000;
p = *(u16 **)(self + 0xCC);
*p = 0;
*(s32 *)(self + 0xCC) = func_80143970(self);
*(s32 *)(self + 0x14) = -0x80000;
*(u16 *)(self + 0x5C) = 0;
*(s32 *)(self + 0x1C) = 8;
func_8012AD44((s32 *)self, 3);
s0 = *(s32 *)(self + 0x64);
q = *(s32 *)(s0 + 0x20);
*(u32 *)(q + 0x4) = *(u32 *)(q + 0x4) | 0x80000000;
func_801851C8(s0);
*(u16 *)(s0 + 0x5C) = 0;
func_8012AD44((s32 *)s0, 2);
t = *(s32 *)(self + 0xD0);
if (t != 0) {
*(u16 *)(t + 0x2C) = 0;
func_80182910((void *)t);
}
func_80185C08();
func_80185C2C(self + 0x4);
func_8002D4C8(0x74C, 0);
}
extern u8 D_8018DF4C;
extern s32 func_8012A828(void*, void*);
@@ -3967,7 +4018,12 @@ void func_801824A0(int a0)
}
INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017FB84", func_80182550);
extern void func_8012AD44(s32 *a0, s16 a1);
void func_80182550(void *arg0) {
func_8012AD44((s32 *)arg0, 8);
}
extern s32 func_801831D0(void);
void func_80182570(void) {
+111 -1
View File
@@ -11167,7 +11167,117 @@ void func_8018A488(void *a0) {
}
INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018A4C4);
/* func_8018A4C4 — ov_SC04_011, TU src/ov_SC04_011/ov_SC04_011_jr_8017D494.c
*
* Spawn/init dispatcher keyed on ent->0x70: below 0x10 it reads an 8-byte record
* out of D_80194A98 (f0/f2/f4 = s16 offsets, f6 = u16 flag word); at 0x10 and
* above everything is randomised. Sibling shape: func_8018A8EC (same TU, L11255)
* and func_8018A1B4 (L11083) — declarations copied VERBATIM from those blocks
* (func_8012C1B8 / func_8012CAE4 / func_8001C214 / func_8012B23C / func_8012AD50
* / rand / D_801948F0). D_80194A98 is new: typed u8[] and indexed by byte offset,
* the TU's own spelling for a strided record block (cf. `extern u8 D_801E5810[];`).
*
* TWO byte-required levers, both regalloc/schedule, neither reachable by pins:
*
* 1. §48-A2, THE LOCAL-ALLOC $s0 OCCUPANT — `tbl` is declared INSIDE the if-arm.
* That makes it a single-block, call-crossing quantity, so LOCAL-alloc parks it
* in $s0 before global-alloc runs. Every global allocno that is live in that
* block (the ent copy, the object pointer) then conflicts with $s0 and rotates
* onto $s1/$s2, while `s0` — dead in the if-arm — is free to share $s0 with it.
* That is what produces `addu $s2,$v0,$zero / addu $s0,$s2,$zero` at entry and
* `sll $s0,$v1,3 / addu $s0,$s0,$v0` at the table. Hoisting `tbl` to function
* scope (one variable for both roles) swaps $s0<->$s2 everywhere and additionally
* lets dbr steal the beqz delay slot. With `tbl` block-scoped the match is
* PIN-FREE; six pin combinations over $16/$17/$18 were tried first and every one
* cost 2-4 instructions (a hard-reg local cannot be the destination of a
* two-operand add, so `s0 += base` always buys a temp plus a `move`).
*
* 2. §31 STATEMENT ORDER — `ent->0x1C = (s16)ent->0x70` is written LAST, after the
* 0x18 store, even though the target emits its `sw` BEFORE the 0x18 chain. Put it
* third (its emission position) and sched2 hoists the whole statement above the
* 0x14 store and then has nothing left to fill the `lh 0x4($s0)` load delay: +1 nop.
* Written last, its `lh`/`sw` pair is exactly the filler for the two load delays,
* and the trailing 0x18 store is what cross_jump merges into the join block's
* `jal rand` delay slot. Do not pre-schedule for gcc.
*/
extern s32 D_801948F0[];
extern u8 D_80194A98[];
extern s32 func_8012C1B8(void);
extern void func_8012CAE4(void *a0);
extern void func_8001C214(s32 a0, s32 a1);
extern void func_8012B23C(s32 a0);
extern s32 func_8012AD50(void *a0);
extern s32 rand(void);
void func_8018A4C4(void *a0)
{
s32 ent = (s32)a0;
s32 v0;
s32 s0;
v0 = func_8012C1B8();
s0 = v0;
*(s32 *)(ent + 0x20) = v0;
if (v0 == 0) {
func_8012CAE4((void *)ent);
return;
}
if (*(s16 *)(ent + 0x70) < 0x10) {
s32 tbl = (s32)&D_80194A98[*(s16 *)(ent + 0x70) * 8];
u16 idx;
u16 flags;
u16 merged;
idx = *(u16 *)(tbl + 0x6) & 7;
*(u16 *)(ent + 0xFE) = idx;
func_8001C214(v0, D_801948F0[idx]);
flags = *(u16 *)(tbl + 0x6) & 0xFFF0;
merged = *(u16 *)(v0 + 0x2C) | 0x10;
*(u16 *)(v0 + 0x1C) = flags;
*(u16 *)(v0 + 0x1A) = flags;
*(u16 *)(v0 + 0x18) = flags;
*(u16 *)(v0 + 0x2C) = merged;
*(u16 *)(ent + 0x6) = *(u16 *)(*(s32 *)(ent + 0x64) + 0x6) + *(u16 *)(tbl + 0x0);
*(u16 *)(ent + 0xA) = *(u16 *)(*(s32 *)(ent + 0x64) + 0xA) + *(u16 *)(tbl + 0x2);
*(u16 *)(ent + 0xE) = *(u16 *)(*(s32 *)(ent + 0x64) + 0xE) + *(u16 *)(tbl + 0x4);
func_8012B23C(ent);
*(s32 *)(ent + 0x10) = *(s16 *)(tbl + 0x0) * 3 << 10;
*(s32 *)(ent + 0x14) = (*(s16 *)(tbl + 0x2) << 12) - 0x80000;
*(s32 *)(ent + 0x18) = *(s16 *)(tbl + 0x4) * 3 << 10;
*(s32 *)(ent + 0x1C) = *(s16 *)(ent + 0x70);
} else {
u16 merged;
func_8001C214(s0, D_801948F0[rand() & 3]);
merged = *(u16 *)(s0 + 0x2C) | 0x10;
*(u16 *)(s0 + 0x1C) = 0x600;
*(u16 *)(s0 + 0x1A) = 0x600;
*(u16 *)(s0 + 0x18) = 0x600;
*(u16 *)(s0 + 0x2C) = merged;
*(u16 *)(ent + 0x6) = *(u16 *)(*(s32 *)(ent + 0x64) + 0x6) + (rand() & 0x7F) - 0x40;
*(u16 *)(ent + 0xA) = *(u16 *)(*(s32 *)(ent + 0x64) + 0xA) + (rand() & 0x7F) - 0x40;
*(u16 *)(ent + 0xE) = *(u16 *)(*(s32 *)(ent + 0x64) + 0xE) + (rand() & 0x7F) - 0x40;
func_8012B23C(ent);
*(s32 *)(ent + 0x10) = *(s32 *)(*(s32 *)(ent + 0x64) + 0x10) * 4 / 3;
*(s32 *)(ent + 0x14) = *(s32 *)(*(s32 *)(ent + 0x64) + 0x14) * 4 / 3;
*(s32 *)(ent + 0x18) = *(s32 *)(*(s32 *)(ent + 0x64) + 0x18) * 4 / 3;
}
*(u16 *)(ent + 0x106) = rand() & 0xF0;
*(u16 *)(ent + 0x108) = rand() & 0xF0;
func_8012AD50((void *)ent);
}
extern void (*D_80194B18[])(void);
+100 -5
View File
@@ -4506,7 +4506,37 @@ s32 func_8017DE4C(void *a0) {
}
INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017DEA0);
extern void func_800D1E28(void);
extern void func_8002D4C8(s32 a0, s32 a1);
extern void func_8001BFD0(void);
extern s32 func_800291B4(s32 arg);
extern s32 func_80029504(void);
extern void func_800D0C48(s32 a0);
s32 func_8017DEA0(void *a0)
{
s32 sel;
s32 *p;
sel = func_80029504();
p = (s32 *)((u8 *)a0 + 0x28);
*p = *p - 1;
if (*p == -1) {
func_800D1E28();
func_8002D4C8(0x1C, 0);
func_8001BFD0();
if ((func_800291B4(0xCE) & 0xFF) == 0
&& (u32)(sel - 0x384) >= 0x6E
&& (u32)(sel - 0x460) >= 0x32) {
func_800D0C48(1);
}
(*(u8 *)((u8 *)a0 + 0x15))++;
}
return 0;
}
extern void (*D_80190D28[])(void);
@@ -4635,7 +4665,17 @@ void func_8017E20C(void *a0) {
}
INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017E248);
void func_8017E284(void *a0, u8 *a1);
void func_8017E3C4(s32 param_1);
void func_8017E248(void *a0)
{
s32 pad[2];
func_8017E284(a0, (u8 *)((s32)a0 + 0xA0));
func_8017E3C4((s32)a0);
}
void func_8017E27C(u8 *a0) {
*(s8 *)(a0 + 0xA0) = 0;
@@ -4990,7 +5030,25 @@ void func_8017E92C(s32 a0) {
}
INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017EA6C);
void func_8017EA6C(s32 a0) {
extern void func_8012E8E0(s32, s32);
extern void func_8012E88C(s32);
extern void func_8012A828(s32, s32);
extern void func_80184990(s32);
extern void func_80184BD4(s32, s32, s32, s32);
extern s16 D_80191228;
extern s32 D_801B9DB4;
extern u8 D_801B6714[];
*(u16 *)(a0 + 0x2) = 0xA;
*(u16 *)(a0 + 0x34) = 0;
func_8012E8E0(a0, (s32)&D_80191228);
func_8012E88C(a0);
func_8012A828(a0, (s32)&D_801B9DB4);
func_80184990(a0);
func_80184BD4(a0, (s32)&D_801B6714, 1, 0x60);
}
extern void func_8012E8E0(s32 a0, s32 a1);
extern void func_8012E8A8(u8 *a0);
@@ -5045,7 +5103,7 @@ extern void func_80184BD4(s32, s32, s32, s32);
extern void func_801849B8(s32 *a0, s32 a1);
extern void func_80185CB8(s32 a0, s32 a1, s32 a2);
extern s32 func_801788B8(s32 arg0, s32 arg1);
extern void func_8017EE10(void);
extern s32 func_8017EE10();
void func_8017EB30(void *a0) {
@@ -5158,7 +5216,44 @@ extern s32 func_80029178(s32 arg);
}
INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017EE10);
#include "common.h"
extern s32 func_8012BD14(s32 a0);
extern s32 func_80178BF8();
extern void func_80172710(void);
s32 func_8017EE10(void *a0)
{
s32 p;
register s32 p2 __asm__("$3");
u16 st;
p = *(s32 *)((s32)a0 + 0x64);
st = *(u16 *)(p + 0x2);
switch (st) {
case 3:
if (func_8012BD14(p) > 0x4000) {
return 0;
}
p2 = *(s32 *)((s32)a0 + 0x64);
*(u16 *)(p2 + 0x2) += 1;
break;
case 9:
if (func_8012BD14(p) > 0x4000) {
return 0;
}
p2 = *(s32 *)((s32)a0 + 0x64);
*(u16 *)(p2 + 0x34) += 1;
break;
default:
return 0;
}
func_80178BF8();
return (s32)func_80172710;
}
extern s32 func_801848AC(s32 arg0, s32 arg1);
extern s16 func_80184B44(void);
+1 -1
View File
@@ -2775,7 +2775,7 @@ extern s32 func_801848AC(s32 arg0, s32 arg1);
extern void func_8012E88C(s32 a0);
extern void func_801849B8(s32 *a0, s32 a1);
extern void func_80185CB8(s32 a0, s32 a1, s32 a2);
extern void func_8017EE10(void);
extern s32 func_8017EE10();
extern void func_8017EB30(void *a0);
extern void (*D_801912B8[])(void);
extern void func_8017ED1C(void *a0);
+1 -1
View File
@@ -2761,7 +2761,7 @@ extern void func_8012E8A8(u8 *a0);
extern void func_801849B0(void *a0);
extern void func_801849B8(s32 *a0, s32 a1);
extern void func_80185CB8(s32 a0, s32 a1, s32 a2);
extern void func_8017EE10(void);
extern s32 func_8017EE10();
extern void func_8017EB30(void *a0);
extern void (*D_801912B8[])(void);
extern void func_8017ED1C(void *a0);
+156 -3
View File
@@ -3859,7 +3859,36 @@ void func_8017F308(void) {
}
INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017DB90", func_8017F3E8);
extern short D_801F85EC[];
extern void (*D_801860E4[])(void *);
extern short D_801F80A4;
extern short D_801F80A0;
extern void func_8013C9C4(void *a0);
extern int D_801860DC;
void func_8017F3E8(void)
{
short *psVar1;
int iVar2;
psVar1 = D_801F85EC;
iVar2 = 0;
do {
if (*psVar1 != 0) {
D_801860E4[*psVar1](psVar1);
}
iVar2 = iVar2 + 1;
psVar1 = psVar1 + 0x2a;
} while (iVar2 < 0xc);
if (D_801F80A4 != 0) {
D_801F80A0 = D_801F80A0 + 1;
if (3 < D_801F80A0) {
D_801F80A0 = 0;
func_8013C9C4(&D_801860DC);
}
}
}
void func_8017F4B8(void) {
}
@@ -4038,7 +4067,107 @@ void func_8017F934(void) {
}
INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017DB90", func_8017FA2C);
/* func_8017FA2C — ov_SC06_006, TU src/ov_SC06_006/ov_SC06_006_jr_8017DB90.c
*
* Draws two 3-point strips (XY pass from D_8018636C, XZ pass from D_80186380) through
* func_80017758, using the matrix func_8017FD4C builds into the 32-byte sp+0x10 buffer.
*
* Key lever (the ONLY thing that separated a 198-ins near from the 200-ins match):
* `p.c[1].b = (D_800B99DA & 1) ? 0x58 : 0x48;` compiles to the if-converted form
* (`li v1,0x48` hoisted above the branch, then the >>2 taken from the REGISTER) — two
* instructions short. Writing it as an explicit if/else that STORES in each arm gives the
* target's cross-jumped shape: `beqz .L74 / j .L78 (delay: li 0x58) / .L74: li 0x48 /
* .L78: sb 0x56(sp)` followed by a genuine `lbu 0x56(sp)` reload. Cookbook: store-in-both-
* arms defeats the constant CSE that a ternary into memory enables.
*
* Other shapes read straight off the .s:
* - chained assignments (`a = b = c = 0`) evaluate right-to-left, which is why every
* zero-group stores its HIGHEST offset first (0x4C,0x44,0x34 / 0x5E,0x5D,0x5C ...);
* - each loop body reads six bytes with `*q++` and then `q -= 2`; gcc folds the sixth
* increment into the subtraction and emits the single `addiu $s0,$s0,-1`;
* - `s16 i` gives the addiu/move/sll/sra/slti counter idiom on both do-whiles.
*/
typedef struct { s16 vx, vy, vz, pad; } Sv_8017FA2C;
typedef struct { u8 r, g, b, cd; } Cv_8017FA2C;
typedef struct {
Sv_8017FA2C v[4]; /* 0x00 */
Cv_8017FA2C c[4]; /* 0x20 */
u32 code; /* 0x30 */
} Prim_8017FA2C;
extern u16 D_800B99DA;
extern s32 D_801F8090;
extern s8 D_8018636C[];
extern s8 D_80186380[];
extern s32 func_80029178(s32);
extern s32 func_80017758(void *a0, void *a1);
extern void func_8017FD4C(s32 param_1, s16 *param_2, s16 *param_3, void *param_4);
void func_8017FA2C(s32 param_1, s16 *param_2, s16 *param_3) {
u8 sp10[32];
Prim_8017FA2C p;
s8 *q;
s16 i;
func_8017FD4C(param_1, param_2, param_3, sp10);
p.v[0].vz = p.v[2].vz = p.v[3].vz = 0;
p.v[1].vx = p.v[1].vy = p.v[1].vz = 0;
if (D_800B99DA & 1) {
p.c[1].b = 0x58;
} else {
p.c[1].b = 0x48;
}
p.c[1].r = p.c[1].g = p.c[1].b >> 2;
if ((u8)func_80029178(0x81)) {
p.c[1].g <<= 2;
p.c[1].b >>= 1;
}
q = D_8018636C;
i = 0;
p.c[0].r = p.c[0].g = p.c[0].b = 0;
p.c[2].r = p.c[2].g = p.c[2].b = 0;
p.c[3].r = p.c[3].g = p.c[3].b = 0;
p.code = 0x50000000;
do {
p.v[0].vx = (*q++ * D_801F8090) >> 12;
p.v[0].vy = (*q++ * D_801F8090) >> 12;
p.v[2].vx = (*q++ * D_801F8090) >> 12;
p.v[2].vy = (*q++ * D_801F8090) >> 12;
p.v[3].vx = (*q++ * D_801F8090) >> 12;
p.v[3].vy = (*q++ * D_801F8090) >> 12;
q -= 2;
func_80017758(&p, sp10);
i++;
} while (i < 4);
p.v[1].vz = -0x12;
q = D_80186380;
i = 0;
p.v[0].vy = p.v[2].vy = p.v[3].vy = 0;
p.v[1].vx = p.v[1].vy = 0;
p.c[1].b <<= 1;
p.c[1].r = p.c[1].g = p.c[1].g << 1;
do {
p.v[0].vx = (*q++ * D_801F8090) >> 12;
p.v[0].vz = (*q++ * D_801F8090) >> 12;
p.v[2].vx = (*q++ * D_801F8090) >> 12;
p.v[2].vz = (*q++ * D_801F8090) >> 12;
p.v[3].vx = (*q++ * D_801F8090) >> 12;
p.v[3].vz = (*q++ * D_801F8090) >> 12;
q -= 2;
if (i == 2) {
p.c[3].b = p.c[1].b;
p.c[3].r = p.c[3].g = p.c[1].r;
} else if (i == 3) {
p.c[3].r = p.c[3].g = p.c[3].b = 0;
p.c[0].b = p.c[1].b;
p.c[0].r = p.c[0].g = p.c[1].r;
}
func_80017758(&p, sp10);
i++;
} while (i < 4);
}
extern s32 D_801269A4;
extern s32 D_801269A8;
@@ -4272,7 +4401,31 @@ void func_801802A0(s32 arg0, s32 arg1, s32 arg2, s32 arg3)
}
INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017DB90", func_801802E0);
#include "common.h"
extern void func_8012E8A8(u8 *a0);
extern u8 *D_801F80AC[];
void func_801802E0(s32 *arg0) {
s32 i;
u8 **p;
u8 *obj;
i = 0;
p = D_801F80AC;
do {
obj = *p;
p++;
i++;
func_8012E8A8(obj);
*(s16 *)(obj + 0x98) = 0;
*(s16 *)(obj + 0x34) = 0;
*(s32 *)(obj + 4) = 0;
*(s32 *)(obj + 8) = 0;
*(s32 *)(obj + 0xC) = 0;
} while (i < 0x1B);
}
extern void func_80180390(void);
extern s32 D_801F8084;
+77 -3
View File
@@ -4958,7 +4958,27 @@ void func_80181D94(s32 param_1)
INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_80181DF8);
INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_80182334);
s32 func_80182334(s32 a0)
{
typedef struct { u16 x; s16 y; s16 z; u16 pad; s32 w1, w2; } Ent_801DFBF8; /* 0x10 */
extern Ent_801DFBF8 D_801DFBF8[];
Ent_801DFBF8 *e;
s32 i;
e = &D_801DFBF8[*(s16 *)(a0 + 0x70) * 4];
i = 0;
do {
i++;
e->x = 0;
e->y = -0x170;
e->z = -0x178;
e->w1 = 0;
e->w2 = 0;
e++;
} while (i < 4);
}
#include "common.h"
@@ -5192,7 +5212,42 @@ void func_801827D0(void *a0) {
}
INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8018280C);
extern s32 func_8012C1B8(void);
extern void func_8012CAE4(void *a0);
extern void func_8001C214(s32 a0, s32 a1);
extern void func_8001D0E8(s32 a0, s32 a1, s32 a2);
extern s32 D_8019EA7C[];
extern u8 D_80190808[];
extern void func_80182BC8();
void func_8018280C(s32 param_1) {
s32 v0;
v0 = func_8012C1B8();
*(s32 *)(param_1 + 0x20) = v0;
if (v0 == 0) {
func_8012CAE4((void *)param_1);
return;
}
*(s32 *)(param_1 + 0xF4) = D_8019EA7C[0];
*(s32 *)(param_1 + 0xF8) = 0;
func_8001C214(*(s32 *)(param_1 + 0x20), param_1 + 0xF4);
func_8001D0E8(*(s32 *)(param_1 + 0x20), 0x7FFF, 0x7FFF);
*(s32 *)(*(s32 *)(param_1 + 0x20) + 0x20) =
(s32)&D_80190808[(*(u16 *)(param_1 + 0x70) & 0xF) * 12];
*(u16 *)(param_1 + 0x5C) = 0xC800;
*(s32 *)(param_1 + 0x58) = (param_1 + 0xFC) | 0x50000000;
func_80182BC8((void *)param_1);
*(u8 *)(param_1 + 0x75) = 0;
*(u16 *)(param_1 + 0x34) = 0;
*(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1;
*(s32 *)(param_1 + 0xEC) = *(s16 *)(*(s32 *)(param_1 + 0x64) + 0x36);
}
#include "common.h"
@@ -5457,7 +5512,26 @@ void func_80182DB0(void *a0) {
INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_80182ED8);
INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_801833FC);
#include "common.h"
extern void func_80016714(void *a0, s32 a1);
extern void func_8012C218(void *a0);
extern void *D_801DFDD4[][8];
void func_801833FC(void *a0) {
void **slot;
s32 i;
slot = D_801DFDD4[*(s16 *)((s32)a0 + 0x70)];
for (i = 0; i < 8; i++) {
if (*slot != NULL) {
func_80016714(*slot, 0x38);
}
slot++;
}
func_8012C218(a0);
}
extern void *D_801DFDD4[][8];
+53 -3
View File
@@ -5873,7 +5873,21 @@ void func_80180674(s32 a0, s16 a1) {
}
INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_8017AE2C", func_80180694);
extern s16 D_801A924C;
extern s16 D_801A924E;
extern s16 D_801A9250;
void func_80180694(s32 _arg0)
{
s16 *p = &D_801A924C;
*p += -8;
if (*p < -0xFF) {
*p = -0xFF;
}
D_801A9250 = *p;
D_801A924E = *p;
}
extern void func_8012C1B8(void);
extern void func_8012CAE4(void *a0);
@@ -5907,7 +5921,34 @@ void func_801806E0(void *a0) {
}
INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_8017AE2C", func_8018078C);
extern s32 func_8017DCC8(void);
extern s32 func_8012AD50(void *a0);
extern u8 D_801A9260;
extern u8 D_801A9261;
extern u8 D_801A9262;
extern u8 D_801A9270;
extern u8 D_801A9272;
extern u8 D_801A9282;
extern u8 D_801A9290;
void func_8018078C(void *a0) {
s32 *s0 = *(s32 **)((s32)a0 + 0x20);
if (func_8017DCC8() == 6) {
*(s32 *)((s32)s0 + 4) &= 0x7FFFFFFF;
func_8012AD50(a0);
D_801A9261 = 0xFF;
D_801A9282 = 0xFF;
D_801A9290 = 0xFF;
D_801A9261 = 0xFF;
D_801A9272 = 0xFF;
D_801A9270 = 0xFF;
D_801A9261 = 0xFF;
D_801A9262 = 0xFF;
D_801A9260 = 0xFF;
}
}
INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_8017AE2C", func_80180834);
@@ -6000,7 +6041,16 @@ void func_80180944(s32 param_1)
}
INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_8017AE2C", func_80180A50);
extern void func_800159E4(s32 a0, s32 a1);
extern void func_8012BF4C(s32 *a0, s32 a1);
void func_80180A50(int param_1)
{
((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10);
*(unsigned short *)(param_1 + 0x100) = *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18);
func_8012BF4C((s32 *)param_1, 0);
}
extern s16 D_80185F50;
extern s16 D_80185F52;