From e77b96f5833d14dd2575c540de5183fe46090448 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 12 Oct 2024 19:59:03 -0400 Subject: [PATCH] id 18480 as geo_layout from sm64 --- include/global.h | 64 ++-- linker_scripts/us/symbol_addrs.txt | 9 + linker_scripts/us/symbol_addrs_code.txt | 16 +- src/11BA0.c | 16 +- src/11BA0.h | 10 +- src/12D80.c | 78 ++--- src/12D80.h | 64 ++-- src/18480.c | 401 ---------------------- src/19840.c | 6 +- src/30640.c | 2 +- src/fragments/10/fragment10.c | 4 +- src/fragments/11/fragment11.c | 4 +- src/fragments/12/fragment12.c | 6 +- src/fragments/13/fragment13.c | 6 +- src/fragments/14/fragment14_144300.c | 4 +- src/fragments/14/fragment14_1462A0.c | 4 +- src/fragments/15/fragment15.h | 6 +- src/fragments/15/fragment15_14CA70.c | 16 +- src/fragments/16/fragment16.h | 2 +- src/fragments/16/fragment16_158A00.c | 20 +- src/fragments/3/fragment3.h | 2 +- src/fragments/6/fragment6.c | 4 +- src/fragments/7/fragment7.c | 4 +- src/fragments/8/fragment8.c | 4 +- src/fragments/9/fragment9.c | 4 +- src/geo_layout.c | 426 ++++++++++++++++++++++++ src/{18480.h => geo_layout.h} | 43 ++- yamls/us/rom.yaml | 2 +- 28 files changed, 642 insertions(+), 585 deletions(-) delete mode 100644 src/18480.c create mode 100644 src/geo_layout.c rename src/{18480.h => geo_layout.h} (87%) diff --git a/include/global.h b/include/global.h index 9cdc82a2..54e63c96 100644 --- a/include/global.h +++ b/include/global.h @@ -167,19 +167,19 @@ typedef struct unk_D_86002F34_000_014 { /* 0x04 */ u8* unk_04; } unk_D_86002F34_000_014; // size >= 0x8 -typedef s32 (*func_D_86002F34_000_010)(s32, struct unk_D_86002F34_000*); +typedef s32 (*func_D_86002F34_000_010)(s32, struct GraphNode*); -typedef struct unk_D_86002F34_000 { +typedef struct GraphNode { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 unk_01; /* 0x02 */ u8 unk_02; /* 0x03 */ u8 unk_03; - /* 0x04 */ struct unk_D_86002F34_000* unk_04; - /* 0x08 */ struct unk_D_86002F34_000* unk_08; + /* 0x04 */ struct GraphNode* unk_04; + /* 0x08 */ struct GraphNode* unk_08; /* 0x0C */ struct unk_D_86002F34_00C* unk_0C; /* 0x10 */ func_D_86002F34_000_010 unk_10; /* 0x14 */ unk_D_86002F34_000_014* unk_14; -} unk_D_86002F34_000; // size = 0x18 +} GraphNode; // size = 0x18 typedef struct unk_D_86002F34_00C_018 { /* 0x00 */ Vp* vp; @@ -237,7 +237,7 @@ typedef struct unk_D_86002F34_00C_0CC { } unk_D_86002F34_00C_0CC; // size >= 0x20 typedef struct unk_D_86002F34_00C { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ unk_D_86002F34_00C_018 unk_18; /* 0x24 */ unk_D_86002F34_00C_024 unk_24; /* 0x40 */ unk_D_86002F34_00C_040 unk_40; @@ -247,7 +247,7 @@ typedef struct unk_D_86002F34_00C { } unk_D_86002F34_00C; // size = 0xF0 typedef struct unk_D_86002F34_alt1 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ u16 unk_1A; /* 0x1C */ s8 unk_1C; @@ -257,32 +257,32 @@ typedef struct unk_D_86002F34_alt1 { } unk_D_86002F34_alt1; // size >= 0x28 typedef struct unk_D_86002F34_alt2 { - /* 0x00 */ unk_D_86002F34_000 unk_00; - /* 0x18 */ unk_D_86002F34_000* unk_18; + /* 0x00 */ struct GraphNode unk_00; + /* 0x18 */ struct GraphNode* unk_18; } unk_D_86002F34_alt2; // size >= 0x1C typedef struct unk_D_86002F34_alt3 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ s32 unk_1C; } unk_D_86002F34_alt3; // size >= 0x20 typedef struct unk_D_86002F34_alt4 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Color_RGBA8_u32 unk_18; /* 0x1C */ u16 unk_1C; /* 0x1E */ u16 unk_1E; } unk_D_86002F34_alt4; // size >= 0x20 typedef struct unk_D_86002F34_alt5 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Vec3f unk_18; /* 0x24 */ Vec3s unk_24; } unk_D_86002F34_alt5; // size = 0x2C typedef struct unk_D_86002F34_alt6 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Vec3s unk_18; /* 0x1E */ Vec3s unk_1E; /* 0x24 */ Vec3f unk_24; @@ -292,26 +292,26 @@ typedef struct unk_D_86002F34_alt6 { } unk_D_86002F34_alt6; // size = 0x34 typedef struct unk_D_86002F34_alt7 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Gfx* unk_18; /* 0x1C */ s16 unk_1C; } unk_D_86002F34_alt7; // size = 0x20 typedef struct unk_D_86002F34_alt8 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Gfx* unk_18; /* 0x1C */ MtxF unk_1C; } unk_D_86002F34_alt8; // size = 0x5C typedef struct unk_D_86002F34_alt9 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Gfx* unk_18; /* 0x1C */ Vec3f unk_1C; /* 0x28 */ f32 unk_28; } unk_D_86002F34_alt9; // size = 0x2C typedef struct unk_D_86002F34_alt10 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s32 unk_18; /* 0x1C */ s16 unk_1C; /* 0x1E */ s16 unk_1E; @@ -329,13 +329,13 @@ typedef struct unk_D_86002F34_alt11_018 { } unk_D_86002F34_alt11_018; // size >= 0xC typedef struct unk_D_86002F34_alt11 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ unk_D_86002F34_alt11_018* unk_18; /* 0x1C */ unk_D_86002F34_alt11_018* unk_1C; } unk_D_86002F34_alt11; // size >= 0x20 typedef struct unk_D_86002F34_alt12 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ s16 unk_1C; @@ -343,29 +343,29 @@ typedef struct unk_D_86002F34_alt12 { } unk_D_86002F34_alt12; // size = 0x20 typedef struct unk_D_86002F34_alt13 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; } unk_D_86002F34_alt13; // size = 0x1C typedef struct unk_D_86002F34_alt14 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; } unk_D_86002F34_alt14; // size = 0x18 typedef struct unk_D_86002F34_alt15 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; } unk_D_86002F34_alt15; // size = 0x18 typedef struct unk_D_86002F34_alt16 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ u32 unk_18; } unk_D_86002F34_alt16; // size = 0x1C typedef struct unk_D_86002F34_alt17 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; } unk_D_86002F34_alt17; // size = 0x18 typedef struct unk_D_86002F34_alt18 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ u8 r; /* 0x19 */ u8 g; /* 0x1A */ u8 b; @@ -375,36 +375,36 @@ typedef struct unk_D_86002F34_alt18 { } unk_D_86002F34_alt18; // size = 0x20 typedef struct unk_D_86002F34_alt19 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ u8 r; /* 0x19 */ u8 g; /* 0x1A */ u8 b; } unk_D_86002F34_alt19; // size = 0x1C typedef struct unk_D_86002F34_alt20 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; } unk_D_86002F34_alt20; // size = 0x1C typedef struct unk_D_86002F34_alt21 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; } unk_D_86002F34_alt21; // size = 0x1C typedef struct unk_D_86002F34_alt22 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Vec3f unk_18; } unk_D_86002F34_alt22; // size = 0x24 typedef struct unk_D_86002F34_alt23 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; } unk_D_86002F34_alt23; // size = 0x1C typedef struct unk_D_86002F34_alt24 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ s16 unk_1C; @@ -434,7 +434,7 @@ typedef struct unk_D_86002F34_01C { } unk_D_86002F34_01C; // size = 0xC typedef struct unk_D_86002F34 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ unk_D_86002F34_018* unk_18; /* 0x1C */ unk_D_86002F34_01C* unk_1C; /* 0x20 */ Vtx* unk_20; diff --git a/linker_scripts/us/symbol_addrs.txt b/linker_scripts/us/symbol_addrs.txt index c9bf1672..61d8c3cc 100644 --- a/linker_scripts/us/symbol_addrs.txt +++ b/linker_scripts/us/symbol_addrs.txt @@ -295,10 +295,19 @@ D_8006F050 = 0x8006F050; // size:0xC D_8006F05C = 0x8006F05C; // size:0x6 D_8006F064 = 0x8006F064; // size:0xC D_800ABE10 = 0x800ABE10; // size:0xA18 +gCurRootGraphNode = 0x800ABD34; // size:0x4 gPlayer1Controller = 0x80068BA0; gPlayer2Controller = 0x80068BA4; gPlayer3Controller = 0x80068BA8; gPlayer4Controller = 0x80068BAC; +GeoLayoutJumpTable = 0x8006F2B0; // size:0xA0 +gGeoLayoutCommand = 0x800ABE00; // size:0x4 +gGeoLayoutStack = 0x800ABD38; +gGraphNodePool = 0x800ABD30; // size:0x4 +gGeoLayoutStackIndex = 0x800ABDFA; // size:0x2 +gGeoLayoutReturnIndex = 0x800ABDFE; // size:0x2 +gCurGraphNodeList = 0x800ABD78; // size:0x80 +gCurGraphNodeIndex = 0x800ABDF8; // size:0x2 D_8790606C = 0x8790606C; // size:0x6 D_87906088 = 0x87906088; // size:0xC D_8790609C = 0x8790609C; // size:0x6 diff --git a/linker_scripts/us/symbol_addrs_code.txt b/linker_scripts/us/symbol_addrs_code.txt index 46d3aa1e..57d768e4 100644 --- a/linker_scripts/us/symbol_addrs_code.txt +++ b/linker_scripts/us/symbol_addrs_code.txt @@ -556,13 +556,13 @@ func_80017804 = 0x80017804; // type:func func_8001781C = 0x8001781C; // type:func func_8001783C = 0x8001783C; // type:func func_80017858 = 0x80017858; // type:func -func_80017880 = 0x80017880; // type:func -func_80017914 = 0x80017914; // type:func -func_8001799C = 0x8001799C; // type:func -func_800179C8 = 0x800179C8; // type:func -func_80017A1C = 0x80017A1C; // type:func -func_80017A54 = 0x80017A54; // type:func -func_80017A98 = 0x80017A98; // type:func +geo_layout_cmd_branch_and_link = 0x80017880; // type:func +geo_layout_cmd_end = 0x80017914; // type:func +geo_layout_cmd_jump = 0x8001799C; // type:func +geo_layout_cmd_branch = 0x800179C8; // type:func +geo_layout_cmd_return = 0x80017A1C; // type:func +geo_layout_cmd_open_node = 0x80017A54; // type:func +geo_layout_cmd_close_node = 0x80017A98; // type:func func_80017AC4 = 0x80017AC4; // type:func func_80017B28 = 0x80017B28; // type:func func_80017B60 = 0x80017B60; // type:func @@ -596,7 +596,7 @@ func_800189B8 = 0x800189B8; // type:func func_80018A40 = 0x80018A40; // type:func func_80018A8C = 0x80018A8C; // type:func func_80018AD0 = 0x80018AD0; // type:func -func_80018B70 = 0x80018B70; // type:func +process_geo_layout = 0x80018B70; // type:func func_80018C40 = 0x80018C40; // type:func func_80018DE8 = 0x80018DE8; // type:func func_80018E7C = 0x80018E7C; // type:func diff --git a/src/11BA0.c b/src/11BA0.c index 638bcc1c..90eae21e 100644 --- a/src/11BA0.c +++ b/src/11BA0.c @@ -3,7 +3,7 @@ #include "F420.h" #include "util.h" -void func_80010FA0(unk_D_86002F34_000* arg0, u8 arg1) { +void func_80010FA0(struct GraphNode* arg0, u8 arg1) { if (arg0 != NULL) { arg0->unk_00 = arg1; arg0->unk_01 = 0x11; @@ -17,7 +17,7 @@ void func_80010FA0(unk_D_86002F34_000* arg0, u8 arg1) { } } -void func_80010FDC(unk_D_86002F34_000* arg0, func_D_86002F34_000_010 arg1, unk_D_86002F34_000_014* arg2) { +void func_80010FDC(struct GraphNode* arg0, func_D_86002F34_000_010 arg1, unk_D_86002F34_000_014* arg2) { if (arg1 != NULL) { arg1 = Util_ConvertAddrToVirtAddr(arg1); } @@ -31,9 +31,9 @@ void func_80010FDC(unk_D_86002F34_000* arg0, func_D_86002F34_000_010 arg1, unk_D } } -unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, unk_D_86002F34_000* arg1) { +struct GraphNode* func_8001103C(MainPoolState* arg0, struct GraphNode* arg1) { if (arg0 != NULL) { - arg1 = func_80002DCC(arg0, sizeof(unk_D_86002F34_000), 4); + arg1 = func_80002DCC(arg0, sizeof(struct GraphNode), 4); } if (arg1 != NULL) { @@ -43,7 +43,7 @@ unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, unk_D_86002F34_000* arg1) return arg1; } -unk_D_86002F34_alt2* func_80011088(MainPoolState* arg0, unk_D_86002F34_alt2* arg1, unk_D_86002F34_000* arg2) { +unk_D_86002F34_alt2* func_80011088(MainPoolState* arg0, unk_D_86002F34_alt2* arg1, struct GraphNode* arg2) { if (arg0 != NULL) { arg1 = func_80002DCC(arg0, sizeof(unk_D_86002F34_alt2), 4); } @@ -529,9 +529,9 @@ void func_80011FC8(unk_D_86002F34_00C* arg0, s16 arg1, s16 arg2, u8 arg3, u8 arg #pragma GLOBAL_ASM("asm/us/nonmatchings/11BA0/func_80012044.s") -void func_80012094(unk_D_86002F34_000* arg0, unk_D_86002F34_000* arg1) { - unk_D_86002F34_000* temp_v0; - unk_D_86002F34_000* temp_v1; +void func_80012094(struct GraphNode* arg0, struct GraphNode* arg1) { + struct GraphNode* temp_v0; + struct GraphNode* temp_v1; if ((arg0 != NULL) && (arg1 != NULL)) { temp_v0 = arg0->unk_0C; diff --git a/src/11BA0.h b/src/11BA0.h index 7f8b7769..8fea9ab4 100644 --- a/src/11BA0.h +++ b/src/11BA0.h @@ -20,10 +20,10 @@ typedef struct unk_D_8690A610 { /* 0x18 */ unk_D_8690A610_018 unk_18; } unk_D_8690A610; // size = 0x20 -void func_80010FA0(unk_D_86002F34_000* arg0, u8 arg1); -void func_80010FDC(unk_D_86002F34_000* arg0, func_D_86002F34_000_010 arg1, unk_D_86002F34_000_014* arg2); -unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, unk_D_86002F34_000* arg1); -unk_D_86002F34_alt2* func_80011088(MainPoolState* arg0, unk_D_86002F34_alt2* arg1, unk_D_86002F34_000* arg2); +void func_80010FA0(struct GraphNode* arg0, u8 arg1); +void func_80010FDC(struct GraphNode* arg0, func_D_86002F34_000_010 arg1, unk_D_86002F34_000_014* arg2); +struct GraphNode* func_8001103C(MainPoolState* arg0, struct GraphNode* arg1); +unk_D_86002F34_alt2* func_80011088(MainPoolState* arg0, unk_D_86002F34_alt2* arg1, struct GraphNode* arg2); unk_D_86002F34_00C* func_800110E0(MemoryBlock* arg0, unk_D_86002F34_00C* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5); unk_D_86002F34_alt13* func_800111A4(MemoryBlock* arg0, unk_D_86002F34_alt13* arg1, s16 arg2); unk_D_86002F34_alt1* func_800111FC(MemoryBlock* arg0, unk_D_86002F34_alt1* arg1, s16 arg2); @@ -58,5 +58,5 @@ void func_80011DAC(unk_D_86002F34_00C* arg0, s16 arg1, s16 arg2, s16 arg3, s16 a void func_80011E68(unk_D_86002F34_00C* arg0, f32 arg1, f32 arg2, f32 arg3); void func_80011EB4(unk_D_86002F34_00C* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, s32 arg7); void func_80011FC8(unk_D_86002F34_00C* arg0, s16 arg1, s16 arg2, u8 arg3, u8 arg4, u8 arg5); -void func_80012094(unk_D_86002F34_000* arg0, unk_D_86002F34_000* arg1); +void func_80012094(struct GraphNode* arg0, struct GraphNode* arg1); #endif // _11BA0_H_ diff --git a/src/12D80.c b/src/12D80.c index a7ff88d1..5f9e7fb5 100644 --- a/src/12D80.c +++ b/src/12D80.c @@ -11,7 +11,7 @@ #include "src/memmap.h" #include "src/util.h" -typedef void (*func_D_8006F0A4)(unk_D_86002F34_000* arg0); +typedef void (*func_D_8006F0A4)(struct GraphNode* arg0); typedef struct unk_D_800AA8C8 { /* 0x0000 */ MtxF unk_0000[64]; @@ -380,9 +380,9 @@ void func_800131B4(unk_D_86002F34_00C_0CC* arg0, unk_D_86002F34_00C_040* arg1) { } } -void func_80013330(unk_D_86002F34_000* arg0) { - unk_D_86002F34_000* temp_s2 = arg0->unk_0C; - unk_D_86002F34_000* var_s0 = temp_s2; +void func_80013330(struct GraphNode* arg0) { + struct GraphNode* temp_s2 = arg0->unk_0C; + struct GraphNode* var_s0 = temp_s2; if (temp_s2 != NULL) { do { @@ -398,9 +398,9 @@ void func_80013330(unk_D_86002F34_000* arg0) { } } -void func_800133D8(unk_D_86002F34_000* arg0) { +void func_800133D8(struct GraphNode* arg0) { UNUSED s32 pad; - unk_D_86002F34_000* temp_a1 = ((unk_D_86002F34*)arg0)->unk_18; + struct GraphNode* temp_a1 = ((unk_D_86002F34*)arg0)->unk_18; if ((temp_a1 != NULL) && (temp_a1->unk_01 & 1)) { D_800AA6C0 = 0; @@ -413,7 +413,7 @@ void func_800133D8(unk_D_86002F34_000* arg0) { func_80013330(arg0); } -void func_80013464(unk_D_86002F34_000* arg0) { +void func_80013464(struct GraphNode* arg0) { UNUSED MtxF pad_mtx; unk_D_86002F34_00C* arg = (unk_D_86002F34_00C*)arg0; unk_D_86002F34_00C_040* temp_s2 = &arg->unk_40; @@ -454,13 +454,13 @@ void func_80013464(unk_D_86002F34_000* arg0) { D_8006F088 = NULL; } -void func_80013764(unk_D_86002F34_000* arg0) { +void func_80013764(struct GraphNode* arg0) { D_8006F08C = arg0; func_80013330(arg0); D_8006F08C = NULL; } -void func_8001378C(unk_D_86002F34_000* arg0) { +void func_8001378C(struct GraphNode* arg0) { unk_D_86002F34_alt1* arg = (unk_D_86002F34_alt1*)arg0; if (arg->unk_00.unk_0C != NULL) { @@ -494,7 +494,7 @@ void func_8001378C(unk_D_86002F34_000* arg0) { arg->unk_1A = D_8006F084; } -void func_800138F0(unk_D_86002F34_000* arg0) { +void func_800138F0(struct GraphNode* arg0) { unk_D_86002F34_00C* arg = (unk_D_86002F34_00C*)arg0; if ((D_8006F094 == NULL) && (arg->unk_00.unk_0C != NULL)) { @@ -506,7 +506,7 @@ void func_800138F0(unk_D_86002F34_000* arg0) { } } -void func_8001395C(unk_D_86002F34_000* arg0) { +void func_8001395C(struct GraphNode* arg0) { if ((D_8006F094 == NULL) && (arg0->unk_0C != NULL)) { gSPPerspNormalize(gDisplayListHead++, 0xFFFF); gSPMatrix(gDisplayListHead++, (u32)D_8006F088->unk_40.mtx & 0x1FFFFFFF, @@ -516,7 +516,7 @@ void func_8001395C(unk_D_86002F34_000* arg0) { } } -void func_800139E8(unk_D_86002F34_000* arg0) { +void func_800139E8(struct GraphNode* arg0) { if ((D_8006F094 == NULL) && (arg0->unk_0C != NULL)) { gSPLookAt(gDisplayListHead++, (u32)&D_8006F088->unk_60.lookat->l & 0x1FFFFFFF); @@ -531,7 +531,7 @@ void func_800139E8(unk_D_86002F34_000* arg0) { } } -void func_80013AF8(unk_D_86002F34_000* arg0) { +void func_80013AF8(struct GraphNode* arg0) { unk_D_86002F34_alt2* arg = (unk_D_86002F34_alt2*)arg0; unk_D_86002F34_00C_018* ptr = &D_8006F088->unk_18; @@ -541,7 +541,7 @@ void func_80013AF8(unk_D_86002F34_000* arg0) { gDPSetCycleType(gDisplayListHead++, G_CYC_2CYCLE); } -void func_80013B8C(UNUSED unk_D_86002F34_000* arg0) { +void func_80013B8C(UNUSED struct GraphNode* arg0) { unk_D_86002F34_00C_018* ptr = &D_8006F088->unk_18; func_800067E4(&gDisplayListHead, ptr->x, ptr->y, ptr->width, ptr->height); @@ -550,10 +550,10 @@ void func_80013B8C(UNUSED unk_D_86002F34_000* arg0) { gDPSetCycleType(gDisplayListHead++, G_CYC_2CYCLE); } -void func_80013C14(UNUSED unk_D_86002F34_000* arg0) { +void func_80013C14(UNUSED struct GraphNode* arg0) { } -void func_80013C1C(unk_D_86002F34_000* arg0) { +void func_80013C1C(struct GraphNode* arg0) { unk_D_86002F34_alt3* arg = (unk_D_86002F34_alt3*)arg0; D_8006F090->unk_1D = 1; @@ -565,7 +565,7 @@ void func_80013C1C(unk_D_86002F34_000* arg0) { } #ifdef NON_MATCHING -void func_80013D34(unk_D_86002F34_000* arg0) { +void func_80013D34(struct GraphNode* arg0) { unk_D_86002F34_alt4* arg = (unk_D_86002F34_alt4*)arg0; Lights7* lights; unk_D_86002F34_alt1* new_var; @@ -611,10 +611,10 @@ void func_80013D34(unk_D_86002F34_000* arg0) { #pragma GLOBAL_ASM("asm/us/nonmatchings/12D80/func_80013D34.s") #endif -void func_80013F7C(UNUSED unk_D_86002F34_000* arg0) { +void func_80013F7C(UNUSED struct GraphNode* arg0) { } -void func_80013F84(unk_D_86002F34_000* arg0) { +void func_80013F84(struct GraphNode* arg0) { unk_D_86002F34_alt4* arg = (unk_D_86002F34_alt4*)arg0; s32 i; Lights7* lights; @@ -640,7 +640,7 @@ void func_80013F84(unk_D_86002F34_000* arg0) { gSPLight(gDisplayListHead++, D_8006F090->lights, i + 1); } -void func_80014124(unk_D_86002F34_000* arg0) { +void func_80014124(struct GraphNode* arg0) { unk_D_86002F34_alt11* arg = (unk_D_86002F34_alt11*)arg0; MtxF* temp_v0 = &D_800AA8C8.unk_0000[D_800AA8C8.unk_10A0]; Vec3f sp2C; @@ -665,7 +665,7 @@ void func_80014124(unk_D_86002F34_000* arg0) { D_8006F0A0 = NULL; } -void func_80014214(unk_D_86002F34_000* arg0) { +void func_80014214(struct GraphNode* arg0) { unk_D_86002F34_alt3* arg = (unk_D_86002F34_alt3*)arg0; MtxF* mtx2 = &D_8006F088->unk_60.mtxf; f32 a = D_800AA8C8.unk_0000[D_800AA8C8.unk_10A0].mf[3][0]; @@ -678,10 +678,10 @@ void func_80014214(unk_D_86002F34_000* arg0) { } } -void func_800142BC(unk_D_86002F34_000* arg0) { +void func_800142BC(struct GraphNode* arg0) { unk_D_86002F34_alt3* arg = (unk_D_86002F34_alt3*)arg0; s32 i; - unk_D_86002F34_000* var_a1 = arg->unk_00.unk_0C; + struct GraphNode* var_a1 = arg->unk_00.unk_0C; if (var_a1 != NULL) { for (i = 0; i < arg->unk_1A; i++) { @@ -694,7 +694,7 @@ void func_800142BC(unk_D_86002F34_000* arg0) { } } -void func_80014334(unk_D_86002F34_000* arg0) { +void func_80014334(struct GraphNode* arg0) { MtxF sp20; unk_D_86002F34_alt5* arg = (unk_D_86002F34_alt5*)arg0; @@ -705,7 +705,7 @@ void func_80014334(unk_D_86002F34_000* arg0) { D_800AA8C8.unk_10A0--; } -void func_80014384(unk_D_86002F34_000* arg0) { +void func_80014384(struct GraphNode* arg0) { unk_D_86002F34_alt5* arg = (unk_D_86002F34_alt5*)arg0; func_80012344(&arg->unk_18); @@ -714,7 +714,7 @@ void func_80014384(unk_D_86002F34_000* arg0) { D_800AA8C8.unk_10A0--; } -void func_800143C0(unk_D_86002F34_000* arg0) { +void func_800143C0(struct GraphNode* arg0) { Vec3s sp90; Vec3f sp84; Vec3f sp78; @@ -766,7 +766,7 @@ void func_800143C0(unk_D_86002F34_000* arg0) { } } -void func_80014624(unk_D_86002F34_000* arg0) { +void func_80014624(struct GraphNode* arg0) { unk_D_86002F34_alt7* arg = (unk_D_86002F34_alt7*)arg0; if (arg->unk_18 != NULL) { @@ -777,7 +777,7 @@ void func_80014624(unk_D_86002F34_000* arg0) { func_80013330(arg0); } -void func_80014690(unk_D_86002F34_000* arg0) { +void func_80014690(struct GraphNode* arg0) { MtxF sp38; Color_RGBA8_u32 sp34; unk_D_86002F58_004_000* arg = (unk_D_86002F58_004_000*)arg0; @@ -829,7 +829,7 @@ void func_80014690(unk_D_86002F34_000* arg0) { } } -void func_800148D8(unk_D_86002F34_000* arg0) { +void func_800148D8(struct GraphNode* arg0) { unk_D_86002F34_alt8* arg = (unk_D_86002F34_alt8*)arg0; func_800122B4(&arg->unk_1C); @@ -845,7 +845,7 @@ void func_800148D8(unk_D_86002F34_000* arg0) { D_800AA8C8.unk_10A0--; } -void func_80014980(unk_D_86002F34_000* arg0) { +void func_80014980(struct GraphNode* arg0) { MtxF sp30; unk_D_86002F34_alt9* arg = (unk_D_86002F34_alt9*)arg0; @@ -866,7 +866,7 @@ void func_80014980(unk_D_86002F34_000* arg0) { D_800AA8C8.unk_10A0--; } -void func_80014A60(unk_D_86002F34_000* arg0) { +void func_80014A60(struct GraphNode* arg0) { unk_D_86002F34_alt9* arg = (unk_D_86002F34_alt9*)arg0; if ((arg->unk_18 != NULL) || (arg->unk_00.unk_10 != NULL)) { @@ -879,7 +879,7 @@ void func_80014A60(unk_D_86002F34_000* arg0) { func_80013330(arg0); } -void func_80014AEC(unk_D_86002F34_000* arg0) { +void func_80014AEC(struct GraphNode* arg0) { Color_RGBA8_u32 sp44; unk_D_86002F34_alt10* arg = (unk_D_86002F34_alt10*)arg0; unk_D_86002F34_alt11_018* sp3C; @@ -932,18 +932,18 @@ void func_80014CB8(s32 arg0) { } } -void func_80014D24(unk_D_86002F34_000* arg0) { +void func_80014D24(struct GraphNode* arg0) { unk_D_86002F34_alt3* arg = (unk_D_86002F34_alt3*)arg0; func_80014CB8(arg->unk_18); func_80013330(arg0); } -void func_80014D50(unk_D_86002F34_000* arg0) { +void func_80014D50(struct GraphNode* arg0) { func_80013330(arg0); } -void func_80014D70(unk_D_86002F34_000* arg0) { +void func_80014D70(struct GraphNode* arg0) { Vec3f sp9C; Vec3f sp90; Vec3f sp84; @@ -1007,7 +1007,7 @@ void func_80014D70(unk_D_86002F34_000* arg0) { } } -void func_80015094(unk_D_86002F34_000* arg0) { +void func_80015094(struct GraphNode* arg0) { unk_D_86002F34_alt1* arg = (unk_D_86002F34_alt1*)arg0; if (arg0->unk_01 & 1) { @@ -1032,9 +1032,9 @@ void func_80015094(unk_D_86002F34_000* arg0) { D_8006F080 = 0; } -void func_80015220(unk_D_86002F34_000* arg0, s32 arg1) { - unk_D_86002F34_000* var_s1 = arg0; - unk_D_86002F34_000** var_s0; +void func_80015220(struct GraphNode* arg0, s32 arg1) { + struct GraphNode* var_s1 = arg0; + struct GraphNode** var_s0; do { if (var_s1->unk_10 != NULL) { diff --git a/src/12D80.h b/src/12D80.h index 4471573e..0deaa092 100644 --- a/src/12D80.h +++ b/src/12D80.h @@ -69,39 +69,39 @@ void func_80012870(Vtx* arg0, unk_D_86002F34_00C_0CC* arg1, s16 arg2, s16 arg3, Vtx* func_80012960(unk_D_86002F34_00C_0CC* arg0); void func_80012D88(unk_D_86002F34_00C_0CC* arg0, UNUSED unk_D_86002F34_00C_040* arg1); void func_800131B4(unk_D_86002F34_00C_0CC* arg0, unk_D_86002F34_00C_040* arg1); -void func_80013330(unk_D_86002F34_000* arg0); -void func_800133D8(unk_D_86002F34_000* arg0); -void func_80013464(unk_D_86002F34_000* arg0); -void func_80013764(unk_D_86002F34_000* arg0); -void func_8001378C(unk_D_86002F34_000* arg0); -void func_800138F0(unk_D_86002F34_000* arg0); -void func_8001395C(unk_D_86002F34_000* arg0); -void func_800139E8(unk_D_86002F34_000* arg0); -void func_80013AF8(unk_D_86002F34_000* arg0); -void func_80013B8C(UNUSED unk_D_86002F34_000* arg0); -void func_80013C14(UNUSED unk_D_86002F34_000* arg0); -void func_80013C1C(unk_D_86002F34_000* arg0); -void func_80013D34(unk_D_86002F34_000* arg0); -void func_80013F7C(UNUSED unk_D_86002F34_000* arg0); -void func_80013F84(unk_D_86002F34_000* arg0); -void func_80014124(unk_D_86002F34_000* arg0); -void func_80014214(unk_D_86002F34_000* arg0); -void func_800142BC(unk_D_86002F34_000* arg0); -void func_80014334(unk_D_86002F34_000* arg0); -void func_80014384(unk_D_86002F34_000* arg0); -void func_800143C0(unk_D_86002F34_000* arg0); -void func_80014624(unk_D_86002F34_000* arg0); -void func_80014690(unk_D_86002F34_000* arg0); -void func_800148D8(unk_D_86002F34_000* arg0); -void func_80014980(unk_D_86002F34_000* arg0); -void func_80014A60(unk_D_86002F34_000* arg0); -void func_80014AEC(unk_D_86002F34_000* arg0); +void func_80013330(struct GraphNode* arg0); +void func_800133D8(struct GraphNode* arg0); +void func_80013464(struct GraphNode* arg0); +void func_80013764(struct GraphNode* arg0); +void func_8001378C(struct GraphNode* arg0); +void func_800138F0(struct GraphNode* arg0); +void func_8001395C(struct GraphNode* arg0); +void func_800139E8(struct GraphNode* arg0); +void func_80013AF8(struct GraphNode* arg0); +void func_80013B8C(UNUSED struct GraphNode* arg0); +void func_80013C14(UNUSED struct GraphNode* arg0); +void func_80013C1C(struct GraphNode* arg0); +void func_80013D34(struct GraphNode* arg0); +void func_80013F7C(UNUSED struct GraphNode* arg0); +void func_80013F84(struct GraphNode* arg0); +void func_80014124(struct GraphNode* arg0); +void func_80014214(struct GraphNode* arg0); +void func_800142BC(struct GraphNode* arg0); +void func_80014334(struct GraphNode* arg0); +void func_80014384(struct GraphNode* arg0); +void func_800143C0(struct GraphNode* arg0); +void func_80014624(struct GraphNode* arg0); +void func_80014690(struct GraphNode* arg0); +void func_800148D8(struct GraphNode* arg0); +void func_80014980(struct GraphNode* arg0); +void func_80014A60(struct GraphNode* arg0); +void func_80014AEC(struct GraphNode* arg0); void func_80014CB8(s32 arg0); -void func_80014D24(unk_D_86002F34_000* arg0); -void func_80014D50(unk_D_86002F34_000* arg0); -void func_80014D70(unk_D_86002F34_000* arg0); -void func_80015094(unk_D_86002F34_000* arg0); -void func_80015220(unk_D_86002F34_000* arg0, s32 arg1); +void func_80014D24(struct GraphNode* arg0); +void func_80014D50(struct GraphNode* arg0); +void func_80014D70(struct GraphNode* arg0); +void func_80015094(struct GraphNode* arg0); +void func_80015220(struct GraphNode* arg0, s32 arg1); void func_8001533C(s32 arg0); void func_80015348(void); s32 func_80015360(void); diff --git a/src/18480.c b/src/18480.c deleted file mode 100644 index 82362733..00000000 --- a/src/18480.c +++ /dev/null @@ -1,401 +0,0 @@ -#include "18480.h" -#include "src/11BA0.h" -#include "src/F420.h" -#include "src/util.h" - -extern MemoryBlock* D_800ABD30; -extern unk_D_86002F34* D_800ABD34; -extern u32 D_800ABD38[]; -extern unk_D_86002F34_000* D_800ABD78[32]; -extern s16 D_800ABDF8; -extern s16 D_800ABDFA; -extern s16 D_800ABDFE; -extern u8* D_800ABE00; - -void func_80017880(void) { - unk_D_800ABE00_cmd0* cmd = (unk_D_800ABE00_cmd0*)D_800ABE00; - u32 v = (u32)D_800ABE00; - - D_800ABD38[D_800ABDFA++] = v + sizeof(unk_D_800ABE00_cmd0); - D_800ABD38[D_800ABDFA++] = (D_800ABDF8 << 0x10) + D_800ABDFE; - D_800ABDFE = D_800ABDFA; - - D_800ABE00 = (u8*)Util_ConvertAddrToVirtAddr(cmd->unk_04); -} - -void func_80017914(void) { - D_800ABDFA = D_800ABDFE; - - D_800ABDFE = D_800ABD38[--D_800ABDFA] & 0xFFFF; - D_800ABDF8 = D_800ABD38[D_800ABDFA] >> 0x10; - D_800ABE00 = D_800ABD38[--D_800ABDFA]; -} - -void func_8001799C(void) { - unk_D_800ABE00_cmd2* cmd = (unk_D_800ABE00_cmd2*)D_800ABE00; - - D_800ABE00 = Util_ConvertAddrToVirtAddr(cmd->unk_04); -} - -void func_800179C8(void) { - unk_D_800ABE00_cmd3* cmd = (unk_D_800ABE00_cmd3*)D_800ABE00; - - cmd += 0; - - D_800ABD38[D_800ABDFA++] = D_800ABE00 + sizeof(unk_D_800ABE00_cmd3); - D_800ABE00 = (u8*)Util_ConvertAddrToVirtAddr(cmd->unk_04); -} - -void func_80017A1C(void) { - D_800ABE00 = D_800ABD38[--D_800ABDFA]; -} - -void func_80017A54(void) { - D_800ABD78[D_800ABDF8 + 1] = D_800ABD78[D_800ABDF8]; - D_800ABDF8++; - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd5); -} - -void func_80017A98(void) { - D_800ABDF8--; - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd6); -} - -void func_80017AC4(unk_D_86002F34_000* arg0) { - if (arg0 != NULL) { - D_800ABD78[D_800ABDF8] = arg0; - if (D_800ABDF8 == 0) { - if (D_800ABD34 == NULL) { - D_800ABD34 = arg0; - } - } else { - func_80012094(D_800ABD78[D_800ABDF8 - 1], arg0); - } - } -} - -void func_80017B28(void) { - unk_D_800ABE00_cmd7* cmd = (unk_D_800ABE00_cmd7*)D_800ABE00; - - func_80017AC4(&cmd->unk_04->unk_00); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd7); -} - -void func_80017B60(void) { - unk_D_800ABE00_cmd8* cmd = (unk_D_800ABE00_cmd8*)D_800ABE00; - - if (D_800ABD78[D_800ABDF8] != NULL) { - func_80010FDC(D_800ABD78[D_800ABDF8], cmd->unk_04, cmd->unk_08); - } - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd8); -} - -void func_80017BBC(void) { - func_80017AC4(func_8001103C(D_800ABD30, NULL)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd9); -} - -void func_80017BFC(void) { - unk_D_800ABE00_cmdA* cmd = (unk_D_800ABE00_cmdA*)D_800ABE00; - - func_80017AC4(func_80011088(D_800ABD30, NULL, cmd->unk_04)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmdA); -} - -void func_80017C48(void) { - unk_D_800ABE00_cmdB* cmd = (unk_D_800ABE00_cmdB*)D_800ABE00; - unk_D_86002F34_00C* temp_v0 = func_800110E0(D_800ABD30, NULL, cmd->unk_04, cmd->unk_06, cmd->unk_08, cmd->unk_0A); - - if (temp_v0 != NULL) { - temp_v0->unk_24.fovy = cmd->unk_02; - func_8000E990(&temp_v0->unk_60.at, &cmd->unk_0C); - func_80010354(&temp_v0->unk_60.at, &temp_v0->unk_60.eye, cmd->unk_16, (cmd->unk_12 << 0xF) / 180, - (cmd->unk_14 << 0xF) / 180); - } - - func_80017AC4(&temp_v0->unk_00); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmdB); -} - -void func_80017D94(void) { - unk_D_800ABE00_cmdC* cmd = (unk_D_800ABE00_cmdC*)D_800ABE00; - - func_80017AC4(func_800111A4(D_800ABD30, NULL, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmdC); -} - -void func_80017DE0(void) { - unk_D_800ABE00_cmdD* cmd = (unk_D_800ABE00_cmdD*)D_800ABE00; - - func_80017AC4(func_800111FC(D_800ABD30, NULL, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmdD); -} - -void func_80017E2C(void) { - unk_D_800ABE00_cmdE* cmd = (unk_D_800ABE00_cmdE*)D_800ABE00; - - func_80017AC4(func_80011258(D_800ABD30, NULL, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmdE); -} - -void func_80017E78(void) { - unk_D_800ABE00_cmdF* cmd = (unk_D_800ABE00_cmdF*)D_800ABE00; - - func_80017AC4(func_800112BC(D_800ABD30, NULL, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmdF); -} - -void func_80017EC4(void) { - unk_D_800ABE00_cmd10* cmd = (unk_D_800ABE00_cmd10*)D_800ABE00; - - func_80017AC4(func_80011320(D_800ABD30, NULL, cmd->unk_01, cmd->unk_02, cmd->unk_03)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd10); -} - -void func_80017F1C(void) { - func_80017AC4(func_800113AC(D_800ABD30, NULL)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd11); -} - -void func_80017F5C(void) { -} - -void func_80017F64(void) { - unk_D_800ABE00_cmd13* cmd = (unk_D_800ABE00_cmd13*)D_800ABE00; - - func_80017AC4(func_800113F8(D_800ABD30, NULL, cmd->unk_04, cmd->unk_06, cmd->r, cmd->g, cmd->b, 0xFF)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd13); -} - -void func_80017FD4(void) { - unk_D_800ABE00_cmd14* cmd = (unk_D_800ABE00_cmd14*)D_800ABE00; - - func_80017AC4(func_80011484(D_800ABD30, NULL, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, cmd->r, - cmd->g, cmd->b, cmd->a)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd14); -} - -void func_800180BC(void) { - D_800ABE00 += sizeof(unk_D_800ABE00_cmd15); -} - -void func_800180D4(void) { - unk_D_800ABE00_cmd16* cmd = (unk_D_800ABE00_cmd16*)D_800ABE00; - - func_80017AC4(func_80011504(D_800ABD30, NULL, cmd->r, cmd->g, cmd->b)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd16); -} - -void func_8001812C(void) { - unk_D_800ABE00_cmd17* cmd = (unk_D_800ABE00_cmd17*)D_800ABE00; - - func_80017AC4( - func_8001156C(D_800ABD30, NULL, cmd->unk_02, cmd->unk_08, cmd->unk_04, cmd->unk_0C, cmd->unk_06, cmd->unk_10)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd17); -} - -void func_8001819C(void) { - unk_D_800ABE00_cmd18* cmd = (unk_D_800ABE00_cmd18*)D_800ABE00; - - func_80017AC4(func_800115F0(D_800ABD30, NULL, cmd->unk_01, cmd->unk_04, cmd->unk_06, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd18); -} - -void func_800181FC(void) { - unk_D_800ABE00_cmd19* cmd = (unk_D_800ABE00_cmd19*)D_800ABE00; - - func_80017AC4(func_80011660(D_800ABD30, NULL, cmd->unk_04, cmd->unk_06)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd19); -} - -void func_8001824C(void) { - unk_D_800ABE00_cmd1A* cmd = (unk_D_800ABE00_cmd1A*)D_800ABE00; - - func_80017AC4(func_800116C0(D_800ABD30, NULL, cmd->unk_01, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd1A); -} - -void func_8001829C(void) { - Vec3s sp30; - Vec3f sp24; - UNUSED s32 pad; - unk_D_800ABE00_cmd1B* cmd = (unk_D_800ABE00_cmd1B*)D_800ABE00; - - func_8000E990(&sp24, &cmd->unk_0A); - func_8000EB70(&sp30, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, (cmd->unk_08 << 0xF) / 180); - func_80017AC4(func_80011720(D_800ABD30, NULL, &sp24, &sp30)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd1B); -} - -void func_800183C4(void) { - Vec3f sp24; - unk_D_800ABE00_cmd1C* cmd = (unk_D_800ABE00_cmd1C*)D_800ABE00; - - sp24.x = cmd->unk_04 / 65536.0f; - sp24.y = cmd->unk_08 / 65536.0f; - sp24.z = cmd->unk_0C / 65536.0f; - func_80017AC4(func_800117A8(D_800ABD30, NULL, &sp24)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd1C); -} - -void func_80018490(void) { - Vec3f sp3C; - s16 var_a3 = 1; - unk_D_800ABE00_cmd1D* cmd = (unk_D_800ABE00_cmd1D*)D_800ABE00; - - sp3C.x = cmd->unk_10 / 65536.0f; - sp3C.y = cmd->unk_14 / 65536.0f; - sp3C.z = cmd->unk_18 / 65536.0f; - - if (cmd->unk_02 & 1) { - var_a3 = 0; - } - - if (cmd->unk_02 & 2) { - var_a3 |= 2; - } - - func_80017AC4(func_80011814(D_800ABD30, NULL, cmd->unk_01, var_a3, cmd->unk_03, &cmd->unk_04, &cmd->unk_0A, &sp3C)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd1D); -} - -void func_800185A8(void) { - unk_D_800ABE00_cmd1E* cmd = (unk_D_800ABE00_cmd1E*)D_800ABE00; - - func_80017AC4(func_800118D0(D_800ABD30, NULL, cmd->unk_01, cmd->unk_04, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd1E); -} - -void func_80018600(void) { - Vec3s sp40; - Vec3f sp34; - Vec3f sp28; - unk_D_86002F58_004_000* tmp; - unk_D_800ABE00_cmd1F* cmd = (unk_D_800ABE00_cmd1F*)D_800ABE00; - - func_8000E990(&sp34, &cmd->unk_0A); - - sp28.x = cmd->unk_10 / 100.0f; - sp28.y = cmd->unk_12 / 100.0f; - sp28.z = cmd->unk_14 / 100.0f; - - func_8000EB70(&sp40, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, (cmd->unk_08 << 0xF) / 180); - tmp = func_80011938(D_800ABD30, NULL, cmd->unk_02, &sp34, &sp40, &sp28); - func_80017AC4(tmp); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd1F); -} - -void func_8001878C(void) { - Vec3f sp34; - Vec3s sp2C; - unk_D_86002F34_alt8* tmp; - unk_D_800ABE00_cmd20* cmd = (unk_D_800ABE00_cmd20*)D_800ABE00; - - func_8000E990(&sp34, &cmd->unk_0A); - func_8000EB70(&sp2C, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, (cmd->unk_08 << 0xF) / 180); - tmp = func_80011ABC(D_800ABD30, NULL, cmd->unk_01, cmd->unk_10, &sp34, &sp2C); - func_80017AC4(tmp); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd20); -} - -void func_800188C8(void) { - Vec3f sp2C; - unk_D_86002F34_alt9* tmp; - unk_D_800ABE00_cmd21* cmd = (unk_D_800ABE00_cmd21*)D_800ABE00; - - func_8000E990(&sp2C, &cmd->unk_02); - tmp = func_80011B10(D_800ABD30, NULL, cmd->unk_01, cmd->unk_0C, &sp2C, cmd->unk_08 / 65536.0f); - func_80017AC4(tmp); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd21); -} - -void func_80018968(void) { - unk_D_800ABE00_cmd22* cmd = (unk_D_800ABE00_cmd22*)D_800ABE00; - - func_80017AC4(func_80011B94(D_800ABD30, NULL, cmd->unk_01, cmd->unk_04)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd22); -} - -void func_800189B8(void) { - unk_D_800ABE00_cmd23* cmd = (unk_D_800ABE00_cmd23*)D_800ABE00; - - func_80017AC4(func_80011BF4(D_800ABD30, NULL, cmd->unk_01, cmd->unk_02, cmd->unk_04, cmd->unk_08, cmd->unk_0A, - cmd->r, cmd->g, cmd->b, cmd->a)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd23); -} - -void func_80018A40(void) { - unk_D_800ABE00_cmd24* cmd = (unk_D_800ABE00_cmd24*)D_800ABE00; - - func_80017AC4(func_80011C98(D_800ABD30, NULL, cmd->unk_02)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd24); -} - -void func_80018A8C(void) { - unk_D_800ABE00_cmd25* cmd = (unk_D_800ABE00_cmd25*)D_800ABE00; - - if (D_800ABD78[D_800ABDF8] != NULL) { - D_800ABD78[D_800ABDF8]->unk_02 |= 4; - } - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd25); -} - -void func_80018AD0(void) { - unk_D_800ABE00_cmd26* cmd = (unk_D_800ABE00_cmd26*)D_800ABE00; - - func_80017AC4(func_80011CF0(D_800ABD30, NULL, cmd->unk_01, cmd->unk_04, cmd->unk_06, cmd->unk_08, cmd->unk_0A, - cmd->unk_02, cmd->unk_03, cmd->unk_0C, cmd->r, cmd->g, cmd->b, cmd->a)); - - D_800ABE00 += sizeof(unk_D_800ABE00_cmd26); -} - -unk_D_86002F34_000* func_80018B70(MemoryBlock* arg0, void* arg1) { - extern func_D_8006F2B0 D_8006F2B0[]; - - D_800ABD34 = NULL; - D_800ABDF8 = 0; - D_800ABDFA = 2; - D_800ABDFE = 2; - D_800ABE00 = Util_ConvertAddrToVirtAddr((uintptr_t)arg1); - D_800ABD30 = arg0; - D_800ABD78[0] = NULL; - D_800ABD38[0] = 0; - D_800ABD38[1] = 0; - - while (D_800ABE00 != NULL) { - D_8006F2B0[*D_800ABE00](); - } - - return D_800ABD34; -} diff --git a/src/19840.c b/src/19840.c index 6b116791..fddb3e8e 100644 --- a/src/19840.c +++ b/src/19840.c @@ -1,5 +1,5 @@ #include "19840.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/dma.h" #include "src/memmap.h" #include "src/memory.h" @@ -203,7 +203,7 @@ s32 func_80019328(MemoryBlock* arg0, Fragment* arg1, arg1_func_80010CA8 arg2) { temp_v0->unk_14 = arg1; for (i = 0; i < temp_v0->unk_03; i++) { - temp_v0_2 = func_80018B70(arg0, temp_v0->unk_08[i]); + temp_v0_2 = process_geo_layout(arg0, temp_v0->unk_08[i]); if (temp_v0_2->unk_00.unk_00 == 0xE) { temp_v0_2->unk_28 = arg1; @@ -220,7 +220,7 @@ s32 func_80019328(MemoryBlock* arg0, Fragment* arg1, arg1_func_80010CA8 arg2) { void func_80019420(MemoryBlock* arg0, arg1_func_80019420* arg1) { while (arg1->unk_00) { if (arg1->unk_00 == 3) { - arg1->unk_04 = func_80018B70(arg0, arg1->unk_04); + arg1->unk_04 = process_geo_layout(arg0, arg1->unk_04); } arg1++; diff --git a/src/30640.c b/src/30640.c index 2bdbe185..64b61128 100644 --- a/src/30640.c +++ b/src/30640.c @@ -4,7 +4,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" diff --git a/src/fragments/10/fragment10.c b/src/fragments/10/fragment10.c index 90ae4774..8b597c7f 100644 --- a/src/fragments/10/fragment10.c +++ b/src/fragments/10/fragment10.c @@ -2,7 +2,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -847,7 +847,7 @@ void func_86402130(void) { u8 y; MemoryBlock* temp_v0 = func_80002D10(main_pool_get_available(), 0); - D_87B000E8 = func_80018B70(temp_v0, D_8640290C); + D_87B000E8 = process_geo_layout(temp_v0, D_8640290C); func_80002D60(temp_v0); func_8001BB20(); func_8001987C(); diff --git a/src/fragments/11/fragment11.c b/src/fragments/11/fragment11.c index d8a49f98..ab898efa 100644 --- a/src/fragments/11/fragment11.c +++ b/src/fragments/11/fragment11.c @@ -2,7 +2,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/1C720.h" #include "src/1CF30.h" #include "src/20470.h" @@ -733,7 +733,7 @@ void func_86501AAC(void) { MemoryBlock* temp_v0; temp_v0 = func_80002D10(main_pool_get_available(), 0); - D_87B000E8 = func_80018B70(temp_v0, D_86502DE4); + D_87B000E8 = process_geo_layout(temp_v0, D_86502DE4); func_80002D60(temp_v0); func_8001BB20(); func_8001987C(); diff --git a/src/fragments/12/fragment12.c b/src/fragments/12/fragment12.c index 720c1241..3a781887 100644 --- a/src/fragments/12/fragment12.c +++ b/src/fragments/12/fragment12.c @@ -2,7 +2,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -25,7 +25,7 @@ static u32 D_86600850[] = { }; static unk_D_86002F30* D_86600940; -static unk_D_86002F34_000* D_86600944; +static struct GraphNode* D_86600944; static unk_D_86002F34_00C* D_86600948; static unk_D_86002F58_004_000 D_86600950; static s16 D_86600AB8; @@ -202,7 +202,7 @@ void func_866005B8(void) { void func_86600658(void) { MemoryBlock* sp1C = func_80002D10(main_pool_get_available(), 0); - D_86600944 = func_80018B70(sp1C, &D_86600850); + D_86600944 = process_geo_layout(sp1C, &D_86600850); func_80002D60(sp1C); func_8001BB20(); func_8001BB58(&D_86600950); diff --git a/src/fragments/13/fragment13.c b/src/fragments/13/fragment13.c index f00d8d7a..0e373f28 100644 --- a/src/fragments/13/fragment13.c +++ b/src/fragments/13/fragment13.c @@ -2,7 +2,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -25,7 +25,7 @@ static u32 D_86700840[] = { }; static unk_D_86002F30* D_86700930; -static unk_D_86002F34_000* D_86700934; +static struct GraphNode* D_86700934; static unk_D_86002F34_00C* D_86700938; static unk_D_86002F58_004_000 D_86700940; @@ -196,7 +196,7 @@ void func_867005A8(void) { void func_86700648(void) { MemoryBlock* sp1C = func_80002D10(main_pool_get_available(), 0); - D_86700934 = func_80018B70(sp1C, &D_86700840); + D_86700934 = process_geo_layout(sp1C, &D_86700840); func_80002D60(sp1C); func_8001BB20(); func_8001BB58(&D_86700940); diff --git a/src/fragments/14/fragment14_144300.c b/src/fragments/14/fragment14_144300.c index 6d31db12..c32eba4d 100644 --- a/src/fragments/14/fragment14_144300.c +++ b/src/fragments/14/fragment14_144300.c @@ -1,6 +1,6 @@ #include "fragment14.h" #include "src/12D80.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -705,7 +705,7 @@ void func_86801D48(void) { MemoryBlock* sp18; sp18 = func_80002D10(main_pool_get_available(), 0); - D_86807500 = (unk_D_86002F34_000*)func_80018B70(sp18, &D_86806CD0); + D_86807500 = (struct GraphNode*)process_geo_layout(sp18, &D_86806CD0); func_80002D60(sp18); func_8001BB20(); diff --git a/src/fragments/14/fragment14_1462A0.c b/src/fragments/14/fragment14_1462A0.c index 0e65dc01..2a2f37a4 100644 --- a/src/fragments/14/fragment14_1462A0.c +++ b/src/fragments/14/fragment14_1462A0.c @@ -1,7 +1,7 @@ #include "fragment14.h" #include "src/12D80.h" #include "src/17300.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/4CBC0.h" @@ -1650,7 +1650,7 @@ void func_86805858(s32 arg0) { D_86807550 = func_80019D18(0xA0); temp_v0 = func_80002D10(main_pool_get_available(), 0); - D_86808474 = (unk_D_86002F58_004_000_004*)func_80018B70(temp_v0, &D_86807078); + D_86808474 = (unk_D_86002F58_004_000_004*)process_geo_layout(temp_v0, &D_86807078); func_80002D60(temp_v0); D_8680847A = 0; D_8680847E = 4 - D_8780FA2C; diff --git a/src/fragments/15/fragment15.h b/src/fragments/15/fragment15.h index c5064dba..65af689a 100644 --- a/src/fragments/15/fragment15.h +++ b/src/fragments/15/fragment15.h @@ -109,9 +109,9 @@ extern Controller D_8690B390; extern unk_D_8690B3C0 D_8690B3C0; extern s8 D_8690B3D0[255]; -s32 func_86900020(s32 arg0, unk_D_86002F34_000* arg1); -s32 func_86900088(s32 arg0, unk_D_86002F34_000* arg1); -s32 func_869000F4(s32 arg0, unk_D_86002F34_000* arg1); +s32 func_86900020(s32 arg0, struct GraphNode* arg1); +s32 func_86900088(s32 arg0, struct GraphNode* arg1); +s32 func_869000F4(s32 arg0, struct GraphNode* arg1); void func_86900110(u8 arg0, u8 arg1, u8 arg2); void func_86900188(void); unk_D_86002F58_004_000_010_024* func_86900244(unk_func_8001BEE8* arg0); diff --git a/src/fragments/15/fragment15_14CA70.c b/src/fragments/15/fragment15_14CA70.c index 446c2ffc..f98941b7 100644 --- a/src/fragments/15/fragment15_14CA70.c +++ b/src/fragments/15/fragment15_14CA70.c @@ -6,7 +6,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1CF30.h" #include "src/20330.h" @@ -337,7 +337,7 @@ static Controller D_8690B5D0; static s32 D_8690B5F4; static s32 D_8690B5F8; -s32 func_86900020(s32 arg0, unk_D_86002F34_000* arg1) { +s32 func_86900020(s32 arg0, struct GraphNode* arg1) { unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; f32 sp28; s16 sp26; @@ -351,7 +351,7 @@ s32 func_86900020(s32 arg0, unk_D_86002F34_000* arg1) { return 0; } -s32 func_86900088(s32 arg0, unk_D_86002F34_000* arg1) { +s32 func_86900088(s32 arg0, struct GraphNode* arg1) { unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; f32 sp28; s16 sp26; @@ -365,7 +365,7 @@ s32 func_86900088(s32 arg0, unk_D_86002F34_000* arg1) { return 0; } -s32 func_869000F4(s32 arg0, unk_D_86002F34_000* arg1) { +s32 func_869000F4(s32 arg0, struct GraphNode* arg1) { unk_D_86002F58_004_000* ptr = (unk_D_86002F58_004_000*)arg1; if (arg0 == 2) { @@ -467,17 +467,17 @@ void func_86900484(s32 arg0) { temp_v0 = sp18(0, 0); if (temp_v0 != NULL) { - func_80012094(&D_8690A630, func_80018B70(sp1C, temp_v0)); + func_80012094(&D_8690A630, process_geo_layout(sp1C, temp_v0)); } temp_v0 = sp18(1, 0); if (temp_v0 != NULL) { - func_80012094(&D_8690A648, func_80018B70(sp1C, temp_v0)); + func_80012094(&D_8690A648, process_geo_layout(sp1C, temp_v0)); } temp_v0 = sp18(3, 0); if (temp_v0 != NULL) { - func_80012094(&D_8690A660, func_80018B70(sp1C, temp_v0)); + func_80012094(&D_8690A660, process_geo_layout(sp1C, temp_v0)); } D_8690A688 = sp18(2, 0); @@ -506,7 +506,7 @@ void func_8690060C(void) { func_8001103C(NULL, &D_8690A660); func_86900110(0xFF, 0xFF, 0xFF); sp2C = func_80002D10(main_pool_get_available(), 0); - D_87906050 = func_80018B70(sp2C, &D_86908ABC); + D_87906050 = process_geo_layout(sp2C, &D_86908ABC); func_80002D60(sp2C); func_8001BB20(); } diff --git a/src/fragments/16/fragment16.h b/src/fragments/16/fragment16.h index d8d1fbc0..1528b1e8 100644 --- a/src/fragments/16/fragment16.h +++ b/src/fragments/16/fragment16.h @@ -440,7 +440,7 @@ extern unk_D_86002F34_00C* D_86A06254; extern s16 D_86A06258; extern s16* D_86A0625C; -s32 func_86A00020(s32 arg0, unk_D_86002F34_000* arg1); +s32 func_86A00020(s32 arg0, struct GraphNode* arg1); void func_86A013C8(u8 arg0, u8 arg1, unk_D_86A03014* arg2); void func_86A01490(void); void func_86A014F0(void); diff --git a/src/fragments/16/fragment16_158A00.c b/src/fragments/16/fragment16_158A00.c index 67e0a920..68017e32 100644 --- a/src/fragments/16/fragment16_158A00.c +++ b/src/fragments/16/fragment16_158A00.c @@ -1,7 +1,7 @@ #include "fragment16.h" #include "src/11BA0.h" #include "src/12D80.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/1C720.h" #include "src/1CF30.h" #include "src/20330.h" @@ -25,14 +25,14 @@ typedef struct unk_D_86A02700 { } unk_D_86A02700; // size = 0x10 static unk_D_8690A610 D_86A06170; -static unk_D_86002F34_000 D_86A06190; -static unk_D_86002F34_000 D_86A061A8; -static unk_D_86002F34_000 D_86A061C0; +static struct GraphNode D_86A06190; +static struct GraphNode D_86A061A8; +static struct GraphNode D_86A061C0; static s8 D_86A061D8; static u8 D_86A061D9; static BinArchive* D_86A061DC; static Color_RGBA8_u32 D_86A061E0; -static unk_D_86002F34_000* D_86A061E4; +static struct GraphNode* D_86A061E4; static unk_D_86002F34_00C* D_86A061E8; static s16 D_86A061EC; static s16 D_86A061EE; @@ -120,7 +120,7 @@ u32 D_86A025D0[] = { 0x06000000, 0x01000000, }; -s32 func_86A00020(s32 arg0, unk_D_86002F34_000* arg1) { +s32 func_86A00020(s32 arg0, struct GraphNode* arg1) { unk_D_86002F58_004_000* ptr = (unk_D_86002F58_004_000*)arg1; if (arg0 == 2) { @@ -166,17 +166,17 @@ void func_86A000B4(s8 arg0, u8 arg1) { temp_v0 = sp28(0, 0); if (temp_v0 != NULL) { - func_80012094(&D_86A06190, func_80018B70(sp2C, temp_v0)); + func_80012094(&D_86A06190, process_geo_layout(sp2C, temp_v0)); } temp_v0 = sp28(1, 0); if (temp_v0 != NULL) { - func_80012094(&D_86A061A8, func_80018B70(sp2C, temp_v0)); + func_80012094(&D_86A061A8, process_geo_layout(sp2C, temp_v0)); } temp_v0 = sp28(3, 0); if (temp_v0 != NULL) { - func_80012094(&D_86A061C0, func_80018B70(sp2C, temp_v0)); + func_80012094(&D_86A061C0, process_geo_layout(sp2C, temp_v0)); } D_86A025C8 = sp28(2, 0); @@ -1448,7 +1448,7 @@ void func_86A00DAC(s32 arg0) { func_8001103C(NULL, &D_86A061C0); func_86A0003C(0xFF, 0xFF, 0xFF); sp2C = func_80002D10(main_pool_get_available(), 0); - D_86A061E4 = func_80018B70(sp2C, &D_86A025D0); + D_86A061E4 = process_geo_layout(sp2C, &D_86A025D0); func_80002D60(sp2C); func_8001BB20(); func_86A00D00(); diff --git a/src/fragments/3/fragment3.h b/src/fragments/3/fragment3.h index 3e37f701..429808cb 100644 --- a/src/fragments/3/fragment3.h +++ b/src/fragments/3/fragment3.h @@ -114,7 +114,7 @@ typedef struct unk_func_8790002C { // Possibly unk_D_86002F34_alt7, unk_D_86002F34_alt8, // unk_D_86002F34_alt9 or unk_D_86002F34_alt2 typedef struct arg1_func_87902F80 { - /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x00 */ struct GraphNode unk_00; /* 0x18 */ Gfx* unk_18; } arg1_func_87902F80; // size >= 0x1C diff --git a/src/fragments/6/fragment6.c b/src/fragments/6/fragment6.c index dc81e718..2aeaa30c 100644 --- a/src/fragments/6/fragment6.c +++ b/src/fragments/6/fragment6.c @@ -8,7 +8,7 @@ #include "src/fragments/2/fragment2.h" #include "src/fragments/4/fragment4.h" #include "src/fragments/6/fragment6.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/32D10.h" @@ -1125,7 +1125,7 @@ void func_86002440(void) { MemoryBlock* temp_v0; temp_v0 = (MemoryBlock*)func_80002D10(main_pool_get_available(), 0); - D_86002F34 = (unk_D_86002F34*)func_80018B70(temp_v0, D_86002B18); + D_86002F34 = (unk_D_86002F34*)process_geo_layout(temp_v0, D_86002B18); func_80002D60(temp_v0); func_8001BB20(); func_8001987C(); diff --git a/src/fragments/7/fragment7.c b/src/fragments/7/fragment7.c index 008d3790..75523a72 100644 --- a/src/fragments/7/fragment7.c +++ b/src/fragments/7/fragment7.c @@ -2,7 +2,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -1741,7 +1741,7 @@ void func_86103E9C(void) { D_861054B8 = 2; } - D_86105484 = (unk_D_86002F34*)func_80018B70(temp_v0, D_86104AA4); + D_86105484 = (unk_D_86002F34*)process_geo_layout(temp_v0, D_86104AA4); func_80002D60(temp_v0); func_8001BB20(); func_8001987C(); diff --git a/src/fragments/8/fragment8.c b/src/fragments/8/fragment8.c index bf8570ac..83f2002f 100644 --- a/src/fragments/8/fragment8.c +++ b/src/fragments/8/fragment8.c @@ -2,7 +2,7 @@ #include "src/12D80.h" #include "src/17300.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -1284,7 +1284,7 @@ void func_862030D0(void) { MemoryBlock* temp_v0 = func_80002D10(main_pool_get_available(), 0); unk_D_86002F58_004_000* temp_s0; - D_86203E38 = func_80018B70(temp_v0, &D_86203D0C); + D_86203E38 = process_geo_layout(temp_v0, &D_86203D0C); func_80002D60(temp_v0); func_8001BB20(); func_8001987C(); diff --git a/src/fragments/9/fragment9.c b/src/fragments/9/fragment9.c index 9ae7efa1..f03e647a 100644 --- a/src/fragments/9/fragment9.c +++ b/src/fragments/9/fragment9.c @@ -2,7 +2,7 @@ #include "include/libc/math.h" #include "src/12D80.h" #include "src/18140.h" -#include "src/18480.h" +#include "src/geo_layout.h" #include "src/19840.h" #include "src/1C720.h" #include "src/1CF30.h" @@ -524,7 +524,7 @@ void func_86301234(void) { s32 i; MemoryBlock* temp_v0 = func_80002D10(main_pool_get_available(), 0); - D_86301714 = func_80018B70(temp_v0, &D_86301650); + D_86301714 = process_geo_layout(temp_v0, &D_86301650); func_80002D60(temp_v0); func_8001BB20(); func_8001987C(); diff --git a/src/geo_layout.c b/src/geo_layout.c new file mode 100644 index 00000000..c3343878 --- /dev/null +++ b/src/geo_layout.c @@ -0,0 +1,426 @@ +#include "geo_layout.h" +#include "src/11BA0.h" +#include "src/F420.h" +#include "src/util.h" + +extern GeoLayoutCommandProc GeoLayoutJumpTable[]; + +extern MemoryBlock* gGraphNodePool; +extern unk_D_86002F34* gCurRootGraphNode; +extern u32 gGeoLayoutStack[]; +extern struct GraphNode *gCurGraphNodeList[32]; +extern s16 gCurGraphNodeIndex; +extern s16 gGeoLayoutStackIndex; +extern s16 gGeoLayoutReturnIndex; +extern u8* gGeoLayoutCommand; + +/* + 0x00: Branch and store return address + cmd+0x04: void *branchTarget +*/ +void geo_layout_cmd_branch_and_link(void) { + u8* cmd = (void*)gGeoLayoutCommand; + + cmd += 0; + + gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(cmd + CMD_PROCESS_OFFSET(8)); + gGeoLayoutStack[gGeoLayoutStackIndex++] = (gCurGraphNodeIndex << 16) + gGeoLayoutReturnIndex; + gGeoLayoutReturnIndex = gGeoLayoutStackIndex; + gGeoLayoutCommand = Util_ConvertAddrToVirtAddr(cur_geo_cmd_ptr(0x04)); +} + +// 0x01: Terminate geo layout +void geo_layout_cmd_end(void) { + gGeoLayoutStackIndex = gGeoLayoutReturnIndex; + gGeoLayoutReturnIndex = gGeoLayoutStack[--gGeoLayoutStackIndex] & 0xFFFF; + gCurGraphNodeIndex = gGeoLayoutStack[gGeoLayoutStackIndex] >> 16; + gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex]; +} + +/* + 0x02: Jump to address + cmd+0x04: void *jumpTarget +*/ +void geo_layout_cmd_jump(void) { + u8* cmd = (void*)gGeoLayoutCommand; + + cmd += 0; + + gGeoLayoutCommand = Util_ConvertAddrToVirtAddr(cur_geo_cmd_ptr(0x04)); +} + +/* + 0x03: Branch + cmd+0x04: void *branchTarget +*/ +void geo_layout_cmd_branch(void) { + u8* cmd = (void*)gGeoLayoutCommand; + + cmd += 0; + + // unlike in sm64, this argument doesnt seem to be optional. + gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(cmd + CMD_PROCESS_OFFSET(8)); + gGeoLayoutCommand = Util_ConvertAddrToVirtAddr(cur_geo_cmd_ptr(0x04)); +} + +// 0x04: Return from branch +void geo_layout_cmd_return(void) { + gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex]; +} + +// 0x05: Open node +void geo_layout_cmd_open_node(void) { + gCurGraphNodeList[gCurGraphNodeIndex + 1] = gCurGraphNodeList[gCurGraphNodeIndex]; + gCurGraphNodeIndex++; + gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT; +} + +// 0x06: Close node +void geo_layout_cmd_close_node(void) { + gCurGraphNodeIndex--; + gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT; +} + +void func_80017AC4(struct GraphNode *arg0) { + if (arg0 != NULL) { + gCurGraphNodeList[gCurGraphNodeIndex] = arg0; + if (gCurGraphNodeIndex == 0) { + if (gCurRootGraphNode == NULL) { + gCurRootGraphNode = arg0; + } + } else { + func_80012094(gCurGraphNodeList[gCurGraphNodeIndex - 1], arg0); + } + } +} + +void func_80017B28(void) { + unk_D_800ABE00_cmd7* cmd = (unk_D_800ABE00_cmd7*)gGeoLayoutCommand; + + func_80017AC4(&cmd->unk_04->unk_00); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd7); +} + +void func_80017B60(void) { + unk_D_800ABE00_cmd8* cmd = (unk_D_800ABE00_cmd8*)gGeoLayoutCommand; + + if (gCurGraphNodeList[gCurGraphNodeIndex] != NULL) { + func_80010FDC(gCurGraphNodeList[gCurGraphNodeIndex], cmd->unk_04, cmd->unk_08); + } + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd8); +} + +void func_80017BBC(void) { + func_80017AC4(func_8001103C(gGraphNodePool, NULL)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd9); +} + +void func_80017BFC(void) { + unk_D_800ABE00_cmdA* cmd = (unk_D_800ABE00_cmdA*)gGeoLayoutCommand; + + func_80017AC4(func_80011088(gGraphNodePool, NULL, cmd->unk_04)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmdA); +} + +void func_80017C48(void) { + unk_D_800ABE00_cmdB* cmd = (unk_D_800ABE00_cmdB*)gGeoLayoutCommand; + unk_D_86002F34_00C* temp_v0 = func_800110E0(gGraphNodePool, NULL, cmd->unk_04, cmd->unk_06, cmd->unk_08, cmd->unk_0A); + + if (temp_v0 != NULL) { + temp_v0->unk_24.fovy = cmd->unk_02; + func_8000E990(&temp_v0->unk_60.at, &cmd->unk_0C); + func_80010354(&temp_v0->unk_60.at, &temp_v0->unk_60.eye, cmd->unk_16, (cmd->unk_12 << 0xF) / 180, + (cmd->unk_14 << 0xF) / 180); + } + + func_80017AC4(&temp_v0->unk_00); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmdB); +} + +void func_80017D94(void) { + unk_D_800ABE00_cmdC* cmd = (unk_D_800ABE00_cmdC*)gGeoLayoutCommand; + + func_80017AC4(func_800111A4(gGraphNodePool, NULL, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmdC); +} + +void func_80017DE0(void) { + unk_D_800ABE00_cmdD* cmd = (unk_D_800ABE00_cmdD*)gGeoLayoutCommand; + + func_80017AC4(func_800111FC(gGraphNodePool, NULL, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmdD); +} + +void func_80017E2C(void) { + unk_D_800ABE00_cmdE* cmd = (unk_D_800ABE00_cmdE*)gGeoLayoutCommand; + + func_80017AC4(func_80011258(gGraphNodePool, NULL, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmdE); +} + +void func_80017E78(void) { + unk_D_800ABE00_cmdF* cmd = (unk_D_800ABE00_cmdF*)gGeoLayoutCommand; + + func_80017AC4(func_800112BC(gGraphNodePool, NULL, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmdF); +} + +void func_80017EC4(void) { + unk_D_800ABE00_cmd10* cmd = (unk_D_800ABE00_cmd10*)gGeoLayoutCommand; + + func_80017AC4(func_80011320(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_02, cmd->unk_03)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd10); +} + +void func_80017F1C(void) { + func_80017AC4(func_800113AC(gGraphNodePool, NULL)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd11); +} + +void func_80017F5C(void) { +} + +void func_80017F64(void) { + unk_D_800ABE00_cmd13* cmd = (unk_D_800ABE00_cmd13*)gGeoLayoutCommand; + + func_80017AC4(func_800113F8(gGraphNodePool, NULL, cmd->unk_04, cmd->unk_06, cmd->r, cmd->g, cmd->b, 0xFF)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd13); +} + +void func_80017FD4(void) { + unk_D_800ABE00_cmd14* cmd = (unk_D_800ABE00_cmd14*)gGeoLayoutCommand; + + func_80017AC4(func_80011484(gGraphNodePool, NULL, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, cmd->r, + cmd->g, cmd->b, cmd->a)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd14); +} + +void func_800180BC(void) { + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd15); +} + +void func_800180D4(void) { + unk_D_800ABE00_cmd16* cmd = (unk_D_800ABE00_cmd16*)gGeoLayoutCommand; + + func_80017AC4(func_80011504(gGraphNodePool, NULL, cmd->r, cmd->g, cmd->b)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd16); +} + +void func_8001812C(void) { + unk_D_800ABE00_cmd17* cmd = (unk_D_800ABE00_cmd17*)gGeoLayoutCommand; + + func_80017AC4( + func_8001156C(gGraphNodePool, NULL, cmd->unk_02, cmd->unk_08, cmd->unk_04, cmd->unk_0C, cmd->unk_06, cmd->unk_10)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd17); +} + +void func_8001819C(void) { + unk_D_800ABE00_cmd18* cmd = (unk_D_800ABE00_cmd18*)gGeoLayoutCommand; + + func_80017AC4(func_800115F0(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_04, cmd->unk_06, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd18); +} + +void func_800181FC(void) { + unk_D_800ABE00_cmd19* cmd = (unk_D_800ABE00_cmd19*)gGeoLayoutCommand; + + func_80017AC4(func_80011660(gGraphNodePool, NULL, cmd->unk_04, cmd->unk_06)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd19); +} + +void func_8001824C(void) { + unk_D_800ABE00_cmd1A* cmd = (unk_D_800ABE00_cmd1A*)gGeoLayoutCommand; + + func_80017AC4(func_800116C0(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1A); +} + +void func_8001829C(void) { + Vec3s sp30; + Vec3f sp24; + UNUSED s32 pad; + unk_D_800ABE00_cmd1B* cmd = (unk_D_800ABE00_cmd1B*)gGeoLayoutCommand; + + func_8000E990(&sp24, &cmd->unk_0A); + func_8000EB70(&sp30, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, (cmd->unk_08 << 0xF) / 180); + func_80017AC4(func_80011720(gGraphNodePool, NULL, &sp24, &sp30)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1B); +} + +void func_800183C4(void) { + Vec3f sp24; + unk_D_800ABE00_cmd1C* cmd = (unk_D_800ABE00_cmd1C*)gGeoLayoutCommand; + + sp24.x = cmd->unk_04 / 65536.0f; + sp24.y = cmd->unk_08 / 65536.0f; + sp24.z = cmd->unk_0C / 65536.0f; + func_80017AC4(func_800117A8(gGraphNodePool, NULL, &sp24)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1C); +} + +void func_80018490(void) { + Vec3f sp3C; + s16 var_a3 = 1; + unk_D_800ABE00_cmd1D* cmd = (unk_D_800ABE00_cmd1D*)gGeoLayoutCommand; + + sp3C.x = cmd->unk_10 / 65536.0f; + sp3C.y = cmd->unk_14 / 65536.0f; + sp3C.z = cmd->unk_18 / 65536.0f; + + if (cmd->unk_02 & 1) { + var_a3 = 0; + } + + if (cmd->unk_02 & 2) { + var_a3 |= 2; + } + + func_80017AC4(func_80011814(gGraphNodePool, NULL, cmd->unk_01, var_a3, cmd->unk_03, &cmd->unk_04, &cmd->unk_0A, &sp3C)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1D); +} + +void func_800185A8(void) { + unk_D_800ABE00_cmd1E* cmd = (unk_D_800ABE00_cmd1E*)gGeoLayoutCommand; + + func_80017AC4(func_800118D0(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_04, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1E); +} + +void func_80018600(void) { + Vec3s sp40; + Vec3f sp34; + Vec3f sp28; + unk_D_86002F58_004_000* tmp; + unk_D_800ABE00_cmd1F* cmd = (unk_D_800ABE00_cmd1F*)gGeoLayoutCommand; + + func_8000E990(&sp34, &cmd->unk_0A); + + sp28.x = cmd->unk_10 / 100.0f; + sp28.y = cmd->unk_12 / 100.0f; + sp28.z = cmd->unk_14 / 100.0f; + + func_8000EB70(&sp40, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, (cmd->unk_08 << 0xF) / 180); + tmp = func_80011938(gGraphNodePool, NULL, cmd->unk_02, &sp34, &sp40, &sp28); + func_80017AC4(tmp); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1F); +} + +void func_8001878C(void) { + Vec3f sp34; + Vec3s sp2C; + unk_D_86002F34_alt8* tmp; + unk_D_800ABE00_cmd20* cmd = (unk_D_800ABE00_cmd20*)gGeoLayoutCommand; + + func_8000E990(&sp34, &cmd->unk_0A); + func_8000EB70(&sp2C, (cmd->unk_04 << 0xF) / 180, (cmd->unk_06 << 0xF) / 180, (cmd->unk_08 << 0xF) / 180); + tmp = func_80011ABC(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_10, &sp34, &sp2C); + func_80017AC4(tmp); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd20); +} + +void func_800188C8(void) { + Vec3f sp2C; + unk_D_86002F34_alt9* tmp; + unk_D_800ABE00_cmd21* cmd = (unk_D_800ABE00_cmd21*)gGeoLayoutCommand; + + func_8000E990(&sp2C, &cmd->unk_02); + tmp = func_80011B10(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_0C, &sp2C, cmd->unk_08 / 65536.0f); + func_80017AC4(tmp); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd21); +} + +void func_80018968(void) { + unk_D_800ABE00_cmd22* cmd = (unk_D_800ABE00_cmd22*)gGeoLayoutCommand; + + func_80017AC4(func_80011B94(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_04)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd22); +} + +void func_800189B8(void) { + unk_D_800ABE00_cmd23* cmd = (unk_D_800ABE00_cmd23*)gGeoLayoutCommand; + + func_80017AC4(func_80011BF4(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_02, cmd->unk_04, cmd->unk_08, cmd->unk_0A, + cmd->r, cmd->g, cmd->b, cmd->a)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd23); +} + +void func_80018A40(void) { + unk_D_800ABE00_cmd24* cmd = (unk_D_800ABE00_cmd24*)gGeoLayoutCommand; + + func_80017AC4(func_80011C98(gGraphNodePool, NULL, cmd->unk_02)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd24); +} + +void func_80018A8C(void) { + unk_D_800ABE00_cmd25* cmd = (unk_D_800ABE00_cmd25*)gGeoLayoutCommand; + + if (gCurGraphNodeList[gCurGraphNodeIndex] != NULL) { + gCurGraphNodeList[gCurGraphNodeIndex]->unk_02 |= 4; + } + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd25); +} + +void func_80018AD0(void) { + unk_D_800ABE00_cmd26* cmd = (unk_D_800ABE00_cmd26*)gGeoLayoutCommand; + + func_80017AC4(func_80011CF0(gGraphNodePool, NULL, cmd->unk_01, cmd->unk_04, cmd->unk_06, cmd->unk_08, cmd->unk_0A, + cmd->unk_02, cmd->unk_03, cmd->unk_0C, cmd->r, cmd->g, cmd->b, cmd->a)); + + gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd26); +} + +struct GraphNode *process_geo_layout(MemoryBlock* pool, void *segptr) { + // set by register_scene_graph_node when gCurGraphNodeIndex is 0 + // and gCurRootGraphNode is NULL + gCurRootGraphNode = NULL; + + // gGeoNumViews seems to have been removed in this version of geo_script.c + gCurGraphNodeIndex = 0; + + gGeoLayoutStackIndex = 2; + gGeoLayoutReturnIndex = 2; // stack index is often copied here? + + gGeoLayoutCommand = Util_ConvertAddrToVirtAddr(segptr); + + gGraphNodePool = pool; + + gCurGraphNodeList[0] = 0; + + gGeoLayoutStack[0] = 0; + gGeoLayoutStack[1] = 0; + + while (gGeoLayoutCommand != NULL) { + GeoLayoutJumpTable[gGeoLayoutCommand[0x00]](); + } + + return gCurRootGraphNode; +} diff --git a/src/18480.h b/src/geo_layout.h similarity index 87% rename from src/18480.h rename to src/geo_layout.h index 2164697a..e0aec3e1 100644 --- a/src/18480.h +++ b/src/geo_layout.h @@ -5,7 +5,30 @@ #include "src/memory.h" #include "src/11BA0.h" -typedef void (*func_D_8006F2B0)(void); +#define GEO_CMD_FLAGS_RESET 0 +#define GEO_CMD_FLAGS_SET 1 +#define GEO_CMD_FLAGS_CLEAR 2 + +#define CMD_SIZE_SHIFT (sizeof(void *) >> 3) +#define CMD_PROCESS_OFFSET(offset) (((offset) & 3) | (((offset) & ~3) << CMD_SIZE_SHIFT)) + +#define cur_geo_cmd_u8(offset) \ + (gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)]) + +#define cur_geo_cmd_s16(offset) \ + (*(s16 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)]) + +#define cur_geo_cmd_s32(offset) \ + (*(s32 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)]) + +#define cur_geo_cmd_u32(offset) \ + (*(u32 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)]) + +#define cur_geo_cmd_ptr(offset) \ + (*(void **) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)]) + + +typedef void (*GeoLayoutCommandProc)(void); typedef struct unk_D_800ABE00_cmd0 { /* 0x00 */ u8 cmd; @@ -59,7 +82,7 @@ typedef struct unk_D_800ABE00_cmd9 { typedef struct unk_D_800ABE00_cmdA { /* 0x00 */ u8 cmd; - /* 0x04 */ unk_D_86002F34_000* unk_04; + /* 0x04 */ struct GraphNode* unk_04; } unk_D_800ABE00_cmdA; // size = 0x8 typedef struct unk_D_800ABE00_cmdB { @@ -283,13 +306,13 @@ typedef struct unk_D_800ABE00_cmd26 { /* 0x13 */ u8 a; } unk_D_800ABE00_cmd26; // size = 0x14 -void func_80017880(void); // cmd 0 -void func_80017914(void); // cmd 1 -void func_8001799C(void); // cmd 2 -void func_800179C8(void); // cmd 3 -void func_80017A1C(void); // cmd 4 -void func_80017A54(void); // cmd 5 -void func_80017A98(void); // cmd 6 +void geo_layout_cmd_branch_and_link(void); // cmd 0 +void geo_layout_cmd_end(void); // cmd 1 +void geo_layout_cmd_jump(void); // cmd 2 +void geo_layout_cmd_branch(void); // cmd 3 +void geo_layout_cmd_return(void); // cmd 4 +void geo_layout_cmd_open_node(void); // cmd 5 +void geo_layout_cmd_close_node(void); // cmd 6 void func_80017B28(void); // cmd 7 void func_80017B60(void); // cmd 8 void func_80017BBC(void); // cmd 9 @@ -322,6 +345,6 @@ void func_800189B8(void); // cmd 35 void func_80018A40(void); // cmd 36 void func_80018A8C(void); // cmd 37 void func_80018AD0(void); // cmd 38 -unk_D_86002F34_000* func_80018B70(MemoryBlock*, void*); +struct GraphNode* process_geo_layout(MemoryBlock*, void*); #endif // _18480_H_ diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index 8eed6da3..f8071021 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -59,7 +59,7 @@ - [0x12D80, c] # - [0x17300, c] # - [0x18140, c] # dp model animations - - [0x18480, c] # dp model animations + - [0x18480, c, geo_layout] # dp model animations - [0x19840, c] # alternative pkm textures - [0x1AB70, c] # vs screen code - [0x1C720, c] #