diff --git a/.gitignore b/.gitignore index 66f9179..1179299 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,6 @@ ctx.c.m2c .vscode/* !.vscode/c_cpp_properties.json tools/vtxdis -tools/permuter/ +tools/permuter +tools/n64 .DS_Store diff --git a/src/32D10.c b/src/32D10.c index fe7c74e..b1bffaa 100644 --- a/src/32D10.c +++ b/src/32D10.c @@ -5,17 +5,10 @@ #include "src/memmap.h" #include "src/fragments/31/fragment31.h" -extern s16 D_800AF778[4]; -extern s16 D_800AF780[4]; -extern s16 D_800AF788[4]; -extern s16 D_800AF790[4]; -extern s16 D_800AF798[4]; -extern s16 D_800AF7A0[4]; extern s32 D_800AF7A8; extern s16 D_800AF7AC; extern s16 D_800AF7AE; extern s16 D_800AF7C0[]; -extern s16 D_800AF7B0[2]; extern s16 D_800AF7B4[6]; void func_80032110(u8 arg0, s16 arg1) { diff --git a/src/32D10.h b/src/32D10.h index 1316418..36132ca 100644 --- a/src/32D10.h +++ b/src/32D10.h @@ -3,6 +3,14 @@ #include "global.h" +extern s16 D_800AF778[4]; +extern s16 D_800AF780[4]; +extern s16 D_800AF788[4]; +extern s16 D_800AF790[4]; +extern s16 D_800AF798[4]; +extern s16 D_800AF7A0[4]; +extern s16 D_800AF7B0[2]; + void func_80032110(u8 arg0, s16 arg1); void func_80032244(u8 arg0, s16 arg1); void func_80032570(void); diff --git a/src/334D0.c b/src/334D0.c index 7ee7baf..41f9ab0 100644 --- a/src/334D0.c +++ b/src/334D0.c @@ -1,6 +1,7 @@ #include "334D0.h" #include "src/12D80.h" #include "src/30640.h" +#include "src/32D10.h" #include "src/6A40.h" #include "src/F420.h" diff --git a/src/334D0.h b/src/334D0.h index ee2f21a..4aaf041 100644 --- a/src/334D0.h +++ b/src/334D0.h @@ -6,5 +6,7 @@ void func_800328D0(s32); s32 func_800328D8(s32); void func_80032A34(s32); +void func_80032D28(void); +Gfx* func_80032F94(Gfx*); #endif // _334D0_H_ diff --git a/src/fragments/1/fragment1_86CB0.c b/src/fragments/1/fragment1_86CB0.c index a06bef6..f14c0ea 100644 --- a/src/fragments/1/fragment1_86CB0.c +++ b/src/fragments/1/fragment1_86CB0.c @@ -185,7 +185,7 @@ u16 func_81207C5C_Empty(void) { } #ifdef NON_MATCHING -// Does match but won't generate correct checksum +// Matching but won't generate correct checksum u16 func_81207DF8(void) { static s32 D_8120EB6C; u16 temp_v0; diff --git a/src/fragments/31/fragment31.h b/src/fragments/31/fragment31.h index 42b5bde..de15ea9 100644 --- a/src/fragments/31/fragment31.h +++ b/src/fragments/31/fragment31.h @@ -4,6 +4,17 @@ #include "global.h" #include "30640.h" +typedef struct DisplayListAddresses { + /* 0x00 */ u32 segments[2]; + /* 0x08 */ u32 textures[1]; +} DisplayListAddresses; // size = 0xC + +typedef struct DisplayListState { + /* 0x00 */ char unk00[0x14]; + /* 0x14 */ DisplayListAddresses* addresses; + /* 0x18 */ Gfx* gfx; +} DisplayListState; // size = 0x1C + void func_810007A8(unk_D_86002F58_004_000*); void func_810007F8(void); void func_81002174(unk_D_83402EE0_00A*); diff --git a/src/fragments/31/fragment31_2554C0.c b/src/fragments/31/fragment31_2554C0.c index 3711d65..d32bd6e 100644 --- a/src/fragments/31/fragment31_2554C0.c +++ b/src/fragments/31/fragment31_2554C0.c @@ -1,9 +1,59 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" +#include "src/32D10.h" +#include "src/334D0.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2554C0/func_81000200.s") +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; } + gSPDisplayList(gfx++, addresses->segments[1]); + gSPEndDisplayList(gfx++); + return gfx; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2554C0/func_810002DC.s") +void func_810002DC(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2554C0/func_81000330.s") + if (arg0 == 2) { + addresses = state->addresses; + gfx = func_80005F5C(0x50); + state->gfx = gfx; + func_81000200(gfx, addresses, D_8006F084 & 7); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2554C0/func_81000420.s") +Gfx* func_81000330(Gfx* gfx, DisplayListAddresses* addresses, s32 index) { + gDPLoadTextureBlock(gfx++, addresses->textures[index], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + func_80032D28(); + { + Gfx* gfx2 = func_80032F94(gfx); + gSPSetGeometryMode(gfx2++, 0x00020000); + gSPEndDisplayList(gfx2++); + return gfx2; + } +} + +void func_81000420(s32 arg0, DisplayListState* state) { + static s32 D_81003FD0 = 0; + Gfx* gfx; + DisplayListAddresses* addresses; + u8 temp_v1; + + temp_v1 = func_800325B4(); + if (arg0 == 2) { + addresses = state->addresses; + gfx = func_80005F5C(0x140); + state->gfx = gfx; + func_81000330(gfx, addresses, ((D_800AF7B0[temp_v1 & 1] * 3) + D_81003FD0) % 8); + D_81003FD0 += 1; + } +} diff --git a/src/fragments/31/fragment31_2557A0.c b/src/fragments/31/fragment31_2557A0.c index 23d53ad..4975025 100644 --- a/src/fragments/31/fragment31_2557A0.c +++ b/src/fragments/31/fragment31_2557A0.c @@ -1,9 +1,40 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2557A0/func_810004E0.s") +void func_810004E0(Gfx* gfx, DisplayListAddresses* addresses) { + gSPDisplayList(gfx++, addresses->segments[0]); + gSPDisplayList(gfx++, addresses->segments[1]); + gSPEndDisplayList(gfx++); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2557A0/func_81000518.s") +void func_81000518(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2557A0/func_81000560.s") + if (arg0 == 2) { + addresses = state->addresses; + gfx = func_80005F5C(0x18); + state->gfx = gfx; + func_810004E0(gfx, addresses); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2557A0/func_8100059C.s") +void func_81000560(Gfx* gfx, s32* address) { + if (D_8006F09C->unk_01C == 0) { + gSPDisplayList(gfx++, *address); + } + gSPEndDisplayList(gfx++); +} + +void func_8100059C(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + + if (arg0 == 2) { + addresses = state->addresses; + gfx = func_80005F5C(0x50); + state->gfx = gfx; + func_81000560(gfx, addresses); + } +} diff --git a/src/fragments/31/fragment31_2558B0.c b/src/fragments/31/fragment31_2558B0.c index 276b2aa..846bf78 100644 --- a/src/fragments/31/fragment31_2558B0.c +++ b/src/fragments/31/fragment31_2558B0.c @@ -1,4 +1,5 @@ #include "fragment31.h" +#include "12D80.h" typedef struct unk_D_810047E0 { /* 0x00 */ s16 unk_00; @@ -9,6 +10,7 @@ typedef struct unk_D_810047E0 { } unk_D_810047E0; // size = 0x2C extern unk_D_810047E0 D_810047E0[2][10]; +extern unk_D_810047E0 D_81004998[2][10]; extern s32 D_81004B50; extern s32 D_81004B54; diff --git a/src/fragments/31/fragment31_257750.c b/src/fragments/31/fragment31_257750.c index 683d1be..188e7c9 100644 --- a/src/fragments/31/fragment31_257750.c +++ b/src/fragments/31/fragment31_257750.c @@ -1,5 +1,22 @@ #include "fragment31.h" +#include "12D80.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257750/func_81002490.s") +void func_81002490(Gfx* gfx, DisplayListAddresses* addresses) { + if (D_8006F09C->unk_01C == 0) { + gSPDisplayList(gfx++, addresses->segments[0]); + } + gSPDisplayList(gfx++, addresses->segments[1]); + gSPEndDisplayList(gfx++); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257750/func_810024E4.s") +void func_810024E4(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + + if (arg0 == 2) { + addresses = state->addresses; + gfx = func_80005F5C(0x50); + state->gfx = gfx; + func_81002490(gfx, addresses); + } +} diff --git a/src/fragments/31/fragment31_2577F0.c b/src/fragments/31/fragment31_2577F0.c index e04b393..3c7cffd 100644 --- a/src/fragments/31/fragment31_2577F0.c +++ b/src/fragments/31/fragment31_2577F0.c @@ -1,5 +1,67 @@ #include "fragment31.h" +#include "32D10.h" +#include "12D80.h" +#include "6A40.h" +extern s32 D_81004170; +extern s16 D_81004B60; + +#ifdef NON_MATCHING +void func_81002530(Gfx* gfx, DisplayListAddresses* addresses) { + s16 temp_t3; + s16 temp_t4; + s16 temp_t2; + u8 temp_v0; + + temp_v0 = func_800325B4(); + if ((D_8006F09C->unk_01C & 0xFF) == 0) { + temp_t2 = (D_81004B60 >> 4); + temp_t3 = 0x4000 - (D_81004B60 >> 4); + temp_t4 = 0x4000 - (D_81004B60 >> 3); + + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xDE000000; _gfx->words.w1 = D_81004170; } + + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD10001F; _gfx->words.w1 = addresses->segments[0]; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5101000; _gfx->words.w1 = 0x07014050; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C07C; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5101000; _gfx->words.w1 = 0x14050; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C07C; } + + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = (((temp_t2 & 0xFFF) << 0xC) | 0xF2000000 | (temp_t3 & 0xFFF)); _gfx->words.w1 = ((((temp_t2 + 0x1F) & 0xFFF) << 0xC) | ((temp_t3 + 0x1F) & 0xFFF)); } + + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD10001F; _gfx->words.w1 = addresses->segments[1]; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5101100; _gfx->words.w1 = 0x07014050; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C07C; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5101100; _gfx->words.w1 = 0x01014050; } \ + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x0107C07C; } + + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = (((temp_t3 & 0xFFF) << 0xC) | 0xF2000000 | (temp_t4 & 0xFFF)); _gfx->words.w1 = (((temp_t3 & 0xFFF) << 0xC) | 0x01000000 | ((temp_t4 + 0x1F) & 0xFFF)); } + + if (D_800AF7B0[temp_v0 & 1] == 0) { + if (func_800325AC() == 0) { + D_81004B60--; + } + } + } + gSPEndDisplayList(gfx++); +} +#else +void func_81002530(Gfx*, DisplayListAddresses*); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2577F0/func_81002530.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2577F0/func_810027E0.s") +void func_810027E0(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + + if (arg0 == 2) { + addresses = state->addresses; + gfx = func_80005F5C(0xF0); + state->gfx = gfx; + func_81002530(gfx, addresses); + } +} diff --git a/src/fragments/31/fragment31_257AF0.c b/src/fragments/31/fragment31_257AF0.c index 3a357b9..de59573 100644 --- a/src/fragments/31/fragment31_257AF0.c +++ b/src/fragments/31/fragment31_257AF0.c @@ -1,9 +1,87 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" +typedef struct unk_arg1_func_81002830 { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk02; + /* 0x04 */ s32 unk_04[1]; +} unk_arg1_func_81002830; // size = 0x8 + +typedef struct unk_arg1_func_81002968 { + /* 0x00 */ char unk00[0x14]; + /* 0x14 */ u32* unk_14; + /* 0x18 */ Gfx* unk_18; +} unk_arg1_func_81002968; // size = 0x1C + +typedef struct TextureState { + /* 0x00 */ char unk00[0x14]; + /* 0x14 */ u32* textures; + /* 0x18 */ Gfx* gfx; +} TextureState; // size = 0x1C + +extern s16 D_800AF7AE; + +#ifdef NON_MATCHING +void func_81002830(Gfx* gfx, unk_arg1_func_81002830* arg1) { + s16 temp_v0; + s32 var_a3; + if (D_8006F09C->unk_01C == 0) { + var_a3 = D_800AF7AE; + temp_v0 = 0x4000 - (arg1->unk_00 * var_a3); + if (1) {} + gDPLoadTextureBlock(gfx++, arg1->unk_04[var_a3 & 0x7], G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD); + gDPSetTileSize(gfx++, 0, temp_v0, 0, ((temp_v0 + 63) << 2), 124); + } + gSPEndDisplayList(gfx++); +} +#else +void func_81002830(s32, s32); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257AF0/func_81002830.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257AF0/func_81002968.s") +void func_81002968(s32 arg0, unk_arg1_func_81002968* arg1) { + s32 temp_v0; + s32 sp18; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257AF0/func_810029B0.s") + if (arg0 == 2) { + sp18 = arg1->unk_14; + temp_v0 = func_80005F5C(0x50); + arg1->unk_18 = temp_v0; + func_81002830(temp_v0, sp18); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257AF0/func_81002A68.s") +Gfx* func_810029B0(Gfx* gfx, u32* textures, s32 index) { + gDPLoadTextureBlock(gfx++, textures[index + 1], G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD, G_TX_NOLOD); + gSPEndDisplayList(gfx++); + return gfx; +} + +void func_81002A68(s32 arg0, TextureState* state) { + s32 index; + u32* textures; + + if (arg0 == 2) { + textures = state->textures; + state->gfx = (Gfx*)func_80005F5C(0x50); + if (D_8006F09C->unk_01A == 0x58) { + index = (s32) D_8006F09C->unk_040.unk_08 >> 0x10; + if (index >= 0x42) { + index = index - 0x42; + } else { + index = 0; + } + if (index >= 8) { + index = 0; + } + if (D_8006F09C->unk_040.unk_00 >= 2) { + index = 0; + } + } else { + index = D_8006F084 & 7; + } + func_810029B0(state->gfx, textures, index); + } +} diff --git a/src/fragments/31/fragment31_257DE0.c b/src/fragments/31/fragment31_257DE0.c index b31c5d5..1454adc 100644 --- a/src/fragments/31/fragment31_257DE0.c +++ b/src/fragments/31/fragment31_257DE0.c @@ -1,5 +1,25 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" +#include "src/32D10.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257DE0/func_81002B20.s") +void func_81002B20(Gfx* gfx) { + Mtx* mtx; + u8 angle; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257DE0/func_81002BC0.s") + angle = D_8006F09C->unk_0A6 & 3; + mtx = (Mtx*)func_80005F5C(sizeof(Mtx)); + guRotate(mtx, D_800AF778[angle], 1.0f, 0.0f, 0.0f); + gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPEndDisplayList(gfx++); +} + +void func_81002BC0(s32 arg0, DisplayListState* state) { + Gfx* gfx; + + if (arg0 == 2) { + gfx = (Gfx*)func_80005F5C(0x50); + state->gfx = gfx; + func_81002B20(gfx); + } +} diff --git a/src/fragments/31/fragment31_257EC0.c b/src/fragments/31/fragment31_257EC0.c index 337c3ff..ef798d9 100644 --- a/src/fragments/31/fragment31_257EC0.c +++ b/src/fragments/31/fragment31_257EC0.c @@ -1,5 +1,25 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" +#include "src/32D10.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257EC0/func_81002C00.s") +void func_81002C00(Gfx* gfx) { + Mtx* mtx; + u8 angle; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257EC0/func_81002CA0.s") + angle = D_8006F09C->unk_0A6 & 3; + mtx = func_80005F5C(0x40); + guRotate(mtx, D_800AF780[angle], 1.0f, 0.0f, 0.0f); + gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPEndDisplayList(gfx++); +} + +void func_81002CA0(s32 arg0, DisplayListState* state) { + Gfx* gfx; + + if (arg0 == 2) { + gfx = func_80005F5C(0x50); + state->gfx = gfx; + func_81002C00(gfx); + } +} diff --git a/src/fragments/31/fragment31_257FA0.c b/src/fragments/31/fragment31_257FA0.c index e945693..a3de669 100644 --- a/src/fragments/31/fragment31_257FA0.c +++ b/src/fragments/31/fragment31_257FA0.c @@ -1,5 +1,25 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" +#include "src/32D10.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257FA0/func_81002CE0.s") +void func_81002CE0(Gfx* gfx) { + Mtx* mtx; + u8 angle; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_257FA0/func_81002D80.s") + angle = D_8006F09C->unk_0A6 & 3; + mtx = (Mtx*)func_80005F5C(0x40); + guRotate(mtx, D_800AF788[angle], 1.0f, 0.0f, 0.0f); + gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPEndDisplayList(gfx++); +} + +void func_81002D80(s32 arg0, DisplayListState* state) { + Gfx* gfx; + + if (arg0 == 2) { + gfx = (Gfx*)func_80005F5C(0x50); + state->gfx = gfx; + func_81002CE0(gfx); + } +} diff --git a/src/fragments/31/fragment31_258080.c b/src/fragments/31/fragment31_258080.c index 9e9926b..444774d 100644 --- a/src/fragments/31/fragment31_258080.c +++ b/src/fragments/31/fragment31_258080.c @@ -1,32 +1,332 @@ #include "fragment31.h" #include "src/fragments/7/fragment7.h" +#include "src/fragments/8/fragment8.h" +#include "src/6A40.h" +typedef struct { + /* 0x00 */ u8 rgb0[3]; // start color + /* 0x03 */ u8 frameStart; // frame where this keyframe begins + /* 0x04 */ u8 rgb1[3]; // end color + /* 0x07 */ u8 frameEnd; // frame where keyframe ends +} Keyframe; // size = 0x08 + +extern Keyframe* D_8100419C[]; +extern s32 D_810041D0; +extern s32 D_81004B70; +extern s32 D_81004B80; +extern s32 D_81004B90; +extern s32 D_81004BA0; +extern s32 D_81004BB0; + +#ifdef NON_MATCHING +void func_81002DC0(Gfx* gfx, s32 arg1, s32 arg2) { + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xD7000002; _gfx->words.w1 = -1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE3001001; _gfx->words.w1 = 0x8000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD100000; _gfx->words.w1 = arg1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE8000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5000100; _gfx->words.w1 = 0x07000000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF0000000; _gfx->words.w1 = 0x073FC000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD48001F; _gfx->words.w1 = (((D_862082A0[0] * 4) & ~0x1F) + arg2 + ((D_81004B70 & 3) << 0xB)); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x07098250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C0FC; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x98250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C0FC; } + gSPEndDisplayList(gfx++); +} +#else +void func_81002DC0(Gfx*, s32, s32); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81002DC0.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81002F38.s") +void func_81002F38(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + addresses = state->addresses; + switch (arg0) { + case 0: + D_81004B70 = 0; + return; + case 2: + gfx = func_80005F5C(0xA0); + state->gfx = gfx; + func_81002DC0(gfx, addresses->segments[0], addresses->segments[1]); + D_81004B70 += 1; + return; + } +} + +#ifdef NON_MATCHING +void func_81002FC0(Gfx* gfx, s32 arg1, s32 arg2) { + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xD7000002; _gfx->words.w1 = -1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE3001001; _gfx->words.w1 = 0x8000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD100000; _gfx->words.w1 = arg1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE8000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5000100; _gfx->words.w1 = 0x07000000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF0000000; _gfx->words.w1 = 0x073FC000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD48001F; _gfx->words.w1 = (((D_862082A0[1] * 4) & ~0x1F) + arg2 + ((D_81004B80 & 3) << 11)); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x07098250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C0FC; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x98250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C0FC; } + gSPEndDisplayList(gfx++); +} +#else +void func_81002FC0(Gfx*, s32, s32); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81002FC0.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003138.s") +void func_81003138(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + addresses = state->addresses; + switch (arg0) { /* irregular */ + case 0: + D_81004B80 = 0; + return; + case 2: + gfx = func_80005F5C(0xA0); + state->gfx = gfx; + func_81002FC0(gfx, addresses->segments[0], addresses->segments[1]); + D_81004B80 += 1; + return; + } +} + +#ifdef NON_MATCHING +void func_810031C0(Gfx* gfx, s32 arg1, s32 arg2) { + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xD7000002; _gfx->words.w1 = -1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE3001001; _gfx->words.w1 = 0x8000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD100000; _gfx->words.w1 = arg1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE8000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5000100; _gfx->words.w1 = 0x07000000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF0000000; _gfx->words.w1 = 0x073FC000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD48001F; _gfx->words.w1 = ((((D_862082A0[2]) * 4) & ~0x1F) + arg2 + ((D_81004B90 & 3) << 0xB)); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x07098250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C0FC; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x98250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C0FC; } + gSPEndDisplayList(gfx++); +} +#else +void func_810031C0(Gfx*, s32, s32); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_810031C0.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003338.s") +void func_81003338(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + addresses = state->addresses; + switch (arg0) { /* irregular */ + case 0: + D_81004B90 = 0; + return; + case 2: + gfx = func_80005F5C(0xA0); + state->gfx = gfx; + func_810031C0(gfx, addresses->segments[0], addresses->segments[1]); + D_81004B90 += 1; + return; + } +} + +#ifdef NON_MATCHING +void func_810033C0(Gfx* gfx, s32 arg1, s32 arg2) { + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xD7000002; _gfx->words.w1 = -1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE3001001; _gfx->words.w1 = 0x8000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD100000; _gfx->words.w1 = arg1; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE8000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5000100; _gfx->words.w1 = 0x07000000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF0000000; _gfx->words.w1 = 0x073FC000; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD48001F; _gfx->words.w1 = ((((D_862082A0[3]) * 4) & ~0x1F) + arg2 + ((D_81004BA0 & 3) << 0xB)); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x07098250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF4000000; _gfx->words.w1 = 0x0707C0FC; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5480800; _gfx->words.w1 = 0x98250; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C0FC; } + gSPEndDisplayList(gfx++); +} +#else +void func_810033C0(Gfx*, s32, s32); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_810033C0.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003538.s") +void func_81003538(s32 arg0, DisplayListState* state) { + Gfx* gfx; + DisplayListAddresses* addresses; + addresses = state->addresses; + switch (arg0) { /* irregular */ + case 0: + D_81004BA0 = 0; + return; + case 2: + gfx = func_80005F5C(0xA0); + state->gfx = gfx; + func_810033C0(gfx, addresses->segments[0], addresses->segments[1]); + D_81004BA0 += 1; + return; + } +} + +#ifdef NON_MATCHING +// Matching, needs more data +void func_810035C0(s32 arg0, DisplayListState* state) { + static u8 D_81004190 = 0; + s32 temp_a1; + s32 temp_a2; + Gfx* gfx; + + if (arg0 == 2) { + gfx = func_80005F5C(0x10); + temp_a1 = D_81004190 * 3; + temp_a2 = D_81004190 * -6; + state->gfx = gfx; + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = (((temp_a1 & 0xFFF) << 0xC) | 0xF2000000 | (temp_a2 & 0xFFF)); _gfx->words.w1 = ((((0x27F << (temp_a1 + 2)) & 0xFFF) << 0xC) | ((0x7F << (temp_a2 + 2)) & 0xFFF)); } + gSPEndDisplayList(gfx++); + D_81004190++; + D_81004190 &= 0x7F; + } +} +#else +void func_810035C0(s32, DisplayListState*); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_810035C0.s") +#endif +#ifdef NON_MATCHING +void func_81003678(s32 arg0, DisplayListState* state) { + static u8 D_81004194 = 0; + static u8 D_81004198 = 0; + Keyframe* kf; + Gfx* gfx; + u8 rgbInterp[3]; + f32 var_ft2; + s32 temp_a3_2; + s32 temp_t1_2; + s32 i; + s32 c; + u8 start; + u8 span; + u8 delta; + u8 t; + + if (arg0 == 2) { + gfx = func_80005F5C(0x20); + state->gfx = gfx; + for (i = 0; i < 5; i++) { + kf = D_8100419C[i]; + if (D_81004198 == kf->frameStart) { + for(c = 0; c < 3; c++) { + rgbInterp[c] = kf->rgb0[c]; + } + } else if (kf->frameStart < D_81004198 && D_81004198 < kf->frameEnd) { + span = (kf->frameEnd - kf->frameStart); + t = D_81004198 - kf->frameStart; + for(c = 0; c < 3; c++) { + start = kf->rgb0[c]; + var_ft2 = (f32) start; + if ((s32) start < 0) { + var_ft2 += 4294967296.0f; + } + delta = (kf->rgb1[c] - start); + rgbInterp[c] = (var_ft2 + ((f32) (delta * t) / (f32) span) + 0.5f); + } + } + } + temp_a3_2 = D_81004194 * -2; + temp_t1_2 = D_81004194 * 2; + // set prim color? + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFA000080; _gfx->words.w1 = ((rgbInterp[2] << 8) | (rgbInterp[1] << 0x18) | (rgbInterp[0] << 0x10) | 0xB4); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = (((temp_a3_2 & 0xFFF) << 0xC) | 0xF2000000); _gfx->words.w1 = ((((0x13F << (temp_a3_2 + 2)) & 0xFFF) << 0xC) | 0xFC); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = (((temp_t1_2 & 0xFFF) << 0xC) | 0xF2000000); _gfx->words.w1 = ((((0x13F << (temp_t1_2 + 2)) & 0xFFF) << 0xC) | 0x01000000 | 0xFC); } + gSPEndDisplayList(gfx++); + D_81004194++; + D_81004194 &= 0x7F; + D_81004198++; + if ((s32) D_81004198 >= 0x32) { + D_81004198 = 0; + } + } +} +#else +void func_81003678(s32, DisplayListState*); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003678.s") +#endif -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_810038D0.s") +void func_810038D0(Gfx* gfx) { + s32 temp_a3; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003A24.s") + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xDE000000; _gfx->words.w1 = &D_810041D0; } + temp_a3 = ((s32) ((D_800AF770[5]) * 0x55) / 255) + 0xAA; + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = ((temp_a3 & 0xFF) | 0xFA000000); _gfx->words.w1 = -0x3701; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFB000000; _gfx->words.w1 = 0x501E0AFF; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFD700000; _gfx->words.w1 = Util_ConvertAddrToVirtAddr(&D_3008000); } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5700000; _gfx->words.w1 = 0x07094260; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE6000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF3000000; _gfx->words.w1 = 0x070FF200; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xE7000000; _gfx->words.w1 = 0; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF5680800; _gfx->words.w1 = 0x94260; } + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xF2000000; _gfx->words.w1 = 0x7C03C; } + gSPEndDisplayList(gfx++); + D_81004BB0 = 0; +} +s32 func_81003A24(s8* arg0) { + s32 var_v1; + s8 temp_t7; + s8* var_v0; + + var_v1 = 0; + var_v0 = arg0; + if (*arg0 != 0) { + do { + var_v1 += 1; + var_v0 += 1; + } while (var_v0[0] != 0); + } + return var_v1; +} + +void func_81003A54(Gfx*); #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003A54.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003CF0.s") +void func_81003CF0(s32 arg0, DisplayListState* state) { + Gfx* gfx; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_258080/func_81003D2C.s") + if (arg0 == 2) { + gfx = func_80005F5C(0xF0); + state->gfx = gfx; + func_810038D0(gfx); + } +} + +void func_81003D2C(s32 arg0, DisplayListState* state) { + Gfx* gfx; + + if (arg0 == 2) { + gfx = func_80005F5C(0xA0); + state->gfx = gfx; + func_81003A54(gfx); + } +} diff --git a/src/fragments/31/fragment31_259030.c b/src/fragments/31/fragment31_259030.c index 1fde383..88ec6e1 100644 --- a/src/fragments/31/fragment31_259030.c +++ b/src/fragments/31/fragment31_259030.c @@ -1,3 +1,18 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/fragments/10/fragment10.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_259030/func_81003D70.s") +void func_81003D70(s32 arg0, DisplayListState* state) { + Gfx* gfx; + + if (arg0 == 2) { + gfx = (Gfx*)func_80005F5C(0x10); + state->gfx = gfx; + if (D_86402848 == 0) { + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFC119604; _gfx->words.w1 = 0xFF13FFFF; } + } else { + { Gfx *_gfx = (Gfx *)(gfx++); _gfx->words.w0 = 0xFCFFFFFF; _gfx->words.w1 = 0xFFFDF638; } + } + gSPEndDisplayList(gfx++); + } +} diff --git a/src/fragments/31/fragment31_2590C0.c b/src/fragments/31/fragment31_2590C0.c index 0bdbec6..7d33a7a 100644 --- a/src/fragments/31/fragment31_2590C0.c +++ b/src/fragments/31/fragment31_2590C0.c @@ -1,7 +1,85 @@ #include "fragment31.h" +#include "src/6A40.h" +#include "src/12D80.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2590C0/func_81003E00.s") +typedef struct unk_arg1_func_81003E00_14 { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u16 unk_02; + /* 0x04 */ u16 unk_04; +} unk_arg1_func_81003E00_14; // size = 0x6 -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2590C0/func_81003E90.s") +typedef struct unk_arg1_func_81003E00_04 { + /* 0x00 */ char unk00[0x1]; + /* 0x01 */ u8 unk_01; +} unk_arg1_func_81003E00_04; // size = 0x2 -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/31/fragment31_2590C0/func_81003F20.s") +typedef struct unk_arg1_func_81003E00 { + /* 0x00 */ char unk00[0x4]; + /* 0x04 */ unk_arg1_func_81003E00_04* unk_04; + /* 0x08 */ char unk08[0xC]; + /* 0x14 */ unk_arg1_func_81003E00_14* unk_14; +} unk_arg1_func_81003E00; // size = 0x18 + +void func_81003E00(s32 arg0, unk_arg1_func_81003E00* arg1) { + s32 temp_a2; + s32 var_v1; + unk_arg1_func_81003E00_14* temp_v0; + unk_arg1_func_81003E00_04* temp_v0_2; + + if (arg0 == 2) { + temp_v0 = arg1->unk_14; + var_v1 = 0; + if (D_8006F09C->unk_040.unk_00 == temp_v0->unk_00) { + temp_a2 = ((s32) D_8006F09C->unk_040.unk_08 >> 0x10) & 0xFFFF; + if ((temp_a2 >= (s32) temp_v0->unk_02) && ((s32) temp_v0->unk_04 >= temp_a2)) { + var_v1 = 1; + } + } + if (var_v1 == 1) { + temp_v0_2 = arg1->unk_04; + temp_v0_2->unk_01 |= 1; + return; + } + temp_v0_2 = arg1->unk_04; + temp_v0_2->unk_01 &= 0xFFFE; + } +} + +void func_81003E90(s32 arg0, unk_arg1_func_81003E00* arg1) { + s32 temp_a2; + s32 var_v1; + unk_arg1_func_81003E00_14* temp_v0; + unk_arg1_func_81003E00_04* temp_v0_2; + + if (arg0 == 2) { + temp_v0 = arg1->unk_14; + var_v1 = 1; + if (D_8006F09C->unk_040.unk_00 == temp_v0->unk_00) { + temp_a2 = ((s32) D_8006F09C->unk_040.unk_08 >> 0x10) & 0xFFFF; + if ((temp_a2 >= (s32) temp_v0->unk_02) && ((s32) temp_v0->unk_04 >= temp_a2)) { + var_v1 = 0; + } + } + if (var_v1 == 1) { + temp_v0_2 = arg1->unk_04; + temp_v0_2->unk_01 |= 1; + return; + } + temp_v0_2 = arg1->unk_04; + temp_v0_2->unk_01 &= 0xFFFE; + } +} + +void func_81003F20(s32 arg0, DisplayListState* state) { + Gfx* gfx; + + if (arg0 == 2) { + gfx = func_80005F5C(0xA0); + state->gfx = gfx; + gDPSetAlphaDither(gfx++, G_AD_NOISE); + gDPSetPrimColor(gfx++, 0, 0, 10, 10, 10, D_8006F09C->unk_0A6 & 0xFF); + gDPSetEnvColor(gfx++, 0x37, 0x14, 0x14, 0xB4); + gDPSetCombineLERP(gfx++, 0, 0, 0, 0, TEXEL0, 1, PRIMITIVE, 1, 0, 0, 0, 0, COMBINED, 0, ENVIRONMENT, 0); + gSPEndDisplayList(gfx++); + } +} diff --git a/src/fragments/34/fragment34.h b/src/fragments/34/fragment34.h index 8f8bd8c..a9dcfa0 100644 --- a/src/fragments/34/fragment34.h +++ b/src/fragments/34/fragment34.h @@ -150,7 +150,7 @@ typedef struct arg1_func_87903D64_014 { // unk_D_86002F34_alt9 or unk_D_86002F34_alt2 typedef struct arg1_func_87903D64 { /* 0x00 */ char unk00[0x14]; - /* 0x00 */ arg1_func_87903D64_014* unk_14; + /* 0x14 */ arg1_func_87903D64_014* unk_14; /* 0x18 */ Gfx* unk_18; } arg1_func_87903D64; // size >= 0x1C diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index 1888b6e..398edec 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -1390,10 +1390,11 @@ - [0x258080, c, fragments/31/fragment31_258080] - [0x259030, c, fragments/31/fragment31_259030] - [0x2590C0, c, fragments/31/fragment31_2590C0] - - [0x259290, data, fragments/31/fragment31_data] + - [0x259290, .data, fragments/31/fragment31_2554C0] + - [0x2592A0, data, fragments/31/fragment31_data] - [0x259480, rodata, fragments/31/fragment31_rodata_259480] - [0x259490, rodata, fragments/31/fragment31_rodata_259490] - - [0x2594E0, rodata, fragments/31/fragment31_rodata_2594E0] + - [0x2594E0, .rodata, fragments/31/fragment31_2558B0] - [0x259A90, rodata, fragments/31/fragment31_rodata_259A90] - {vram: 0x810047E0, type: bss, name: fragments/31/fragment31_bss}