mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-06 17:11:04 -04:00
feat(decomp): parallel gate — 5 fns across 3 binaries (4 workers)
ov_SC02_011 func_80183178 ov_SC01_084 func_80182328 ov_SC03_105 func_801813BC func_80181C84 func_8018624C
This commit is contained in:
+4
-3
@@ -809,7 +809,7 @@ build/src/ov_SC01_084/ov_SC01_084_jr_8015AE2C.o: JTBL_PADS := 0,4 # §8e pads (
|
||||
build/src/ov_SC01_084/ov_SC01_084_jr_8016AB6C.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x20
|
||||
build/src/ov_SC01_084/ov_SC01_084_jr_80178D40.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x178
|
||||
build/src/ov_SC01_084/ov_SC01_084_jr_8017CA80.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x20
|
||||
build/src/ov_SC01_084/ov_SC01_084_jr_8017F690.o: JTBL_PADS := 0,0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x14,+0x28
|
||||
build/src/ov_SC01_084/ov_SC01_084_jr_8017F690.o: JTBL_PADS := 0,0,0,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x14,+0x28,+0x40
|
||||
build/src/ov_SC01_084/ov_SC01_084_o0c.o: JTBL_PADS := 0,4,4,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x38,+0xa8,+0x118
|
||||
ov_SC01_084_CHECK_SHA := config/check.ov_SC01_084.sha
|
||||
ov_SC01_084_SYMBOLS := config/symbols.ov_SC01_084.txt
|
||||
@@ -917,7 +917,7 @@ build/src/ov_SC02_011/ov_SC02_011_jr_8015AE2C.o: JTBL_PADS := 0,4 # §8e pads (
|
||||
build/src/ov_SC02_011/ov_SC02_011_jr_8016AB6C.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x20
|
||||
build/src/ov_SC02_011/ov_SC02_011_jr_80178D40.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x178
|
||||
build/src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.o: JTBL_PADS := 0,0,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x14,+0x2c
|
||||
build/src/ov_SC02_011/ov_SC02_011_jr_80183178.o: JTBL_PADS := 0,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x30
|
||||
build/src/ov_SC02_011/ov_SC02_011_jr_80183178.o: JTBL_PADS := 0,4,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x30,+0x60
|
||||
build/src/ov_SC02_011/ov_SC02_011_jr_80188E3C.o: JTBL_PADS := 0,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x18
|
||||
build/src/ov_SC02_011/ov_SC02_011_o0c.o: JTBL_PADS := 0,4,4,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x38,+0xa8,+0x118
|
||||
ov_SC02_011_CHECK_SHA := config/check.ov_SC02_011.sha
|
||||
@@ -2416,7 +2416,7 @@ ov_SC03_105_ELF := $(ov_SC03_105_OUT).elf
|
||||
ov_SC03_105_MAPFILE := $(ov_SC03_105_OUT).map
|
||||
ov_SC03_105_LD_SCRIPT := $(ov_SC03_105_OUT).ld
|
||||
ov_SC03_105_SPLAT_YAML := config/splat.ov_SC03_105.yaml
|
||||
ov_SC03_105_JTBL_INTERLEAVE := --order tail.data.o,ov_SC03_105.o,ov_SC03_105_jr_8012ACE0.o,tail2.data.o,ov_SC03_105_jr_80135888.o,tail3.data.o,ov_SC03_105_jr_80135A4C.o,tail4.data.o,ov_SC03_105_jr_80135D20.o,tail5.data.o,ov_SC03_105_jr_801380E0.o,ov_SC03_105_o0c.o,tail6.data.o,ov_SC03_105_jr_8013F350.o,tail7.data.o,ov_SC03_105_jr_8013FFD8.o,tail8.data.o,ov_SC03_105_jr_80140608.o,tail9.data.o,ov_SC03_105_jr_8015444C.o,ov_SC03_105_jr_80154C24.o,ov_SC03_105_jr_801588CC.o,ov_SC03_105_jr_80159C84.o,tail10.data.o,ov_SC03_105_jr_8015A3C8.o,tail11.data.o,ov_SC03_105_jr_8015AE2C.o,tail12.data.o,ov_SC03_105_jr_8015C32C.o,tail13.data.o,ov_SC03_105_jr_8016AB6C.o,tail14.data.o,ov_SC03_105_jr_80171B4C.o,ov_SC03_105_jr_801734BC.o,tail15.data.o,ov_SC03_105_jr_801789AC.o,ov_SC03_105_jr_80178D40.o,tail16.data.o,ov_SC03_105_jr_8017A4AC.o,tail17.data.o,ov_SC03_105_jr_8017AE2C.o,tail18.data.o,ov_SC03_105_jr_8017C8D0.o,tail19.data.o,ov_SC03_105_jr_8018624C.o,tail20.data.o,ov_SC03_105_jr_80186B24.o,ov_SC03_105_jr_80186DDC.o,tail21.data.o,ov_SC03_105_jr_80189798.o,tail22.data.o,trailing.o # Phase-26 §8 jtbl-rodata carve
|
||||
ov_SC03_105_JTBL_INTERLEAVE := --order tail.data.o,ov_SC03_105.o,ov_SC03_105_jr_8012ACE0.o,tail2.data.o,ov_SC03_105_jr_80135888.o,tail3.data.o,ov_SC03_105_jr_80135A4C.o,tail4.data.o,ov_SC03_105_jr_80135D20.o,tail5.data.o,ov_SC03_105_jr_801380E0.o,ov_SC03_105_o0c.o,tail6.data.o,ov_SC03_105_jr_8013F350.o,tail7.data.o,ov_SC03_105_jr_8013FFD8.o,tail8.data.o,ov_SC03_105_jr_80140608.o,tail9.data.o,ov_SC03_105_jr_8015444C.o,ov_SC03_105_jr_80154C24.o,ov_SC03_105_jr_801588CC.o,ov_SC03_105_jr_80159C84.o,tail10.data.o,ov_SC03_105_jr_8015A3C8.o,tail11.data.o,ov_SC03_105_jr_8015AE2C.o,tail12.data.o,ov_SC03_105_jr_8015C32C.o,tail13.data.o,ov_SC03_105_jr_8016AB6C.o,tail14.data.o,ov_SC03_105_jr_80171B4C.o,ov_SC03_105_jr_801734BC.o,tail15.data.o,ov_SC03_105_jr_801789AC.o,ov_SC03_105_jr_80178D40.o,tail16.data.o,ov_SC03_105_jr_8017A4AC.o,tail17.data.o,ov_SC03_105_jr_8017AE2C.o,tail18.data.o,ov_SC03_105_jr_8017C8D0.o,tail19.data.o,ov_SC03_105_jr_801813BC.o,tail20.data.o,ov_SC03_105_jr_80181C84.o,tail21.data.o,ov_SC03_105_jr_8018624C.o,tail22.data.o,ov_SC03_105_jr_80186B24.o,ov_SC03_105_jr_80186DDC.o,tail23.data.o,ov_SC03_105_jr_80189798.o,tail24.data.o,trailing.o # Phase-26 §8 jtbl-rodata carve
|
||||
build/src/ov_SC03_105/ov_SC03_105.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x14
|
||||
build/src/ov_SC03_105/ov_SC03_105_jr_8012ACE0.o: JTBL_PADS := 0,0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0xcc,+0xe0
|
||||
build/src/ov_SC03_105/ov_SC03_105_jr_80135D20.o: JTBL_PADS := 0,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x18
|
||||
@@ -2430,6 +2430,7 @@ build/src/ov_SC03_105/ov_SC03_105_jr_8015AE2C.o: JTBL_PADS := 0,4 # §8e pads (
|
||||
build/src/ov_SC03_105/ov_SC03_105_jr_8016AB6C.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x20
|
||||
build/src/ov_SC03_105/ov_SC03_105_jr_80178D40.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x178
|
||||
build/src/ov_SC03_105/ov_SC03_105_jr_8017C8D0.o: JTBL_PADS := 0,0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x20,+0x34
|
||||
build/src/ov_SC03_105/ov_SC03_105_jr_8018624C.o: JTBL_PADS := 0,0 # §8e pads (jtbl_carve.py) tables=+0x0,+0x38
|
||||
build/src/ov_SC03_105/ov_SC03_105_o0c.o: JTBL_PADS := 0,4,4,4 # §8e pads (jtbl_carve.py) tables=+0x0,+0x38,+0xa8,+0x118
|
||||
ov_SC03_105_CHECK_SHA := config/check.ov_SC03_105.sha
|
||||
ov_SC03_105_SYMBOLS := config/symbols.ov_SC03_105.txt
|
||||
|
||||
@@ -172,7 +172,7 @@ segments:
|
||||
- [0x9df28, .rodata, ov_SC01_084_jr_8017CA80] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x9df60, data, tail18]
|
||||
- [0x9df70, .rodata, ov_SC01_084_jr_8017F690] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x9dfac, data, tail19]
|
||||
- [0x9dfc4, data, tail19]
|
||||
- [0x9FA9C, bin, trailing] # final 3 bytes (EOF not 4-aligned; spimdisasm drops a partial word)
|
||||
- [0x9FA9F] # EOF marker = the 0.4.dec byte length
|
||||
# @TRAILING@ (above) is replaced by tools/new_overlay.sh: for a non-4-aligned overlay it becomes
|
||||
|
||||
@@ -173,7 +173,7 @@ segments:
|
||||
- [0xc1c04, data, tail17]
|
||||
- [0xc1c08, .rodata, ov_SC02_011_jr_8017AE2C] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0xc1c48, data, tail18]
|
||||
- [0xc1c88, .rodata, ov_SC02_011_jr_80183178] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0xc1c58, .rodata, ov_SC02_011_jr_80183178] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0xc1cd8, data, tail19]
|
||||
- [0xc1ce4, .rodata, ov_SC02_011_jr_80188E3C] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0xc1d10, data, tail20]
|
||||
|
||||
@@ -121,6 +121,8 @@ segments:
|
||||
- [0x52354, c, ov_SC03_105_jr_8017A4AC]
|
||||
- [0x52cd4, c, ov_SC03_105_jr_8017AE2C]
|
||||
- [0x54778, c, ov_SC03_105_jr_8017C8D0]
|
||||
- [0x59264, c, ov_SC03_105_jr_801813BC]
|
||||
- [0x59b2c, c, ov_SC03_105_jr_80181C84]
|
||||
# S74 split (cookbook §426/§431): jr_8017C8D0 owned raw jtbls in TWO non-adjacent
|
||||
# .rodata spans — 0x801B814C-0x801B822C (func_801806F8/80180ABC/80180EC0/801813BC/
|
||||
# 801818E8/80181C84) and 0x801B8240-0x801B8290 (func_8018624C/801867D0). One object =
|
||||
@@ -173,13 +175,17 @@ segments:
|
||||
- [0x8fe70, data, tail18]
|
||||
- [0x8ffa8, .rodata, ov_SC03_105_jr_8017C8D0] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x8fff4, data, tail19]
|
||||
- [0x90120, .rodata, ov_SC03_105_jr_8018624C] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x90134, data, tail20]
|
||||
- [0x9005c, .rodata, ov_SC03_105_jr_801813BC] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x90088, data, tail20]
|
||||
- [0x900a4, .rodata, ov_SC03_105_jr_80181C84] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x900d4, data, tail21]
|
||||
- [0x900e8, .rodata, ov_SC03_105_jr_8018624C] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x90134, data, tail22]
|
||||
- [0x90138, .rodata, ov_SC03_105_jr_80186B24] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x90160, .rodata, ov_SC03_105_jr_80186DDC] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x90188, data, tail21]
|
||||
- [0x90188, data, tail23]
|
||||
- [0x90190, .rodata, ov_SC03_105_jr_80189798] # Phase-26 §8 jtbl-rodata carve (jtbl_carve.py)
|
||||
- [0x901a4, data, tail22]
|
||||
- [0x901a4, data, tail24]
|
||||
- [0x94BC4, bin, trailing] # final 3 bytes (EOF not 4-aligned; spimdisasm drops a partial word)
|
||||
- [0x94BC7] # EOF marker = the 0.4.dec byte length
|
||||
# @TRAILING@ (above) is replaced by tools/new_overlay.sh: for a non-4-aligned overlay it becomes
|
||||
|
||||
@@ -4604,7 +4604,210 @@ void func_801822A4(void *a0) {
|
||||
}
|
||||
|
||||
|
||||
INCLUDE_ASM("asm/ov_SC01_084/nonmatchings/ov_SC01_084_jr_8017F690", func_80182328);
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
* func_80182328 (ov_SC01_084) -- MATCH.
|
||||
*
|
||||
* Two non-obvious levers, both now in the cookbook backlog:
|
||||
*
|
||||
* 1. BLOCK-SCOPED temporaries for the "reset" body. That body appears THREE
|
||||
* times (case 0's else, case 2, case 4's else); gcc-2.7.2 cross-jumps the
|
||||
* case-0/case-4 copies into one and merges case 2's tail from .L80182658.
|
||||
* With `t/m/y/f/g` declared at FUNCTION scope, one pseudo per variable is
|
||||
* live in several basic blocks, so local-alloc hands them to global-alloc
|
||||
* and the whole block re-allocates ($v1,$a0,$a1 / mflo $t1,$v0). Declaring
|
||||
* them inside each block gives each copy its own single-BB pseudo, which
|
||||
* local-alloc assigns exactly as the target does ($a0,$a1,$v1 / mflo $a2,
|
||||
* $t1). Calibrated against the already-banked twin body in func_80181DEC,
|
||||
* which compiles standalone to $a0/$a1/$v1 -- the "known-true case".
|
||||
* `sp10[3]` stays at function scope: three scopes would mean three stack
|
||||
* slots and a 0x38 frame instead of 0x28.
|
||||
*
|
||||
* 2. `*(u16 *)(p+0x5E) = 0;` must come BEFORE `*(s32 *)(p+0x1C) = 0xA;`.
|
||||
* In case 2 the constant 10 is CSE'd into $s1 (shared with the
|
||||
* `*(s32 *)(p+0x1C) == 0xA` test above), so `sw $s1,0x1C($s0)` has no
|
||||
* in-block dependency and the scheduler keeps it in source order. With
|
||||
* 0x1C first, `sh $zero,0x5E($s0)` ends up adjacent to the merge point and
|
||||
* cross-jumping swallows it too -- 230 instructions instead of 231.
|
||||
* (The neighbour func_80181DEC has the opposite order because it has only
|
||||
* one copy and nothing to cross-jump against.)
|
||||
*
|
||||
* Everything else is straight house style: `if (A <= K && x > D) {..} else {reset}`
|
||||
* for the &&-shaped case 4 (gcc puts the else block last, which is where the
|
||||
* shared reset lands), and the `v0 = *(u16*)(p+0x100); ... |= 4` tail that four
|
||||
* sites cross-jump into at .L80182600.
|
||||
*/
|
||||
|
||||
extern u8 D_8018AA6C[];
|
||||
extern u8 D_8018AA8C[];
|
||||
extern u8 D_801A1820[];
|
||||
extern s32 D_801A1A10;
|
||||
extern u8 D_801A1C10[];
|
||||
extern u8 D_801A1CD8[];
|
||||
extern u8 D_801A2848[];
|
||||
extern u8 D_801A2940[];
|
||||
extern s16 D_801C7748;
|
||||
|
||||
extern s32 func_80047D3C(s32 a0);
|
||||
extern s32 func_801807D8(s16 *a0);
|
||||
extern void func_8012A828(s32 a0, void *a1);
|
||||
extern s32 func_8012B8E4(s32 a0, s32 a1);
|
||||
extern s32 func_8012BCCC(s32 a0);
|
||||
extern s32 func_8012BEE8(s32 a0);
|
||||
extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3);
|
||||
extern s32 func_801845EC(s32 a0, s32 a1);
|
||||
extern s32 func_80185E68(s32 a0, s32 a1);
|
||||
|
||||
void func_80182328(s32 param_1) {
|
||||
s16 sp10[3];
|
||||
s16 c;
|
||||
s32 state;
|
||||
|
||||
switch (*(u16 *)(param_1 + 0x34)) {
|
||||
case 0:
|
||||
if (*(s32 *)(param_1 + 0x1C) == 9) {
|
||||
func_8012D5E4(param_1, (s32)&D_8018AA8C[0], (s32)&D_8018AA8C[8], 0xB);
|
||||
}
|
||||
if (func_8012BEE8(param_1) != 0) {
|
||||
if (func_8012BCCC(param_1) <= 0x40000) {
|
||||
*(s16 *)(param_1 + 2) = 4;
|
||||
*(s16 *)(param_1 + 0x34) = 1;
|
||||
func_8012A828(param_1, D_801A1820);
|
||||
*(s32 *)(param_1 + 0x1C) = 0xA;
|
||||
*(u16 *)(param_1 + 0x100) |= 4;
|
||||
} else {
|
||||
s32 t;
|
||||
u16 m, y, f, g;
|
||||
*(s16 *)(param_1 + 0xFC) = 0;
|
||||
*(u8 *)(param_1 + 0xC1) = 0;
|
||||
*(s16 *)(param_1 + 2) = 1;
|
||||
*(s16 *)(param_1 + 0x34) = 0;
|
||||
func_8012A828(param_1, &D_801A1A10);
|
||||
m = *(u16 *)(param_1 + 0x5C);
|
||||
y = *(u16 *)(param_1 + 6);
|
||||
f = *(u16 *)(param_1 + 0xFC);
|
||||
*(u16 *)(param_1 + 0x5E) = 0;
|
||||
*(s32 *)(param_1 + 0x1C) = 0xA;
|
||||
t = (s32)(s16)y * (s32)(s16)y;
|
||||
g = m | 0x8000;
|
||||
*(u16 *)(param_1 + 0x5C) = g;
|
||||
*(u16 *)(param_1 + 0xFC) = f ^ 1;
|
||||
sp10[0] = y;
|
||||
sp10[1] = *(u16 *)(param_1 + 0xA);
|
||||
sp10[2] = *(u16 *)(param_1 + 0xE);
|
||||
t += (s32)(s16)sp10[2] * (s32)(s16)sp10[2];
|
||||
*(s16 *)(param_1 + 0xDE) = func_80047D3C(t);
|
||||
*(s16 *)(param_1 + 0xDC) = func_801807D8(sp10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (func_8012BEE8(param_1) != 0) {
|
||||
*(s16 *)(param_1 + 2) = 4;
|
||||
*(s16 *)(param_1 + 0x34) = 2;
|
||||
func_8012A828(param_1, D_801A1CD8);
|
||||
*(s32 *)(param_1 + 0x1C) = 0x18;
|
||||
*(u16 *)(param_1 + 0x100) |= 4;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (*(s32 *)(param_1 + 0x1C) == 0xA) {
|
||||
func_8012D5E4(param_1, (s32)&D_8018AA8C[0], (s32)&D_8018AA8C[8], 0xB);
|
||||
}
|
||||
if (func_8012BEE8(param_1) != 0) {
|
||||
s32 t;
|
||||
u16 m, y, f, g;
|
||||
*(s16 *)(param_1 + 0xFC) = 0;
|
||||
*(u8 *)(param_1 + 0xC1) = 0;
|
||||
*(s16 *)(param_1 + 2) = 1;
|
||||
*(s16 *)(param_1 + 0x34) = 0;
|
||||
func_8012A828(param_1, &D_801A1A10);
|
||||
m = *(u16 *)(param_1 + 0x5C);
|
||||
y = *(u16 *)(param_1 + 6);
|
||||
f = *(u16 *)(param_1 + 0xFC);
|
||||
*(u16 *)(param_1 + 0x5E) = 0;
|
||||
*(s32 *)(param_1 + 0x1C) = 0xA;
|
||||
t = (s32)(s16)y * (s32)(s16)y;
|
||||
g = m | 0x8000;
|
||||
*(u16 *)(param_1 + 0x5C) = g;
|
||||
*(u16 *)(param_1 + 0xFC) = f ^ 1;
|
||||
sp10[0] = y;
|
||||
sp10[1] = *(u16 *)(param_1 + 0xA);
|
||||
sp10[2] = *(u16 *)(param_1 + 0xE);
|
||||
t += (s32)(s16)sp10[2] * (s32)(s16)sp10[2];
|
||||
*(s16 *)(param_1 + 0xDE) = func_80047D3C(t);
|
||||
*(s16 *)(param_1 + 0xDC) = func_801807D8(sp10);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
*(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) += func_8012B8E4(param_1, 4);
|
||||
state = *(s32 *)(param_1 + 0x1C);
|
||||
if (state == 0xC) {
|
||||
func_801845EC(param_1, 0);
|
||||
} else if (state == 0xF) {
|
||||
func_80185E68(param_1, (s32)D_8018AA6C);
|
||||
}
|
||||
if (func_8012BEE8(param_1) != 0) {
|
||||
c = *(u16 *)(param_1 + 0xE0) + 1;
|
||||
*(s16 *)(param_1 + 0xE0) = c;
|
||||
if (c >= 3) {
|
||||
*(s16 *)(param_1 + 0xE0) = 0;
|
||||
*(u16 *)(param_1 + 0x34) += 1;
|
||||
func_8012A828(param_1, D_801A2940);
|
||||
*(s32 *)(param_1 + 0x1C) = 0x1E;
|
||||
} else {
|
||||
*(s32 *)(param_1 + 0x1C) = 1;
|
||||
*(u16 *)(param_1 + 0x34) += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (func_8012BEE8(param_1) != 0) {
|
||||
if (func_8012BCCC(param_1) <= 0x64000 &&
|
||||
*(s16 *)(param_1 + 0xDC) > D_801C7748) {
|
||||
if (*(s16 *)(param_1 + 0x70) == 0) {
|
||||
*(s16 *)(param_1 + 2) = 4;
|
||||
*(s16 *)(param_1 + 0x34) = 0;
|
||||
func_8012A828(param_1, D_801A1C10);
|
||||
*(s32 *)(param_1 + 0x1C) = 0x18;
|
||||
*(u16 *)(param_1 + 0x100) |= 4;
|
||||
} else {
|
||||
*(s16 *)(param_1 + 2) = 4;
|
||||
*(s16 *)(param_1 + 0x34) = 3;
|
||||
func_8012A828(param_1, D_801A2848);
|
||||
*(s32 *)(param_1 + 0x1C) = 0x1E;
|
||||
*(u16 *)(param_1 + 0x100) |= 4;
|
||||
}
|
||||
} else {
|
||||
s32 t;
|
||||
u16 m, y, f, g;
|
||||
*(s16 *)(param_1 + 0xFC) = 0;
|
||||
*(u8 *)(param_1 + 0xC1) = 0;
|
||||
*(s16 *)(param_1 + 2) = 1;
|
||||
*(s16 *)(param_1 + 0x34) = 0;
|
||||
func_8012A828(param_1, &D_801A1A10);
|
||||
m = *(u16 *)(param_1 + 0x5C);
|
||||
y = *(u16 *)(param_1 + 6);
|
||||
f = *(u16 *)(param_1 + 0xFC);
|
||||
*(u16 *)(param_1 + 0x5E) = 0;
|
||||
*(s32 *)(param_1 + 0x1C) = 0xA;
|
||||
t = (s32)(s16)y * (s32)(s16)y;
|
||||
g = m | 0x8000;
|
||||
*(u16 *)(param_1 + 0x5C) = g;
|
||||
*(u16 *)(param_1 + 0xFC) = f ^ 1;
|
||||
sp10[0] = y;
|
||||
sp10[1] = *(u16 *)(param_1 + 0xA);
|
||||
sp10[2] = *(u16 *)(param_1 + 0xE);
|
||||
t += (s32)(s16)sp10[2] * (s32)(s16)sp10[2];
|
||||
*(s16 *)(param_1 + 0xDE) = func_80047D3C(t);
|
||||
*(s16 *)(param_1 + 0xDC) = func_801807D8(sp10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void func_8012DBD0(s32 a0, s32 a1, s32 a2, s32 a3);
|
||||
extern void func_8012A828(s32 a0, void *a1);
|
||||
|
||||
@@ -10,7 +10,145 @@
|
||||
* and cookbook §426/§431. Declarations shared with the sibling TUs live in
|
||||
* src/ov_SC02_011/ov_SC02_011_shared.h. */
|
||||
|
||||
INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_80183178", func_80183178);
|
||||
extern s32 func_8012CBCC(s32 a0);
|
||||
extern s32 func_8012BEE8(s32 a0);
|
||||
extern void func_8012B23C(s32 a0);
|
||||
extern void func_8012B14C(s32 a0, s32 a1);
|
||||
extern void func_8012A828(s32 a0, void *a1);
|
||||
extern void func_8012CC40(s32 arg0, s32 arg1);
|
||||
extern void func_8012B200(u8 *a0);
|
||||
extern void func_8012AD80(s32 a0);
|
||||
extern void func_8013C9C4(void *a0);
|
||||
extern void func_8002D4C8(s32 a0, s32 a1);
|
||||
extern void func_80184964(s32 a0);
|
||||
extern s32 func_80184A28(s32 *a0);
|
||||
extern s32 func_801789AC(s32 arg0);
|
||||
extern void func_80178D18(void);
|
||||
extern void func_80184918(s32 arg0, s32 arg1);
|
||||
|
||||
|
||||
typedef struct Sub83178 {
|
||||
char pad0[0x10];
|
||||
s16 unk10;
|
||||
} Sub83178;
|
||||
|
||||
typedef struct Ent83178 {
|
||||
char pad0[0x20];
|
||||
Sub83178 *unk20;
|
||||
} Ent83178;
|
||||
|
||||
void func_80183178(s32 a0) {
|
||||
|
||||
extern u8 D_80195184[];
|
||||
extern u8 D_80195114[];
|
||||
extern u8 D_801F404C[];
|
||||
extern void *D_80195144;
|
||||
extern s32 D_801950D8;
|
||||
extern u8 D_801F3EFC[];
|
||||
extern short D_801F3EA4;
|
||||
extern s16 D_801EBA7C;
|
||||
s32 s0 = a0;
|
||||
|
||||
switch (*(u16 *)(s0 + 0x34)) {
|
||||
case 0:
|
||||
*(u16 *)(*(s32 *)(s0 + 0x20) + 0x10) -= 0x20;
|
||||
if (*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) < -0x400) {
|
||||
*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) = -0x400;
|
||||
}
|
||||
if (func_8012CBCC(s0) & 0x2000) {
|
||||
*(u16 *)(s0 + 0x34) = 0xA;
|
||||
func_8013C9C4((void *)D_80195184);
|
||||
func_80184964(s0);
|
||||
func_8002D4C8(0x5CA, 0);
|
||||
D_801EBA7C = 3;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (func_8012BEE8(s0) != 0) {
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
*(u16 *)(*(s32 *)(s0 + 0x20) + 0x10) += 0x80;
|
||||
if (*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) >= 0) {
|
||||
*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) = 0;
|
||||
func_8012B23C(s0);
|
||||
func_8012B14C(s0, (s32)D_80195114);
|
||||
func_8012A828(s0, (void *)D_801F404C);
|
||||
*(s32 *)(s0 + 0x1C) = 0xA;
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (func_8012BEE8(s0) != 0) {
|
||||
if (((s32 (*)(s32, s32))func_8012CC40)(s0, (s32)&D_80195144) & 0x8000) {
|
||||
*(u16 *)(s0 + 0x98) = 0;
|
||||
func_8012B200((u8 *)s0);
|
||||
func_8012B14C(s0, (s32)&D_801950D8);
|
||||
func_8012A828(s0, (void *)D_801F3EFC);
|
||||
D_801EBA7C = 3;
|
||||
*(s32 *)(s0 + 0x1C) = 0x1E;
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (func_8012BEE8(s0) == 0) {
|
||||
func_8012AD80(s0);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
func_8012B23C(s0);
|
||||
*(u16 *)(s0 + 0x98) = 0;
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
break;
|
||||
case 6:
|
||||
*(u16 *)(*(s32 *)(s0 + 0x20) + 0x10) -= 0x20;
|
||||
if (*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) < -0x400) {
|
||||
*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) = -0x400;
|
||||
}
|
||||
if (func_8012CBCC(s0) & 0x2000) {
|
||||
*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) = -0x400;
|
||||
*(s32 *)(s0 + 0x1C) = 0x2D;
|
||||
func_8013C9C4((void *)D_80195184);
|
||||
func_80184964(s0);
|
||||
func_8002D4C8(0x5CA, 0);
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (func_8012BEE8(s0) != 0) {
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
*(u16 *)(*(s32 *)(s0 + 0x20) + 0x10) += 0x80;
|
||||
if (*(s16 *)(*(s32 *)(s0 + 0x20) + 0x10) >= 0) {
|
||||
D_801EBA7C = 3;
|
||||
((Ent83178 *)s0)->unk20->unk10 = 0;
|
||||
func_8012A828(s0, (void *)&D_801F3EA4);
|
||||
*(u16 *)(s0 + 0x34) = *(u16 *)(s0 + 0x34) + 1;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
if (func_80184A28((s32 *)s0) == 1) {
|
||||
D_801EBA7C = 3;
|
||||
((Ent83178 *)s0)->unk20->unk10 = -0x400;
|
||||
*(s32 *)(s0 + 0x1C) = 0x2D;
|
||||
*(u16 *)(s0 + 0x34) = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (func_801789AC(s0) == 1) {
|
||||
((void (*)(s32))func_80178D18)(s0);
|
||||
*(u16 *)(s0 + 2) = 8;
|
||||
func_80184918(s0, 0x1C);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void func_8012B23C(s32 a0);
|
||||
extern void func_8012B14C(s32 a0, s32 a1);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,175 @@
|
||||
* boundary and both span-2 owners at/above it, so each piece carves its own span.
|
||||
* Contents are VERBATIM from the parent TU; only the INCLUDE_ASM subseg path changed. */
|
||||
|
||||
INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8018624C", func_8018624C);
|
||||
#include "common.h"
|
||||
|
||||
extern s32 rand(void);
|
||||
extern void func_8002D4C8(s32 a0, s32 a1);
|
||||
extern void func_8012A568(void (*a0)(void));
|
||||
extern void func_8012A828(s32 a0, void *a1);
|
||||
extern s32 func_8012C51C(void *a0, s32 a1);
|
||||
extern s32 func_8012C588(s32 a0, s32 a1);
|
||||
extern s32 func_8012C658(s32 a0, s32 a1, s32 a2);
|
||||
extern void func_8013C9C4(void *a0);
|
||||
extern s32 func_80147054(void *a0);
|
||||
extern s32 func_801789AC(s32 a0);
|
||||
extern void func_80178D18(void);
|
||||
extern void func_8017BF08(void *a0, void *a1, s32 a2, s32 a3);
|
||||
extern void func_8017E08C(u8 *a0);
|
||||
extern void func_801870B4(void);
|
||||
extern void func_801871C0(void *a0, s32 a1, s32 a2);
|
||||
extern void func_801873C8(void);
|
||||
extern void func_80187434(void *a0);
|
||||
|
||||
extern u8 D_800AF630[];
|
||||
extern s32 D_80126B58;
|
||||
extern u8 D_8018EDF4[];
|
||||
extern s16 D_8018EE00;
|
||||
extern u8 D_8018EE54[];
|
||||
extern u8 D_8018EE5C;
|
||||
extern u8 D_801B1DC8[];
|
||||
extern u8 D_801B2410[];
|
||||
|
||||
/* func_8018624C — MATCH (269 ins). State machine on *(u16 *)(ent+0x34), dispatched
|
||||
* through jtbl_801B8240 (14 dense entries 0..13; the empty arms are what keeps the
|
||||
* table's minval at 0, i.e. `sll $v0,$v1,2` with NO `addiu -N` bias).
|
||||
*
|
||||
* THREE LOAD-BEARING DIALS — do not "simplify" any of them:
|
||||
*
|
||||
* 1. `tbl = D_800AF630;` hoisted to the top. The four guards read the same halfword at
|
||||
* +0xA3AA (= D_800B99DA); off a held base pointer that expands to the far-offset form
|
||||
* `lui $at,1 / addu $at,$s6,$at / lhu -0x5C56($at)` (the resident single-base idiom,
|
||||
* cf. src/ov_SC03_105/ov_SC03_105_jr_8017C8D0.c func_80182DCC note #2).
|
||||
*
|
||||
* 2. `t2 = tmp;` — a DEAD CHAINED COPY, and it is the whole crack (cookbook §193-F /
|
||||
* §148-A, the `move_movables` threshold staircase). The inner loop has three
|
||||
* invariants: the /3 magic 0x55555556, the OR mask -0x8000, and `&D_8018EE54`, and
|
||||
* `move_movables` admits each iff `threshold * savings * lifetime >= insn_count` with
|
||||
* threshold 29 (loop_has_call) decaying -3 per move. All three are life 1 / savings 1,
|
||||
* so the ranks test 29, 26, 23. The target hoists only the first two and recomputes
|
||||
* `la $a0,%hi/%lo(D_8018EE54)` INSIDE the loop, i.e. rank 3 must fail: insn_count >= 24.
|
||||
* Measured with `cc1 -dL`: plain body = 22 real insns (all three hoist, +1 callee-saved
|
||||
* register = frame 0x38 with NINE saves and 271 ins). Routing the func_8012C51C return
|
||||
* through the multiply-set `tmp` buys +1 (23, still hoists), and the second dead copy
|
||||
* into the multiply-set `t2` buys the +1 that reaches 24 -> "not desirable" -> $s7 is
|
||||
* never allocated and the count lands on 269. Both copies are deleted by flow (they run
|
||||
* before it), so they cost ZERO instructions. Collapsing either one re-hoists the symbol.
|
||||
*
|
||||
* 3. `s32 pad[2];` — dead-local frame pad (§162i1): vars=8 turns frame 0x30 into 0x38.
|
||||
* Same device as the sibling state machine func_80186DDC in this overlay.
|
||||
*
|
||||
* Init order `j = 0;` BEFORE `off = 0;` is also load-bearing: it is what emits
|
||||
* `addu $s1,$zero,$zero` ahead of `addu $s0,$zero,$zero` at the outer-loop top.
|
||||
*/
|
||||
void func_8018624C(void *arg0) {
|
||||
s32 ent;
|
||||
u8 *tbl;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 off;
|
||||
s32 tmp;
|
||||
s32 t2;
|
||||
s16 *p;
|
||||
s32 pad[2];
|
||||
|
||||
ent = (s32)arg0;
|
||||
tbl = D_800AF630;
|
||||
switch (*(u16 *)(ent + 0x34)) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 6:
|
||||
case 8:
|
||||
case 10:
|
||||
case 12:
|
||||
break;
|
||||
case 1:
|
||||
if ((*(u16 *)(tbl + 0xA3AA) & 3) == 0) {
|
||||
func_8013C9C4(D_8018EDF4);
|
||||
func_801871C0((void *)ent, 1, 1);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
func_8012A828(ent, D_801B1DC8);
|
||||
func_8012A828(*(s32 *)(ent + 0x6C), D_801B2410);
|
||||
((void (*)(s32))func_801873C8)(ent);
|
||||
*(u16 *)(ent + 0x34) += 1;
|
||||
/* fallthrough */
|
||||
case 4:
|
||||
if ((u32)*(s32 *)(ent + 0x94) < 0x2C && (*(u16 *)(tbl + 0xA3AA) & 3) == 0) {
|
||||
func_8013C9C4(D_8018EDF4);
|
||||
func_801871C0((void *)ent, 1, 1);
|
||||
}
|
||||
if (*(s32 *)(ent + 0x94) == 0x2B) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
j = 0;
|
||||
off = 0;
|
||||
for (; j < 3; j++) {
|
||||
*(u16 *)(&D_8018EE5C + off) = (rand() % 3 + 1) | -0x8000;
|
||||
tmp = func_8012C51C(D_8018EE54 + off, ent);
|
||||
t2 = tmp;
|
||||
off += 0x14;
|
||||
}
|
||||
}
|
||||
func_801871C0((void *)ent, 0xA, 5);
|
||||
func_80187434((void *)ent);
|
||||
func_8002D4C8(0x726, 0);
|
||||
func_8002D4C8(4, 0x79F);
|
||||
}
|
||||
if (*(s32 *)(ent + 0x94) == 0x4B) {
|
||||
func_8002D4C8(0x727, 0);
|
||||
}
|
||||
if (*(s32 *)(ent + 0x94) == 0x84) {
|
||||
func_8002D4C8(0xC05, 0);
|
||||
}
|
||||
if (*(s32 *)(ent + 0x94) == 0x5A) {
|
||||
func_801871C0((void *)ent, 0xF, 5);
|
||||
}
|
||||
if (*(s32 *)(ent + 0x94) > 0x78 && (*(u16 *)(tbl + 0xA3AA) & 0xF) == 0) {
|
||||
t2 = rand();
|
||||
func_801871C0((void *)ent, t2 % 5 + 1, 2);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
*(s32 *)(ent + 0x1C) = 0x1E;
|
||||
*(u16 *)(ent + 0x34) += 1;
|
||||
func_8002D4C8(0x72D, 0);
|
||||
break;
|
||||
case 7:
|
||||
func_8012A568((void (*)(void))func_8017E08C);
|
||||
*(u16 *)(*(s32 *)(ent + 0xD0) + 0x34) += 1;
|
||||
func_8002D4C8(4, 0x733);
|
||||
*(u16 *)(ent + 0x34) += 1;
|
||||
break;
|
||||
case 9:
|
||||
tmp = func_8012C658(0x14B, 0, ent);
|
||||
*(s32 *)(ent + 0xCC) = tmp;
|
||||
func_8012C588(0x3BD, tmp);
|
||||
*(u16 *)(ent + 0x34) += 1;
|
||||
func_8002D4C8(0x72F, 0);
|
||||
break;
|
||||
case 11:
|
||||
*(u16 *)(ent + 0x34) += 1;
|
||||
func_801870B4();
|
||||
break;
|
||||
case 13:
|
||||
p = &D_8018EE00;
|
||||
func_8017BF08(p, p + 1, 2, 0x96);
|
||||
*(u16 *)(ent + 0x34) += 1;
|
||||
break;
|
||||
}
|
||||
if (*(u16 *)(ent + 0x34) >= 5 && (*(u16 *)(tbl + 0xA3AA) & 0x7F) == 0) {
|
||||
func_801871C0((void *)ent, 5, 5);
|
||||
}
|
||||
if (func_801789AC(ent) == 1) {
|
||||
((void (*)(s32))func_80178D18)(ent);
|
||||
*(s16 *)(ent + 0x2) = 3;
|
||||
*(s16 *)(*(s32 *)(ent + 0xCC) + 0x2) = 2;
|
||||
*(s32 *)(ent + 0x1C) = 0x5A;
|
||||
func_80147054(&D_80126B58);
|
||||
func_8002D4C8(4, 0x72F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user