mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-01 23:52:03 -04:00
feat(phase-31): propagate func_8018825C (gate lane)
This commit is contained in:
@@ -14985,3 +14985,10 @@ groups:
|
||||
func: DEFINE_func_8018512C
|
||||
vram: 0x8018512C
|
||||
binaries: [ov_SC02_000, ov_SC02_003]
|
||||
- id: E_func_8018825C
|
||||
tier: h_exact
|
||||
hash: bd445f888c97aaafab3e9edcbba05ce9f110c7fa
|
||||
source: src/shared/engine_core.h
|
||||
func: DEFINE_func_8018825C
|
||||
vram: 0x8018825C
|
||||
binaries: [ov_SC02_000, ov_SC02_003]
|
||||
|
||||
@@ -4756,92 +4756,7 @@ DEFINE_func_80188134() /* dedup: shared engine-core @0x80188134 (src/shared) */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern s32 func_8012C588(s32 a0, s32 a1);
|
||||
extern s32 func_8012B030(u8 *a0);
|
||||
extern s32 func_80143B6C(s32 a0, s32 a1);
|
||||
extern void func_8012B23C(s32 a0);
|
||||
extern void func_8012A828(s32 a0, void *a1);
|
||||
extern void func_8012CBCC(s32 a0);
|
||||
extern s32 func_801884FC();
|
||||
extern void func_8002D4C8(s32 a0, s32 a1);
|
||||
|
||||
extern u8 D_8018F498[];
|
||||
extern u8 D_8018F47C[];
|
||||
extern u8 D_801A68A4[];
|
||||
|
||||
void func_8018825C(s32 param_1) {
|
||||
/* 16B of dead frame locals the original keeps: the target reserves
|
||||
* sp -0x28 (0x10 outgoing-arg area + 0x10 locals + 8 saved regs) yet
|
||||
* never touches sp+0x10..0x1F. gcc-2.7.2 assigns aggregate frame
|
||||
* slots at RTL-expansion time and never reclaims them when the uses
|
||||
* are later optimised away, so an unreferenced local array reproduces
|
||||
* the frame byte-for-byte. Cookbook: frame-size residual class. */
|
||||
s32 deadLocals[4];
|
||||
s32 v0;
|
||||
s32 entity;
|
||||
s32 other;
|
||||
s32 r;
|
||||
|
||||
v0 = *(s32 *)(param_1 + 0xE0) - 1;
|
||||
*(s32 *)(param_1 + 0xE0) = v0;
|
||||
if (v0 == 0) {
|
||||
*(s32 *)(param_1 + 0x4C) = 0x4000;
|
||||
}
|
||||
|
||||
if (*(s16 *)(param_1 + 0xFC) != 0) {
|
||||
entity = func_8012C588(0x3F, param_1);
|
||||
if (entity != 0) {
|
||||
*(s16 *)(param_1 + 0xFC) = 0;
|
||||
*(u16 *)(entity + 0xE) -= 0x300;
|
||||
*(s32 *)(entity + 0xDC) += 0x1E;
|
||||
*(s16 *)(entity + 0xFC) = 0;
|
||||
*(s32 *)(entity + 0x64) = *(s32 *)(param_1 + 0x64);
|
||||
func_8012B030((u8 *)entity);
|
||||
}
|
||||
}
|
||||
|
||||
v0 = *(s32 *)(param_1 + 0xE4) - 1;
|
||||
*(s32 *)(param_1 + 0xE4) = v0;
|
||||
if (v0 == 0) {
|
||||
func_80143B6C(param_1, 0);
|
||||
*(s32 *)(param_1 + 0xE4) = 4;
|
||||
}
|
||||
|
||||
other = *(s32 *)(param_1 + 0x64);
|
||||
if (*(s16 *)(other + 0xE) - 0x80 < *(s16 *)(param_1 + 0xE)) {
|
||||
*(s16 *)(param_1 + 0x2) = 5;
|
||||
func_8012B23C(param_1);
|
||||
func_8012A828(param_1, &D_8018F498);
|
||||
*(s32 *)(param_1 + 0x18) = 0xFFE30000;
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE50000;
|
||||
/* the 0xDC store precedes the call in program order — gcc back-fills
|
||||
* the jal delay slot with it, which is what the target does. */
|
||||
*(s32 *)(param_1 + 0xDC) = 1;
|
||||
func_8002D4C8(0x6AA, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
func_8012CBCC(param_1);
|
||||
r = func_801884FC(param_1);
|
||||
if (r == 1) {
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE00000;
|
||||
*(s32 *)(param_1 + 0x44) = 0;
|
||||
*(s32 *)(param_1 + 0x48) = 0x40000;
|
||||
*(s32 *)(param_1 + 0x4C) = 0;
|
||||
*(u16 *)(param_1 + 0x2) += 1;
|
||||
func_8012A828(param_1, &D_8018F47C);
|
||||
return;
|
||||
}
|
||||
if (r == 2) {
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE00000;
|
||||
*(s32 *)(param_1 + 0x44) = 0;
|
||||
*(s32 *)(param_1 + 0x48) = 0x40000;
|
||||
*(s32 *)(param_1 + 0x4C) = 0;
|
||||
func_8012A828(param_1, &D_801A68A4);
|
||||
*(s16 *)(param_1 + 0x2) = 5;
|
||||
*(s32 *)(param_1 + 0xDC) = 0x20;
|
||||
}
|
||||
}
|
||||
DEFINE_func_8018825C() /* dedup: shared engine-core @0x8018825C (src/shared) */
|
||||
|
||||
|
||||
INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8018173C", func_80188414);
|
||||
|
||||
@@ -3454,7 +3454,7 @@ DEFINE_func_80188028() /* dedup: shared engine-core @0x80188028 (src/shared) */
|
||||
|
||||
DEFINE_func_80188134() /* dedup: shared engine-core @0x80188134 (src/shared) */
|
||||
|
||||
INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8018173C", func_8018825C);
|
||||
DEFINE_func_8018825C() /* dedup: shared engine-core @0x8018825C (src/shared) */
|
||||
|
||||
INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8018173C", func_80188414);
|
||||
|
||||
|
||||
@@ -61789,6 +61789,79 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_func_8018825C() \
|
||||
extern s32 func_8012C588(s32 a0, s32 a1); \
|
||||
extern s32 func_8012B030(u8 *a0); \
|
||||
extern s32 func_80143B6C(s32 a0, s32 a1); \
|
||||
extern void func_8012B23C(s32 a0); \
|
||||
extern void func_8012A828(s32 a0, void *a1); \
|
||||
extern void func_8012CBCC(s32 a0); \
|
||||
extern s32 func_801884FC(); \
|
||||
extern void func_8002D4C8(s32 a0, s32 a1); \
|
||||
extern u8 D_8018F498[]; \
|
||||
extern u8 D_8018F47C[]; \
|
||||
extern u8 D_801A68A4[]; \
|
||||
void func_8018825C(s32 param_1) { \
|
||||
s32 deadLocals[4]; \
|
||||
s32 v0; \
|
||||
s32 entity; \
|
||||
s32 other; \
|
||||
s32 r; \
|
||||
v0 = *(s32 *)(param_1 + 0xE0) - 1; \
|
||||
*(s32 *)(param_1 + 0xE0) = v0; \
|
||||
if (v0 == 0) { \
|
||||
*(s32 *)(param_1 + 0x4C) = 0x4000; \
|
||||
} \
|
||||
if (*(s16 *)(param_1 + 0xFC) != 0) { \
|
||||
entity = func_8012C588(0x3F, param_1); \
|
||||
if (entity != 0) { \
|
||||
*(s16 *)(param_1 + 0xFC) = 0; \
|
||||
*(u16 *)(entity + 0xE) -= 0x300; \
|
||||
*(s32 *)(entity + 0xDC) += 0x1E; \
|
||||
*(s16 *)(entity + 0xFC) = 0; \
|
||||
*(s32 *)(entity + 0x64) = *(s32 *)(param_1 + 0x64); \
|
||||
func_8012B030((u8 *)entity); \
|
||||
} \
|
||||
} \
|
||||
v0 = *(s32 *)(param_1 + 0xE4) - 1; \
|
||||
*(s32 *)(param_1 + 0xE4) = v0; \
|
||||
if (v0 == 0) { \
|
||||
func_80143B6C(param_1, 0); \
|
||||
*(s32 *)(param_1 + 0xE4) = 4; \
|
||||
} \
|
||||
other = *(s32 *)(param_1 + 0x64); \
|
||||
if (*(s16 *)(other + 0xE) - 0x80 < *(s16 *)(param_1 + 0xE)) { \
|
||||
*(s16 *)(param_1 + 0x2) = 5; \
|
||||
func_8012B23C(param_1); \
|
||||
func_8012A828(param_1, &D_8018F498); \
|
||||
*(s32 *)(param_1 + 0x18) = 0xFFE30000; \
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE50000; \
|
||||
*(s32 *)(param_1 + 0xDC) = 1; \
|
||||
func_8002D4C8(0x6AA, 0); \
|
||||
return; \
|
||||
} \
|
||||
func_8012CBCC(param_1); \
|
||||
r = func_801884FC(param_1); \
|
||||
if (r == 1) { \
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE00000; \
|
||||
*(s32 *)(param_1 + 0x44) = 0; \
|
||||
*(s32 *)(param_1 + 0x48) = 0x40000; \
|
||||
*(s32 *)(param_1 + 0x4C) = 0; \
|
||||
*(u16 *)(param_1 + 0x2) += 1; \
|
||||
func_8012A828(param_1, &D_8018F47C); \
|
||||
return; \
|
||||
} \
|
||||
if (r == 2) { \
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE00000; \
|
||||
*(s32 *)(param_1 + 0x44) = 0; \
|
||||
*(s32 *)(param_1 + 0x48) = 0x40000; \
|
||||
*(s32 *)(param_1 + 0x4C) = 0; \
|
||||
func_8012A828(param_1, &D_801A68A4); \
|
||||
*(s16 *)(param_1 + 0x2) = 5; \
|
||||
*(s32 *)(param_1 + 0xDC) = 0x20; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define DEFINE_func_80128EA8() \
|
||||
@@ -152983,4 +153056,77 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_func_8018825C() \
|
||||
extern s32 func_8012C588(s32 a0, s32 a1); \
|
||||
extern s32 func_8012B030(u8 *a0); \
|
||||
extern s32 func_80143B6C(s32 a0, s32 a1); \
|
||||
extern void func_8012B23C(s32 a0); \
|
||||
extern void func_8012A828(s32 a0, void *a1); \
|
||||
extern void func_8012CBCC(s32 a0); \
|
||||
extern s32 func_801884FC(); \
|
||||
extern void func_8002D4C8(s32 a0, s32 a1); \
|
||||
extern u8 D_8018F498[]; \
|
||||
extern u8 D_8018F47C[]; \
|
||||
extern u8 D_801A68A4[]; \
|
||||
void func_8018825C(s32 param_1) { \
|
||||
s32 deadLocals[4]; \
|
||||
s32 v0; \
|
||||
s32 entity; \
|
||||
s32 other; \
|
||||
s32 r; \
|
||||
v0 = *(s32 *)(param_1 + 0xE0) - 1; \
|
||||
*(s32 *)(param_1 + 0xE0) = v0; \
|
||||
if (v0 == 0) { \
|
||||
*(s32 *)(param_1 + 0x4C) = 0x4000; \
|
||||
} \
|
||||
if (*(s16 *)(param_1 + 0xFC) != 0) { \
|
||||
entity = func_8012C588(0x3F, param_1); \
|
||||
if (entity != 0) { \
|
||||
*(s16 *)(param_1 + 0xFC) = 0; \
|
||||
*(u16 *)(entity + 0xE) -= 0x300; \
|
||||
*(s32 *)(entity + 0xDC) += 0x1E; \
|
||||
*(s16 *)(entity + 0xFC) = 0; \
|
||||
*(s32 *)(entity + 0x64) = *(s32 *)(param_1 + 0x64); \
|
||||
func_8012B030((u8 *)entity); \
|
||||
} \
|
||||
} \
|
||||
v0 = *(s32 *)(param_1 + 0xE4) - 1; \
|
||||
*(s32 *)(param_1 + 0xE4) = v0; \
|
||||
if (v0 == 0) { \
|
||||
func_80143B6C(param_1, 0); \
|
||||
*(s32 *)(param_1 + 0xE4) = 4; \
|
||||
} \
|
||||
other = *(s32 *)(param_1 + 0x64); \
|
||||
if (*(s16 *)(other + 0xE) - 0x80 < *(s16 *)(param_1 + 0xE)) { \
|
||||
*(s16 *)(param_1 + 0x2) = 5; \
|
||||
func_8012B23C(param_1); \
|
||||
func_8012A828(param_1, &D_8018F498); \
|
||||
*(s32 *)(param_1 + 0x18) = 0xFFE30000; \
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE50000; \
|
||||
*(s32 *)(param_1 + 0xDC) = 1; \
|
||||
func_8002D4C8(0x6AA, 0); \
|
||||
return; \
|
||||
} \
|
||||
func_8012CBCC(param_1); \
|
||||
r = func_801884FC(param_1); \
|
||||
if (r == 1) { \
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE00000; \
|
||||
*(s32 *)(param_1 + 0x44) = 0; \
|
||||
*(s32 *)(param_1 + 0x48) = 0x40000; \
|
||||
*(s32 *)(param_1 + 0x4C) = 0; \
|
||||
*(u16 *)(param_1 + 0x2) += 1; \
|
||||
func_8012A828(param_1, &D_8018F47C); \
|
||||
return; \
|
||||
} \
|
||||
if (r == 2) { \
|
||||
*(s32 *)(param_1 + 0x14) = 0xFFE00000; \
|
||||
*(s32 *)(param_1 + 0x44) = 0; \
|
||||
*(s32 *)(param_1 + 0x48) = 0x40000; \
|
||||
*(s32 *)(param_1 + 0x4C) = 0; \
|
||||
func_8012A828(param_1, &D_801A68A4); \
|
||||
*(s16 *)(param_1 + 0x2) = 5; \
|
||||
*(s32 *)(param_1 + 0xDC) = 0x20; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user