Merge pull request #224 from dplewis/17300-match
Some checks failed
C/C++ CI / build (push) Has been cancelled

Match 17300
This commit is contained in:
Revo 2026-01-10 15:51:50 -05:00 committed by GitHub
commit 246a0d68b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 278 additions and 61 deletions

View File

@ -3,6 +3,11 @@
#include "src/F420.h"
#include "src/18140.h"
typedef struct unk_func_80016B30_arg0 {
/* 0x00 */ Vec3s vec;
/* 0x06 */ s16 unk_06;
} unk_func_80016B30_arg0; // size = 0x8
static unk_D_800ABCC0 D_800ABCC0[2];
static s32 D_800ABCF0;
@ -74,23 +79,11 @@ f32 func_80016848(unk_D_800ABCC0* arg0, s32 arg1) {
return var_fv1;
}
#ifdef NON_MATCHING
f32 func_80016934(Vec3s* arg0, s16 arg1, s16 arg2) {
f32 y;
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 x;
f32 var_fv1;
s16 temp_v1_2;
s32 temp_v1;
s32 var_v0;
if (arg0->x >= arg2) {
var_fv1 = arg0->y;
@ -104,28 +97,47 @@ f32 func_80016934(Vec3s* arg0, s16 arg1, s16 arg2) {
}
}
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);
x = (arg2 - arg0[i].x) / 30.0f;
y = 30.0f / (arg0[i + 1].x - arg0[i].x);
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)));
var_fv1 = (arg0[i].y * (((2.0f * x * x * x * y * y * y) - 3.0f * x * x * y * y) + 1.0f))
+ (arg0[i + 1].y * ((-2.0f * x * x * x * y * y * y) + 3.0f * x * x * y * y))
+ (arg0[i].z * ((x * x * x * y * y - (2.0f * x * x * y)) + x))
+ (arg0[i + 1].z * (x * x * x * y * y - (x * x * y)));
}
}
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")
f32 func_80016B30(unk_func_80016B30_arg0* arg0, s16 arg1, s16 arg2) {
f32 y;
s32 i;
f32 x;
f32 var_fv1;
f32 func_80016B30(Vec3s*, s16, s16);
if (arg0->vec.x >= arg2) {
var_fv1 = arg0->vec.y;
} else {
if (arg2 >= arg0[arg1 - 1].vec.x) {
var_fv1 = arg0[arg1 - 1].vec.y;
} else {
for (i = 0; i < arg1 - 2; i++) {
if (arg2 < arg0[i + 1].vec.x) {
break;
}
}
x = (arg2 - arg0[i].vec.x) / 30.0f;
y = 30.0f / (arg0[i + 1].vec.x - arg0[i].vec.x);
var_fv1 = (arg0[i].vec.y * (((2.0f * x * x * x * y * y * y) - 3.0f * x * x * y * y) + 1.0f))
+ (arg0[i + 1].vec.y * ((-2.0f * x * x * x * y * y * y) + 3.0f * x * x * y * y))
+ (arg0[i].unk_06 * ((x * x * x * y * y - (2.0f * x * x * y)) + x))
+ (arg0[i + 1].vec.z * (x * x * x * y * y - (x * x * y)));
}
}
return var_fv1;
}
f32 func_80016D20(unk_D_800ABCC0* arg0, s32 arg1) {
f32 var_fv1;
@ -173,7 +185,7 @@ s16 func_80016DE0(unk_D_800ABCC0* arg0, s32 arg1) {
}
f32 func_80016F20(unk_D_800ABCC0* arg0, s32 arg1) {
Vec3s* temp_a0;
s16* temp_a0;
f32 var_fv0;
f32 var_fv1;
unk_D_800ABCC0_008* temp_v0 = &arg0->unk_08[arg1];
@ -192,36 +204,34 @@ f32 func_80016F20(unk_D_800ABCC0* arg0, s32 arg1) {
return var_fv1;
}
typedef union arg1_func_80010CA8_test {
typedef union unk_D_86002F58_004_000_040_raw_08 {
struct {
s16 unk_00;
s16 unk_02;
};
s32 raw;
} arg1_func_80010CA8_test; // size = 0x4
} unk_D_86002F58_004_000_040_raw_08; // size = 0x4
typedef struct unk_D_86002F58_004_000_040_test {
typedef struct unk_D_86002F58_004_000_040_raw {
/* 0x00 */ s16 unk_00;
/* 0x04 */ unk_D_86002F58_004_000_040_004* unk_04;
/* 0x08 */ arg1_func_80010CA8_test unk_08;
/* 0x08 */ unk_D_86002F58_004_000_040_raw_08 unk_08;
/* 0x0C */ s32 unk_0C;
/* 0x10 */ char unk10[0x2];
/* 0x12 */ u16 unk_12;
} unk_D_86002F58_004_000_040_test; // size >= 0x14
} unk_D_86002F58_004_000_040_raw; // size >= 0x14
#ifdef NON_MATCHING
s32 func_80016FBC(unk_D_86002F58_004_000_040_test* arg0, u16 arg1) {
arg1_func_80010CA8_test spC;
arg1_func_80010CA8_test* ptr;
s32 func_80016FBC(unk_D_86002F58_004_000_040_raw* arg0, u16 arg1) {
unk_D_86002F58_004_000_040_raw_08 spC;
unk_D_86002F58_004_000_040_raw_08* ptr;
unk_D_86002F58_004_000_040_004* temp_v0;
spC = arg0->unk_08;
ptr = &spC;
temp_v0 = arg0->unk_04;
if (arg1 != arg0->unk_12) {
spC.raw = arg0->unk_08.raw;
if (arg0->unk_12 != arg1) {
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;
@ -230,7 +240,6 @@ s32 func_80016FBC(unk_D_86002F58_004_000_040_test* arg0, u16 arg1) {
}
}
} else {
ptr = &spC;
if (ptr->unk_00 < temp_v0->unk_06) {
if (temp_v0->unk_00 & 2) {
ptr->unk_00 = temp_v0->unk_06;
@ -243,9 +252,6 @@ s32 func_80016FBC(unk_D_86002F58_004_000_040_test* arg0, u16 arg1) {
return spC.raw;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/17300/func_80016FBC.s")
#endif
void func_80017080(void) {
D_800ABCF0 = -1;

View File

@ -144,7 +144,7 @@ s32 func_80003680(u32 addr, s32 arg1, u8* arg2) {
unk_func_80003680_sp300 sp300;
u8 sp200[2][0x80];
unk_func_80003680_spB0 spB0[4];
u8* temp_s0;
u16* temp_s0;
u8* temp_s3;
unk_func_80003680_sp90 sp90;
unk_func_80003680_sp27 sp74;

View File

@ -1,17 +1,229 @@
#include "C970.h"
typedef struct unk_func_8000C104_arg1 {
/* 0x000 */ u8 value;
/* 0x001 */ u8 pad01[0x0F];
/* 0x010 */ u16 unk_10;
/* 0x012 */ u8 pad12[0xEE];
/* 0x100 */ u16 unk_100;
} unk_func_8000C104_arg1; // size >= 0x102
#ifdef NON_MATCHING
void func_8000BD70(u8* in_quantization_tables, u8* out_quantization_tables, s32 num_tables) {
u8* src;
u8* dst;
s32 i;
s32 j;
s32 count;
src = in_quantization_tables;
count = num_tables & 0xFF;
for (i = 0; i < count; i++) {
src++;
for (j = 0; j < 0x40; j++) {
dst = out_quantization_tables + (i << 7) + (j * 2);
*(s16*)dst = (s16)*src;
src++;
}
}
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000BD70.s")
#endif
#ifdef NON_MATCHING
s16 func_8000BDD8(u8* arg0, u16* arg1) {
s16 var_a2;
s16 var_v1;
s8 i;
s8 var_v0;
u8* temp_a1;
var_v0 = 1;
var_v1 = 0;
var_a2 = 1;
for (i = 1; i < 0x11; i = (var_v0 + 1) & 0xFF) {
temp_a1 = &arg0[i];
if ((s32) temp_a1[-1] > 0) {
do {
arg1[var_v1] = var_v0;
var_a2 += 1;
var_v1 += 1;
} while ((s32) temp_a1[-1] >= var_a2);
var_a2 = 1;
}
var_v0 = i;
}
arg1[var_v1] = 0;
return var_v1;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000BDD8.s")
#endif
#ifdef NON_MATCHING
s16 func_8000BE5C(u8* arg0, u16* arg1) {
s16 var_v0;
s16 var_v1;
s32 temp_t6;
u8 temp_t0;
u8 var_a2;
u8 var_a3;
var_a2 = *arg0;
var_v1 = 0;
var_v0 = 0;
var_a3 = var_a2;
while(1) {
temp_t6 = var_v1 * 2;
var_v1 += 1;
arg1[temp_t6] = var_v0;
temp_t0 = arg0[var_v1];
var_v0 = (var_v0 + 1) & 0xFFFF;
if (var_a3 == temp_t0) {
continue;
}
if (temp_t0 != 0) {
do {
var_a3 = (var_a2 + 1) & 0xFF;
var_v0 = (var_v0 * 2) & 0xFFFF;
var_a2 = var_a3;
} while (temp_t0 != var_a3);
continue;
}
break;
}
return var_v1;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000BE5C.s")
#endif
#ifdef NON_MATCHING
s8 func_8000BEC8(u8* arg0, unk_func_80003680_spB0* arg1, u16* arg2) {
s32 i;
s32 temp_t4;
s8 var_v1;
var_v1 = 0;
for (i = 0; i < 16; i = (i + 1) & 0xFF) {
if (arg0[i] != 0) {
arg1->unk_00[i] = var_v1;
arg1->unk_10[i] = arg2[var_v1];
temp_t4 = ((var_v1 + arg0[i]) - 1) & 0xFFFF;
var_v1 = (temp_t4 + 1);
arg1->unk_30[i] = arg2[temp_t4];
} else {
arg1->unk_30[i] = 0xFFFF;
}
}
return var_v1;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000BEC8.s")
#endif
#ifdef NON_MATCHING
s16 func_8000BF70(u8* arg0, unk_func_80003680_spB0* arg1, u8* arg2, u16* arg3, u8 arg4) {
s16 temp_v0;
temp_v0 = func_8000BDD8(arg2, arg3);
if ((temp_v0 == 0) || ((arg4 != 0) && (temp_v0 >= 0x101)) || ((arg4 == 0) && (temp_v0 >= 0x11))) {
return 0;
}
if (func_8000BE5C(arg2, arg3) != temp_v0) {
return 0;
}
if (temp_v0 != func_8000BEC8(arg0, arg1, arg3)) {
return 0;
}
return temp_v0;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000BF70.s")
#endif
#ifdef NON_MATCHING
s32 func_8000C02C(u8* arg0, unk_func_80003680_spB0* arg1, u8* arg2, u16* arg3, s32 arg4) {
s32 temp_at;
s32 temp_lo;
s32 temp_t8;
s32 temp_v0;
s32 var_s1;
u8* var_s0;
u8* temp_s0;
u8* temp_s0_2;
var_s0 = arg0;
var_s1 = 0;
if ((s32) arg4 > 0) {
while(1) {
temp_lo = var_s1 * 0x54;
temp_s0 = var_s0 + 1;
temp_v0 = func_8000BF70(temp_s0, &arg1[temp_lo], arg2, arg3, (s32) *var_s0 >> 4);
temp_s0_2 = temp_s0 + 0x10;
if (temp_v0 == 0) {
return 1;
}
temp_t8 = (var_s1 + 1) & 0xFF;
temp_at = temp_t8 < (s32) arg4;
arg1[temp_lo].unk_50 = temp_s0_2;
var_s1 = temp_t8;
var_s0 = temp_s0_2 + temp_v0;
if (temp_at == 0) {
return 0;
}
}
}
return 0;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000C02C.s")
#endif
#ifdef NON_MATCHING
void func_8000C104(u8* arg0, unk_func_8000C104_arg1* arg1, u8* arg2, u16* arg3, s16 arg4, u8 arg5) {
s16 i;
u8 temp_v1;
for (i = 0; i < arg4; i++) {
temp_v1 = arg0[i];
if (arg5 != 0) {
arg1[temp_v1 * 2].unk_100 = arg3[i];
arg1[temp_v1].value = arg2[i];
} else {
arg1[temp_v1 * 2].unk_10 = arg3[i];
arg1[temp_v1].value = arg2[i];
}
}
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000C104.s")
#endif
#ifdef NON_MATCHING
s32 func_8000C1AC(u8* arg0, unk_func_8000C104_arg1* arg1, u8* arg2, u16* arg3) {
u8 sp2F;
s16 sp2C;
s16 temp_v0;
u8* temp_s0;
temp_s0 = arg0 + 1;
sp2F = (u8) ((s32) *arg0 >> 4);
temp_v0 = func_8000BDD8(temp_s0, arg2);
if ((temp_v0 == 0) || ((sp2F != 0) && (temp_v0 >= 0x101)) || ((sp2F == 0) && (temp_v0 >= 0x11))) {
return 1;
}
sp2C = temp_v0;
if (func_8000BE5C(arg2, arg3) != temp_v0) {
return 1;
}
func_8000C104((u8*)temp_s0 + 0x10, arg1, arg2, arg3, temp_v0, sp2F);
return 0;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/C970/func_8000C1AC.s")
#endif

View File

@ -11,6 +11,6 @@ typedef struct unk_func_80003680_spB0 {
} unk_func_80003680_spB0; // size = 0x54
void func_8000BD70(u8* in_quantization_tables, u8* out_quantization_tables, s32 num_tables);
void func_8000C02C(u8* in_huffman_table, unk_func_80003680_spB0*, u8*, u8*, s32);
s32 func_8000C02C(u8*, unk_func_80003680_spB0*, u8*, u16*, s32);
#endif // _C970_H_

View File

@ -1,6 +1,14 @@
#include "global.h"
#include "memmap.h"
struct MemoryMap {
uintptr_t vaddr;
size_t size;
};
struct MemoryMap gSegments[16];
struct MemoryMap gFragments[240];
/*
* Set the base virtual address and size of the specified segment memmap.
*/

View File

@ -7,16 +7,6 @@
#define RELOCATIONS_SIZE
#endif
struct MemoryMap {
uintptr_t vaddr;
size_t size;
};
// these are probably .bss symbols in memmap.c, but until I have more
// of bss mapped, not 100% sure if they go in that file. TODO: Migrate
extern struct MemoryMap gSegments[16];
extern struct MemoryMap gFragments[240];
/* MIPS Relocation Types */
#define R_MIPS_32 2
#define R_MIPS_26 4

View File

@ -2,4 +2,4 @@
#include <macros.h>
// used for padding. Splat cant auto gen these I guess
UNUSED static u8 unk_bss[0x800A6070 - 0x80083CA0];
UNUSED static u8 unk_bss[0x800A5870 - 0x80083CA0];

View File

@ -57,7 +57,7 @@
- [0xF420, c] #
- [0x11BA0, c] #
- [0x12D80, c] #
- [0x17300, c] #
- [0x17300, c, 17300] #
- [0x18140, c] # dp model animations
- [0x18480, c, geo_layout] # dp model animations
- [0x19840, c] # alternative pkm textures
@ -493,6 +493,7 @@
- {vram: 0x8007F190, type: .bss, name: main}
- {vram: 0x80081900, type: .bss, name: rsp}
- {vram: 0x80083CA0, type: bss, name: unk_bss}
- {vram: 0x800A5870, type: .bss, name: memmap}
- {vram: 0x800A6070, type: .bss, name: memory_main}
- {vram: 0x800A60B0, type: bss, name: unk_bss_4}
- {vram: 0x800A60C0, type: .bss, name: 3FB0}