This commit is contained in:
Maide
2024-09-22 20:09:37 +01:00
parent 8c4b7c5ab4
commit e2931bf87e
7 changed files with 363 additions and 26 deletions
+13 -7
View File
@@ -80,25 +80,33 @@ typedef struct unk_D_86002F58_004_000_000 {
} unk_D_86002F58_004_000_000; // size = 0x18
typedef struct unk_D_86002F58_004_000_040_004 {
/* 0x00 */ char unk00[0x4];
/* 0x00 */ s16 unk_00;
/* 0x02 */ char unk02[0x2];
/* 0x04 */ s16 unk_04;
/* 0x06 */ char unk06[0x4];
/* 0x06 */ s16 unk_06;
/* 0x08 */ u16 unk_08;
/* 0x0A */ u16 unk_0A;
} unk_D_86002F58_004_000_040_004; // size >= 0xC
/* 0x0C */ u32 unk_0C;
/* 0x10 */ u32 unk_10;
/* 0x14 */ u32 unk_14;
/* 0x18 */ u32 unk_18;
} unk_D_86002F58_004_000_040_004; // size >= 0x1C
typedef struct unk_D_86002F58_004_000_040 {
/* 0x00 */ s16 unk_00;
/* 0x04 */ unk_D_86002F58_004_000_040_004* unk_04;
/* 0x08 */ s32 unk_08;
/* 0x0C */ u32 unk_0C;
} unk_D_86002F58_004_000_040; // size >= 0x10
/* 0x10 */ char unk10[0x2];
/* 0x12 */ u16 unk_12;
} unk_D_86002F58_004_000_040; // size >= 0x14
typedef struct unk_D_86002F58_004_000_054_004 {
/* 0x00 */ s32 unk_00;
/* 0x04 */ s16 unk_04;
/* 0x06 */ char unk_06[0x4];
/* 0x0A */ u16 unk_0A;
} unk_D_86002F58_004_000_054_004; // size >= 0xC
} unk_D_86002F58_004_000_054_004; // size >= 0x0C
typedef struct unk_D_86002F58_004_000_054 {
/* 0x00 */ s16 unk_00;
@@ -123,8 +131,6 @@ typedef struct unk_D_86002F58_004_000 {
/* 0x030 */ Vec3f unk_030;
/* 0x03C */ Color_RGBA8_u32 unk_03C;
/* 0x040 */ unk_D_86002F58_004_000_040 unk_040;
/* 0x050 */ char pad050[2];
/* 0x052 */ s16 unk_052;
/* 0x054 */ unk_D_86002F58_004_000_054 unk_054;
/* 0x060 */ MtxF unk_060;
/* 0x0A0 */ Color_RGBA8_u32 unk_0A0;
+1
View File
@@ -24,6 +24,7 @@
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define SQ(x) ((x) * (x))
#define CB(x) ((x) * (x) * (x))
// cast thru uintptr_t for integer to pointer casts
#define INT2VOID(i) ((void *)(uintptr_t)(i))
+1 -1
View File
@@ -88,7 +88,7 @@ unk_D_86002F58_004_000* func_80011938(MainPoolState* arg0, unk_D_86002F58_004_00
arg1->unk_040.unk_04 = NULL;
arg1->unk_040.unk_08 = 0;
arg1->unk_040.unk_0C = 0x10000;
arg1->unk_052 = 0;
arg1->unk_040.unk_12 = 0;
arg1->unk_054.unk_00 = 0;
arg1->unk_054.unk_04 = NULL;
arg1->unk_054.unk_08 = 0;
+312 -11
View File
@@ -1,31 +1,329 @@
#include "17300.h"
#include "src/util.h"
#include "src/F420.h"
#include "src/18140.h"
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016700.s")
static unk_D_800ABCC0 D_800ABCC0[2];
static s32 D_800ABCF0;
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_800167B4.s")
f32 func_80016700(unk_D_800ABCC0* arg0, s32 arg1) {
f32 ret;
s32 var_a2;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016848.s")
if (temp_v0->unk_00 == 1) {
ret = temp_v0->unk_04 / 1000.0f;
} else {
if (arg0->unk_02 < temp_v0->unk_00) {
var_a2 = temp_v0->unk_04 + arg0->unk_02;
} else {
var_a2 = (temp_v0->unk_04 + temp_v0->unk_00) - 1;
}
ret = arg0->unk_0C[var_a2] / 1000.0f;
}
return ret;
}
s16 func_800167B4(unk_D_800ABCC0* arg0, s32 arg1) {
s32 var_a1;
s16 var_v1;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
if (temp_v0->unk_01 == 1) {
var_v1 = temp_v0->unk_06 * 0x10;
} else {
if (arg0->unk_02 < temp_v0->unk_01) {
var_a1 = temp_v0->unk_06 + arg0->unk_02;
} else {
var_a1 = (temp_v0->unk_06 + temp_v0->unk_01) - 1;
}
var_v1 = func_80010500(arg0->unk_10, var_a1, 0xC) * 0x10;
}
return var_v1;
}
f32 func_80016848(unk_D_800ABCC0* arg0, s32 arg1) {
f32 var_fv1;
s16 var_a2;
s32 var_a1;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
if (temp_v0->unk_02 == 1) {
if (arg0->unk_01 & 4) {
var_fv1 = (s16)temp_v0->unk_08;
} else {
var_a2 = temp_v0->unk_08 * 0x10;
var_fv1 = var_a2 >> 4;
}
} else {
if (arg0->unk_02 < temp_v0->unk_02) {
var_a1 = temp_v0->unk_08 + arg0->unk_02;
} else {
var_a1 = (temp_v0->unk_08 + temp_v0->unk_02) - 1;
}
if (arg0->unk_01 & 4) {
var_fv1 = func_80010500(arg0->unk_14, var_a1, 0x10);
} else {
var_fv1 = func_80010500(arg0->unk_14, var_a1, 0xC);
}
}
return var_fv1;
}
#ifdef NON_MATCHING
f32 func_80016934(Vec3s* arg0, s16 arg1, s16 arg2) {
s32 i;
f32 sp4;
Vec3s* temp_a1;
Vec3s* temp_v0;
Vec3s* var_a1;
f32 temp_fa0;
f32 temp_fa1;
f32 temp_ft3;
f32 temp_ft4;
f32 temp_ft5;
f32 temp_fv0;
f32 var_fv1;
s16 temp_v1_2;
s32 temp_v1;
s32 var_v0;
if (arg0->x >= arg2) {
var_fv1 = arg0->y;
} else {
if (arg2 >= arg0[arg1 - 1].x) {
var_fv1 = arg0[arg1 - 1].y;
} else {
for (i = 0; i < arg1 - 2; i++) {
if (arg2 < arg0[i + 1].x) {
break;
}
}
temp_fv0 = (arg2 - arg0[i].x) / 30.0f;
temp_fa0 = 30.0f / (arg0[i + 1].x - arg0[i].x);
temp_ft4 = CB(temp_fv0) * SQ(temp_fa0);
temp_ft5 = 2.0f * SQ(temp_fv0);
temp_ft3 = 3.0f * SQ(temp_fv0) * SQ(temp_fa0);
var_fv1 = (arg0[i + 1].z * (temp_ft4 - (SQ(temp_fv0) * temp_fa0))) +
((arg0[i].y * (((temp_ft5 * temp_fv0 * CB(temp_fa0)) - temp_ft3) + 1.0f)) +
(arg0[i + 1].y * ((-2.0f * CB(temp_fv0) * CB(temp_fa0)) + temp_ft3)) +
(arg0[i].z * ((temp_ft4 - (temp_ft5 * temp_fa0)) + temp_fv0)));
}
}
return var_fv1;
}
#else
f32 func_80016934(Vec3s* arg0, s16 arg1, s16 arg2);
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016934.s")
#endif
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016B30.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016D20.s")
f32 func_80016B30(Vec3s*, s16, s16);
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016DE0.s")
f32 func_80016D20(unk_D_800ABCC0* arg0, s32 arg1) {
f32 var_fv1;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
s16* tmp;
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016F20.s")
if (temp_v0->unk_00 < 2) {
var_fv1 = (s16)temp_v0->unk_04 / 100.0f;
} else {
tmp = &arg0->unk_0C[temp_v0->unk_04];
if (temp_v0->unk_03 & 4) {
var_fv1 = func_80016B30(tmp, temp_v0->unk_00, arg0->unk_02) / 100.0f;
} else {
var_fv1 = func_80016934(tmp, temp_v0->unk_00, arg0->unk_02) / 100.0f;
}
}
return var_fv1;
}
s16 func_80016DE0(unk_D_800ABCC0* arg0, s32 arg1) {
f32 var_fv1;
s16* temp_a0;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
if (temp_v0->unk_01 < 2) {
var_fv1 = (s16)temp_v0->unk_06 / 10.0f;
} else {
temp_a0 = &arg0->unk_10[temp_v0->unk_06];
if (temp_v0->unk_03 & 2) {
var_fv1 = func_80016B30(temp_a0, temp_v0->unk_01, arg0->unk_02) / 10.0f;
} else {
var_fv1 = func_80016934(temp_a0, temp_v0->unk_01, arg0->unk_02) / 10.0f;
}
}
while (var_fv1 < 0.0f) {
var_fv1 += 360.0f;
}
while (var_fv1 >= 360.0f) {
var_fv1 -= 360.0f;
}
return (var_fv1 / 360.0f) * 65536.0f;
}
f32 func_80016F20(unk_D_800ABCC0* arg0, s32 arg1) {
Vec3s* temp_a0;
f32 var_fv0;
f32 var_fv1;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
if (temp_v0->unk_02 < 2) {
var_fv1 = (s16)temp_v0->unk_08;
} else {
temp_a0 = &arg0->unk_14[temp_v0->unk_08];
if (temp_v0->unk_03 & 1) {
var_fv0 = func_80016B30(temp_a0, temp_v0->unk_02, arg0->unk_02);
} else {
var_fv0 = func_80016934(temp_a0, temp_v0->unk_02, arg0->unk_02);
}
var_fv1 = var_fv0;
}
return var_fv1;
}
typedef union unk_D_86002F58_004_000_010_02C_test {
struct {
s16 unk_00;
s16 unk_02;
};
s32 raw;
} unk_D_86002F58_004_000_010_02C_test; // size = 0x4
typedef struct unk_D_86002F58_004_000_040_test {
/* 0x00 */ s16 unk_00;
/* 0x04 */ unk_D_86002F58_004_000_040_004* unk_04;
/* 0x08 */ unk_D_86002F58_004_000_010_02C_test unk_08;
/* 0x0C */ s32 unk_0C;
/* 0x10 */ char unk10[0x2];
/* 0x12 */ u16 unk_12;
} unk_D_86002F58_004_000_040_test; // size >= 0x14
#ifdef NON_MATCHING
s32 func_80016FBC(unk_D_86002F58_004_000_040_test* arg0, u16 arg1) {
unk_D_86002F58_004_000_010_02C_test spC;
unk_D_86002F58_004_000_010_02C_test* ptr;
unk_D_86002F58_004_000_040_004* temp_v0;
spC = arg0->unk_08;
temp_v0 = arg0->unk_04;
if (arg1 != arg0->unk_12) {
spC.raw += arg0->unk_0C;
if (arg0->unk_0C >= 0) {
ptr = &spC;
if (ptr->unk_00 >= temp_v0->unk_0A) {
if (temp_v0->unk_00 & 2) {
ptr->unk_00 = temp_v0->unk_0A - 1;
} else {
ptr->unk_00 = temp_v0->unk_06;
}
}
} else {
ptr = &spC;
if (ptr->unk_00 < temp_v0->unk_06) {
if (temp_v0->unk_00 & 2) {
ptr->unk_00 = temp_v0->unk_06;
} else {
ptr->unk_00 = temp_v0->unk_0A - 1;
}
}
}
}
return spC.raw;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016FBC.s")
#endif
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80017080.s")
void func_80017080(void) {
D_800ABCF0 = -1;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80017090.s")
void func_80017090(unk_D_86002F58_004_000_040* arg0, u16 arg1, s32 arg2) {
unk_D_86002F58_004_000_040_004* temp_s1;
unk_D_800ABCC0* temp_s0;
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80017188.s")
temp_s1 = arg0->unk_04;
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_800171A8.s")
D_800ABCF0++;
if (D_800ABCF0 < 2) {
temp_s0 = &D_800ABCC0[D_800ABCF0];
if (arg0->unk_04 != NULL) {
if (arg2 != 0) {
arg0->unk_08 = func_80016FBC(arg0, arg1);
}
arg0->unk_12 = arg1;
temp_s0->unk_00 = 1;
temp_s0->unk_01 = arg0->unk_04->unk_00;
temp_s0->unk_02 = arg0->unk_08 >> 0x10;
temp_s0->unk_04 = temp_s1;
temp_s0->unk_08 = Util_ConvertAddrToVirtAddr(temp_s1->unk_0C);
temp_s0->unk_0C = Util_ConvertAddrToVirtAddr(temp_s1->unk_10);
temp_s0->unk_10 = Util_ConvertAddrToVirtAddr(temp_s1->unk_14);
temp_s0->unk_14 = Util_ConvertAddrToVirtAddr(temp_s1->unk_18);
if (temp_s0->unk_02 < 0) {
temp_s0->unk_02 = 0;
}
} else {
temp_s0->unk_00 = 0;
}
}
}
void func_80017188(void) {
if (D_800ABCF0 >= 0) {
D_800ABCF0--;
}
}
void func_800171A8(Vec3f* arg0, Vec3s* arg1, Vec3f* arg2, s32 arg3) {
if ((D_800ABCF0 >= 0) && (D_800ABCF0 < 2)) {
unk_D_800ABCC0* temp_s0 = &D_800ABCC0[D_800ABCF0];
if ((temp_s0->unk_00 == 1) && (arg3 >= 0) && (arg3 + 2 < temp_s0->unk_04->unk_08)) {
if (temp_s0->unk_01 & 8) {
arg0->x = func_80016F20(temp_s0, arg3 + 0);
arg0->y = func_80016F20(temp_s0, arg3 + 1);
arg0->z = func_80016F20(temp_s0, arg3 + 2);
arg1->x = func_80016DE0(temp_s0, arg3 + 0);
arg1->y = func_80016DE0(temp_s0, arg3 + 1);
arg1->z = func_80016DE0(temp_s0, arg3 + 2);
arg2->x = func_80016D20(temp_s0, arg3 + 0);
arg2->y = func_80016D20(temp_s0, arg3 + 1);
arg2->z = func_80016D20(temp_s0, arg3 + 2);
} else {
arg0->x = func_80016848(temp_s0, arg3 + 0);
arg0->y = func_80016848(temp_s0, arg3 + 1);
arg0->z = func_80016848(temp_s0, arg3 + 2);
arg1->x = func_800167B4(temp_s0, arg3 + 0);
arg1->y = func_800167B4(temp_s0, arg3 + 1);
arg1->z = func_800167B4(temp_s0, arg3 + 2);
arg2->x = func_80016700(temp_s0, arg3 + 0);
arg2->y = func_80016700(temp_s0, arg3 + 1);
arg2->z = func_80016700(temp_s0, arg3 + 2);
}
}
}
}
void func_800173CC(unk_D_86002F58_004_000* arg0) {
arg0->unk_040.unk_00 = -1;
@@ -46,7 +344,10 @@ s32 func_800173DC(unk_D_86002F58_004_000* arg0, s16 arg1, s32 arg2, s32 arg3) {
return ptr->unk_08 >> 0x10;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80017454.s")
s32 func_80017454(unk_D_86002F58_004_000* arg0, s32 arg1) {
arg0->unk_040.unk_0C = arg1;
return arg0->unk_040.unk_08 >> 0x10;
}
void func_80017464(unk_D_86002F58_004_000* arg0, s16 arg1) {
arg0->unk_040.unk_08 = (arg1 << 0x10) - arg0->unk_040.unk_0C;
+32 -5
View File
@@ -3,18 +3,45 @@
#include "global.h"
typedef struct unk_D_800ABCC0_008 {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ u8 unk_02;
/* 0x03 */ u8 unk_03;
/* 0x04 */ u16 unk_04;
/* 0x06 */ u16 unk_06;
/* 0x08 */ u16 unk_08;
} unk_D_800ABCC0_008; // size = 0xA
typedef struct unk_D_800ABCC0 {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ s16 unk_02;
/* 0x04 */ unk_D_86002F58_004_000_040_004* unk_04;
/* 0x08 */ unk_D_800ABCC0_008* unk_08;
/* 0x0C */ s16* unk_0C;
/* 0x10 */ s16* unk_10;
/* 0x14 */ s16* unk_14;
} unk_D_800ABCC0; // size = 0x18
f32 func_80016700(unk_D_800ABCC0* arg0, s32 arg1);
s16 func_800167B4(unk_D_800ABCC0* arg0, s32 arg1);
f32 func_80016848(unk_D_800ABCC0* arg0, s32 arg1);
f32 func_80016934(Vec3s* arg0, s16 arg1, s16 arg2);
f32 func_80016D20(unk_D_800ABCC0* arg0, s32 arg1);
s16 func_80016DE0(unk_D_800ABCC0* arg0, s32 arg1);
f32 func_80016F20(unk_D_800ABCC0* arg0, s32 arg1);
void func_80017080(void);
void func_80017090(unk_D_86002F58_004_000_040*, u16, s32);
void func_80017090(unk_D_86002F58_004_000_040* arg0, u16 arg1, s32 arg2);
void func_80017188(void);
void func_800171A8(Vec3f*, Vec3s*, Vec3f*, s32);
void func_800171A8(Vec3f* arg0, Vec3s* arg1, Vec3f* arg2, s32 arg3);
void func_800173CC(unk_D_86002F58_004_000* arg0);
s32 func_800173DC(unk_D_86002F58_004_000* arg0, s16 arg1, s32 arg2, s32 arg3);
s32 func_80017454(unk_D_86002F58_004_000* arg0, s32 arg1);
void func_80017464(unk_D_86002F58_004_000* arg0, s16 arg1);
s32 func_80017484(unk_D_86002F58_004_000* arg0, s16 arg1);
void func_800174E4(unk_D_86002F58_004_000* arg0);
s32 func_80017514(unk_D_86002F58_004_000* arg0);
void func_800175D8(void);
void func_800175E8(unk_D_86002F58_004_000_054*, u16, s32);
void func_800176BC(void);
#endif // _17300_H_
+2
View File
@@ -3,6 +3,8 @@
#include "global.h"
void func_800175E8(unk_D_86002F58_004_000_054* arg0, u16 arg1, s32 arg2);
void func_800176BC(void);
void func_800176DC(unk_D_86002F34_alt11_018**, unk_D_86002F34_alt11_018*, s16);
void func_80017788(unk_D_86002F58_004_000* arg0);
s16 func_80017798(unk_D_86002F58_004_000* arg0, s16 arg1, s32 arg2);
+2 -2
View File
@@ -489,7 +489,8 @@
- {vram: 0x800A7EA0, type: .bss, name: profiler}
- {vram: 0x800A8100, type: bss, name: unk_bss_2}
- {vram: 0x800AA6C0, type: .bss, name: 12D80}
- {vram: 0x800ABCC0, type: bss, name: unk_bss_13}
- {vram: 0x800ABCC0, type: .bss, name: 17300}
- {vram: 0x800ABD00, type: bss, name: unk_bss_13}
- {vram: 0x800ABE10, type: .bss, name: 19840}
- {vram: 0x800AC830, type: bss, name: unk_bss_14}
- {vram: 0x800AC880, type: .bss, name: 20330}
@@ -502,7 +503,6 @@
- {vram: 0x800FF990, type: .bss, name: 4B940}
- {vram: 0x800FF9B0, type: .bss, name: 4BDC0}
- {vram: 0x800FF9C0, type: bss, name: unk_bss_10}
# libleo
- {vram: 0x80100740, type: .bss, name: libleo/driverominit}