Merge pull request #222 from dplewis/30640

30640
This commit is contained in:
Revo 2026-01-09 08:49:59 -05:00 committed by GitHub
commit a2e2f12a6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 732 additions and 60 deletions

View File

@ -35,6 +35,7 @@ typedef struct unk_func_80026268_arg0 {
/* 0x07 */ u8 unk_07;
/* 0x08 */ u8 unk_08;
/* 0x09 */ u8 unk_09[4];
/* 0x0D */ u8 pad0D;
/* 0x0E */ u16 unk_0E;
/* 0x10 */ u32 unk_10;
/* 0x14 */ u16 unk_14;
@ -54,9 +55,9 @@ typedef struct unk_func_80026268_arg0 {
/* 0x30 */ u8 unk_30[11];
/* 0x3B */ u8 unk_3B[11];
/* 0x46 */ u8 unk_46[11];
/* 0x51 */ char unk51[0x1];
/* 0x51 */ u8 pad51;
/* 0x52 */ u8 unk_52;
/* 0x52 */ u8 unk_53;
/* 0x53 */ u8 unk_53;
} unk_func_80026268_arg0; // size = 0x54
typedef struct unk_D_800AE540_0874 {

View File

@ -1,5 +1,7 @@
#include "30640.h"
#include "include/math.h"
#include "src/fragments/15/fragment15.h"
#include "src/fragments/34/fragment34.h"
#include "src/11BA0.h"
#include "src/12D80.h"
#include "src/17300.h"
@ -10,16 +12,49 @@
#include "src/1CF30.h"
#include "src/29BA0.h"
#include "src/3FB0.h"
#include "src/37370.h"
#include "src/4BDC0.h"
#include "src/F420.h"
#include "src/math_util.h"
#include "src/memory.h"
#include "src/util.h"
extern s32 D_80075F84;
typedef struct {
/* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s16 unk_04;
/* 0x06 */ s16 unk_06;
/* 0x08 */ s16 unk_08;
/* 0x0A */ s16 unk_0A;
/* 0x0C */ s16 unk_0C;
/* 0x0E */ s16 unk_0E;
} unk_D_800761B0; /* size = 0x40 */
typedef struct unk_func_8003013C_arg1 {
/* 0x00 */ u8 pad00[0x1C];
/* 0x1C */ s16 unk_1C;
/* 0x1E */ s16 unk_1E;
} unk_func_8003013C_arg1; // size >= 0x20
extern unk_func_80031270* D_80075F80;
extern s32 D_80075F90;
extern unk_func_80031270* D_80075F84;
extern u32* D_80075F88;
extern unk_D_80068BB0* D_80075F90;
extern s32 D_80075F94;
extern s32 D_80075F98;
extern s32 D_80075F9C;
extern u32 D_80075FA0[];
extern u32 D_8007616C[];
extern unk_D_800761B0 D_800761B0[12];
extern f64 D_8007C538;
extern f64 D_8007C540;
extern f64 D_8007C548;
extern f64 D_8007C550;
extern f64 D_8007C558;
extern f64 D_8007C560;
extern f64 D_8007C568;
extern f64 D_8007C570;
void func_800318B8(void);
void func_8340051C(void);
@ -198,31 +233,354 @@ void func_8002FF20(void) {
D_80075F90 = 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8002FF2C.s")
s32 func_8002FF2C(unk_D_83403C60* arg0) {
return ((s32) arg0->unk_6C >> 2) & 3;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8002FF3C.s")
f32 func_8002FF3C(unk_D_83403C60* arg0) {
s32 index;
f32* table;
index = ((s32) arg0->unk_6C >> 1) & 1;
table = (f32*)Util_ConvertAddrToVirtAddr(&D_80075F88);
return table[index];
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8002FF7C.s")
u32 func_8002FF7C(unk_D_83403C60* arg0) {
u8 v1 = arg0->unk_6C;
v1 = v1 >> 4;
return v1 & 0xF;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8002FF8C.s")
s32 func_8002FF8C(s32 arg0) {
unk_func_80031270* var_a1;
UNUSED unk_func_80031270* sp1C;
var_a1 = NULL;
switch (arg0) {
case 0:
var_a1 = D_80075F80;
break;
case 2:
var_a1 = D_80075F84;
break;
case 5:
var_a1 = D_80075F84;
break;
}
sp1C = var_a1;
if (func_800317D8(var_a1) != 0) {
return func_8002FF2C(var_a1->unk_18);
}
return 0;
}
#ifdef NON_MATCHING
s32 func_80030010(s32 arg0, unk_D_86002F34_00C* arg1) {
s32* src;
s32* dst;
if (arg0 == 2) {
src = (s32*)((u8*)D_80075F84->unk_18 + 0x50);
func_80011DAC(arg1, 0, 0, D_80075F84->unk_04, D_80075F84->unk_06);
func_80011E68(arg1, func_8002FF3C(D_80075F84->unk_18), 20.0f, 10000.0f);
dst = (s32*)((u8*)arg1 + 0xA8);
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
dst[4] = src[4];
dst[5] = src[5];
}
return 0;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80030010.s")
#endif
#ifdef NON_MATCHING
s32 func_800300CC(s32 arg0, unk_D_86002F34_00C* arg1) {
if ((func_8002FF8C(arg0) != 0) && (arg0 == 2)) {
func_80011DAC(arg1, 0, 0, D_80075F84->unk_04, D_80075F84->unk_06);
func_80011E68(arg1, 45.0f, 20.0f, 8000.0f);
}
return 0;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800300CC.s")
#endif
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8003013C.s")
s32 func_8003013C(s32 arg0, unk_func_8003013C_arg1* arg1) {
UNUSED s32 pad;
f32 sp28;
s16 sp26;
s16 sp24;
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800301A4.s")
if (arg0 == 2) {
func_800102A4(&D_8006F088->unk_60.at, &D_8006F088->unk_60.eye, &sp28, &sp26, &sp24);
arg1->unk_1C = (s16) (sp26 + 0x2000);
arg1->unk_1E = (s16) (sp24 - 0x2000);
}
return 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80030210.s")
s32 func_800301A4(s32 arg0, unk_func_8003013C_arg1* arg1) {
UNUSED s32 pad;
f32 sp28;
s16 sp26;
s16 sp24;
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80030228.s")
if (arg0 == 2) {
func_800102A4(&D_8006F088->unk_60.at, &D_8006F088->unk_60.eye, &sp28, &sp26, &sp24);
arg1->unk_1C = (s16) (-0x2000 - sp26);
arg1->unk_1E = (s16) (sp24 + 0x6000);
}
return 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80030240.s")
s32 func_80030210(s32 arg0, unk_D_86002F58_004_000* arg1) {
if (arg0 == 0) {
D_80075F80->unk_20 = arg1;
}
return 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800302A4.s")
s32 func_80030228(s32 arg0, unk_func_80031270_024* arg1) {
if (arg0 == 0) {
D_80075F80->unk_24 = arg1;
}
return 0;
}
s32 func_80030240(s32 arg0, GraphNode* arg1) {
s32 temp_v0;
if (arg0 == 0) {
temp_v0 = arg1->unk_14;
switch (temp_v0) { /* irregular */
case 0:
D_80075F80->unk_28 = arg1;
break;
case 1:
D_80075F80->unk_2C = arg1;
break;
case 2:
D_80075F80->unk_30 = arg1;
break;
}
arg1->unk_14 = 0;
}
return 0;
}
void func_800302A4(s32 arg0, s32 arg1) {
s16 temp_a0;
s16 temp_a1;
s32 temp_a3;
s32 temp_v0;
s32 temp_v1;
s32 temp_a2;
s32 i;
unk_D_800761B0* var = &D_800761B0[10];
unk_D_800761B0* var2 = &D_800761B0[11];
temp_v0 = arg0 - 0xC8;
temp_v1 = arg0 + 0xC8;
temp_a2 = arg1 + 0x2B;
temp_a3 = arg1 - 0x2B;
for(i = 0; i < 12; i+=2) {
D_800761B0[i].unk_00 = temp_v0;
D_800761B0[i].unk_08 = 0;
D_800761B0[i + 1].unk_00 = temp_v1;
D_800761B0[i + 1].unk_08 = 0x18E0;
if (i < 10) {
temp_a0 = temp_a2 - (i * 0xA);
D_800761B0[i].unk_02 = temp_a0;
D_800761B0[i + 1].unk_02 = temp_a0;
temp_a1 = (i * 5) << 5;
D_800761B0[i].unk_0A = temp_a1;
D_800761B0[i + 1].unk_0A = temp_a1;
} else {
D_800761B0[10].unk_02 = temp_a3;
var->unk_0A = 0x540;
D_800761B0[11].unk_02 = temp_a3;
var2->unk_0A = 0x540;
}
}
}
#ifdef NON_MATCHING
s32 func_800303C8(s32 arg0, UNUSED GraphNode* arg1) {
char* sp16C;
u8* sp40;
char* temp_s2;
s32 temp_v0;
s32 var_a0;
s32 var_a0_2;
s32 var_a1;
s32 var_ra;
s32 var_ra_2;
s32 var_s1;
s32 var_s2;
s32 var_s4;
s32 var_s5;
s32 var_t4;
s32 var_t4_2;
s32 var_t5;
s32 var_v0;
s32 var_v1;
temp_v0 = func_8002FF8C(arg0);
if ((temp_v0 != 0) && (arg0 == 2)) {
temp_s2 = (char*)((u8*)D_80075F84->unk_18 + 0x73);
D_80075F9C = func_8001F5B0(0x10, 0, temp_s2);
func_800302A4(0, -0x96);
func_80006498(&gDisplayListHead, D_80075F90);
func_8000699C(&gDisplayListHead, 0);
gDPPipeSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3000C00; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3001201; _gfx->words.w1 = 0x2000; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3001402; _gfx->words.w1 = 0xC00; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3000F00; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3000D01; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3000A01; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xFCFFFFFF; _gfx->words.w1 = 0xFFFCF279; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE200001C; _gfx->words.w1 = 0x553048; }
sp16C = temp_s2;
if (temp_v0 == 1) {
var_t4 = 0;
var_ra = 0xF;
for (var_t5 = 0xE; var_t5 < 0x2C; var_t5 += 0xF) {
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xFD100063; _gfx->words.w1 = &D_5001950; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF5103200; _gfx->words.w1 = 0x07080200; }
gDPLoadSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((var_t4 * 4) & 0xFFF) | 0xF4000000); _gfx->words.w1 = (s32) (((var_t5 * 4) & 0xFFF) | 0x0718C000); }
gDPPipeSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF5103200; _gfx->words.w1 = 0x80200; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((var_t4 * 4) & 0xFFF) | 0xF2000000); _gfx->words.w1 = (s32) (((var_t5 * 4) & 0xFFF) | 0x18C000); }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((var_ra * 4) & 0xFFF) | 0xE4190000); _gfx->words.w1 = (var_t4 * 4) & 0xFFF; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE1000000; _gfx->words.w1 = (var_t4 << 5) & 0xFFFF; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF1000000; _gfx->words.w1 = 0x04000400; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((var_ra * 4) & 0xFFF) | 0xE4320000); _gfx->words.w1 = (s32) (((var_t4 * 4) & 0xFFF) | 0x190000); }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE1000000; _gfx->words.w1 = (s32) (((var_t4 << 5) & 0xFFFF) | 0x0C800000); }
var_t4 += 0xF;
var_ra += 0xF;
}
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xFD100063; _gfx->words.w1 = &D_5001950; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF5103200; _gfx->words.w1 = 0x07080200; }
gDPLoadSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF4000078; _gfx->words.w1 = 0x0718C0A8; }
gDPPipeSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF5103200; _gfx->words.w1 = 0x80200; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF2000078; _gfx->words.w1 = 0x18C0A8; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE41900AC; _gfx->words.w1 = 0x78; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE1000000; _gfx->words.w1 = 0x3C0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF1000000; _gfx->words.w1 = 0x04000400; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE43200AC; _gfx->words.w1 = 0x190078; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE1000000; _gfx->words.w1 = 0x0C8003C0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF1000000; _gfx->words.w1 = 0xFC000400; }
func_8001F3F4();
func_8001F470();
func_8001F324(0xF0, 0x78, 0x6E, 0xFF);
func_8001F36C(0xF0, 0xF0, 0x78, 0xFF);
func_8001EBE0(0x10, 0);
func_8001F1E8(0x64 - ((s32) D_80075F9C / 2), 5, sp16C);
func_8001F4C4();
func_8001F444();
} else {
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xFD10001F; _gfx->words.w1 = &D_5003AE8; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF5101000; _gfx->words.w1 = 0x07080200; }
gDPLoadSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C09C; }
gDPPipeSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF5101000; _gfx->words.w1 = 0x80200; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C09C; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE42600A0; _gfx->words.w1 = 0x40000; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE1000000; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF1000000; _gfx->words.w1 = 0x04000400; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE42E40A0; _gfx->words.w1 = 0x260000; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE1000000; _gfx->words.w1 = 0x04000000; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF1000000; _gfx->words.w1 = 0xFC000400; }
func_8001F3F4();
func_8001F470();
func_8001F324(0xDC, 0xFF, 0xDC, 0xFF);
func_8001F36C(0x78, 0xB4, 0xFF, 0xFF);
func_8001EBE0(0x10, 0);
func_8001F1E8(0x64 - ((s32) D_80075F9C / 2), 7, sp16C);
func_8001F4C4();
func_8001F444();
}
func_80006498(&gDisplayListHead, D_80075F84->unk_08);
gDPPipeSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE3000A01; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xFCFFFFFF; _gfx->words.w1 = 0xFFFCF279; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE200001C; _gfx->words.w1 = 0x553048; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xD7000002; _gfx->words.w1 = -1; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xDA380003; _gfx->words.w1 = &D_8006F010; }
var_s4 = 0;
var_s5 = 9;
var_ra_2 = 0;
var_s1 = 4;
var_s2 = 2;
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0x0100C018; _gfx->words.w1 = &D_800761B0; }
for (var_t4_2 = 6; var_t4_2 < 0x1A; var_t4_2 += 4) {
var_s5 += 0xA;
var_s4 += 0xA;
var_v1 = var_s2 & 0xFF;
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((D_80075F94 - 1) & 0xFFF) | 0xFD100000); _gfx->words.w1 = (s32) D_80075F90->img_p; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((((s32) ((D_80075F94 * 2) + 7) >> 3) & 0x1FF) << 9) | 0xF5100000); _gfx->words.w1 = 0x07080200; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((var_s4 * 4) & 0xFFF) | 0xF4000000); _gfx->words.w1 = (s32) (((((D_80075F94 - 1) * 4) & 0xFFF) << 0xC) | 0x07000000 | ((var_s5 * 4) & 0xFFF)); }
gDPPipeSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((((s32) ((D_80075F94 * 2) + 7) >> 3) & 0x1FF) << 9) | 0xF5100000); _gfx->words.w1 = 0x80200; }
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((var_s4 * 4) & 0xFFF) | 0xF2000000); _gfx->words.w1 = (s32) (((((D_80075F94 - 1) * 4) & 0xFFF) << 0xC) | ((var_s5 * 4) & 0xFFF)); }
{
Gfx *_gfx = (Gfx *)(gDisplayListHead++);
var_v0 = var_s1 & 0xFF;
if (var_t4_2 == 6) {
var_a0 = ((var_ra_2 & 0xFF) << 0x10) | (var_v0 << 8) | var_v1;
} else {
var_v1 = var_s2 & 0xFF;
if (var_t4_2 == 8) {
var_v0 = var_s1 & 0xFF;
var_v1 = var_s2 & 0xFF;
var_a1 = (var_v0 << 0x10) | (var_v1 << 8) | (var_ra_2 & 0xFF);
} else {
var_v0 = var_s1 & 0xFF;
var_a1 = (var_v1 << 0x10) | ((var_ra_2 & 0xFF) << 8) | var_v0;
}
var_a0 = var_a1;
}
_gfx->words.w0 = (s32) (var_a0 | 0x06000000);
if (var_t4_2 == 6) {
_gfx->words.w1 = (s32) ((var_v1 << 0x10) | (var_v0 << 8) | (var_t4_2 & 0xFF));
} else {
if (var_t4_2 == 8) {
var_a0_2 = (var_v0 << 0x10) | ((var_t4_2 & 0xFF) << 8) | var_v1;
} else {
var_a0_2 = ((var_t4_2 & 0xFF) << 0x10) | (var_v1 << 8) | var_v0;
}
_gfx->words.w1 = var_a0_2;
}
}
var_ra_2 += 4;
var_s1 += 4;
var_s2 += 4;
}
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80075F94, D_80075F90->img_p);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = (s32) (((((s32) ((D_80075F94 * 2) + 7) >> 3) & 0x1FF) << 9) | 0xF5100000); _gfx->words.w1 = 0; }
gDPLoadSync(gDisplayListHead++);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF40000A0; _gfx->words.w1 = (s32) (((((D_80075F94 - 1) * 4) & 0xFFF) << 0xC) | 0x07000000 | (((D_80075F98 - 1) * 4) & 0xFFF)); }
gDPPipeSync(gDisplayListHead++);
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, (((D_80075F94 * 2) + 7) >> 3), 0, 0, 0, G_TX_CLAMP, 0, 0, G_TX_CLAMP, 0, 0);
{ Gfx *_gfx = (Gfx *)(gDisplayListHead++); _gfx->words.w0 = 0xF20000A0; _gfx->words.w1 = (s32) (((((D_80075F94 - 1) * 4) & 0xFFF) << 0xC) | (((D_80075F98 - 1) * 4) & 0xFFF)); }
gSP2Triangles(gDisplayListHead++, 9, 8, 10, 0, 11, 9, 10, 0);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
}
return 0;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800303C8.s")
#endif
void func_8003107C(unk_D_83402EE0_070* arg0, unk_func_80026268_arg0* arg1) {
s32 i;
@ -257,7 +615,7 @@ void func_80031140(unk_func_80026268_arg0* arg0, unk_D_83407AC8* arg1) {
}
}
void func_80031204(unk_func_80031270* arg0, s16 arg1, s16 arg2) {
void func_80031204(unk_func_80031270* arg0, UNUSED s16 arg1, UNUSED s16 arg2) {
UNUSED s32 pad;
MemoryBlock* sp18;
@ -270,7 +628,7 @@ void func_80031204(unk_func_80031270* arg0, s16 arg1, s16 arg2) {
unk_func_80031270* func_80031270(s16 arg0, s16 arg1, unk_D_80068BB0* arg2, unk_D_80068BB0* arg3,
unk_D_86002F58_004_000_010* arg4, BinArchive* arg5, unk_D_83403C60* arg6) {
unk_D_80068BB0* var_v0;
UNUSED unk_D_80068BB0* var_v0;
unk_func_80031270* temp_v0 = main_pool_alloc(sizeof(unk_func_80031270), 0);
if (temp_v0 != NULL) {
@ -307,27 +665,181 @@ unk_func_80031270* func_80031270(s16 arg0, s16 arg1, unk_D_80068BB0* arg2, unk_D
return temp_v0;
}
void func_80031390(unk_func_80031270*);
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031390.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800314BC.s")
void func_800314BC(unk_func_80031270* arg0) {
MemoryBlock* sp24;
FragmentEntry sp20;
u32* temp_v0;
u32* temp_v0_2;
u32* temp_v0_3;
unk_func_800314BC_temp_v4* temp_v0_4;
unk_func_80031270_024* temp_v1;
func_8001103C(0, arg0->unk_28);
func_8001103C(0, arg0->unk_2C);
func_8001103C(0, arg0->unk_30);
sp20 = func_8000484C(arg0->unk_14, D_8007616C[func_8002FF7C(arg0->unk_18)]);
sp24 = func_80002D10(main_pool_get_available(), 0);
temp_v0 = sp20(0, 0);
if (temp_v0 != NULL) {
func_80012094(arg0->unk_28, process_geo_layout(sp24, temp_v0));
}
temp_v0_2 = sp20(1, 0);
if (temp_v0_2 != NULL) {
func_80012094(arg0->unk_2C, process_geo_layout(sp24, temp_v0_2));
}
temp_v0_3 = sp20(3, 0);
if (temp_v0_3 != NULL) {
func_80012094(arg0->unk_30, process_geo_layout(sp24, temp_v0_3));
}
arg0->unk_34 = sp20(2, 0);
func_80002D60(sp24);
temp_v0_4 = sp20(4, 0);
if (temp_v0_4 == NULL) {
temp_v1 = arg0->unk_24;
temp_v1->unk_01 = (u8) (temp_v1->unk_01 & 0xFFFE);
arg0->unk_24->unk_14 = 0;
return;
}
arg0->unk_24->unk_18 = (s16) temp_v0_4->unk_00;
arg0->unk_24->unk_1A = (s16) temp_v0_4->unk_02;
arg0->unk_24->unk_1C = (s32) temp_v0_4->unk_04;
arg0->unk_24->unk_14 = 1;
temp_v1 = arg0->unk_24;
temp_v1->unk_01 = (u8) (temp_v1->unk_01 | 1);
}
#ifdef NON_MATCHING
u8* func_80031660(unk_func_80031270* arg0) {
void* sp24;
void (*sp20)();
u32 temp_v0_2;
void* v0_ptr;
sp24 = (arg0->unk_18 + 0x50);
sp20 = Util_ConvertAddrToVirtAddr(&func_8140C734);
D_80075F84 = arg0;
if (arg0->unk_00 == 1) {
if (arg0->unk_02 != 1) {
if (arg0->unk_02 == 2) {
func_80031390(arg0);
func_800314BC(arg0);
}
} else {
func_80006498(&gDisplayListHead, arg0->unk_08);
temp_v0_2 = arg0->unk_34;
if ((temp_v0_2 == -1U) || (temp_v0_2 == 0)) {
func_8000699C(&gDisplayListHead, 1);
} else if (temp_v0_2 < 0x10000U) {
func_8000699C(&gDisplayListHead, temp_v0_2 & 0xFFFF);
} else {
func_8000699C(&gDisplayListHead, 0xA6BF);
}
func_80015348();
v0_ptr = Util_ConvertAddrToVirtAddr(&D_8140E6B8);
v0_ptr = (s32) sp24;
sp20();
func_80015094(arg0->unk_1C);
}
}
switch (arg0->unk_00) { /* irregular */
case 0:
arg0->unk_00 = 1U;
arg0->unk_02 = 2;
break;
case 1:
arg0->unk_02--;
if (arg0->unk_02 <= 0) {
arg0->unk_00 = 2U;
}
break;
case 2:
break;
}
return arg0->unk_08->img_p;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031660.s")
#endif
s32 func_800317D8(unk_func_80031270* arg0) {
s32 var_v1;
s32 sp1C;
unk_D_83403C60* temp_a0;
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800317D8.s")
var_v1 = 0;
if (arg0 != NULL) {
temp_a0 = arg0->unk_18;
if (temp_a0 != 0) {
sp1C = 0;
var_v1 = sp1C;
if (func_800318C4(temp_a0) != 0) {
var_v1 = 1;
}
}
}
return var_v1;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_8003181C.s")
s32 func_8003181C(unk_func_80031270** arg0, s32 arg1) {
unk_func_80031270* temp_s1;
s32 sp30;
s32 i;
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800318AC.s")
sp30 = -1;
for (i = 0; i < arg1; i++) {
temp_s1 = arg0[i];
if ((func_800317D8(temp_s1) != 0) && (temp_s1->unk_00 == 1)) {
sp30 = i;
break;
}
}
return sp30;
}
unk_func_80031270* func_800318AC(void) {
return D_80075F84;
}
void func_800318B8(void) {
D_80075F84 = 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800318C4.s")
s32 func_800318C4(unk_D_83403C60* arg0) {
s32 v1 = 0;
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_800318F0.s")
if ((arg0->unk_00.unk_04 > 0 && arg0->unk_00.unk_04 < 0x98) || arg0->unk_00.unk_04 == 0x99) {
v1 = 1;
}
return v1;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031910.s")
void func_800318F0(void) {
func_80036790();
}
void func_80031910(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) {
f32 sp144;
f32 sp140;
f32 temp_fa0;
f32 temp_fa1;
UNUSED s32 pad[1];
Mtx spF0;
Mtx spB0;
Mtx sp70;
UNUSED s32 pad2[16];
temp_fa1 = arg4 - arg1;
temp_fa0 = arg6 - arg3;
sp140 = (f32) (((f64) (f32) MathUtil_Atan2s(temp_fa0, temp_fa1) * D_8007C538) / D_8007C540);
sp144 = (f32) (((f64) (f32) MathUtil_Atan2s(arg5 - arg2, sqrtf((temp_fa1 * temp_fa1) + (temp_fa0 * temp_fa0))) * D_8007C548) / D_8007C550);
guRotate(&spB0, sp140, 0.0f, 1.0f, 0.0f);
guRotate(&sp70, sp144, 0.0f, 0.0f, 1.0f);
guMtxCatL(&spB0, &sp70, &spF0);
*mtx = spF0;
}
f32 func_80031A6C(f32 arg0) {
if (arg0 < 0.0) {
@ -336,17 +848,128 @@ f32 func_80031A6C(f32 arg0) {
return arg0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031A94.s")
void func_80031A94(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32* arg6, f32* arg7, f32* arg8) {
*arg6 = (arg1 * arg5) - (arg2 * arg4);
*arg7 = (arg2 * arg3) - (arg0 * arg5);
*arg8 = (arg0 * arg4) - (arg1 * arg3);
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031B04.s")
void func_80031B04(f32* arg0, f32* arg1, f32* arg2) {
f32 temp_fv1;
f32 temp_fa1;
f32 temp_ft4;
f32 temp_fv0;
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031B98.s")
temp_fv1 = *arg0;
temp_fa1 = *arg1;
temp_ft4 = *arg2;
temp_fv0 = sqrtf((temp_fv1 * temp_fv1) + (temp_fa1 * temp_fa1) + (temp_ft4 * temp_ft4));
if (temp_fv0 > 0.0f) {
temp_fv1 /= temp_fv0;
temp_fa1 /= temp_fv0;
temp_ft4 /= temp_fv0;
}
*arg0 = temp_fv1;
*arg1 = temp_fa1;
*arg2 = temp_ft4;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031BE8.s")
void func_80031B98(const f32* a, const f32* b, f32* out) {
f32 ax = a[0];
f32 ay = a[1];
f32 az = a[2];
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031C6C.s")
f32 bx = b[0];
f32 by = b[1];
f32 bz = b[2];
#pragma GLOBAL_ASM("asm/us/nonmatchings/30640/func_80031DF8.s")
out[0] = (ay * bz) - (az * by);
out[1] = (az * bx) - (ax * bz);
out[2] = (ax * by) - (ay * bx);
}
void func_80031BE8(Vec3f* vec) {
f32 x;
f32 y;
f32 z;
f32 len;
x = vec->x;
y = vec->y;
z = vec->z;
len = sqrtf((x * x) + (y * y) + (z * z));
if (len > 0.0f) {
x = x / len;
y = y / len;
z = z / len;
}
vec->x = x;
vec->y = y;
vec->z = z;
}
void func_80031C6C(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) {
f32 sp10C;
f32 sp108;
UNUSED s32 pad;
UNUSED s32 pad2;
f32 temp_fa1;
f32 temp_fv0;
Mtx spB8;
Mtx sp78;
Mtx sp38;
temp_fa1 = arg4 - arg1;
temp_fv0 = arg6 - arg3;
sp108 = (f32) (((f64) (f32) MathUtil_Atan2s(-temp_fv0, temp_fa1) * D_8007C558) / D_8007C560);
sp10C = (f32) (((f64) (f32) MathUtil_Atan2s(-(arg5 - arg2), sqrtf((temp_fa1 * temp_fa1) + (temp_fv0 * temp_fv0))) * D_8007C568) / D_8007C570);
guTranslate(&spB8, arg1, arg2, arg3);
guRotate(&sp78, sp108, 0.0f, -1.0f, 0.0f);
guMtxCatL(&sp78, &spB8, &spB8);
guRotate(&sp38, sp10C, 1.0f, 0.0f, 0.0f);
guMtxCatL(&sp38, &spB8, &spB8);
*mtx = spB8;
}
void func_80031DF8(
f32 px, f32 py, f32 pz,
f32 ax, f32 ay, f32 az,
f32 bx, f32 by, f32 bz,
f32* outX, f32* outY, f32* outZ
) {
f32 dx;
f32 dy;
f32 dz;
f32 t;
f32 lenSq = SQ(bx - ax) + SQ(by - ay) + SQ(bz - az);
f32 dx2;
f32 dy2;
f32 dz2;
if (lenSq == 0.0) {
*outX = ax;
*outY = ay;
*outZ = az;
return;
}
dx = bx - ax;
dy = by - ay;
dz = bz - az;
dx2 = px - ax;
dy2 = py - ay;
dz2 = pz - az;
t = ((dx * dx2) + (dy * dy2) + (dz * dz2)) / lenSq;
*outX = ax + (t * dx);
*outY = ay + (t * dy);
*outZ = az + (t * dz);
}
void func_80031EF4(MtxF* arg0, MtxF* arg1) {
f32 sp24 = sqrtf(SQ(arg1->mf[0][0]) + SQ(arg1->mf[0][1]) + SQ(arg1->mf[0][2]));

View File

@ -42,7 +42,11 @@ typedef struct unk_D_83402EE0 {
typedef struct unk_D_83403C60 {
/* 0x00 */ unk_func_80026268_arg0 unk_00;
/* 0x54 */ char unk54[0x38];
/* 0x54 */ char unk54[0x18];
/* 0x6C */ u8 unk_6C;
/* 0x6D */ char unk6D[0x3];
/* 0x70 */ unk_D_83407AC8 unk_70;
/* 0x8A */ char unk8A[0x2];
} unk_D_83403C60; // size = 0x8C
typedef struct unk_D_83406EB0 {
@ -68,6 +72,22 @@ typedef struct unk_D_83407B00 {
};
} unk_D_83407B00; // size = 0x8
typedef struct unk_func_800314BC_temp_v4 {
/* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s32 unk_04;
} unk_func_800314BC_temp_v4; // size = 0x8
typedef struct unk_func_80031270_024 {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ char pad2[0x12];
/* 0x14 */ s32 unk_14;
/* 0x18 */ s16 unk_18;
/* 0x1A */ s16 unk_1A;
/* 0x1C */ s32 unk_1C;
} unk_func_80031270_024; // size = 0x20
typedef struct unk_func_80031270 {
/* 0x00 */ u16 unk_00;
/* 0x02 */ s16 unk_02;
@ -79,8 +99,12 @@ typedef struct unk_func_80031270 {
/* 0x14 */ BinArchive* unk_14;
/* 0x18 */ unk_D_83403C60* unk_18;
/* 0x1C */ GraphNode* unk_1C;
/* 0x20 */ char unk20[0x14];
/* 0x32 */ s32 unk_34;
/* 0x20 */ unk_D_86002F58_004_000* unk_20;
/* 0x24 */ unk_func_80031270_024* unk_24;
/* 0x28 */ GraphNode* unk_28;
/* 0x2C */ GraphNode* unk_2C;
/* 0x30 */ GraphNode* unk_30;
/* 0x34 */ s32 unk_34;
} unk_func_80031270; // size = 0x38
typedef struct unk_D_83407B38_0B0 {
@ -109,10 +133,10 @@ void func_8002FF20(void);
void func_8003107C(unk_D_83402EE0_070*, unk_func_80026268_arg0*);
void func_80031140(unk_func_80026268_arg0*, unk_D_83407AC8*);
unk_func_80031270* func_80031270(s16, s16, unk_D_80068BB0*, unk_D_80068BB0*, unk_D_86002F58_004_000_010*, BinArchive*, unk_D_83403C60*);
void func_80031660(unk_func_80031270*);
u8* func_80031660(unk_func_80031270*);
s32 func_800317D8(unk_func_80031270*);
s32 func_8003181C(unk_func_80031270**, s32);
u16* func_800318AC(void);
unk_func_80031270* func_800318AC(void);
void func_800318B8(void);
s32 func_800318C4(unk_D_83403C60*);
f32 func_80031A6C(f32);

View File

@ -1842,10 +1842,6 @@ s32 func_80042850(u8 arg0) {
}
}
#ifdef NON_MATCHING
void func_800428FC(void) {
func_80041C70(0); // Should not take an argument
void func_800428FC(u32 arg0) {
func_80041C70(arg0);
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_800428FC.s")
#endif

View File

@ -3,7 +3,7 @@
#include "src/373A0.h"
typedef struct unk_D_800FD008 {
/* 0x00 */ char unk00[0x28];
/* 0x00 */ u16 unk_00[20];
/* 0x28 */ u8 unk_28;
/* 0x29 */ u8 unk_29;
/* 0x2A */ u8 unk_2A;
@ -26,20 +26,30 @@ extern f32 D_800FD6E4;
extern u32 D_800FD6F0;
extern u32 D_800FD6F4;
extern s16 D_800FD6F8[0x1140];
extern u8 D_800FD6A0[8];
extern u32 D_800FD6AC;
extern u32 D_800FF978;
extern u8 D_800FF97C;
extern s32 D_800FF980;
void func_80049A60(u32);
void func_800497E0(s16* arg0, s32 arg1, u32 arg2, f32 arg3) {
func_80049A60(arg2);
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_8004980C.s")
void func_8004980C(u16 arg0, u8 arg1, u16 arg2) {
D_800FD068[D_800FD6AC].unk_00 = (u8*)&D_800FD008.unk_00[(arg0 & 0xFF) - 0x10];
D_800FD068[D_800FD6AC].unk_04 = arg1;
D_800FD068[D_800FD6AC].unk_06 = arg2 + 1;
D_800FD6A0[arg0 & 0xFF] = arg1;
D_800FD6AC++;
D_800FD6AC %= 200;
D_800FD068[D_800FD6AC].unk_06 = 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_80049890.s")
u8 func_80049890(u16 arg0) {
return D_800FD6A0[arg0 & 0xFF];
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_800498A8.s")
@ -146,8 +156,25 @@ void func_80049D5C(u16 arg0) {
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_8004A89C.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_8004AC9C.s")
void func_8004AC9C(void) {
s32 i;
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_8004ACD0.s")
for (i = 0; i < ARRAY_COUNT(D_800FD6F8); i++) {
D_800FD6F8[i] = 0;
}
D_800FF978 = 0;
}
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_8004AD2C.s")
void func_8004ACD0(void) {
s32 i;
for (i = 0; i < 0xB80; i++) {
D_800FC6D8[i] = 0;
}
D_800FD6F0 = 0;
D_800FD6F4 = 0;
}
void func_8004AD2C(void) {
}

View File

@ -4,7 +4,7 @@
#include "global.h"
void func_800497E0(s16*, s32, u32, f32);
void func_8004980C(u16, u8, s32);
void func_8004980C(u16, u8, u16);
u8 func_80049890(u16);
void func_800498A8(s32, s32, s32);

View File

@ -66,6 +66,9 @@ typedef struct unk_D_8690B3C0 {
/* 0x0C */ s32 unk_0C;
} unk_D_8690B3C0; // size >= 0x10
extern u8 D_5001950[];
extern u8 D_5003AE8[];
extern Vec3f D_86908C20;
extern Vec3f D_86908C2C;
extern Vec3f D_86908C38;

View File

@ -30,8 +30,6 @@ extern u8 D_5000C90[];
extern u8 D_50011D0[];
extern u8 D_5001680[];
extern u8 D_50017E8[];
extern u8 D_5001950[];
extern u8 D_5003AE8[];
void func_86904070(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
unk_D_80068BB0* temp_s1 = func_8000648C();

View File

@ -7,13 +7,13 @@
Gfx* func_81000200(Gfx* gfx, DisplayListAddresses* addresses, s32 index) {
gSPDisplayList(gfx++, addresses->segments[0]);
// TODO: Convert to gDPLoadTextureBlock
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD900000; _gfx->words.w1 = addresses->textures[index]; }
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5900000; _gfx->words.w1 = 0x07080200; }
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF3000000; _gfx->words.w1 = 0x073FF200; }
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; }
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5880800; _gfx->words.w1 = 0x80200; }
{ Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C0FC; }
gDPSetTextureImage(gfx++, G_IM_FMT_I, G_IM_SIZ_16b, 1, addresses->textures[index]);
gDPSetTile(gfx++, G_IM_FMT_I, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD);
gDPLoadSync(gfx++);
gDPLoadBlock(gfx++, 7, 0, 0, 0x3FF, 0x200);
gDPPipeSync(gfx++);
gDPSetTile(gfx++, G_IM_FMT_I, G_IM_SIZ_8b, 4, 0, 0, 0, G_TX_CLAMP, 0, 0, G_TX_CLAMP, 0, 0);
gDPSetTileSize(gfx++, 0, 0, 0, 0x7C, 0xFC);
gSPDisplayList(gfx++, addresses->segments[1]);
gSPEndDisplayList(gfx++);
return gfx;

View File

@ -544,9 +544,9 @@ void func_83401FD0(unk_D_83407B38* arg0) {
}
void func_834020D8(void) {
u16* temp_v0 = func_800318AC();
unk_func_80031270* temp_v0 = func_800318AC();
if ((temp_v0 != NULL) && (temp_v0[0] == 2)) {
if ((temp_v0 != NULL) && (temp_v0->unk_00 == 2)) {
main_pool_pop_state('albu');
func_800318B8();
}