summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2023-04-07 22:13:28 -0600
committerGitHub <noreply@github.com>2023-04-07 22:13:28 -0600
commitafb29a5a65410e43c168a5d309bd7e94ea9ab7ff (patch)
tree603f424d990aa06a746fadae75617a1b15ab5f81 /src
parent772091700c4dc10141b56588d2ea81930fd8dfbb (diff)
Match memory.c, remove warnings, fix fake matches (#301)
* Match memory, remove warnings, fix fake matches * label switch
Diffstat (limited to 'src')
-rw-r--r--src/actors.c296
-rw-r--r--src/actors.h123
-rw-r--r--src/audio/external.h1
-rw-r--r--src/camera.h2
-rw-r--r--src/camera_junk.c1
-rw-r--r--src/ceremony_and_credits.h2
-rw-r--r--src/code_800029B0.c74
-rw-r--r--src/code_80004740.c2
-rw-r--r--src/code_80005FD0.c14
-rw-r--r--src/code_80005FD0.h5
-rw-r--r--src/code_800431B0.c2
-rw-r--r--src/code_800431B0.h2
-rw-r--r--src/code_80057C60.c78
-rw-r--r--src/code_80057C60.h3
-rw-r--r--src/code_8006E9C0.c20
-rw-r--r--src/code_80091750.c36
-rw-r--r--src/code_80091750.h4
-rw-r--r--src/code_800AF9B0.c4
-rw-r--r--src/code_80280000.c31
-rw-r--r--src/code_80280000.h2
-rw-r--r--src/code_80280650.c4
-rw-r--r--src/code_80280650.h3
-rw-r--r--src/code_80281780.c14
-rw-r--r--src/code_80281780.h5
-rw-r--r--src/code_80281C40.c18
-rw-r--r--src/code_802AAA70.c4
-rw-r--r--src/code_802AAA70.h2
-rw-r--r--src/crash_screen.c6
-rw-r--r--src/kart_dma.c26
-rw-r--r--src/main.c97
-rw-r--r--src/main.h11
-rw-r--r--src/math_util.c4
-rw-r--r--src/math_util.h2
-rw-r--r--src/math_util_2.c15
-rw-r--r--src/math_util_2.h4
-rw-r--r--src/memory.c1906
-rw-r--r--src/memory.h62
-rw-r--r--src/profiler.c8
-rw-r--r--src/profiler.h1
-rw-r--r--src/race_logic.c3
-rw-r--r--src/race_logic.h1
-rw-r--r--src/render_courses.c150
-rw-r--r--src/render_courses.h6
-rw-r--r--src/skybox_and_splitscreen.c305
-rw-r--r--src/skybox_and_splitscreen.h5
-rw-r--r--src/spawn_players.c13
-rw-r--r--src/staff_ghosts.c38
-rw-r--r--src/staff_ghosts.h1
48 files changed, 1729 insertions, 1687 deletions
diff --git a/src/actors.c b/src/actors.c
index 3602a6dab..939dedfca 100644
--- a/src/actors.c
+++ b/src/actors.c
@@ -2362,98 +2362,98 @@ void place_course_actors(void) {
}
void func_8029E158(void) {
- set_segment_base_addr(3, gPrevLoadedAddress);
- D_802BA050 = func_802A84F4(D_0F04CBE0, 0x00000257U, 0x00000400U);
- func_802A84F4(D_0F04CE30, 0x00000242U, 0x00000400U);
- func_802A84F4(D_0F04D080, 0x00000259U, 0x00000400U);
- func_802A84F4(D_0F04D2D8, 0x00000256U, 0x00000400U);
- func_802A84F4(D_0F04D538, 0x00000246U, 0x00000400U);
- func_802A84F4(D_0F04D790, 0x0000025EU, 0x00000400U);
- func_802A84F4(D_0F04D9FC, 0x0000025CU, 0x00000400U);
- func_802A84F4(D_0F04DC5C, 0x00000254U, 0x00000400U);
- D_802BA054 = func_802A84F4(D_0F04DEB0, 0x0000022AU, 0x00000400U);
- func_802A84F4(D_0F04E0DC, 0x00000237U, 0x00000400U);
- func_802A84F4(D_0F04E314, 0x0000023EU, 0x00000400U);
- func_802A84F4(D_0F04E554, 0x00000243U, 0x00000400U);
- func_802A84F4(D_0F04E798, 0x00000255U, 0x00000400U);
- func_802A84F4(D_0F04E9F0, 0x00000259U, 0x00000400U);
- func_802A84F4(D_0F04EC4C, 0x00000239U, 0x00000400U);
- func_802A84F4(D_0F04EE88, 0x00000236U, 0x00000400U);
- func_802A84F4(D_0F054C3C, 0x0000028EU, 0x00000800U);
- func_802A84F4(D_0F054ECC, 0x000002FBU, 0x00000800U);
- func_802A84F4(D_0F0551C8, 0x00000302U, 0x00000800U);
- func_802A84F4(D_0F0554CC, 0x000003B4U, 0x00000800U);
- func_802A84F4(D_0F055880, 0x0000031EU, 0x00000800U);
- func_802A84F4(D_0F055BA0, 0x0000036EU, 0x00000800U);
- func_802A84F4(D_0F055F10, 0x0000029CU, 0x00000800U);
- func_802A84F4(D_0F0561AC, 0x0000025BU, 0x00000800U);
- func_802A84F4(gTexture671A88, 0x00000400U, 0x00000800U);
- func_802A84F4(gTexture6774D8, 0x00000400U, 0x00000800U);
+ set_segment_base_addr(3, (void *) gNextFreeMemoryAddress);
+ D_802BA050 = dma_textures(D_0F04CBE0, 0x00000257U, 0x00000400U);
+ dma_textures(D_0F04CE30, 0x00000242U, 0x00000400U);
+ dma_textures(D_0F04D080, 0x00000259U, 0x00000400U);
+ dma_textures(D_0F04D2D8, 0x00000256U, 0x00000400U);
+ dma_textures(D_0F04D538, 0x00000246U, 0x00000400U);
+ dma_textures(D_0F04D790, 0x0000025EU, 0x00000400U);
+ dma_textures(D_0F04D9FC, 0x0000025CU, 0x00000400U);
+ dma_textures(D_0F04DC5C, 0x00000254U, 0x00000400U);
+ D_802BA054 = dma_textures(D_0F04DEB0, 0x0000022AU, 0x00000400U);
+ dma_textures(D_0F04E0DC, 0x00000237U, 0x00000400U);
+ dma_textures(D_0F04E314, 0x0000023EU, 0x00000400U);
+ dma_textures(D_0F04E554, 0x00000243U, 0x00000400U);
+ dma_textures(D_0F04E798, 0x00000255U, 0x00000400U);
+ dma_textures(D_0F04E9F0, 0x00000259U, 0x00000400U);
+ dma_textures(D_0F04EC4C, 0x00000239U, 0x00000400U);
+ dma_textures(D_0F04EE88, 0x00000236U, 0x00000400U);
+ dma_textures(D_0F054C3C, 0x0000028EU, 0x00000800U);
+ dma_textures(D_0F054ECC, 0x000002FBU, 0x00000800U);
+ dma_textures(D_0F0551C8, 0x00000302U, 0x00000800U);
+ dma_textures(D_0F0554CC, 0x000003B4U, 0x00000800U);
+ dma_textures(D_0F055880, 0x0000031EU, 0x00000800U);
+ dma_textures(D_0F055BA0, 0x0000036EU, 0x00000800U);
+ dma_textures(D_0F055F10, 0x0000029CU, 0x00000800U);
+ dma_textures(D_0F0561AC, 0x0000025BU, 0x00000800U);
+ dma_textures(gTexture671A88, 0x00000400U, 0x00000800U);
+ dma_textures(gTexture6774D8, 0x00000400U, 0x00000800U);
switch (gCurrentCourseId) {
- case 0:
- func_802A84F4(D_0F04F45C, 0x0000035BU, 0x00000800U);
- D_802BA058 = func_802A84F4(D_0F056408, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F05662C, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F05688C, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F056AD0, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F056CF0, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F056EC8, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F057084, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F057288, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F057590, 0x000003E8U, 0x00000800U);
+ case COURSE_MARIO_RACEWAY:
+ dma_textures(D_0F04F45C, 0x0000035BU, 0x00000800U);
+ D_802BA058 = dma_textures(D_0F056408, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F05662C, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F05688C, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F056AD0, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F056CF0, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F056EC8, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F057084, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F057288, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F057590, 0x000003E8U, 0x00000800U);
break;
- case 2:
- func_802A84F4(gTextureShrub, 0x000003FFU, 0x00000800U);
+ case COURSE_BOWSER_CASTLE:
+ dma_textures(gTextureShrub, 0x000003FFU, 0x00000800U);
break;
- case 4:
- func_802A84F4(D_0F04F7A4, 0x000003E8U, 0x00000800U);
+ case COURSE_YOSHI_VALLEY:
+ dma_textures(D_0F04F7A4, 0x000003E8U, 0x00000800U);
break;
- case 5:
- func_802A84F4(D_0F0513CC, 0x00000454U, 0x00000800U);
- func_802A84F4(D_0F051820, 0x00000432U, 0x00000800U);
+ case COURSE_FRAPPE_SNOWLAND:
+ dma_textures(D_0F0513CC, 0x00000454U, 0x00000800U);
+ dma_textures(D_0F051820, 0x00000432U, 0x00000800U);
break;
- case 7:
- func_802A84F4(D_0F04FB3C, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F050D50, 0x000003E8U, 0x00000800U);
- D_802BA058 = func_802A84F4(D_0F056408, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F05662C, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F05688C, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F056AD0, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F056CF0, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F056EC8, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F057084, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F057288, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F057590, 0x000003E8U, 0x00000800U);
+ case COURSE_ROYAL_RACEWAY:
+ dma_textures(D_0F04FB3C, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F050D50, 0x000003E8U, 0x00000800U);
+ D_802BA058 = dma_textures(D_0F056408, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F05662C, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F05688C, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F056AD0, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F056CF0, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F056EC8, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F057084, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F057288, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F057590, 0x000003E8U, 0x00000800U);
break;
- case 8:
- func_802A84F4(D_0F050468, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F050678, 0x000003E8U, 0x00000800U);
+ case COURSE_LUIGI_RACEWAY:
+ dma_textures(D_0F050468, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F050678, 0x000003E8U, 0x00000800U);
break;
- case 9:
- func_802A84F4(D_0F04FE28, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F050118, 0x000003E8U, 0x00000800U);
- func_802A84F4(D_0F051C54, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F051FD8, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F05232C, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F0526B8, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F052A20, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F052D3C, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F05300C, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F0532F8, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F05363C, 0x00000400U, 0x00000800U);
- func_802A84F4(D_0F053950, 0x00000400U, 0x00000800U);
+ case COURSE_MOO_MOO_FARM:
+ dma_textures(D_0F04FE28, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F050118, 0x000003E8U, 0x00000800U);
+ dma_textures(D_0F051C54, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F051FD8, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F05232C, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F0526B8, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F052A20, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F052D3C, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F05300C, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F0532F8, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F05363C, 0x00000400U, 0x00000800U);
+ dma_textures(D_0F053950, 0x00000400U, 0x00000800U);
break;
- case 11:
- func_802A84F4(D_0F053C34, 0x0000033EU, 0x00000800U);
- func_802A84F4(D_0F053F74, 0x000002FBU, 0x00000800U);
- func_802A84F4(D_0F054270, 0x000002A8U, 0x00000800U);
- func_802A84F4(D_0F054518, 0x00000374U, 0x00000800U);
- func_802A84F4(D_0F05488C, 0x000003AFU, 0x00000800U);
+ case COURSE_KALAMARI_DESERT:
+ dma_textures(D_0F053C34, 0x0000033EU, 0x00000800U);
+ dma_textures(D_0F053F74, 0x000002FBU, 0x00000800U);
+ dma_textures(D_0F054270, 0x000002A8U, 0x00000800U);
+ dma_textures(D_0F054518, 0x00000374U, 0x00000800U);
+ dma_textures(D_0F05488C, 0x000003AFU, 0x00000800U);
break;
- case 18:
- func_802A84F4(D_0F057EB4, 0x0000032FU, 0x00000400U);
- func_802A84F4(D_0F0581E4, 0x00000369U, 0x00000400U);
- func_802A84F4(D_0F058550, 0x00000364U, 0x00000400U);
+ case COURSE_DK_JUNGLE:
+ dma_textures(D_0F057EB4, 0x0000032FU, 0x00000400U);
+ dma_textures(D_0F0581E4, 0x00000369U, 0x00000400U);
+ dma_textures(D_0F058550, 0x00000364U, 0x00000400U);
break;
}
func_80297818();
@@ -4135,15 +4135,15 @@ void func_802A2F34(struct UnkStruct_800DC5EC *arg0) {
}
void func_802A3008(struct UnkStruct_800DC5EC *arg0) {
- Camera *temp_s1 = arg0->camera;
+ Camera *camera = arg0->camera;
u16 sp92 = arg0->pathCounter;
s32 pad[12];
s32 i;
struct Actor *actor;
Vec3f sp4C = {0.0f, 5.0f, 10.0f};
- f32 sp48 = sins(temp_s1->rot[1] - 0x8000); // unk26;
- f32 temp_f0 = coss(temp_s1->rot[1] - 0x8000);
+ f32 sp48 = sins(camera->rot[1] - 0x8000); // unk26;
+ f32 temp_f0 = coss(camera->rot[1] - 0x8000);
D_801502C0[0][0] = temp_f0;
@@ -4166,7 +4166,7 @@ void func_802A3008(struct UnkStruct_800DC5EC *arg0) {
if (gModeSelection != BATTLE) {
- func_80297340(temp_s1);
+ func_80297340(camera);
}
D_8015F8E0 = 0;
@@ -4178,186 +4178,186 @@ void func_802A3008(struct UnkStruct_800DC5EC *arg0) {
}
switch (actor->type) {
case 2:
- func_80299144(temp_s1, D_801502C0, actor);
+ func_80299144(camera, D_801502C0, actor);
break;
case 3:
- func_8029930C(temp_s1, D_801502C0, actor);
+ func_8029930C(camera, D_801502C0, actor);
break;
case 4:
- func_802994D4(temp_s1, D_801502C0, actor);
+ func_802994D4(camera, D_801502C0, actor);
break;
case 19:
- func_8029969C(temp_s1, D_801502C0, actor);
+ func_8029969C(camera, D_801502C0, actor);
break;
case 26:
- func_80299864(temp_s1, D_801502C0, actor);
+ func_80299864(camera, D_801502C0, actor);
break;
case 28:
- func_80299A2C(temp_s1, D_801502C0, actor);
+ func_80299A2C(camera, D_801502C0, actor);
break;
case 33:
- func_80299BF4(temp_s1, D_801502C0, actor);
+ func_80299BF4(camera, D_801502C0, actor);
break;
case 29:
- func_80299DBC(temp_s1, D_801502C0, actor);
+ func_80299DBC(camera, D_801502C0, actor);
break;
case 30:
- func_80299EDC(temp_s1, D_801502C0, actor);
+ func_80299EDC(camera, D_801502C0, actor);
break;
case 31:
- func_80299FFC(temp_s1, D_801502C0, actor);
+ func_80299FFC(camera, D_801502C0, actor);
break;
case 32:
- func_8029A11C(temp_s1, D_801502C0, actor);
+ func_8029A11C(camera, D_801502C0, actor);
break;
case ACTOR_FALLING_ROCK:
- func_8029CA90(temp_s1, (struct FallingRock *) actor);
+ func_8029CA90(camera, (struct FallingRock *) actor);
break;
case ACTOR_KIWANO_FRUIT:
- func_8029A23C(temp_s1, D_801502C0, actor);
+ func_8029A23C(camera, D_801502C0, actor);
break;
case ACTOR_BANANA:
- func_8029A8F4(temp_s1, D_801502C0, actor);
+ func_8029A8F4(camera, D_801502C0, actor);
break;
case ACTOR_GREEN_SHELL:
- func_8029A690(temp_s1, D_801502C0, (struct ShellActor *) actor);
+ func_8029A690(camera, D_801502C0, (struct ShellActor *) actor);
break;
case ACTOR_RED_SHELL:
- func_8029A75C(temp_s1, D_801502C0, (struct ShellActor *) actor);
+ func_8029A75C(camera, D_801502C0, (struct ShellActor *) actor);
break;
case ACTOR_BLUE_SPINY_SHELL:
- func_8029A828(temp_s1, D_801502C0, (struct ShellActor *) actor);
+ func_8029A828(camera, D_801502C0, (struct ShellActor *) actor);
break;
case ACTOR_PIRANHA_PLANT:
- func_80298328(temp_s1, D_801502C0, actor);
+ func_80298328(camera, D_801502C0, actor);
break;
case ACTOR_TRAIN_ENGINE:
- func_8029B8E8(temp_s1, (struct TrainCar *) actor);
+ func_8029B8E8(camera, (struct TrainCar *) actor);
break;
case ACTOR_TRAIN_TENDER:
- func_8029BFB0(temp_s1, (struct TrainCar *) actor);
+ func_8029BFB0(camera, (struct TrainCar *) actor);
break;
case ACTOR_TRAIN_PASSENGER_CAR:
- func_8029C3CC(temp_s1, (struct TrainCar *) actor);
+ func_8029C3CC(camera, (struct TrainCar *) actor);
break;
case 18:
- func_80297A50(temp_s1, D_801502C0, actor);
+ func_80297A50(camera, D_801502C0, actor);
break;
case 20:
- func_8029AC18(temp_s1, D_801502C0, actor);
+ func_8029AC18(camera, D_801502C0, actor);
break;
case ACTOR_MARIO_RACEWAY_SIGN:
- func_802A29BC(temp_s1, D_801502C0, actor);
+ func_802A29BC(camera, D_801502C0, actor);
break;
case ACTOR_WARIO_STADIUM_SIGN:
- func_802A269C(temp_s1, actor);
+ func_802A269C(camera, actor);
break;
case ACTOR_PALM_TREE:
- func_802A2C78(temp_s1, D_801502C0, actor);
+ func_802A2C78(camera, D_801502C0, actor);
break;
case ACTOR_PADDLE_WHEEL_BOAT:
- func_8029AE1C(temp_s1, actor, D_801502C0, sp92);
+ func_8029AE1C(camera, actor, D_801502C0, sp92);
break;
case ACTOR_BOX_TRUCK:
- func_8029B06C(temp_s1, actor);
+ func_8029B06C(camera, actor);
break;
case ACTOR_SCHOOL_BUS:
- func_8029B2E4(temp_s1, actor);
+ func_8029B2E4(camera, actor);
break;
case ACTOR_TANKER_TRUCK:
- func_8029B6EC(temp_s1, actor);
+ func_8029B6EC(camera, actor);
break;
case ACTOR_CAR:
- func_8029B4E0(temp_s1, actor);
+ func_8029B4E0(camera, actor);
break;
case ACTOR_RAILROAD_CROSSING:
- func_802A2AD0(temp_s1, actor);
+ func_802A2AD0(camera, actor);
break;
case ACTOR_YOSHI_VALLEY_EGG:
- func_802A27A0(temp_s1, D_801502C0, actor, sp92);
+ func_802A27A0(camera, D_801502C0, actor, sp92);
break;
}
}
switch (gCurrentCourseId) {
case COURSE_MOO_MOO_FARM:
- func_802986B4(temp_s1, D_801502C0, actor);
+ func_802986B4(camera, D_801502C0, actor);
break;
case COURSE_DK_JUNGLE:
- func_80298D7C(temp_s1, D_801502C0, actor);
+ func_80298D7C(camera, D_801502C0, actor);
break;
}
}
void update_simple_objects(void) {
- struct Actor *phi_s0;
+ struct Actor *actor;
s32 i;
for (i = 0; i < ACTOR_LIST_SIZE; i++) {
- phi_s0 = &gActorList[i];
- if (phi_s0->flags == 0) {
+ actor = &gActorList[i];
+ if (actor->flags == 0) {
continue;
}
- switch (phi_s0->type) {
+ switch (actor->type) {
case ACTOR_FALLING_ROCK:
- update_obj_falling_rocks(phi_s0);
+ update_obj_falling_rocks(actor);
break;
case ACTOR_GREEN_SHELL:
- update_obj_green_shell(phi_s0);
+ update_obj_green_shell(actor);
break;
case ACTOR_RED_SHELL:
- update_obj_red_blue_shell(phi_s0);
+ update_obj_red_blue_shell(actor);
break;
case ACTOR_BLUE_SPINY_SHELL:
- update_obj_red_blue_shell(phi_s0);
+ update_obj_red_blue_shell(actor);
break;
case ACTOR_KIWANO_FRUIT:
- update_obj_kiwano_fruit(phi_s0);
+ update_obj_kiwano_fruit(actor);
break;
case ACTOR_BANANA:
- update_obj_banana(phi_s0);
+ update_obj_banana(actor);
break;
case ACTOR_PADDLE_WHEEL_BOAT:
- update_obj_paddle_wheel(phi_s0);
+ update_obj_paddle_wheel(actor);
break;
case ACTOR_TRAIN_ENGINE:
- update_obj_train_engine(phi_s0);
+ update_obj_train_engine(actor);
break;
case ACTOR_TRAIN_TENDER:
- update_obj_train_car1(phi_s0);
+ update_obj_train_car1(actor);
break;
case ACTOR_TRAIN_PASSENGER_CAR:
- update_obj_train_car2(phi_s0);
+ update_obj_train_car2(actor);
break;
case ACTOR_ITEM_BOX:
- update_obj_item_box(phi_s0);
+ update_obj_item_box(actor);
break;
case ACTOR_HOT_AIR_BALLOON_ITEM_BOX:
- update_obj_item_box_hot_air_balloon(phi_s0);
+ update_obj_item_box_hot_air_balloon(actor);
break;
case ACTOR_FAKE_ITEM_BOX:
- update_obj_fake_item_box(phi_s0);
+ update_obj_fake_item_box(actor);
break;
case ACTOR_PIRANHA_PLANT:
- update_obj_piranha_plant(phi_s0);
+ update_obj_piranha_plant(actor);
break;
case ACTOR_BANANA_BUNCH:
- update_obj_banana_bunch(phi_s0);
+ update_obj_banana_bunch(actor);
break;
case ACTOR_TRIPLE_GREEN_SHELL:
- update_obj_triple_shell(phi_s0, ACTOR_GREEN_SHELL);
+ update_obj_triple_shell(actor, ACTOR_GREEN_SHELL);
break;
case ACTOR_TRIPLE_RED_SHELL:
- update_obj_triple_shell(phi_s0, ACTOR_RED_SHELL);
+ update_obj_triple_shell(actor, ACTOR_RED_SHELL);
break;
case ACTOR_MARIO_RACEWAY_SIGN:
- update_obj_mario_raceway_sign(phi_s0);
+ update_obj_mario_raceway_sign(actor);
break;
case ACTOR_WARIO_STADIUM_SIGN:
- update_obj_wario_stadium_sign(phi_s0);
+ update_obj_wario_stadium_sign(actor);
break;
case ACTOR_RAILROAD_CROSSING:
- update_obj_railroad_crossing(phi_s0);
+ update_obj_railroad_crossing(actor);
break;
case 2:
case 3:
@@ -4372,10 +4372,10 @@ void update_simple_objects(void) {
case 31:
case 32:
case 33:
- update_obj_trees_cacti_shrubs(phi_s0);
+ update_obj_trees_cacti_shrubs(actor);
break;
case ACTOR_YOSHI_VALLEY_EGG:
- update_obj_yoshi_valley_egg(phi_s0);
+ update_obj_yoshi_valley_egg(actor);
break;
}
}
diff --git a/src/actors.h b/src/actors.h
index ce39093e8..4396d68e2 100644
--- a/src/actors.h
+++ b/src/actors.h
@@ -4,6 +4,7 @@
#include "types.h"
#include "actor_types.h"
+void func_8029E158(void);
void func_80296A50(struct ShellActor*);
void actor_init(struct Actor*, f32*, s16*, f32*, s16);
void func_80297230(Camera*, struct Actor*);
@@ -321,67 +322,67 @@ extern Gfx D_0D0031E8[];
extern Gfx D_0D004B48[];
extern Gfx D_0D004BD8[];
-extern s8 D_0F04CBE0[];
-extern s8 D_0F04CE30[];
-extern s8 D_0F04D080[];
-extern s8 D_0F04D2D8[];
-extern s8 D_0F04D538[];
-extern s8 D_0F04D790[];
-extern s8 D_0F04D9FC[];
-extern s8 D_0F04DC5C[];
-extern s8 D_0F04DEB0[];
-extern s8 D_0F04E0DC[];
-extern s8 D_0F04E314[];
-extern s8 D_0F04E554[];
-extern s8 D_0F04E798[];
-extern s8 D_0F04E9F0[];
-extern s8 D_0F04EC4C[];
-extern s8 D_0F04EE88[];
-extern s8 D_0F04F45C[];
-extern s8 D_0F04F7A4[];
-extern s8 D_0F04FB3C[];
-extern s8 D_0F04FE28[];
-extern s8 D_0F050118[];
-extern s8 D_0F050468[];
-extern s8 D_0F050678[];
-extern s8 D_0F050D50[];
-extern s8 D_0F0513CC[];
-extern s8 D_0F051820[];
-extern s8 D_0F051C54[];
-extern s8 D_0F051FD8[];
-extern s8 D_0F05232C[];
-extern s8 D_0F0526B8[];
-extern s8 D_0F052A20[];
-extern s8 D_0F052D3C[];
-extern s8 D_0F05300C[];
-extern s8 D_0F0532F8[];
-extern s8 D_0F05363C[];
-extern s8 D_0F053950[];
-extern s8 D_0F053C34[];
-extern s8 D_0F053F74[];
-extern s8 D_0F054270[];
-extern s8 D_0F054518[];
-extern s8 D_0F05488C[];
-extern s8 D_0F054C3C[];
-extern s8 D_0F054ECC[];
-extern s8 D_0F0551C8[];
-extern s8 D_0F0554CC[];
-extern s8 D_0F055880[];
-extern s8 D_0F055BA0[];
-extern s8 D_0F055F10[];
-extern s8 D_0F0561AC[];
-extern s8 D_0F056408[];
-extern s8 D_0F05662C[];
-extern s8 D_0F05688C[];
-extern s8 D_0F056AD0[];
-extern s8 D_0F056CF0[];
-extern s8 D_0F056EC8[];
-extern s8 D_0F057084[];
-extern s8 D_0F057288[];
-extern s8 D_0F057590[];
-extern s8 D_0F057EB4[];
-extern s8 D_0F0581E4[];
-extern s8 D_0F058550[];
+extern u8 D_0F04CBE0[];
+extern u8 D_0F04CE30[];
+extern u8 D_0F04D080[];
+extern u8 D_0F04D2D8[];
+extern u8 D_0F04D538[];
+extern u8 D_0F04D790[];
+extern u8 D_0F04D9FC[];
+extern u8 D_0F04DC5C[];
+extern u8 D_0F04DEB0[];
+extern u8 D_0F04E0DC[];
+extern u8 D_0F04E314[];
+extern u8 D_0F04E554[];
+extern u8 D_0F04E798[];
+extern u8 D_0F04E9F0[];
+extern u8 D_0F04EC4C[];
+extern u8 D_0F04EE88[];
+extern u8 D_0F04F45C[];
+extern u8 D_0F04F7A4[];
+extern u8 D_0F04FB3C[];
+extern u8 D_0F04FE28[];
+extern u8 D_0F050118[];
+extern u8 D_0F050468[];
+extern u8 D_0F050678[];
+extern u8 D_0F050D50[];
+extern u8 D_0F0513CC[];
+extern u8 D_0F051820[];
+extern u8 D_0F051C54[];
+extern u8 D_0F051FD8[];
+extern u8 D_0F05232C[];
+extern u8 D_0F0526B8[];
+extern u8 D_0F052A20[];
+extern u8 D_0F052D3C[];
+extern u8 D_0F05300C[];
+extern u8 D_0F0532F8[];
+extern u8 D_0F05363C[];
+extern u8 D_0F053950[];
+extern u8 D_0F053C34[];
+extern u8 D_0F053F74[];
+extern u8 D_0F054270[];
+extern u8 D_0F054518[];
+extern u8 D_0F05488C[];
+extern u8 D_0F054C3C[];
+extern u8 D_0F054ECC[];
+extern u8 D_0F0551C8[];
+extern u8 D_0F0554CC[];
+extern u8 D_0F055880[];
+extern u8 D_0F055BA0[];
+extern u8 D_0F055F10[];
+extern u8 D_0F0561AC[];
+extern u8 D_0F056408[];
+extern u8 D_0F05662C[];
+extern u8 D_0F05688C[];
+extern u8 D_0F056AD0[];
+extern u8 D_0F056CF0[];
+extern u8 D_0F056EC8[];
+extern u8 D_0F057084[];
+extern u8 D_0F057288[];
+extern u8 D_0F057590[];
+extern u8 D_0F057EB4[];
+extern u8 D_0F0581E4[];
+extern u8 D_0F058550[];
extern s8 gTexture671A88[];
extern s8 gTexture6774D8[];
extern s8 gTextureShrub[];
diff --git a/src/audio/external.h b/src/audio/external.h
index dfbc7aa3b..409b87280 100644
--- a/src/audio/external.h
+++ b/src/audio/external.h
@@ -140,6 +140,7 @@ void func_800CA49C(u8);
void func_800CAACC(u8);
void func_800CB134();
void func_800CB2C4(void);
+void func_800C5CB8(void);
// Based on SM64, this should be part of data.c's BSS section. Somehow.
extern s32 gAudioErrorFlags;
diff --git a/src/camera.h b/src/camera.h
index e33fffa3a..8874e6147 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -61,6 +61,8 @@ void func_8001D794(Player*, Camera*, Vec3f, f32*, f32*, f32*, s16);
void func_8001E0C4(Camera*, Player*, s8);
void func_8001E8E8(Camera*, Player*, s8);
void func_8001F87C(s32);
+void func_8001EE98(Player*, Camera*, s8);
+void func_8001F394(Player*, f32*);
extern s32 D_80164A2C;
extern f32 D_80164A30;
diff --git a/src/camera_junk.c b/src/camera_junk.c
index 0a3021ed2..5c2dd4eec 100644
--- a/src/camera_junk.c
+++ b/src/camera_junk.c
@@ -4,6 +4,7 @@
#include "camera.h"
#include "camera_junk.h"
#include "math_util.h"
+#include "ceremony_and_credits.h"
void setup_camera_ending_sequence(void) {
Camera *camera;
diff --git a/src/ceremony_and_credits.h b/src/ceremony_and_credits.h
index c79bd8940..975984758 100644
--- a/src/ceremony_and_credits.h
+++ b/src/ceremony_and_credits.h
@@ -108,6 +108,8 @@ struct Cutscene {
/* Function Prototypes */
+void init_cinematic_camera(void);
+s32 func_80283648(Camera*);
void vec3f_set_dupe(Vec3f, f32, f32, f32);
void vec3s_set_dupe(Vec3s, s16, s16, s16);
void vec3f_clear(Vec3f);
diff --git a/src/code_800029B0.c b/src/code_800029B0.c
index d1ad40e4e..f6337ac7a 100644
--- a/src/code_800029B0.c
+++ b/src/code_800029B0.c
@@ -1,6 +1,7 @@
#include <ultra64.h>
#include <macros.h>
#include "types.h"
+#include "memory.h"
#include "variables.h"
#include "waypoints.h"
#include "actors.h"
@@ -9,14 +10,19 @@
#include "audio/external.h"
#include "code_800029B0.h"
#include <defines.h>
+#include "code_802AAA70.h"
+#include "memory.h"
+#include "code_80091750.h"
+#include "skybox_and_splitscreen.h"
+#include "code_8006E9C0.h"
+#include "spawn_players.h"
+#include "staff_ghosts.h"
+#include "render_courses.h"
extern u16 D_800DC5A8;
-extern struct Controller *gControllerOne[];
-
extern s32 D_800DC510;
extern u16 D_8015F6FE;
-extern s16 D_800DC5B8;
extern u16 D_80152308;
extern s32 D_802BA038;
extern s16 D_802BA048;
@@ -32,39 +38,23 @@ extern s8 gCupSelection;
extern s32 gScreenModeSelection;
extern u32 D_8015F730;
-extern u32 D_8015F734;
-extern u32 gPrevLoadedAddress;
+extern s32 D_8015F734;
+extern u32 gNextFreeMemoryAddress;
extern s32 D_80150120;
extern f32 D_8015F738, D_8015F748, D_8015F758, D_8015F768, D_8015F778;
extern Vec3f D_802B91C8;
-// gfx?
-extern s8 D_0F04F45C[];
-extern s8 D_0F04FE28[];
-extern s8 D_0F050118[];
-extern s8 D_0F051C54[];
-extern s8 D_0F051FD8[];
-extern s8 D_0F05232C[];
-extern s8 D_0F0526B8[];
-extern s8 D_0F052A20[];
-extern s8 D_0F052D3C[];
-extern s8 D_0F05300C[];
-extern s8 D_0F0532F8[];
-extern s8 D_0F05363C[];
-extern s8 D_0F053950[];
-
extern struct ActorSpawnData D_06009570[];
extern struct ActorSpawnData D_06014330[];
extern f32 gCourseDirection;
-extern s16 D_800DC5C8;
s32 D_800DC5E0 = 32;
-s16 D_800DC5E4 = 0;
+u16 D_800DC5E4 = 0;
// TODO: gPlayerWinningIndex (D_800DC5E8) accessed as word, D_800DC5EB as u8
s32 gPlayerWinningIndex = 0;
@@ -75,9 +65,9 @@ struct UnkStruct_800DC5EC *D_800DC5F0 = &D_8015F480[1];
struct UnkStruct_800DC5EC *D_800DC5F4 = &D_8015F480[2];
struct UnkStruct_800DC5EC *D_800DC5F8 = &D_8015F480[3];
u16 D_800DC5FC = 0;
-u8 *pAppNmiBuffer = &osAppNmiBuffer;
+u8 *pAppNmiBuffer = (u8 *) &osAppNmiBuffer;
s32 gIsMirrorMode = 0;
-f32 D_800DC608 = 1.0f;
+f32 vtxStretchY = 1.0f;
Lights1 D_800DC610[] = {
gdSPDefLights1(175, 175, 175, 255, 255, 255, 0, 0, 120),
gdSPDefLights1(115, 115, 115, 255, 255, 255, 0, 0, 120),
@@ -120,12 +110,12 @@ void setup_race(void) {
if (gCurrentCourseId != gCurrentlyLoadedCourseId) {
D_80150120 = 0;
gCurrentlyLoadedCourseId = gCurrentCourseId;
- gPrevLoadedAddress = D_8015F734;
+ gNextFreeMemoryAddress = D_8015F734;
load_course(gCurrentCourseId);
func_80295D88();
- D_8015F730 = gPrevLoadedAddress;
+ D_8015F730 = gNextFreeMemoryAddress;
} else {
- gPrevLoadedAddress = D_8015F730;
+ gNextFreeMemoryAddress = D_8015F730;
}
func_802969F8();
func_80005310();
@@ -162,7 +152,7 @@ void setup_race(void) {
func_800CB2C4();
}
- controller = *gControllerOne;
+ controller = gControllerOne;
for (i = 0; i < 7; i++, controller++){
controller->rawStickX = 0;
@@ -232,11 +222,11 @@ void func_80003040(void) {
gCourseDirection = 1.0f;
gPlayerCountSelection1 = 1;
- set_segment_base_addr(3, (gPrevLoadedAddress + 0xFFFF7000));
+ set_segment_base_addr(0x3, (void *) (gNextFreeMemoryAddress + 0xFFFF7000));
destroy_all_actors();
switch (gCurrentCourseId) {
case COURSE_MARIO_RACEWAY:
- func_802A84F4(D_0F04F45C, 0x35B, 0x800);
+ dma_textures(D_0F04F45C, 0x35B, 0x800);
place_segment_06(D_06009570);
break;
case COURSE_BOWSER_CASTLE:
@@ -251,18 +241,18 @@ void func_80003040(void) {
addActorToEmptySlot(position, rotation, velocity, ACTOR_YOSHI_VALLEY_EGG);
break;
case COURSE_MOO_MOO_FARM:
- func_802A84F4(D_0F04FE28, 0x3E8, 0x800);
- func_802A84F4(D_0F050118, 0x3E8, 0x800);
- func_802A84F4(D_0F051C54, 0x400, 0x800);
- func_802A84F4(D_0F051FD8, 0x400, 0x800);
- func_802A84F4(D_0F05232C, 0x400, 0x800);
- func_802A84F4(D_0F0526B8, 0x400, 0x800);
- func_802A84F4(D_0F052A20, 0x400, 0x800);
- func_802A84F4(D_0F052D3C, 0x400, 0x800);
- func_802A84F4(D_0F05300C, 0x400, 0x800);
- func_802A84F4(D_0F0532F8, 0x400, 0x800);
- func_802A84F4(D_0F05363C, 0x400, 0x800);
- func_802A84F4(D_0F053950, 0x400, 0x800);
+ dma_textures(D_0F04FE28, 0x3E8, 0x800);
+ dma_textures(D_0F050118, 0x3E8, 0x800);
+ dma_textures(D_0F051C54, 0x400, 0x800);
+ dma_textures(D_0F051FD8, 0x400, 0x800);
+ dma_textures(D_0F05232C, 0x400, 0x800);
+ dma_textures(D_0F0526B8, 0x400, 0x800);
+ dma_textures(D_0F052A20, 0x400, 0x800);
+ dma_textures(D_0F052D3C, 0x400, 0x800);
+ dma_textures(D_0F05300C, 0x400, 0x800);
+ dma_textures(D_0F0532F8, 0x400, 0x800);
+ dma_textures(D_0F05363C, 0x400, 0x800);
+ dma_textures(D_0F053950, 0x400, 0x800);
place_segment_06(D_06014330);
break;
case COURSE_SHERBET_LAND:
diff --git a/src/code_80004740.c b/src/code_80004740.c
index ea3053463..b802d2a26 100644
--- a/src/code_80004740.c
+++ b/src/code_80004740.c
@@ -274,7 +274,7 @@ GLOBAL_ASM("asm/non_matchings/code_80004740/func_80004DFC.s")
s16 func_80004EAC(void *addr, s16 offset) {
uintptr_t *item = segmented_to_virtual(addr);
- struct stru_80004EAC *temp = segmented_to_virtual(item[offset]);
+ struct stru_80004EAC *temp = (struct stru_80004EAC *) segmented_to_virtual((void *) item[offset]);
return temp->unk8 - 1;
} \ No newline at end of file
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c
index d9b214fce..7f12f7d1d 100644
--- a/src/code_80005FD0.c
+++ b/src/code_80005FD0.c
@@ -4741,7 +4741,7 @@ void func_8000F2DC(void) {
D_80163368->unk4 = (s32) temp_v0->unk2;
D_80163368->unk8 = (s32) temp_v0->unk4;
D_80163368->unkC = (s32) temp_v0->unk6;
- D_80163598 = func_802A7B70(temp_v0->unk8 * 4);
+ D_80163598 = get_next_available_memory_addr(temp_v0->unk8 * 4);
var_s5 = D_801645A0;
var_s7 = D_80164590;
var_s6 = D_80164580;
@@ -4750,12 +4750,12 @@ void func_8000F2DC(void) {
var_s3 = D_80164550;
var_s1 = D_80163368;
do {
- *var_s3 = func_802A7B70(*var_s1 * 8);
- *var_s4 = func_802A7B70(*var_s1 * 8);
- *var_s2 = func_802A7B70(*var_s1 * 8);
- *var_s6 = func_802A7B70(*var_s1 * 2);
- *var_s7 = func_802A7B70(*var_s1 * 2);
- temp_v0_2 = func_802A7B70(*var_s1 * 2);
+ *var_s3 = get_next_available_memory_addr(*var_s1 * 8);
+ *var_s4 = get_next_available_memory_addr(*var_s1 * 8);
+ *var_s2 = get_next_available_memory_addr(*var_s1 * 8);
+ *var_s6 = get_next_available_memory_addr(*var_s1 * 2);
+ *var_s7 = get_next_available_memory_addr(*var_s1 * 2);
+ temp_v0_2 = get_next_available_memory_addr(*var_s1 * 2);
var_s5 += 4;
var_s1 += 4;
var_s3 += 4;
diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h
index 335f0ebb5..401ac8d41 100644
--- a/src/code_80005FD0.h
+++ b/src/code_80005FD0.h
@@ -28,6 +28,9 @@ struct unk_41F8 {
/* Function Prototypes */
+void func_800070F4(void);
+void func_80019DF4(void);
+void func_80019E58(void);
s16 func_80005FD0(Vec3f, Vec3f);
s32 func_80006018(f32, f32, f32, f32, f32, f32, f32, f32);
void func_80006114(Vec3f, Vec3f, s16);
@@ -39,7 +42,7 @@ s32 func_80008E58(s32, s32);
void func_80008F38(s32);
void func_80009000(s32);
void func_800090F0(s32, Player*);
-void func_800097E0();
+void func_800097E0(void);
void func_80009B60(s32);
s32 func_8000B7E4(s32, u16);
s32 func_8000B820(s32);
diff --git a/src/code_800431B0.c b/src/code_800431B0.c
index 0432f104d..2641eb03f 100644
--- a/src/code_800431B0.c
+++ b/src/code_800431B0.c
@@ -6986,7 +6986,7 @@ void func_800579F8(s32 arg0, s32 arg1, s8 *arg2, s32 arg3) {
func_80057778();
}
-void func_80057A50(s32 arg0, s32 arg1, s8 *arg2, s32 arg3) {
+void func_80057A50(s32 arg0, s32 arg1, char *arg2, s32 arg3) {
load_debug_font();
debug_print_string(&arg0, &arg1, arg2);
func_8005762C(&arg0, &arg1, arg3, 10);
diff --git a/src/code_800431B0.h b/src/code_800431B0.h
index de70845f8..677617d60 100644
--- a/src/code_800431B0.h
+++ b/src/code_800431B0.h
@@ -383,7 +383,7 @@ void func_80057908(s32, s32, s8*, s32);
void func_80057960(s32, s32, s8*, s32);
void func_800579B8(s32, s32, s8*);
void func_800579F8(s32, s32, s8*, s32);
-void func_80057A50(s32, s32, s8*, s32);
+void func_80057A50(s32, s32, char*, s32);
void func_80057AA8(s32, s32, s8*, s32);
void func_80057B14(s32, s32, s8*, s32);
void func_80057B80(s32, s32, s8*, s32);
diff --git a/src/code_80057C60.c b/src/code_80057C60.c
index 0305e10ae..836ca50d0 100644
--- a/src/code_80057C60.c
+++ b/src/code_80057C60.c
@@ -2314,7 +2314,7 @@ block_10:
GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005C360.s")
#endif
-void func_8005C64C(s32 arg0) {
+void func_8005C64C(s32 *arg0) {
}
@@ -2839,7 +2839,7 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005D1F4.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-s32 func_802A84F4(? *, ?, ?); // extern
+s32 dma_textures(? *, ?, ?); // extern
extern ? D_0F05D1E8;
extern ? D_0F05D420;
extern ? D_0F05D674;
@@ -2917,44 +2917,44 @@ extern ? gTextureLightningBolt0;
extern ? gTextureLightningBolt1;
void func_8005D290(void) {
- D_8018D488 = func_802A84F4(&gTexture69C80C, 0x400, 0x400);
- D_8018D474 = func_802A84F4(&gTextureKartShadow, 0x1000, 0x1000);
- D_8018D420 = func_802A84F4(&gTexture69B03C, 0x100, 0x100);
- D_8018D424 = func_802A84F4(&gTexture69B140, 0x400, 0x400);
- D_8018D478 = func_802A84F4(&gTexture69C1E8, 0x200, 0x200);
- D_8018D480 = func_802A84F4(&gTexture69BA28, 0x400, 0x400);
- D_8018D484 = func_802A84F4(&gTexture69B960, 0x400, 0x400);
- D_8018D48C = func_802A84F4(&gTexture69C354, 0x400, 0x400);
- D_8018D494 = func_802A84F4(&gTexture69C4E4, 0x400, 0x400);
+ D_8018D488 = dma_textures(&gTexture69C80C, 0x400, 0x400);
+ D_8018D474 = dma_textures(&gTextureKartShadow, 0x1000, 0x1000);
+ D_8018D420 = dma_textures(&gTexture69B03C, 0x100, 0x100);
+ D_8018D424 = dma_textures(&gTexture69B140, 0x400, 0x400);
+ D_8018D478 = dma_textures(&gTexture69C1E8, 0x200, 0x200);
+ D_8018D480 = dma_textures(&gTexture69BA28, 0x400, 0x400);
+ D_8018D484 = dma_textures(&gTexture69B960, 0x400, 0x400);
+ D_8018D48C = dma_textures(&gTexture69C354, 0x400, 0x400);
+ D_8018D494 = dma_textures(&gTexture69C4E4, 0x400, 0x400);
D_8018D490 = D_8018D48C;
- D_8018D498 = func_802A84F4(&gTexture69B378, 0x1000, 0x1000);
- D_8018D4BC = func_802A84F4(&D_0F05E19C, 0x800, 0x800);
- D_8018D4C0 = func_802A84F4(&D_0F05E3E0, 0x800, 0x800);
- D_8018D49C = func_802A84F4(&gTexture69C9C4, 0x200, 0x200);
- D_8018D4A0 = func_802A84F4(&gTextureBoingExclamation, 0x800, 0x800);
- D_8018D4A4 = func_802A84F4(&D_0F05DDFC, 0x800, 0x800);
- D_8018D4A8 = func_802A84F4(&D_0F05DFC0, 0x800, 0x800);
- D_8018D4AC = func_802A84F4(&D_0F05D674, 0x800, 0x800);
- D_8018D4B0 = func_802A84F4(&D_0F05DA50, 0x800, 0x800);
- D_8018D4B4 = func_802A84F4(&D_0F05D1E8, 0x800, 0x800);
- D_8018D4B8 = func_802A84F4(&D_0F05D420, 0x800, 0x800);
- D_8018D438 = func_802A84F4(&gTexture69CB84, 0x800, 0x800);
- D_8018D43C = func_802A84F4(&gTexture69CCEC, 0x800, 0x800);
- D_8018D440 = func_802A84F4(&gTexture69CEB8, 0x800, 0x800);
- D_8018D444 = func_802A84F4(&gTexture69D148, 0x800, 0x800);
- D_8018D448 = func_802A84F4(&gTexture69D4E0, 0x800, 0x800);
- D_8018D44C = func_802A84F4(&gTexture69D8FC, 0x800, 0x800);
- D_8018D450 = func_802A84F4(&gTexture69DCB4, 0x800, 0x800);
- D_8018D454 = func_802A84F4(&gTexture69DFA0, 0x800, 0x800);
- D_8018D458 = func_802A84F4(&gTexture69E25C, 0x800, 0x800);
- D_8018D45C = func_802A84F4(&gTexture69E518, 0x800, 0x800);
- D_8018D460 = func_802A84F4(&gTexture69E7A8, 0x800, 0x800);
- D_8018D464 = func_802A84F4(&gTexture69EA18, 0x800, 0x800);
- D_8018D468 = func_802A84F4(&gTexture69EC54, 0x800, 0x800);
- D_8018D46C = func_802A84F4(&gTexture69EE38, 0x800, 0x800);
- D_8018D470 = func_802A84F4(&gTexture69EFE0, 0x800, 0x800);
- D_8018D4C4 = func_802A84F4(&gTextureLightningBolt0, 0x800, 0x800);
- D_8018D4C8 = func_802A84F4(&gTextureLightningBolt1, 0x800, 0x800);
+ D_8018D498 = dma_textures(&gTexture69B378, 0x1000, 0x1000);
+ D_8018D4BC = dma_textures(&D_0F05E19C, 0x800, 0x800);
+ D_8018D4C0 = dma_textures(&D_0F05E3E0, 0x800, 0x800);
+ D_8018D49C = dma_textures(&gTexture69C9C4, 0x200, 0x200);
+ D_8018D4A0 = dma_textures(&gTextureBoingExclamation, 0x800, 0x800);
+ D_8018D4A4 = dma_textures(&D_0F05DDFC, 0x800, 0x800);
+ D_8018D4A8 = dma_textures(&D_0F05DFC0, 0x800, 0x800);
+ D_8018D4AC = dma_textures(&D_0F05D674, 0x800, 0x800);
+ D_8018D4B0 = dma_textures(&D_0F05DA50, 0x800, 0x800);
+ D_8018D4B4 = dma_textures(&D_0F05D1E8, 0x800, 0x800);
+ D_8018D4B8 = dma_textures(&D_0F05D420, 0x800, 0x800);
+ D_8018D438 = dma_textures(&gTexture69CB84, 0x800, 0x800);
+ D_8018D43C = dma_textures(&gTexture69CCEC, 0x800, 0x800);
+ D_8018D440 = dma_textures(&gTexture69CEB8, 0x800, 0x800);
+ D_8018D444 = dma_textures(&gTexture69D148, 0x800, 0x800);
+ D_8018D448 = dma_textures(&gTexture69D4E0, 0x800, 0x800);
+ D_8018D44C = dma_textures(&gTexture69D8FC, 0x800, 0x800);
+ D_8018D450 = dma_textures(&gTexture69DCB4, 0x800, 0x800);
+ D_8018D454 = dma_textures(&gTexture69DFA0, 0x800, 0x800);
+ D_8018D458 = dma_textures(&gTexture69E25C, 0x800, 0x800);
+ D_8018D45C = dma_textures(&gTexture69E518, 0x800, 0x800);
+ D_8018D460 = dma_textures(&gTexture69E7A8, 0x800, 0x800);
+ D_8018D464 = dma_textures(&gTexture69EA18, 0x800, 0x800);
+ D_8018D468 = dma_textures(&gTexture69EC54, 0x800, 0x800);
+ D_8018D46C = dma_textures(&gTexture69EE38, 0x800, 0x800);
+ D_8018D470 = dma_textures(&gTexture69EFE0, 0x800, 0x800);
+ D_8018D4C4 = dma_textures(&gTextureLightningBolt0, 0x800, 0x800);
+ D_8018D4C8 = dma_textures(&gTextureLightningBolt1, 0x800, 0x800);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005D290.s")
diff --git a/src/code_80057C60.h b/src/code_80057C60.h
index d435c1ad6..431adf4dc 100644
--- a/src/code_80057C60.h
+++ b/src/code_80057C60.h
@@ -27,6 +27,7 @@ void func_80058C20(u32);
void func_80058DB4(u32);
void func_80058F48();
void func_80058F78();
+void func_80059AC8(void);
void func_80059024();
void func_8005902C();
@@ -76,7 +77,7 @@ void func_8005AB20();
void func_8005B914();
void func_8005C360(f32);
-void func_8005C64C(s32);
+void func_8005C64C(s32*);
void func_8005C654(s32*);
void func_8005C65C(s32);
void func_8005C6B4(s8, s16*, s16*, s16*);
diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c
index c9ae6c87e..1ecee68d0 100644
--- a/src/code_8006E9C0.c
+++ b/src/code_8006E9C0.c
@@ -272,7 +272,7 @@ void func_8006EEE8(s32 courseId) {
temp_t0 = courseId * 2;
temp_a1 = D_800E5520[courseId];
sp1C = temp_t0;
- D_8018D240 = func_802A84F4(gCourseOutlineTextures[courseId], (u32) temp_a1, (u32) temp_a1);
+ D_8018D240 = dma_textures(gCourseOutlineTextures[courseId], (u32) temp_a1, (u32) temp_a1);
temp_v1 = &D_800E5548[temp_t0];
D_8018D2B0 = temp_v1->unk0;
D_8018D2B8 = temp_v1->unk2;
@@ -409,7 +409,7 @@ void func_8006F008(void) {
}
switch ((u32) gCurrentCourseId) {
case 0:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust5, 0x00000443U, 0x00001000U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust5, 0x00000443U, 0x00001000U);
D_8018D2A0 = 0.022f;
D_8018D2E0 = 6;
D_8018D2E8 = 0x001C;
@@ -434,14 +434,14 @@ block_26:
D_8018D2E8 = 0x0030;
break;
case 3:
- D_80165880 = func_802A84F4((s32) &D_0F0D0E50, 0x00004CC2U, 0x0000D980U);
+ D_80165880 = dma_textures((s32) &D_0F0D0E50, 0x00004CC2U, 0x0000D980U);
D_8018D2A0 = 0.016f;
D_8018D2C0.unk0 = 0x0106;
D_8018D2E0 = 0x0037;
D_8018D2E8 = 0x0027;
break;
case 4:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust0, 0x00000479U, 0x00000C00U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust0, 0x00000479U, 0x00000C00U);
D_8018D2A0 = 0.018f;
D_8018D2E0 = 0x003D;
D_8018D2E8 = 0x0026;
@@ -456,14 +456,14 @@ block_26:
D_8018D310 = 0x00FF;
break;
case 6:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust3, 0x000003C8U, 0x00001000U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust3, 0x000003C8U, 0x00001000U);
D_8018D2A0 = 0.014f;
D_8018D2C0.unk0 = 0x010C;
D_8018D2E0 = 0x0028;
D_8018D2E8 = 0x0015;
break;
case 7:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust4, 0x000003F8U, 0x00001000U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust4, 0x000003F8U, 0x00001000U);
D_8018D2C0.unk0 = 0x0106;
D_8018D2A0 = 0.014f;
D_8018D2E0 = 0x0025;
@@ -473,7 +473,7 @@ block_26:
D_80165728 = -0x014A;
break;
case 8:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust2, 0x000004F4U, 0x00000C00U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust2, 0x000004F4U, 0x00000C00U);
D_8018D2A0 = 0.0155f;
D_8018D2C0.unk0 = 0x010F;
D_8018D2E0 = 0x002D;
@@ -483,7 +483,7 @@ block_26:
D_80165728 = -0x00D7;
break;
case 9:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust0, 0x00000479U, 0x00000C00U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust0, 0x00000479U, 0x00000C00U);
D_8018D2A0 = 0.0155f;
D_8018D2C0.unk0 = 0x010F;
D_8018D2E0 = 0x0012;
@@ -498,13 +498,13 @@ block_26:
case 11:
D_8018D2C0.unk0 = 0x0107;
D_8018D2D8.unk0 = 0x00A5;
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust5, 0x00000443U, 0x00001000U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust5, 0x00000443U, 0x00001000U);
D_8018D2A0 = 0.015f;
D_8018D2E0 = 0x0037;
D_8018D2E8 = 0x001B;
break;
case 12:
- D_8018D220 = func_802A84F4((s32) &gTextureExhaust1, 0x00000485U, 0x00000C00U);
+ D_8018D220 = dma_textures((s32) &gTextureExhaust1, 0x00000485U, 0x00000C00U);
D_8018D2A0 = 0.015f;
D_8018D2C0.unk0 = 0x0106;
D_8018D2E0 = 0x0034;
diff --git a/src/code_80091750.c b/src/code_80091750.c
index 41945d2d0..d7da31a92 100644
--- a/src/code_80091750.c
+++ b/src/code_80091750.c
@@ -195,7 +195,7 @@ void swap_values(s32 *arg0, s32 *arg1) {
s32 func_80091D74(); /* extern */
void func_800C97C4(s32); /* extern */
void func_800C9D0C(s32); /* extern */
-void *func_802AA88C(? *, ? *); /* extern */
+void *decompress_segments(? *, ? *); /* extern */
void load_save_data(); /* extern */
extern void *D_800DC5EC;
extern s32 D_800E86A4;
@@ -214,7 +214,7 @@ extern s8 D_8018EDF6;
extern s8 D_8018EE0C;
extern u32 _course_mario_raceway_dl_mio0SegmentRomStart;
extern s32 _data_825800SegmentRomStart;
-extern s32 gPrevLoadedAddress;
+extern s32 gNextFreeMemoryAddress;
static s8 D_800E852C = 1;
void func_80091B78(void) {
@@ -236,14 +236,14 @@ void func_80091B78(void) {
}
}
if (gMenuSelection == LOGO_INTRO_MENU) {
- gPrevLoadedAddress = D_8015F734;
- set_segment_base_addr(6, func_802AA88C(&_data_825800SegmentRomStart, &_course_mario_raceway_dl_mio0SegmentRomStart));
- }
- gPrevLoadedAddress = D_8015F734;
- D_8018D9B0 = func_802A7B70(0x000900B0);
- D_8018D9B4 = func_802A7B70(0x0000CE00);
- D_8018D9B8 = func_802A7B70(0x00012C00);
- D_8018D9C0 = func_802A7B70(0x00001000);
+ gNextFreeMemoryAddress = D_8015F734;
+ set_segment_base_addr(6, decompress_segments(&_data_825800SegmentRomStart, &_course_mario_raceway_dl_mio0SegmentRomStart));
+ }
+ gNextFreeMemoryAddress = D_8015F734;
+ D_8018D9B0 = get_next_available_memory_addr(0x000900B0);
+ D_8018D9B4 = get_next_available_memory_addr(0x0000CE00);
+ D_8018D9B8 = get_next_available_memory_addr(0x00012C00);
+ D_8018D9C0 = get_next_available_memory_addr(0x00001000);
func_800AF9B0();
D_8018EE0C = 0;
var_v0 = &D_8018E7AC;
@@ -364,10 +364,10 @@ extern u8 gControllerBits;
void func_80091FA4(void) {
? *var_v1;
- D_8018D9B4 = func_802A7B70(0x00002800);
- D_8018D9B0 = func_802A7B70(0x000124F8);
- D_8018D9B8 = func_802A7B70(0x00001000);
- D_8018D9BC = func_802A7B70(4);
+ D_8018D9B4 = get_next_available_memory_addr(0x00002800);
+ D_8018D9B0 = get_next_available_memory_addr(0x000124F8);
+ D_8018D9B8 = get_next_available_memory_addr(0x00001000);
+ D_8018D9BC = get_next_available_memory_addr(4);
var_v1 = &D_8018E7AC;
do {
var_v1 += 1;
@@ -1238,10 +1238,10 @@ extern s8 D_8018E838;
void func_80093E60(void) {
? *var_v1;
- D_8018D9B4 = func_802A7B70(0x00002800);
- D_8018D9B0 = func_802A7B70(0x000124F8);
- D_8018D9B8 = func_802A7B70(0x00001000);
- D_8018D9BC = func_802A7B70(4);
+ D_8018D9B4 = get_next_available_memory_addr(0x00002800);
+ D_8018D9B0 = get_next_available_memory_addr(0x000124F8);
+ D_8018D9B8 = get_next_available_memory_addr(0x00001000);
+ D_8018D9BC = get_next_available_memory_addr(4);
var_v1 = &D_8018E7AC;
do {
var_v1 += 1;
diff --git a/src/code_80091750.h b/src/code_80091750.h
index 56f1985ea..c789e5c02 100644
--- a/src/code_80091750.h
+++ b/src/code_80091750.h
@@ -58,6 +58,10 @@ typedef struct {
/* Function Prototypes */
+void func_80091EE4(void);
+void func_80091FA4(void);
+void func_80093A30(s32);
+void func_80093A5C(u32);
f64 exponent_by_squaring(f64, s32);
f64 func_80091A6C(f64, s32);
f64 func_80091AC0(f64, s32*);
diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c
index f185e6564..b53ddeed2 100644
--- a/src/code_800AF9B0.c
+++ b/src/code_800AF9B0.c
@@ -33,8 +33,8 @@ Vtx *D_8018EDBC;
#define SQ(x) ((x) * (x))
void func_800AF9B0(void) {
- D_8018EDB8 = (void *)func_802A7B70(480 * sizeof(Vtx));
- D_8018EDBC = (void *)func_802A7B70(480 * sizeof(Vtx));
+ D_8018EDB8 = (void *)get_next_available_memory_addr(480 * sizeof(Vtx));
+ D_8018EDBC = (void *)get_next_available_memory_addr(480 * sizeof(Vtx));
}
// could be a normal vertex, not a color...
diff --git a/src/code_80280000.c b/src/code_80280000.c
index 78488f691..39de208d3 100644
--- a/src/code_80280000.c
+++ b/src/code_80280000.c
@@ -13,6 +13,14 @@
#include "code_80281780.h"
#include "skybox_and_splitscreen.h"
#include <config.h>
+#include "code_80091750.h"
+#include "code_8006E9C0.h"
+#include "code_800029B0.h"
+#include "ceremony_and_credits.h"
+#include "code_80281C40.h"
+#include "code_80057C60.h"
+#include "actors.h"
+#include "render_courses.h"
void func_80280000(void) {
func_802966A0();
@@ -22,8 +30,10 @@ void func_80280000(void) {
}
void func_80280038(void) {
+ u16 perspNorm;
Camera *camera = &cameras[0];
- u16 sp44[36];
+ UNUSED s32 pad;
+ Mat4 matrix;
D_80150112 = 0;
D_80164AF0 = 0;
@@ -32,15 +42,16 @@ void func_80280038(void) {
func_802A53A4();
init_rdp();
func_80057FC4(0);
+
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[1], &sp44[37], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp44[37]);
+ guPerspective(&gGfxPool->mtxPool[1], &perspNorm, D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
gCurrentCourseId = gCreditsCourseId;
- mtxf_identity(&sp44);
- func_802B4FF8(&sp44, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
func_80295A38(D_800DC5EC);
func_802A3008(D_800DC5EC);
func_80058090(0);
@@ -114,10 +125,10 @@ void load_credits(void) {
D_800DC5EC->screenStartY = 120;
gScreenModeSelection = SCREEN_MODE_1P;
gActiveScreenMode = SCREEN_MODE_1P;
- gPrevLoadedAddress = D_8015F734;
+ gNextFreeMemoryAddress = D_8015F734;
load_course(gCurrentCourseId);
- D_8015F730 = gPrevLoadedAddress;
- set_segment_base_addr(0xB, func_802AA88C(&_data_821D10SegmentRomStart, &_data_825800SegmentRomStart));
+ D_8015F730 = gNextFreeMemoryAddress;
+ set_segment_base_addr(0xB, (void *) decompress_segments(&_data_821D10SegmentRomStart, &_data_825800SegmentRomStart));
D_8015F6EA = -0x15A1;
D_8015F6EE = -0x15A1;
D_8015F6F2 = -0x15A1;
@@ -130,7 +141,7 @@ void load_credits(void) {
D_8015F588 = 0;
D_800DC5BC = 0;
D_800DC5C8 = 0;
- D_8015F580 = gPrevLoadedAddress;
+ D_8015F580 = (mk64_surface_map_ram *) gNextFreeMemoryAddress;
camera->pos[0] = 1400.0f;
camera->pos[1] = 300.0f;
camera->pos[2] = 1400.0f;
@@ -146,6 +157,6 @@ void load_credits(void) {
func_80093E60();
func_80092688();
if (D_800DC5EC) {}
- D_801625F8 = ((s32)gHeapEndPtr - gPrevLoadedAddress);
+ D_801625F8 = ((s32)gHeapEndPtr - gNextFreeMemoryAddress);
D_801625FC = ((f32)D_801625F8 / 1000.0f);
}
diff --git a/src/code_80280000.h b/src/code_80280000.h
index 1b0cbda1e..3c1f327ea 100644
--- a/src/code_80280000.h
+++ b/src/code_80280000.h
@@ -24,7 +24,7 @@ extern s32 D_802874A0;
extern u16 D_80164714, D_80164716, D_80164718;
extern u16 D_800DC5E4;
-extern u32 D_802874FC;
+extern s32 D_802874FC;
extern u16 D_800DC518;
diff --git a/src/code_80280650.c b/src/code_80280650.c
index cc29f9d17..2c9c789b8 100644
--- a/src/code_80280650.c
+++ b/src/code_80280650.c
@@ -277,9 +277,9 @@ void func_80280FA8(s32 arg0) {
void func_80280FB0(void) {
D_802874E0 = 0;
- D_802874F8 = func_802A7B70(0x3B60);
+ D_802874F8 = get_next_available_memory_addr(0x3B60);
bzero(D_802874F8, 0x3B60);
- func_80280734(&D_80284E88);
+ func_80280734((struct UnkStruct80280658 *)&D_80284E88);
}
void func_80280FFC(void) {
diff --git a/src/code_80280650.h b/src/code_80280650.h
index 5c505af0a..ac429226f 100644
--- a/src/code_80280650.h
+++ b/src/code_80280650.h
@@ -66,6 +66,7 @@ struct UnkStruct_8028088C {
s32 unk3C;
};
+void func_80281438(void);
void func_80280650();
void func_80280658(struct UnkStruct_80280658*);
struct UnkStruct_80280658 *func_802806C8();
@@ -96,7 +97,7 @@ extern struct UnkStruct_80280658 *D_80284E7C;
extern s32 D_80284E88;
extern s32 D_802874E0;
extern s8 D_802874F4;
-extern s32 D_802874D4;
+extern Gfx *D_802874D4;
extern s32 D_802874FC;
extern Mat4 D_80287500;
extern s16 D_80164AF0;
diff --git a/src/code_80281780.c b/src/code_80281780.c
index ac0b980a9..3f58bf9b6 100644
--- a/src/code_80281780.c
+++ b/src/code_80281780.c
@@ -11,6 +11,8 @@
#include "code_8006E9C0.h"
#include "code_80280650.h"
#include "code_80281780.h"
+#include "code_80005FD0.h"
+#include "code_802AAA70.h"
// unk4 is buttonDown?
void func_80281780(void) {
@@ -93,13 +95,13 @@ void load_ending_sequence_royalraceway(void) {
D_800DC5EC->screenStartX = 160;
D_800DC5EC->screenStartY = 120;
gScreenModeSelection = SCREEN_MODE_1P;
- gPrevLoadedAddress = (s32) D_8015F734;
+ gNextFreeMemoryAddress = (s32) D_8015F734;
gActiveScreenMode = SCREEN_MODE_1P;
gModeSelection = GRAND_PRIX;
load_course(gCurrentCourseId);
- D_8015F730 = (s32) gPrevLoadedAddress;
- set_segment_base_addr(0xB, func_802AA88C(&_data_821D10SegmentRomStart, &_data_825800SegmentRomStart));
- set_segment_base_addr(6, func_802AA88C(&_course_banshee_boardwalk_dl_mio0SegmentRomStart, &_course_yoshi_valley_dl_mio0SegmentRomStart));
+ D_8015F730 = (s32) gNextFreeMemoryAddress;
+ set_segment_base_addr(0xB, (void *) decompress_segments(&_data_821D10SegmentRomStart, &_data_825800SegmentRomStart));
+ set_segment_base_addr(6, (void *) decompress_segments(&_course_banshee_boardwalk_dl_mio0SegmentRomStart, &_course_yoshi_valley_dl_mio0SegmentRomStart));
D_8015F8E4 = -2000.0f;
D_8015F6EA = -0x15A1;
@@ -116,7 +118,7 @@ void load_ending_sequence_royalraceway(void) {
D_8015F588 = (u16)0;
D_800DC5BC = (u16)0;
D_800DC5C8 = (u16)0;
- D_8015F580 = (s32) gPrevLoadedAddress;
+ D_8015F580 = (mk64_surface_map_ram *) gNextFreeMemoryAddress;
// @bug these segmented addresses need to be symbols for mobility
// This syntax is required to match
func_802AF5AC(0x70067E8, -1);
@@ -138,6 +140,6 @@ void load_ending_sequence_royalraceway(void) {
func_80280FB0();
func_802816B8();
func_80093E60();
- D_801625F8 = (s32) gHeapEndPtr - gPrevLoadedAddress;
+ D_801625F8 = (s32) gHeapEndPtr - gNextFreeMemoryAddress;
D_801625FC = ((f32) D_801625F8 / 1000.0f);
}
diff --git a/src/code_80281780.h b/src/code_80281780.h
index 5126e1bf3..3433a8eb1 100644
--- a/src/code_80281780.h
+++ b/src/code_80281780.h
@@ -9,9 +9,8 @@ void func_802818BC(void);
void load_ending_sequence_royalraceway(void);
-extern int func_802AA88C();
+extern int decompress_segments();
extern u32 set_segment_base_addr();
-extern void load_course();
extern void func_80093E60();
@@ -32,7 +31,7 @@ extern u16 D_800DC5BC;
extern u16 D_800DC5C8;
extern struct UnkStruct_800DC5EC *D_800DC5EC;
-extern s32 gMenuSelectionFromEndingSequence; //D_80287550;
+extern u32 gMenuSelectionFromEndingSequence; //D_80287550;
extern s32 D_80287554;
extern f32 D_801647A4;
extern f32 D_80150130[];
diff --git a/src/code_80281C40.c b/src/code_80281C40.c
index 481086a40..121bdd2d2 100644
--- a/src/code_80281C40.c
+++ b/src/code_80281C40.c
@@ -10,12 +10,13 @@
#include "code_80280650.h"
#include "code_80281C40.h"
#include "ceremony_and_credits.h"
+#include "code_8001F980.h"
void func_80281C40(void) {
s32 i;
for (i = 0; i < D_802874FC; i++) {
- func_800579F8(D_80287560[i].unk0, D_80287560[i].unk2, D_80287560[i].unk8, D_80287560[i].unk4);
+ func_800579F8(D_80287560[i].unk0, D_80287560[i].unk2, (s8 *) D_80287560[i].unk8, D_80287560[i].unk4);
}
}
@@ -30,10 +31,11 @@ void func_80281CB4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
}
void func_80281D00(void) {
- // could be a struct,
- // but for now we have the oddest way to match this function
Camera *camera = &cameras[0];
- u16 sp64[46];
+ UNUSED s32 pad[3];
+ u16 perspNorm;
+ Mat4 matrix;
+ UNUSED s32 pad2[3];
func_802A53A4();
init_rdp();
@@ -48,13 +50,13 @@ void func_80281D00(void) {
}
func_8028150C();
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective((Mtx*) &gGfxPool->mtxPool[1], &sp64[39], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp64[39]);
+ guPerspective((Mtx*) &gGfxPool->mtxPool[1], &perspNorm, D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt((Mtx*) &gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(&sp64[6]);
- func_802B4FF8(&sp64[6], 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
gSPDisplayList(gDisplayListHead++, &D_00284F70);
func_800212B4();
gSPDisplayList(gDisplayListHead++, &D_00284EE0);
diff --git a/src/code_802AAA70.c b/src/code_802AAA70.c
index 1af3aa79c..2a2d242bb 100644
--- a/src/code_802AAA70.c
+++ b/src/code_802AAA70.c
@@ -2341,7 +2341,7 @@ extern s16 D_8015F6E8;
extern s16 D_8015F6EA;
extern s16 D_8015F6F0;
extern s16 D_8015F6F2;
-extern s32 gPrevLoadedAddress;
+extern s32 gNextFreeMemoryAddress;
void func_802AF314(void) {
s32 sp4C;
@@ -2368,7 +2368,7 @@ void func_802AF314(void) {
var_v0->unk-E = 0;
} while (var_v0 != &gNumActors);
D_8015F58A = 0;
- D_8015F584 = gPrevLoadedAddress;
+ D_8015F584 = gNextFreeMemoryAddress;
var_s7 = 0;
temp_s6 = (s32) (D_8015F6E8 - D_8015F6EA) / 32;
temp_fp = (s32) (D_8015F6F0 - D_8015F6F2) / 32;
diff --git a/src/code_802AAA70.h b/src/code_802AAA70.h
index 6f838d459..c4bac8037 100644
--- a/src/code_802AAA70.h
+++ b/src/code_802AAA70.h
@@ -23,7 +23,7 @@ s32 func_802AF0FC(s16, s16, s16, s16, u16);
void func_802AF314();
void func_802AF588(s32);
void func_802AF5AC(s32, s8);
-void func_802AF5D8(u32, s8, s32);
+void func_802AF5D8(u32, s8, u16);
void func_802AF7B4(uintptr_t, s32, s32);
void func_802AF8BC(uintptr_t, s8, u8, u8, u8);
void func_802AF9F0(Vec3f, f32, Vec3f);
diff --git a/src/crash_screen.c b/src/crash_screen.c
index 72b2cad31..fa7b6cace 100644
--- a/src/crash_screen.c
+++ b/src/crash_screen.c
@@ -6,7 +6,7 @@ OSThread D_80162790;
ALIGNED8 u8 gDebugThreadStack[0x400];
OSMesgQueue D_80162D40;
OSMesg D_80162D58;
-uintptr_t pFramebuffer;
+uintptr_t *pFramebuffer;
s32 sButtonSequenceIndex;
#define DRAW_CODE 0xFFFF
@@ -219,7 +219,7 @@ void thread9_crash_screen(UNUSED void *arg0)
if (thread) {
// Run only on the first iteration.
if (sCounter == 0) {
- crash_screen_draw_square(pFramebuffer);
+ crash_screen_draw_square((u16 *)pFramebuffer);
while(1)
{
@@ -238,7 +238,7 @@ void thread9_crash_screen(UNUSED void *arg0)
break;
}
}
- crash_screen_draw_info(pFramebuffer, thread);
+ crash_screen_draw_info((u16 *) pFramebuffer, thread);
}
if (sCounter < 5) {
diff --git a/src/kart_dma.c b/src/kart_dma.c
index 8b841d40e..351e8f238 100644
--- a/src/kart_dma.c
+++ b/src/kart_dma.c
@@ -128,22 +128,22 @@ void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
if (((temp & 0x80) == 0x80) || ((temp & 0x40) == 0x40) || ((temp & 0x80000) == 0x80000) || ((temp & 0x800000) == 0x800000) || ((temp & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0)) {
if (player->unk_244[arg2] != 0) {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) || ((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000)) {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], 0x780U);
// I think there's something off with the "player->unk_0A8 >> 8"
// I don't like that right-shift
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], &D_802DFB80[arg4][arg3][arg1], 0x900, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], &D_802DFB80[arg4][arg3][arg1], 0x900, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
}
@@ -155,10 +155,10 @@ void func_80027560(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
{
if (player->unk_244[arg2] != 0) {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000))
@@ -166,28 +166,28 @@ void func_80027560(Player *player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], 0x780);
// I think there's something off with the "player->unk_0A8 >> 8"
// I don't like that right-shift
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], &D_802DFB80[arg4][arg3][arg1], 0x900, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8])], &D_802DFB80[arg4][arg3][arg1], 0x900, &gDmaMesgQueue);
} else {
osInvalDCache(&D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]])], &D_802DFB80[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
}
void func_80027A20(Player *player, s8 arg1, s8 arg2, s8 arg3) {
// Weird typecasting is being done here. We define D_802F1F80 as a 3-dimensional u32 array,
// but its better to understand it as a 3-dimensional struct_D_802F1F80 array.
- struct_D_802F1F80 *temp_s0 = &D_802F1F80[arg3][arg2][arg1 << 7];
+ struct_D_802F1F80 *temp_s0 = (struct_D_802F1F80 *) &D_802F1F80[arg3][arg2][arg1 << 7];
switch(gActiveScreenMode) {
case SCREEN_MODE_1P:
case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL:
case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL:
osInvalDCache(temp_s0, sizeof(struct_D_802F1F80));
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartPalettes[player->characterId])], temp_s0, sizeof(struct_D_802F1F80), &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartPalettes[player->characterId])], temp_s0, sizeof(struct_D_802F1F80), &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
break;
case SCREEN_MODE_3P_4P_SPLITSCREEN:
osInvalDCache(temp_s0, sizeof(struct_D_802F1F80));
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartPalettes[player->characterId])], temp_s0, sizeof(struct_D_802F1F80), &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(gKartPalettes[player->characterId])], temp_s0, sizeof(struct_D_802F1F80), &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
break;
}
@@ -195,11 +195,11 @@ void func_80027A20(Player *player, s8 arg1, s8 arg2, s8 arg3) {
void func_80027BDC(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
osInvalDCache(vAddr, size);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)], vAddr, size, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)], vAddr, size, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
void func_80027C74(UNUSED Player *player, s32 arg1, void *vAddr, u16 size) {
osInvalDCache(vAddr, size);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)], vAddr, size, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_kart_texturesSegmentRomStart[SEGMENT_OFFSET(arg1)], vAddr, size, &gDmaMesgQueue);
}
diff --git a/src/main.c b/src/main.c
index dbd24a10c..419d2b980 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
#include <ultra64.h>
#include <PR/os.h>
#include <macros.h>
+#include <functions.h>
#include "types.h"
#include "config.h"
#include "profiler.h"
@@ -19,6 +20,18 @@
#include "code_800431B0.h"
#include "code_8008C1D0.h"
#include "code_80281780.h"
+#include "audio/external.h"
+#include "code_800029B0.h"
+#include "code_80280000.h"
+#include "code_80280650.h"
+#include "code_80091750.h"
+#include "code_80057C60.h"
+#include "profiler.h"
+#include "code_80027D00.h"
+#include "code_8001F980.h"
+#include "render_courses.h"
+#include "actors.h"
+#include "staff_ghosts.h"
// Declarations (not in this file)
void func_80091B78(void);
@@ -90,7 +103,7 @@ OSContStatus gControllerStatuses[4];
OSContPad gControllerPads[4];
u8 gControllerBits;
-u8 D_8014F110[4096];
+struct UnkStruct_8015F584 D_8014F110[1024];
u16 gNumActors;
u16 D_80150112;
s32 D_80150114;
@@ -119,7 +132,7 @@ Gfx *gDisplayListHead;
struct SPTask *gGfxSPTask;
s32 D_801502A0;
s32 D_801502A4;
-uintptr_t gPhysicalFramebuffers[3];
+u32 gPhysicalFramebuffers[3];
u32 D_801502B4;
UNUSED u32 D_801502B8;
UNUSED u32 D_801502BC;
@@ -274,7 +287,7 @@ void create_gfx_task_structure(void) {
void init_controllers(void) {
osCreateMesgQueue(&gSIEventMesgQueue, &gSIEventMesgBuf[0], ARRAY_COUNT(gSIEventMesgBuf));
osSetEventMesg(OS_EVENT_SI, &gSIEventMesgQueue, (OSMesg) 0x33333333);
- osContInit(&gSIEventMesgQueue, &gControllerBits, &gControllerStatuses);
+ osContInit(&gSIEventMesgQueue, &gControllerBits, gControllerStatuses);
if ((gControllerBits & 1) == 0) {
sIsController1Unplugged = TRUE;
} else {
@@ -323,7 +336,7 @@ void read_controllers(void) {
osContStartReadData(&gSIEventMesgQueue);
osRecvMesg(&gSIEventMesgQueue, &msg, OS_MESG_BLOCK);
- osContGetReadData(&gControllerPads);
+ osContGetReadData(gControllerPads);
update_controller(0);
update_controller(1);
update_controller(2);
@@ -421,6 +434,7 @@ void config_gfx_pool(void) {
* Yields to the VI framerate twice, locking the game at 30 FPS.
* Selects the next framebuffer to be rendered and displayed.
*/
+void crash_screen_set_framebuffer(uintptr_t*);
void display_and_vsync(void) {
profiler_log_thread5_time(BEFORE_DISPLAY_LISTS);
osRecvMesg(&gGfxVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
@@ -430,7 +444,7 @@ void display_and_vsync(void) {
osViSwapBuffer((void *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[sRenderedFramebuffer]));
profiler_log_thread5_time(THREAD5_END);
osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
- crash_screen_set_framebuffer(gPhysicalFramebuffers[sRenderedFramebuffer]);
+ crash_screen_set_framebuffer((uintptr_t *) gPhysicalFramebuffers[sRenderedFramebuffer]);
if (++sRenderedFramebuffer == 3) {
sRenderedFramebuffer = 0;
}
@@ -441,33 +455,33 @@ void display_and_vsync(void) {
}
void init_seg_80280000(void) {
- bzero(SEG_80280000, 0xDF00);
+ bzero((void *) SEG_80280000, 0xDF00);
osWritebackDCacheAll();
- dma_copy(SEG_80280000, &_code_80280000SegmentRomStart, ALIGN16((u32)&_code_80280000SegmentRomEnd - (u32)&_code_80280000SegmentRomStart));
- osInvalICache(SEG_80280000, 0xDF00);
- osInvalDCache(SEG_80280000, 0xDF00);
+ dma_copy((u8 *) SEG_80280000, (u8 *) &_code_80280000SegmentRomStart, ALIGN16((u32)&_code_80280000SegmentRomEnd - (u32)&_code_80280000SegmentRomStart));
+ osInvalICache((void *) SEG_80280000, 0xDF00);
+ osInvalDCache((void *) SEG_80280000, 0xDF00);
}
void init_seg_8028DF00(void) {
- bzero(SEG_8028DF00, 0x2C470);
+ bzero((void *) SEG_8028DF00, 0x2C470);
osWritebackDCacheAll();
- dma_copy(SEG_8028DF00, &_code_8028DF00SegmentRomStart, ALIGN16((u32)&_code_8028DF00SegmentRomEnd - (u32)&_code_8028DF00SegmentRomStart));
- osInvalICache(SEG_8028DF00, 0x2C470);
- osInvalDCache(SEG_8028DF00, 0x2C470);
+ dma_copy((u8 *) SEG_8028DF00, (u8 *) &_code_8028DF00SegmentRomStart, ALIGN16((u32)&_code_8028DF00SegmentRomEnd - (u32)&_code_8028DF00SegmentRomStart));
+ osInvalICache((void *) SEG_8028DF00, 0x2C470);
+ osInvalDCache((void *) SEG_8028DF00, 0x2C470);
}
-void dma_copy(u8 *dest, u8 *arg1, u32 size) {
+void dma_copy(u8 *dest, u8 *romAddr, u32 size) {
osInvalDCache(dest, size);
while(size > 0x100) {
- osPiStartDma(&gDmaIoMesg, 0, 0, arg1, dest, 0x100, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) romAddr, dest, 0x100, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
size -= 0x100;
- arg1 += 0x100;
+ romAddr += 0x100;
dest += 0x100;
}
if (size != 0) {
- osPiStartDma(&gDmaIoMesg, 0, 0, arg1, dest, size, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) romAddr, dest, size, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
}
}
@@ -479,33 +493,33 @@ void setup_game_memory(void) {
UNUSED u32 pad[2];
u32 sp2C;
u32 sp40;
- s32 texture_seg;
- s32 sp38;
+ uintptr_t texture_seg;
+ u32 sp38;
UNUSED s32 unknown_padding;
init_seg_8028DF00();
gHeapEndPtr = SEG_8028DF00;
- set_segment_base_addr(0, 0x80000000);
- func_802A7CF0(&D_801978D0, 0x80242F00);
+ set_segment_base_addr(0, (void *) SEG_START);
+ initialize_memory_pool((uintptr_t) &D_801978D0, (uintptr_t) 0x80242F00);
func_80000BEC();
- osInvalDCache(SEG_802BA370, 0x5810);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_data_802BA370SegmentRomStart, SEG_802BA370, 0x5810, &gDmaMesgQueue);
+ osInvalDCache((void *) SEG_802BA370, 0x5810);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_data_802BA370SegmentRomStart, (void *) SEG_802BA370, 0x5810, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
- set_segment_base_addr(2, func_802A7D70(&_data_segment2SegmentRomStart, &_data_segment2SegmentRomEnd));
+ set_segment_base_addr(2, (void *) load_data((uintptr_t) &_data_segment2SegmentRomStart, (uintptr_t) &_data_segment2SegmentRomEnd));
sp2C = (u32)&_common_texturesSegmentRomEnd - (u32)&_common_texturesSegmentRomStart;
sp2C = ALIGN16(sp2C);
texture_seg = SEG_8028DF00-sp2C;
- osPiStartDma(&gDmaIoMesg, 0, 0, &_common_texturesSegmentRomStart, texture_seg, sp2C, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_common_texturesSegmentRomStart, (void *) texture_seg, sp2C, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
sp40 = *(u32 *)(texture_seg + 4);
sp40 = ALIGN16(sp40);
- sp38 = gPrevLoadedAddress;
- mio0decode(texture_seg, sp38);
- set_segment_base_addr(0xD, sp38);
+ sp38 = gNextFreeMemoryAddress;
+ mio0decode((u8 *) texture_seg, (u8 *) sp38);
+ set_segment_base_addr(0xD, (void *) sp38);
- gPrevLoadedAddress += sp40;
- D_8015F734 = gPrevLoadedAddress;
+ gNextFreeMemoryAddress += sp40;
+ D_8015F734 = gNextFreeMemoryAddress;
}
/**
@@ -519,9 +533,7 @@ void game_init_clear_framebuffer(void) {
void race_logic_loop(void) {
s16 i;
- s32 pad;
u16 rotY;
- f32 pad2 = 0;
D_80150112 = 0;
D_80164AF0 = 0;
@@ -833,7 +845,7 @@ void game_state_handler(void) {
update_menus();
init_rcp();
// gGfxPool->mtxPool->m or gGfxPool?
- func_80094A64(gGfxPool->mtxPool->m);
+ func_80094A64((Mtx *) gGfxPool->mtxPool->m);
break;
case RACING:
race_logic_loop();
@@ -855,7 +867,7 @@ void interrupt_gfx_sptask(void) {
}
void receive_new_tasks(void) {
- s32 pad;
+ UNUSED s32 pad;
struct SPTask *spTask;
while(osRecvMesg(&gSPTaskMesgQueue, (OSMesg *) &spTask, OS_MESG_NOBLOCK) != -1) {
@@ -959,7 +971,7 @@ void handle_sp_complete(void) {
// handle_vblank tried to start an audio task while there was already a
// gfx task running, so it had to interrupt the gfx task. That interruption
// just finished.
- if (osSpTaskYielded(curSPTask) == 0) {
+ if (osSpTaskYielded((OSTask *) curSPTask) == 0) {
// The gfx task completed before we had time to interrupt it.
// Mark it finished, just like below.
curSPTask->state = SPTASK_STATE_FINISHED;
@@ -998,13 +1010,14 @@ void thread3_video(UNUSED void *arg0) {
s32 i;
u64 *framebuffer1;
OSMesg msg;
- s32 pad[4];
+ UNUSED s32 pad[4];
- gPhysicalFramebuffers[0] = (uintptr_t *) &gFramebuffer0;
- gPhysicalFramebuffers[1] = (uintptr_t *) &gFramebuffer1;
- gPhysicalFramebuffers[2] = (uintptr_t *) &gFramebuffer2;
+ gPhysicalFramebuffers[0] = (u32) &gFramebuffer0;
+ gPhysicalFramebuffers[1] = (u32) &gFramebuffer1;
+ gPhysicalFramebuffers[2] = (u32) &gFramebuffer2;
- framebuffer1 = &gFramebuffer1;
+ // Clear framebuffer.
+ framebuffer1 = (u64 *) &gFramebuffer1;
for (i = 0; i < 19200; i++) {
framebuffer1[i] = 0;
}
@@ -1103,7 +1116,7 @@ void update_gamestate(void) {
}
void thread5_game_loop(UNUSED void *arg) {
- osCreateMesgQueue(&gGfxVblankQueue, &gGfxMesgBuf, 1);
+ osCreateMesgQueue(&gGfxVblankQueue, gGfxMesgBuf, 1);
osCreateMesgQueue(&gGameVblankQueue, &gGameMesgBuf, 1);
init_controllers();
if (!wasSoftReset) {
@@ -1145,7 +1158,7 @@ void thread5_game_loop(UNUSED void *arg) {
void thread4_audio(UNUSED void *arg) {
UNUSED u32 unused[3];
audio_init();
- osCreateMesgQueue(&sSoundMesgQueue, &sSoundMesgBuf, ARRAY_COUNT(sSoundMesgBuf));
+ osCreateMesgQueue(&sSoundMesgQueue, sSoundMesgBuf, ARRAY_COUNT(sSoundMesgBuf));
set_vblank_handler(1, &sSoundVblankHandler, &sSoundMesgQueue, (OSMesg) 512);
while (TRUE) {
diff --git a/src/main.h b/src/main.h
index adc737900..11f78a4d7 100644
--- a/src/main.h
+++ b/src/main.h
@@ -18,6 +18,11 @@ struct GfxPool {
/* 0x28B20 */ struct SPTask spTask;
}; // size = 0x28B70
+struct UnkStruct_8015F584 {
+ u16 unk0;
+ u16 unk2;
+};
+
void create_thread(OSThread*, OSId, void (*entry)(void *), void*, void*, OSPri);
void main_func();
void thread1_idle(void*);
@@ -62,7 +67,11 @@ void thread4_audio(void*);
extern struct GfxPool *gGfxPool;
extern Gfx *gDisplayListHead;
extern struct Controller gControllers[8];
+extern struct Controller *gControllerOne;
+extern s32 D_800DC568;
+extern s32 D_800DC56C[];
+extern u32 gPhysicalFramebuffers[];
extern OSIoMesg gDmaIoMesg;
extern OSMesg gMainReceivedMesg;
extern OSMesgQueue gDmaMesgQueue;
@@ -89,7 +98,7 @@ extern u64 gspF3DLXDataStart[];
extern u64 gGfxSPTaskOutputBuffer[];
extern u32 gGfxSPTaskOutputBufferSize;
-extern u32 gPrevLoadedAddress;
+extern u32 gNextFreeMemoryAddress;
extern s32 D_8015F734;
extern u8 _data_segment2SegmentRomStart[];
extern u8 _data_segment2SegmentRomEnd[];
diff --git a/src/math_util.c b/src/math_util.c
index 185d9ecb2..8c8cf9abe 100644
--- a/src/math_util.c
+++ b/src/math_util.c
@@ -610,7 +610,7 @@ void func_802B6434(Vec3f arg0, Mat4 arg1) {
arg0[2] = temp_f6;
}
-UNUSED void func_802B64B0(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
+UNUSED void func_802B64B0(UNUSED s32 arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3) {
}
@@ -936,7 +936,7 @@ void func_802B71CC(Mat4 arg0, Mat4 arg1, Mat4 arg2) {
product[3][1] = (arg1[3][0] * arg2[0][1]) + (arg1[3][1] * arg2[1][1]) + (arg1[3][2] * arg2[2][1]) + (arg1[3][3] * arg2[3][1]);
product[3][2] = (arg1[3][0] * arg2[0][2]) + (arg1[3][1] * arg2[1][2]) + (arg1[3][2] * arg2[2][2]) + (arg1[3][3] * arg2[3][2]);
product[3][3] = (arg1[3][0] * arg2[0][3]) + (arg1[3][1] * arg2[1][3]) + (arg1[3][2] * arg2[2][3]) + (arg1[3][3] * arg2[3][3]);
- func_802B5398(arg0, product, 0x10);
+ func_802B5398((s32 *)arg0, (s32 *)product, 0x10);
}
#ifdef MIPS_TO_C
diff --git a/src/math_util.h b/src/math_util.h
index 738857877..c24c9385b 100644
--- a/src/math_util.h
+++ b/src/math_util.h
@@ -36,7 +36,7 @@ void func_802B5A44(Mat4, s16);
void func_802B5AAC(Mat4, s16);
void func_802B5CAC(s16, s16, Vec3f);
void func_802B5D30(s16, s16, s32);
-void func_802B5D64(u32, s16, s32, s32);
+void func_802B5D64(uintptr_t, s16, s32, s32);
void func_802B5F00(Mat4, f32);
void func_802B5F74(Mat4, Vec3f, Vec3s);
void func_802B60B4(Mat4, Vec3s, Vec3s);
diff --git a/src/math_util_2.c b/src/math_util_2.c
index f84876bf5..d873eb1b2 100644
--- a/src/math_util_2.c
+++ b/src/math_util_2.c
@@ -9,6 +9,7 @@
#include "memory.h"
#include "code_802AAA70.h"
+#include "code_8001F980.h"
#pragma intrinsic (sqrtf)
@@ -334,11 +335,11 @@ void func_80041480(s16 *arg0, s16 arg1, s16 arg2, s16 *arg3) {
}
}
-s32 vec3f_set_dupe_2_electric_boogaloo(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
+Vec3f *vec3f_set_dupe_2_electric_boogaloo(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
arg0[0] = arg1;
arg0[1] = arg2;
arg0[2] = arg3;
- return &arg0;
+ return (Vec3f *) &arg0;
}
Vec3f *func_80041530(Vec3f dest) {
@@ -347,7 +348,7 @@ Vec3f *func_80041530(Vec3f dest) {
dest[0] = dest[0] * invsqrt;
dest[1] = dest[1] * invsqrt;
dest[2] = dest[2] * invsqrt;
- return &dest;
+ return (Vec3f *) &dest;
}
Vec3f *func_80041594(Vec3f arg0, Vec3f arg1, Vec3f arg2) {
@@ -356,7 +357,7 @@ Vec3f *func_80041594(Vec3f arg0, Vec3f arg1, Vec3f arg2) {
arg0[1] = (arg1[2] * arg2[0]) - (arg2[2] * arg1[0]);
arg0[2] = (arg1[0] * arg2[1]) - (arg2[0] * arg1[1]);
- return &arg0;
+ return (Vec3f *) &arg0;
}
UNUSED s32 func_80041608(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
@@ -473,7 +474,7 @@ void func_800419F8(void) {
D_80165840[2] = sp24[2];
}
-UNUSED func_80041A70(void) {
+UNUSED void func_80041A70(void) {
}
@@ -601,7 +602,7 @@ extern s8 D_801658FE;
extern Mtx D_80183D60[];
void func_80041D34(void) {
- guOrtho(&D_80183D60, 0.0f, 320.0f, 240.0f, 0.0f, -1.0f, 1.0f, 1.0f);
+ guOrtho((Mtx *)D_80183D60, 0.0f, 320.0f, 240.0f, 0.0f, -1.0f, 1.0f, 1.0f);
switch (gActiveScreenMode) {
case SCREEN_MODE_1P:
guOrtho(&gGfxPool->mtxPool[5], 0.0f, 320.0f, 240.0f, 0.0f, -1.0f, 1.0f, 1.0f);
@@ -645,7 +646,7 @@ UNUSED void func_80042000(u16 arg0) {
Mat4 matrix;
func_80041AD8(matrix, arg0);
- func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], &matrix);
+ func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
D_8018D120++;
diff --git a/src/math_util_2.h b/src/math_util_2.h
index 294200ee9..cf433c4bc 100644
--- a/src/math_util_2.h
+++ b/src/math_util_2.h
@@ -48,7 +48,7 @@ s32 u16_step_down_towards(u16*, s32, s32);
s32 s16_step_towards(s16*, s16, s16);
s32 f32_step_towards(f32*, f32, f32);
void func_80041480(s16*, s16, s16, s16*);
-s32 vec3f_set_dupe_2_electric_boogaloo(Vec3f, f32, f32, f32);
+Vec3f *vec3f_set_dupe_2_electric_boogaloo(Vec3f, f32, f32, f32);
Vec3f *func_80041530(Vec3f dest);
Vec3f *func_80041594(Vec3f, Vec3f, Vec3f);
s32 func_80041658(f32, f32);
@@ -66,7 +66,7 @@ void func_80041AD8(Mat4, u16);
void func_80041B68(Mat4, f32);
void func_80041BBC(Mat4, u16, f32);
void func_80041C64(Mat4, s32, s32, u16, f32);
-void func_80041D24();
+void func_80041D24(void);
void func_80041D34();
void func_80041EF4();
void func_80042330(s32, s32, u16, f32);
diff --git a/src/memory.c b/src/memory.c
index 8775f3303..add9cd044 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -1,24 +1,17 @@
#include <ultra64.h>
#include <PR/ultratypes.h>
#include <macros.h>
-#include "types.h"
-
-// Includes from SM64
-//#include "buffers/buffers.h"
-//#include "decompress.h"
-//#include "game_init.h"
+#include <types.h>
+#include <common_structs.h>
+#include <variables.h>
+#include <segments.h>
#include "main.h"
#include "memory.h"
-#include "variables.h"
-#include "common_structs.h"
#include "math_util.h"
-//#include "segment_symbols.h"
-#include "segments.h"
-
+s32 sGfxSeekPosition;
+s32 sPackedSeekPosition;
-s32 D_802BA270;
-s32 D_802BA274;
u32 sPoolFreeSpace;
struct MainPoolBlock *sPoolListHeadL;
struct MainPoolBlock *sPoolListHeadR;
@@ -30,19 +23,39 @@ struct UnkStruct_802B8CD4 D_802B8CD4[] = {
};
s32 D_802B8CE4 = 0; // pad
-s32 func_802A7B70(s32 segment) {
- s32 old;
- old = gPrevLoadedAddress;
- segment = ALIGN16(segment);
- gPrevLoadedAddress += segment;
- return old;
+/**
+ * @brief Returns the address of the next available memory location and updates the memory pointer
+ * to reference the next location of available memory based provided size to allocate.
+ * @param size of memory to allocate.
+ * @return Address of free memory
+ */
+u32 *get_next_available_memory_addr(u32 size) {
+ u32 *freeSpace = (u32 *)gNextFreeMemoryAddress;
+ size = ALIGN16(size);
+ gNextFreeMemoryAddress += size;
+ return freeSpace;
}
+/**
+ * @brief Stores the physical memory addr for segmented memory in `gSegmentTable` using the segment number as an index.
+ *
+ * This function takes a segment number and a pointer to a memory address, and stores the address in the `gSegmentTable` array
+ * at the specified segment index. The stored address is truncated to a 29-bit value to ensure that it fits within the
+ * memory address. This allows converting between segmented memory and physical memory.
+ *
+ * @param segment A segment number from 0x0 to 0xF to set the base address.
+ * @param addr A pointer containing the physical memory address of the data.
+ * @return The stored base address, truncated to a 29-bit value.
+ */
uintptr_t set_segment_base_addr(s32 segment, void *addr) {
gSegmentTable[segment] = (uintptr_t) addr & 0x1FFFFFFF;
return gSegmentTable[segment];
}
+/**
+ * @brief Returns the physical memory location of a segment.
+ * @param permits segment numbers from 0x0 to 0xF.
+*/
void *get_segment_base_addr(s32 segment) {
return (void *) (gSegmentTable[segment] | 0x80000000);
}
@@ -65,24 +78,33 @@ void move_segment_table_to_dmem(void) {
}
}
-void func_802A7CF0(s32 start, s32 end) {
-
- start = ALIGN16(start);
- end &= ~0xF;
-
- D_8015F724 = (end - start) - 0x10;
- gPrevLoadedAddress = start;
+/**
+ * @brief Sets the starting location for allocating memory and calculates pool size.
+ *
+ * Default memory size, 701.984 Kilobytes.
+*/
+void initialize_memory_pool(uintptr_t poolStart, uintptr_t poolEnd) {
+
+ poolStart = ALIGN16(poolStart);
+ // Truncate to a 16-byte boundary.
+ poolEnd &= ~0xF;
+
+ gFreeMemorySize = (poolEnd - poolStart) - 0x10;
+ gNextFreeMemoryAddress = poolStart;
}
-s32 func_802A7D1C(s32 arg0) {
- s32 addr;
+/**
+ * @brief Allocates memory and adjusts gFreeMemorySize.
+*/
+void *allocate_memory(u32 size) {
+ u32 *freeSpace;
- arg0 = ALIGN16(arg0);
- D_8015F724 -= arg0;
- addr = gPrevLoadedAddress;
- gPrevLoadedAddress += arg0;
+ size = ALIGN16(size);
+ gFreeMemorySize -= size;
+ freeSpace = (u32 *) gNextFreeMemoryAddress;
+ gNextFreeMemoryAddress += size;
- return addr;
+ return (void *) freeSpace;
}
UNUSED void func_802A7D54(s32 arg0, s32 arg1) {
@@ -90,15 +112,18 @@ UNUSED void func_802A7D54(s32 arg0, s32 arg1) {
gD_80150158[arg0].unk8 = arg1;
}
-s32 func_802A7D70(s32 arg0, s32 arg1) {
- s32 temp_v0;
- s32 temp_a2 = arg1 - arg0;
-
- temp_v0 = func_802A7D1C(temp_a2);
- if (temp_v0 != 0) {
- dma_copy(temp_v0, arg0, temp_a2);
+/**
+ * @brief Allocate and DMA.
+*/
+void *load_data(uintptr_t startAddr, uintptr_t endAddr) {
+ void *allocated;
+ u32 size = endAddr - startAddr;
+
+ allocated = allocate_memory(size);
+ if (allocated != 0) {
+ dma_copy((u8 *)allocated, (u8 *)startAddr, size);
}
- return temp_v0;
+ return (void *) allocated;
}
UNUSED void main_pool_init(u32 start, u32 end) {
@@ -120,7 +145,7 @@ UNUSED void main_pool_init(u32 start, u32 end) {
* specified side of the pool (MEMORY_POOL_LEFT or MEMORY_POOL_RIGHT).
* If there is not enough space, return NULL.
*/
-void *main_pool_alloc(u32 size, u32 side) {
+UNUSED void *main_pool_alloc(u32 size, u32 side) {
struct MainPoolBlock *newListHead;
void *addr = NULL;
@@ -149,7 +174,7 @@ void *main_pool_alloc(u32 size, u32 side) {
* newer blocks are freed as well.
* Return the amount of free space left in the pool.
*/
-u32 main_pool_free(void *addr) {
+UNUSED u32 main_pool_free(void *addr) {
struct MainPoolBlock *block = (struct MainPoolBlock *) ((u8 *) addr - 8);
struct MainPoolBlock *oldListHead = (struct MainPoolBlock *) ((u8 *) addr - 8);
@@ -212,15 +237,15 @@ UNUSED u32 main_pool_pop_state(void) {
return sPoolFreeSpace;
}
// similar to sm64 dma_read
-void *func_802A80B0(u8 *dest, u8 *srcStart, u8 *srcEnd) {
- u32 addr;
+UNUSED void *func_802A80B0(u8 *dest, u8 *srcStart, u8 *srcEnd) {
+ void *addr;
u32 size = srcStart - dest;
- addr = main_pool_alloc(size, srcEnd);
+ addr = main_pool_alloc(size, (u32) srcEnd);
if (addr != 0) {
osInvalDCache(addr, size);
- osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, dest, addr, size,
+ osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) dest, addr, size,
&gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
@@ -228,7 +253,7 @@ void *func_802A80B0(u8 *dest, u8 *srcStart, u8 *srcEnd) {
}
// replaces call to dynamic_dma_read with dma_read.
-UNUSED void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side) {
+UNUSED void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u8 *side) {
void *addr = func_802A80B0(srcStart, srcEnd, side);
if (addr != NULL) {
@@ -238,30 +263,28 @@ UNUSED void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side) {
}
// Similar to sm64 load_to_fixed_pool_addr?
-UNUSED void *func_802A8190(s32 arg0, s32 arg1) {
+UNUSED void *func_802A8190(s32 arg0, u8 *arg1) {
//u32 srcSize = ALIGN16(srcEnd - srcStart);
//u32 destSize = ALIGN16((u8 *) sPoolListHeadR - destAddr);
- u32 addr;
+ void *addr;
u32 temp_v0 = D_802B8CD4[arg0].unk4;
u32 temp_v1 = D_802B8CD4[arg0].unk8;
u32 temp_v2 = D_802B8CD4[arg0].unk2;
- addr = func_802A80B0(temp_v0, temp_v1, arg1);
+ addr = func_802A80B0((u8 *) temp_v0, (u8 *) temp_v1, arg1);
//dest = main_pool_alloc(destSize, MEMORY_POOL_RIGHT);
if (addr != 0) {
-
set_segment_base_addr(temp_v2, addr);
}
- return addr;
+ return (void *) addr;
}
UNUSED void func_802A81EC(void) {
- u32 addr;
s32 temp_s0;
s16 *phi_s1;
s32 phi_s0;
- phi_s1 = &D_802B8CD4;
+ phi_s1 = (s16 *) &D_802B8CD4;
phi_s0 = 0;
do {
if ((*phi_s1 & 1) != 0) {
@@ -282,7 +305,7 @@ UNUSED struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side) {
if (addr != NULL) {
subPool = (struct AllocOnlyPool *) addr;
subPool->totalSpace = size;
- subPool->usedSpace = (u8 *) addr + sizeof(struct AllocOnlyPool);
+ subPool->usedSpace = (s32) addr + sizeof(struct AllocOnlyPool);
subPool->startPtr = 0;
subPool->freePtr = (u8 *) addr + sizeof(struct AllocOnlyPool);
}
@@ -302,1055 +325,1016 @@ UNUSED u32 func_802A82AC(s32 arg0) {
return phi_v1;
}
-s32 func_802A82E4(u8 *start, u8 *end) {
- s32 dest;
+/**
+ * @brief Returns pointer to mio0 compressed Vtx.
+ */
+u8 *dma_compressed_vtx(u8 *start, u8 *end) {
+ u8 *freeSpace;
u32 size;
size = ALIGN16(end - start);
- dest = gPrevLoadedAddress;
- dma_copy(dest, start, size);
- gPrevLoadedAddress += size;
- return dest;
+ freeSpace = (u8 *) gNextFreeMemoryAddress;
+ dma_copy(freeSpace, start, size);
+ gNextFreeMemoryAddress += size;
+ return freeSpace;
}
// unused mio0 decode func.
UNUSED s32 func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
- s32 offset;
- UNUSED s32 *pad;
- s32 oldAddr;
- s32 newAddr;
+ u32 offset;
+ UNUSED void *pad;
+ uintptr_t oldAddr;
+ void *newAddr;
offset = ALIGN16(arg1 * arg2);
- oldAddr = gPrevLoadedAddress;
- newAddr = oldAddr + offset;
+ oldAddr = gNextFreeMemoryAddress;
+ newAddr = (void *) (oldAddr + offset);
pad = &newAddr;
osInvalDCache(newAddr, offset);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_other_texturesSegmentRomStart[arg0 & 0xFFFFFF], newAddr, offset, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], newAddr, offset, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
- func_80040030(newAddr, oldAddr);
- gPrevLoadedAddress += offset;
+ func_80040030((u8 *) newAddr, (u8 *) oldAddr);
+ gNextFreeMemoryAddress += offset;
return oldAddr;
}
-UNUSED s32 func_802A841C(s32 arg0, s32 arg1, s32 arg2) {
- s32 temp_v0;
- s32 temp_a0;
- temp_v0 = gPrevLoadedAddress;
+UNUSED u8 *func_802A841C(u8* arg0, s32 arg1, s32 arg2) {
+ u8 *temp_v0;
+ void *temp_a0;
+ temp_v0 = (u8 *) gNextFreeMemoryAddress;
temp_a0 = temp_v0 + arg2;
arg1 = ALIGN16(arg1);
arg2 = ALIGN16(arg2);
osInvalDCache(temp_a0, arg1);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_other_texturesSegmentRomStart[arg0 & 0xFFFFFF],temp_a0, arg1, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)],temp_a0, arg1, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
- func_80040030(temp_a0, temp_v0);
- gPrevLoadedAddress += arg2;
+ func_80040030((u8 *) temp_a0, temp_v0);
+ gNextFreeMemoryAddress += arg2;
return temp_v0;
}
-s32 func_802A84F4(s32 arg0, u32 arg1, u32 arg2) {
+u8 *dma_textures(u8 *arg0, u32 arg1, u32 arg2) {
u8 *temp_v0;
- u32 temp_a0;
+ void *temp_a0;
- temp_v0 = gPrevLoadedAddress;
+ temp_v0 = (u8 *) gNextFreeMemoryAddress;
temp_a0 = temp_v0 + arg2;
arg1 = ALIGN16(arg1);
arg2 = ALIGN16(arg2);
- osInvalDCache(temp_a0, arg1);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_other_texturesSegmentRomStart[arg0 & 0xFFFFFF], temp_a0, arg1, &gDmaMesgQueue);
+ osInvalDCache((void *) temp_a0, arg1);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], (void *)temp_a0, arg1, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, (int) 1);
- mio0decode(temp_a0, temp_v0);
- gPrevLoadedAddress += arg2;
+ mio0decode((u8 *) temp_a0, temp_v0);
+ gNextFreeMemoryAddress += arg2;
return temp_v0;
}
-u32 MIO0_0F(s32 arg0, u32 arg1, u32 arg2) {
+u32 MIO0_0F(u8 *arg0, u32 arg1, u32 arg2) {
u32 oldHeapEndPtr;
- u8 *temp_v0;
- u32 temp_a0;
+ void *temp_v0;
arg1 = ALIGN16(arg1);
arg2 = ALIGN16(arg2);
oldHeapEndPtr = gHeapEndPtr;
- temp_v0 = gPrevLoadedAddress;
+ temp_v0 = (void *) gNextFreeMemoryAddress;
osInvalDCache(temp_v0, arg1);
- osPiStartDma(&gDmaIoMesg, 0, 0, &_other_texturesSegmentRomStart[arg0 & 0xFFFFFF], temp_v0, arg1, &gDmaMesgQueue);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], temp_v0, arg1, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
- mio0decode(temp_v0, oldHeapEndPtr);
+ mio0decode((u8 *) temp_v0, (u8 *) oldHeapEndPtr);
gHeapEndPtr += arg2;
return oldHeapEndPtr;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-extern f32 D_800DC608;
-extern s16 *gHeapEndPtr;
-
-void func_802A86A8(mk64_Vtx *arg0, u32 arg1) {
- f32 temp_f6;
- mk64_Vtx *var_v0;
- s16 *var_v1;
+void func_802A86A8(mk64_Vtx *data, u32 arg1) {
+ mk64_Vtx_n *vtx_n = (mk64_Vtx_n *) data;
+ Vtx *vtx;
+ s32 tmp = ALIGN16(arg1 * 0x10);
+ s32 i;
s8 temp_a0;
s8 temp_a3;
- u32 var_a2;
-
- var_v1 = gHeapEndPtr - (((arg1 * 0x10) + 0xF) & ~0xF);
- var_v0 = arg0;
- gHeapEndPtr = var_v1;
- var_a2 = 0;
- if (arg1 != 0) {
- do {
- if (gIsMirrorMode != 0) {
- *var_v1 = -var_v0->ob[0];
+ s8 flags;
+
+ gHeapEndPtr -= tmp;
+ vtx = (Vtx *) gHeapEndPtr;
+
+ for (i = 0; i < arg1; i++) {
+ if (gIsMirrorMode) {
+ vtx->n.ob[0] = -vtx_n->ob[0];
} else {
- *var_v1 = var_v0->ob[0];
+ vtx->n.ob[0] = vtx_n->ob[0];
}
- var_a2 += 1;
- var_v1 += 0x10;
- temp_f6 = (f32) var_v0->ob[1];
- var_v0 += 0xE;
- var_v1->unk-E = (s16) (s32) (temp_f6 * D_800DC608);
- temp_a0 = var_v0->unk-4;
- temp_a3 = var_v0->unk-3;
- var_v1->unk-C = (s16) var_v0->unk-A;
- var_v1->unk-8 = (s16) var_v0->unk-8;
- var_v1->unk-4 = (s8) (temp_a0 & 0xFC);
- var_v1->unk-3 = (s8) (temp_a3 & 0xFC);
- var_v1->unk-6 = (s16) var_v0->unk-6;
- var_v1->unk-2 = (s8) var_v0->unk-2;
- var_v1->unk-A = (s16) (s8) ((temp_a0 & 3) | ((temp_a3 * 4) & 0xC));
- var_v1->unk-1 = 0xFF;
- } while (var_a2 < arg1);
- }
+
+ vtx->n.ob[1] = (vtx_n->ob[1] * vtxStretchY);
+ temp_a0 = vtx_n->n[0];
+ temp_a3 = vtx_n->n[1];
+
+ flags = temp_a0 & 3;
+ flags |= (temp_a3 * 4) & 0xC;
+
+ vtx->n.ob[2] = vtx_n->ob[2];
+ vtx->n.tc[0] = vtx_n->tc[0];
+ vtx->n.tc[1] = vtx_n->tc[1];
+ vtx->n.n[0] = (temp_a0 & 0xFC);
+ vtx->n.n[1] = (temp_a3 & 0xFC);
+ vtx->n.n[2] = vtx_n->n[2];
+ vtx->n.flag = flags;
+ vtx->n.a = 0xFF;
+ vtx++;
+ vtx_n++;
+ }
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A86A8.s")
-#endif
-void func_802A87A8(s32 arg0, u32 vertexCount) {
- s32 pad;
+void decompress_vtx(u8 *arg0, u32 vertexCount) {
+ s32 size = ALIGN16(vertexCount * 0x18);
u32 segment = SEGMENT_NUMBER2(arg0);
u32 offset = SEGMENT_OFFSET(arg0);
- s32 old;
- s32 addr = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
- s32 temp_v0 = ALIGN16(vertexCount * 0x18);
+ void *freeSpace;
+ u8 *vtxCompressed = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
+ UNUSED s32 pad;
- old = gPrevLoadedAddress;
- gPrevLoadedAddress += temp_v0;
+ freeSpace = (void *) gNextFreeMemoryAddress;
+ gNextFreeMemoryAddress += size;
- mio0decode(addr, old);
- func_802A86A8(old, vertexCount);
- set_segment_base_addr(4, gHeapEndPtr);
+ mio0decode(vtxCompressed, (u8 *) freeSpace);
+ func_802A86A8((mk64_Vtx *) freeSpace, vertexCount);
+ set_segment_base_addr(4, (void *) gHeapEndPtr);
}
UNUSED void func_802A8844(void) {
}
-void func_802A884C(Gfx *arg0, u8 arg1, s8 arg2) {
- s32 pad;
+void unpack_lights(Gfx *arg0, UNUSED u8 *arg1, s8 arg2) {
+ UNUSED s32 pad;
s32 a = (arg2 * 0x18) + 0x9000008;
s32 b = (arg2 * 0x18) + 0x9000000;
Gfx macro[] = {gsSPNumLights(NUMLIGHTS_1)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
- D_802BA270++;
- arg0[D_802BA270].words.w0 = 0x3860010;
+ sGfxSeekPosition++;
+ arg0[sGfxSeekPosition].words.w0 = 0x3860010;
- arg0[D_802BA270].words.w1 = a;
+ arg0[sGfxSeekPosition].words.w1 = a;
- D_802BA270++;
- arg0[D_802BA270].words.w0 = 0x3880010;
- arg0[D_802BA270].words.w1 = b;
- D_802BA270++;
+ sGfxSeekPosition++;
+ arg0[sGfxSeekPosition].words.w0 = 0x3880010;
+ arg0[sGfxSeekPosition].words.w1 = b;
+ sGfxSeekPosition++;
}
-void func_802A8940(Gfx *arg0, u8 *arg1, u8 arg2) {
-
- u32 temp_v0 = arg1[D_802BA274++];
- u32 temp_t7 = ((arg1[D_802BA274++]) << 8 | temp_v0) * 8;
- arg0[D_802BA270].words.w0 = 0x6000000;
- arg0[D_802BA270].words.w1 = 0x7000000 + temp_t7;
- D_802BA270++;
+void unpack_displaylist(Gfx *arg0, u8 *args, UNUSED s8 opcode) {
+ u32 temp_v0 = args[sPackedSeekPosition++];
+ uintptr_t temp_t7 = ((args[sPackedSeekPosition++]) << 8 | temp_v0) * 8;
+ arg0[sGfxSeekPosition].words.w0 = 0x06000000;
+ // Segment seven addr
+ arg0[sGfxSeekPosition].words.w1 = 0x07000000 + temp_t7;
+ sGfxSeekPosition++;
}
-// end display list
-void func_802A89C0(Gfx *arg0, u8 arg1, u8 arg2) {
- arg0[D_802BA270].words.w0 = G_ENDDL << 24;
- arg0[D_802BA270].words.w1 = 0;
- D_802BA270++;
+// end displaylist
+void unpack_end_displaylist(Gfx *arg0, UNUSED u8 *arg1, UNUSED s8 arg2) {
+ arg0[sGfxSeekPosition].words.w0 = G_ENDDL << 24;
+ arg0[sGfxSeekPosition].words.w1 = 0;
+ sGfxSeekPosition++;
}
-void func_802A8A04(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_set_geometry_mode(Gfx *arg0, UNUSED u8 *arg1, UNUSED s8 arg2) {
Gfx macro[] = {gsSPSetGeometryMode(G_CULL_BACK)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8A70(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_clear_geometry_mode(Gfx *arg0, UNUSED u8 *arg1, UNUSED s8 arg2) {
Gfx macro[] = {gsSPClearGeometryMode(G_CULL_BACK)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8ADC(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_cull_displaylist(Gfx *arg0, UNUSED u8 *arg1, UNUSED s8 arg2) {
Gfx macro[] = {gsSPCullDisplayList(0, 160)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8B48(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_combine_mode1(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_MODULATERGBA, G_CC_MODULATERGBA)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8BB4(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_combine_mode2(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_MODULATERGBDECALA, G_CC_MODULATERGBDECALA)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8C20(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_combine_mode_shade(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8C8C(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_combine_mode4(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_MODULATERGBDECALA, G_CC_MODULATERGBDECALA)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8CF8(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_combine_mode5(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8D64(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_render_mode_opaque(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8DD0(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_render_mode_tex_edge(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8E3C(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_render_mode_translucent(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8EA8(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_render_mode_opaque_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_OPA_DECAL, G_RM_AA_ZB_OPA_DECAL)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A8F14(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_render_mode_translucent_decal(Gfx *arg0, UNUSED u8 *arg1, UNUSED u32 arg2) {
Gfx macro[] = {gsDPSetRenderMode(G_RM_AA_ZB_XLU_DECAL, G_RM_AA_ZB_XLU_DECAL)};
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-Gfx D_802B8D58[] = {gsDPTileSync()};
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A8F80(Gfx *displayList, s32 arg1, s8 arg2) {
- u32 sp58;
- s32 sp48;
- s32 sp44;
- s32 sp40;
- s32 temp_t5;
- s32 temp_t9;
- s32 var_v0;
- s32 var_v1;
- u8 temp_a0;
- u8 temp_a0_2;
-
- sp58.unk0 = D_802B8D58->words.w0;
- var_v0 = 0;
- sp58.unk4 = (u32) D_802B8D58->words.w1;
- switch (arg2) {
- case 26:
- var_v1 = 0x00000020;
- sp44 = 0x00000020;
- sp40 = 0;
-block_9:
- sp48 = var_v1;
- break;
- case 44:
- var_v1 = 0x00000020;
- sp44 = 0x00000020;
- sp40 = 0;
- var_v0 = 0x100;
- goto block_9;
- case 27:
- var_v1 = 0x00000040;
- sp44 = 0x00000020;
- sp40 = 0;
- goto block_9;
- case 28:
- var_v1 = 0x00000020;
- sp44 = 0x00000040;
- sp40 = 0;
- goto block_9;
- case 29:
- var_v1 = 0x00000020;
- sp44 = 0x00000020;
- sp40 = 3;
- goto block_9;
- case 30:
- var_v1 = 0x00000040;
- sp44 = 0x00000020;
- sp40 = 3;
- goto block_9;
- case 31:
- var_v1 = 0x00000020;
- sp44 = 0x00000040;
- sp40 = 3;
- goto block_9;
+void unpack_tile_sync(Gfx *gfx, u8 *args, s8 opcode) {
+ Gfx tileSync[] = { gsDPTileSync() };
+ u32 temp_a0;
+ u32 lo;
+ u32 hi;
+
+ s32 width;
+ s32 height;
+ s32 fmt;
+ s32 siz;
+ s32 line;
+ s32 tmem;
+ s32 cms;
+ s32 masks;
+ s32 cmt;
+ s32 maskt;
+ s32 lrs;
+ s32 lrt;
+ UNUSED s32 pad[4];
+
+ tmem = 0;
+ switch (opcode) {
+ case 26:
+ width = 32;
+ height = 32;
+ fmt = 0;
+ break;
+ case 44:
+ width = 32;
+ height = 32;
+ fmt = 0;
+ tmem = 256;
+ break;
+ case 27:
+ width = 64;
+ height = 32;
+ fmt = 0;
+ break;
+ case 28:
+ width = 32;
+ height = 64;
+ fmt = 0;
+ break;
+ case 29:
+ width = 32;
+ height = 32;
+ fmt = 3;
+ break;
+ case 30:
+ width = 64;
+ height = 32;
+ fmt = 3;
+ break;
+ case 31:
+ width = 32;
+ height = 64;
+ fmt = 3;
+ break;
}
- temp_a0 = *(D_802BA274 + arg1);
- temp_t9 = D_802BA274 + 1;
- D_802BA274 = temp_t9;
- temp_a0_2 = *(temp_t9 + arg1);
- D_802BA274 = temp_t9 + 1;
- displayList[D_802BA270].words.w0 = sp58;
- displayList[D_802BA270].words.w1 = sp5C;
- D_802BA270 += 1;
- displayList[D_802BA270].words.w0 = (sp40 << 0x15) | 0xF5000000 | 0x100000 | (((s32) ((sp48 * 2) + 7) >> 3) << 9) | var_v0;
- displayList[D_802BA270].words.w1 = ((temp_a0_2 & 0xF) << 0x12) | (((u32) (temp_a0_2 & 0xF0) >> 4) << 0xE) | ((temp_a0 & 0xF) << 8) | (((u32) (temp_a0 & 0xF0) >> 4) * 0x10);
- temp_t5 = D_802BA270 + 1;
- D_802BA270 = temp_t5;
- displayList[temp_t5].words.w0 = 0xF2000000;
- displayList[D_802BA270].words.w1 = ((sp48 - 1) << 0xE) | ((sp44 - 1) * 4);
- D_802BA270 += 1;
+
+ // Set arguments
+
+ siz = G_IM_SIZ_16b_BYTES;
+ line = ((((width * 2) + 7) >> 3));
+
+ temp_a0 = args[sPackedSeekPosition++];
+ cms = temp_a0 & 0xF;
+ masks = (temp_a0 & 0xF0) >> 4;
+
+ temp_a0 = args[sPackedSeekPosition++];
+ cmt = temp_a0 & 0xF;
+ maskt = (temp_a0 & 0xF0) >> 4;
+
+ // Generate gfx
+
+ gfx[sGfxSeekPosition].words.w0 = tileSync->words.w0;
+ gfx[sGfxSeekPosition].words.w1 = tileSync->words.w1;
+ sGfxSeekPosition++;
+
+ lo = (G_SETTILE << 24) | (fmt << 21) | (siz << 19) | (line << 9) | tmem;
+ hi = ((cmt) << 18) | ((maskt) << 14) | ((cms) << 8) | ((masks) << 4);
+
+ gfx[sGfxSeekPosition].words.w0 = lo;
+ gfx[sGfxSeekPosition].words.w1 = hi;
+ sGfxSeekPosition++;
+
+ lrs = (width - 1) << 2;
+ lrt = (height - 1) << 2;
+
+ lo = (G_SETTILESIZE << 24);
+ hi = (lrs << 12) | lrt;
+
+ gfx[sGfxSeekPosition].words.w0 = lo;
+ gfx[sGfxSeekPosition].words.w1 = hi;
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A8F80.s")
-#endif
-
-Gfx D_802B8D60[] = { gsDPTileSync() };
-Gfx D_802B8D68[] = { gsDPLoadSync() };
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A91E4(Gfx *displayList, s32 arg1, s8 arg2) {
- u32 sp48;
- u32 sp40;
- s32 sp2C;
- s32 sp28;
- s32 sp24;
- s32 temp_t6;
- s32 temp_t6_2;
- s32 temp_t8;
- s32 temp_t9;
- s32 temp_t9_2;
- s32 var_v0;
- u32 temp_t1;
- u32 temp_t2;
- u32 temp_t6_3;
- u32 var_a2;
- u32 var_v0_2;
- u32 var_v1;
- u8 temp_a2;
- u8 temp_a3;
-
- sp48.unk0 = D_802B8D60->words.w0;
- sp48.unk4 = (u32) D_802B8D60->words.w1;
- sp40.unk0 = D_802B8D68->words.w0;
- sp40.unk4 = (u32) D_802B8D68->words.w1;
- switch (arg2) {
- case 32:
- var_v0 = 0x00000020;
- sp28 = 0x00000020;
- sp24 = 0;
-block_8:
- sp2C = var_v0;
- break;
- case 33:
- var_v0 = 0x00000040;
- sp28 = 0x00000020;
- sp24 = 0;
- goto block_8;
- case 34:
- var_v0 = 0x00000020;
- sp28 = 0x00000040;
- sp24 = 0;
- goto block_8;
- case 35:
- var_v0 = 0x00000020;
- sp28 = 0x00000020;
- sp24 = 3;
- goto block_8;
- case 36:
- var_v0 = 0x00000040;
- sp28 = 0x00000020;
- sp24 = 3;
- goto block_8;
- case 37:
- var_v0 = 0x00000020;
- sp28 = 0x00000040;
- sp24 = 3;
- goto block_8;
- }
- temp_a2 = *(arg1 + D_802BA274);
- temp_t9 = D_802BA274 + 1;
- D_802BA274 = temp_t9;
- temp_t8 = temp_t9 + 1;
- D_802BA274 = temp_t8;
- temp_a3 = *(temp_t8 + arg1);
- D_802BA274 = temp_t8 + 1;
- temp_t6 = sp24 << 0x15;
- displayList[D_802BA270].words.w0 = temp_t6 | 0xFD000000 | 0x100000;
- displayList[D_802BA270].words.w1 = (temp_a2 << 0xB) + 0x05000000;
- temp_t9_2 = D_802BA270 + 1;
- D_802BA270 = temp_t9_2;
- displayList[temp_t9_2].words.w0 = sp48;
- var_v1 = 0x7FF;
- displayList[D_802BA270].words.w1 = sp4C;
- D_802BA270 += 1;
- displayList[D_802BA270].words.w0 = temp_t6 | 0xF5000000 | 0x100000 | (temp_a3 & 0xF);
- temp_t1 = ((u32) (temp_a3 & 0xF0) >> 4) << 0x18;
- displayList[D_802BA270].words.w1 = temp_t1;
- temp_t6_2 = D_802BA270 + 1;
- D_802BA270 = temp_t6_2;
- displayList[temp_t6_2].words.w0 = sp40;
- displayList[D_802BA270].words.w1 = sp44;
- temp_t6_3 = (u32) (sp2C * 2) >> 3;
- D_802BA270 += 1;
- temp_t2 = (sp2C * sp28) - 1;
- if (temp_t2 < 0x7FFU) {
- var_v1 = temp_t2;
- }
- if (temp_t6_3 == 0) {
- var_v0_2 = 1;
- } else {
- var_v0_2 = temp_t6_3;
- }
- var_a2 = temp_t6_3;
- if (temp_t6_3 == 0) {
- var_a2 = 1;
+
+void unpack_tile_load_sync(Gfx *gfx, u8 *args, s8 opcode) {
+ UNUSED u32 var;
+ Gfx tileSync[] = { gsDPTileSync() };
+ Gfx loadSync[] = { gsDPLoadSync() };
+
+ u32 arg;
+ u32 lo;
+ u32 hi;
+ u32 addr;
+ u32 width;
+ u32 height;
+ u32 fmt;
+ u32 siz;
+ u32 tmem;
+ u32 tile;
+
+ switch (opcode) {
+ case 32:
+ width = 32;
+ height = 32;
+ fmt = 0;
+ break;
+ case 33:
+ width = 64;
+ height = 32;
+ fmt = 0;
+ break;
+ case 34:
+ width = 32;
+ height = 64;
+ fmt = 0;
+ break;
+ case 35:
+ width = 32;
+ height = 32;
+ fmt = 3;
+ break;
+ case 36:
+ width = 64;
+ height = 32;
+ fmt = 3;
+ break;
+ case 37:
+ width = 32;
+ height = 64;
+ fmt = 3;
+ break;
}
- displayList[D_802BA270].words.w0 = 0xF3000000;
- displayList[D_802BA270].words.w1 = ((u32) (var_v0_2 + 0x7FF) / var_a2) | temp_t1 | (var_v1 << 0xC);
- D_802BA270 += 1;
+
+ // Set arguments
+
+ // Waa?
+ var = args[sPackedSeekPosition];
+ // Generates a texture address.
+ addr = SEGMENT_ADDR(0x05, args[sPackedSeekPosition++] << 11);
+ sPackedSeekPosition++;
+ arg = args[sPackedSeekPosition++];
+ siz = G_IM_SIZ_16b;
+ tmem = (arg & 0xF);
+ tile = (arg & 0xF0) >> 4;
+
+ // Generate gfx
+
+ lo = (G_SETTIMG << 24) | (fmt << 21) | (siz << 19);
+ gfx[sGfxSeekPosition].words.w0 = lo;
+ gfx[sGfxSeekPosition].words.w1 = addr;
+ sGfxSeekPosition++;
+
+ gfx[sGfxSeekPosition].words.w0 = tileSync->words.w0;
+ gfx[sGfxSeekPosition].words.w1 = tileSync->words.w1;
+ sGfxSeekPosition++;
+
+ lo = (G_SETTILE << 24) | (fmt << 21) | (siz << 19) | tmem;
+ hi = tile << 24;
+
+ gfx[sGfxSeekPosition].words.w0 = lo;
+ gfx[sGfxSeekPosition].words.w1 = hi;
+ sGfxSeekPosition++;
+
+ gfx[sGfxSeekPosition].words.w0 = loadSync->words.w0;
+ gfx[sGfxSeekPosition].words.w1 = loadSync->words.w1;
+ sGfxSeekPosition++;
+
+ lo = G_LOADBLOCK << 24;
+ hi = (tile << 24) | (MIN((width * height) - 1, 0x7FF) << 12) | CALC_DXT(width, G_IM_SIZ_16b_BYTES);
+
+ gfx[sGfxSeekPosition].words.w0 = lo;
+ gfx[sGfxSeekPosition].words.w1 = hi;
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A91E4.s")
-#endif
-void func_802A94D8(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_texture_on(Gfx *arg0, UNUSED u8 *args, UNUSED s8 arg2) {
Gfx macro[] = { gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON) };
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-void func_802A9544(Gfx *arg0, u8 arg1, u8 arg2) {
+void unpack_texture_off(Gfx *arg0, UNUSED u8 *args, UNUSED s8 arg2) {
Gfx macro[] = { gsSPTexture(0x1, 0x1, 0, G_TX_RENDERTILE, G_OFF) };
- arg0[D_802BA270].words.w0 = macro->words.w0;
- arg0[D_802BA270].words.w1 = macro->words.w1;
- D_802BA270++;
+ arg0[sGfxSeekPosition].words.w0 = macro->words.w0;
+ arg0[sGfxSeekPosition].words.w1 = macro->words.w1;
+ sGfxSeekPosition++;
}
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A95B0(Gfx *displayList, u8 *arg1, s32 arg2) {
- s32 temp_t5;
- s32 temp_t7;
- s32 temp_t7_2;
- u8 temp_v0;
-
- temp_t7 = D_802BA274 + 1;
- temp_v0 = arg1[D_802BA274];
- D_802BA274 = temp_t7;
- temp_t5 = temp_t7 + 1;
- D_802BA274 = temp_t5;
- temp_t7_2 = temp_t5 + 1;
- D_802BA274 = temp_t7_2;
- D_802BA274 = temp_t7_2 + 1;
- displayList[D_802BA270].words.w0 = ((arg1[temp_t7_2] & 0x3F) << 0x11) | 0x04000000 | (((arg1[temp_t5] & 0x3F) * 0x410) - 1);
- displayList[D_802BA270].words.w1 = (((arg1[temp_t7] << 8) | temp_v0) * 0x10) + 0x04000000;
- D_802BA270 += 1;
+void unpack_vtx1(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
+ u32 temp_t7;
+ u32 temp_t7_2;
+
+ u32 temp = args[sPackedSeekPosition++];
+ u32 temp2 = ((args[sPackedSeekPosition++] << 8) | temp) * 0x10;
+
+ temp = args[sPackedSeekPosition++];
+ temp_t7 = temp & 0x3F;
+ temp = args[sPackedSeekPosition++];
+ temp_t7_2 = temp & 0x3F;
+
+ gfx[sGfxSeekPosition].words.w0 = (G_VTX << 24) | (temp_t7_2 * 2 << 16) | (((temp_t7 << 10) + ((0x10 * temp_t7) - 1)));
+ gfx[sGfxSeekPosition].words.w1 = 0x04000000 + temp2;
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A95B0.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A9674(Gfx *displayList, u8 *arg1, s8 arg2) {
- s32 temp_t9;
- u8 temp_v0;
-
- temp_t9 = D_802BA274 + 1;
- temp_v0 = arg1[D_802BA274];
- D_802BA274 = temp_t9;
- D_802BA274 = temp_t9 + 1;
- displayList[D_802BA270].words.w0 = (((arg2 - 0x32) * 0x410) - 1) | 0x04000000;
- displayList[D_802BA270].words.w1 = (((arg1[temp_t9] << 8) | temp_v0) * 0x10) + 0x04000000;
- D_802BA270 += 1;
+
+void unpack_vtx2(Gfx *gfx, u8 *args, s8 arg2) {
+ u32 temp_t9;
+ u32 temp_v1;
+ u32 temp_v2;
+
+ temp_v1 = args[sPackedSeekPosition++];
+ temp_v2 = ((args[sPackedSeekPosition++] << 8) | temp_v1) * 0x10;
+
+ temp_t9 = arg2 - 50;
+
+ gfx[sGfxSeekPosition].words.w0 = (G_VTX << 24) | ((temp_t9 << 10) + (((temp_t9) * 0x10) - 1));
+ gfx[sGfxSeekPosition].words.w1 = 0x4000000 + temp_v2;
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A9674.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A9714(Gfx *displayList, u8 *arg1, s32 arg2) {
- s32 temp_t7;
- s32 var_a0;
- s32 var_a2;
- s32 var_a3;
- u8 temp_v0;
- u8 temp_v0_2;
- u8 temp_v0_3;
-
- temp_v0 = arg1[D_802BA274];
- temp_t7 = D_802BA274 + 1;
- D_802BA274 = temp_t7;
- var_a0 = temp_v0 & 0x1F;
- var_a3 = temp_v0 & 0x1F;
- if (gIsMirrorMode != 0) {
- temp_v0_2 = arg1[temp_t7];
- D_802BA274 = temp_t7 + 1;
- var_a2 = ((temp_v0 >> 5) & 7) | ((temp_v0_2 & 3) * 8);
- var_a3 = (temp_v0_2 >> 2) & 0x1F;
+
+void unpack_triangle(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
+ u32 temp_v0;
+ u32 phi_a0;
+ u32 phi_a2;
+ u32 phi_a3;
+
+ temp_v0 = args[sPackedSeekPosition++];
+
+ if (gIsMirrorMode) {
+ phi_a3 = temp_v0 & 0x1F;
+ phi_a2 = (temp_v0 >> 5) & 7;
+ temp_v0 = args[sPackedSeekPosition++];
+ phi_a2 |= (temp_v0 & 3) * 8;
+ phi_a0 = (temp_v0 >> 2) & 0x1F;
} else {
- temp_v0_3 = arg1[D_802BA274];
- D_802BA274 += 1;
- var_a2 = ((temp_v0 >> 5) & 7) | ((temp_v0_3 & 3) * 8);
- var_a0 = (temp_v0_3 >> 2) & 0x1F;
+ phi_a0 = temp_v0 & 0x1F;
+ phi_a2 = (temp_v0 >> 5) & 7;
+ temp_v0 = args[sPackedSeekPosition++];
+ phi_a2 |= (temp_v0 & 3) * 8;
+ phi_a3 = (temp_v0 >> 2) & 0x1F;
}
- displayList[D_802BA270].words.w0 = 0xBF000000;
- displayList[D_802BA270].words.w1 = (var_a3 << 0x11) | (var_a2 << 9) | (var_a0 * 2);
- D_802BA270 += 1;
+ gfx[sGfxSeekPosition].words.w0 = (G_TRI1 << 24);
+ gfx[sGfxSeekPosition].words.w1 = ((phi_a0 * 2) << 16) | ((phi_a2 * 2) << 8) | (phi_a3 * 2);
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A9714.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A980C(Gfx *displayList, u8 *arg1, s32 arg2) {
- s32 temp_t7;
- s32 temp_t8;
- s32 temp_t9;
- s32 temp_t9_2;
- s32 var_a0;
- s32 var_a2;
- s32 var_a3;
- s32 var_t0;
- s32 var_t1;
- s32 var_t2;
- u8 temp_v0;
- u8 temp_v0_2;
- u8 temp_v0_3;
- u8 temp_v0_4;
- u8 temp_v0_5;
- u8 temp_v0_6;
-
- temp_v0 = arg1[D_802BA274];
- temp_t7 = D_802BA274 + 1;
- D_802BA274 = temp_t7;
- var_a0 = temp_v0 & 0x1F;
- var_t0 = temp_v0 & 0x1F;
- if (gIsMirrorMode != 0) {
- temp_v0_2 = arg1[temp_t7];
- D_802BA274 = temp_t7 + 1;
- var_a3 = ((temp_v0 >> 5) & 7) | ((temp_v0_2 & 3) * 8);
- var_t0 = (temp_v0_2 >> 2) & 0x1F;
+
+void unpack_quadrangle(Gfx *gfx, u8 *args, UNUSED s8 arg2) {
+ u32 temp_v0;
+ u32 phi_t0;
+ u32 phi_a3;
+ u32 phi_a0;
+ u32 phi_t2;
+ u32 phi_t1;
+ u32 phi_a2;
+
+ temp_v0 = args[sPackedSeekPosition++];
+
+ if (gIsMirrorMode) {
+ phi_t0 = temp_v0 & 0x1F;
+ phi_a3 = (temp_v0 >> 5) & 7;
+ temp_v0 = args[sPackedSeekPosition++];
+ phi_a3 |= (temp_v0 & 3) * 8;
+ phi_a0 = (temp_v0 >> 2) & 0x1F;
} else {
- temp_v0_3 = arg1[D_802BA274];
- D_802BA274 += 1;
- var_a3 = ((temp_v0 >> 5) & 7) | ((temp_v0_3 & 3) * 8);
- var_a0 = (temp_v0_3 >> 2) & 0x1F;
+ phi_a0 = temp_v0 & 0x1F;
+ phi_a3 = (temp_v0 >> 5) & 7;
+ temp_v0 = args[sPackedSeekPosition++];
+ phi_a3 |= (temp_v0 & 3) * 8;
+ phi_t0 = (temp_v0 >> 2) & 0x1F;
}
- temp_v0_4 = arg1[D_802BA274];
- temp_t9 = D_802BA274 + 1;
- D_802BA274 = temp_t9;
- if (gIsMirrorMode != 0) {
- var_a2 = temp_v0_4 & 0x1F;
- temp_v0_5 = arg1[temp_t9];
- D_802BA274 = temp_t9 + 1;
- var_t1 = ((temp_v0_4 >> 5) & 7) | ((temp_v0_5 & 3) * 8);
- var_t2 = (temp_v0_5 >> 2) & 0x1F;
+
+ temp_v0 = args[sPackedSeekPosition++];
+
+ if (gIsMirrorMode) {
+ phi_a2 = temp_v0 & 0x1F;
+ phi_t1 = (temp_v0 >> 5) & 7;
+ temp_v0 = args[sPackedSeekPosition++];
+ phi_t1 |= (temp_v0 & 3) * 8;
+ phi_t2 = (temp_v0 >> 2) & 0x1F;
} else {
- var_t2 = temp_v0_4 & 0x1F;
- temp_v0_6 = arg1[D_802BA274];
- temp_t8 = (temp_v0_6 & 3) * 8;
- temp_t9_2 = (temp_v0_6 >> 2) & 0x1F;
- D_802BA274 += 1;
- var_t1 = ((temp_v0_4 >> 5) & 7) | temp_t8;
- var_a2 = temp_t9_2;
+ phi_t2 = temp_v0 & 0x1F;
+ phi_t1 = (temp_v0 >> 5) & 7;
+ temp_v0 = args[sPackedSeekPosition++];
+ phi_t1 |= (temp_v0 & 3) * 8;
+ phi_a2 = (temp_v0 >> 2) & 0x1F;
}
- displayList[D_802BA270].words.w0 = (var_t0 << 0x11) | 0xB1000000 | (var_a3 << 9) | (var_a0 * 2);
- displayList[D_802BA270].words.w1 = (var_t2 << 0x11) | (var_t1 << 9) | (var_a2 * 2);
- D_802BA270 += 1;
+ gfx[sGfxSeekPosition].words.w0 =
+ (G_TRI2 << 24) | ((phi_a0 * 2) << 16) | ((phi_a3 * 2) << 8) | (phi_t0 * 2);
+ gfx[sGfxSeekPosition].words.w1 = ((phi_t2 * 2) << 16) | ((phi_t1 * 2) << 8) | (phi_a2 * 2);
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A980C.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 9841ff34ca242f5f14b2eab2b54a7a65ac47d80f
-void func_802A99A4(Gfx *displayList, u8 *arg1, s32 arg2) {
- s32 temp_t3;
- s32 temp_t6;
- s32 temp_t7;
- s32 var_a0;
- s32 var_a2;
- s32 var_a3;
- s32 var_t0;
- u8 temp_v0;
- u8 temp_v0_2;
- u8 temp_v0_3;
-
- temp_v0 = arg1[D_802BA274];
- temp_t7 = D_802BA274 + 1;
- D_802BA274 = temp_t7;
- var_a0 = temp_v0 & 0x1F;
- var_t0 = temp_v0 & 0x1F;
+
+void unpack_spline_3D(Gfx *gfx, u8 *arg1, UNUSED s8 arg2) {
+ u32 temp_v0;
+ u32 phi_a0;
+ u32 phi_t0;
+ u32 phi_a3;
+ u32 phi_a2;
+
+ temp_v0 = arg1[sPackedSeekPosition++];
+
if (gIsMirrorMode != 0) {
- temp_v0_2 = arg1[temp_t7];
- temp_t3 = temp_t7 + 1;
- D_802BA274 = temp_t3;
- var_a2 = ((temp_v0 >> 5) & 7) | ((temp_v0_2 & 3) * 8);
- var_a3 = (temp_v0_2 >> 2) & 0x1F;
- D_802BA274 = temp_t3 + 1;
- var_t0 = ((temp_v0_2 >> 7) & 1) | ((arg1[temp_t3] & 0xF) * 2);
+ phi_a0 = temp_v0 & 0x1F;
+ phi_a2 = ((temp_v0 >> 5) & 7);
+ temp_v0 = arg1[sPackedSeekPosition++];
+ phi_a2 |= ((temp_v0 & 3) * 8);
+ phi_a3 = (temp_v0 >> 2) & 0x1F;
+ phi_t0 = ((temp_v0 >> 7) & 1);
+ temp_v0 = arg1[sPackedSeekPosition++];
+ phi_t0 |= (temp_v0 & 0xF) * 2;
} else {
- temp_v0_3 = arg1[D_802BA274];
- temp_t6 = D_802BA274 + 1;
- D_802BA274 = temp_t6;
- var_a3 = ((temp_v0 >> 5) & 7) | ((temp_v0_3 & 3) * 8);
- var_a2 = (temp_v0_3 >> 2) & 0x1F;
- D_802BA274 = temp_t6 + 1;
- var_a0 = ((temp_v0_3 >> 7) & 1) | ((arg1[temp_t6] & 0xF) * 2);
+ phi_t0 = temp_v0 & 0x1F;
+ phi_a3 = ((temp_v0 >> 5) & 7);
+ temp_v0 = arg1[sPackedSeekPosition++];
+ phi_a3 |= ((temp_v0 & 3) * 8);
+ phi_a2 = (temp_v0 >> 2) & 0x1F;
+ phi_a0 = ((temp_v0 >> 7) & 1);
+ temp_v0 = arg1[sPackedSeekPosition++];
+ phi_a0 |= (temp_v0 & 0xF) * 2;
}
- displayList[D_802BA270].words.w0 = 0xB5000000;
- displayList[D_802BA270].words.w1 = (var_a0 << 0x19) | (var_t0 << 0x11) | (var_a3 << 9) | (var_a2 * 2);
- D_802BA270 += 1;
+ gfx[sGfxSeekPosition].words.w0 = (G_LINE3D << 24);
+ gfx[sGfxSeekPosition].words.w1 =
+ ((phi_a0 * 2) << 24) | ((phi_t0 * 2) << 16) | ((phi_a3 * 2) << 8) | (phi_a2 * 2);
+ sGfxSeekPosition++;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802A99A4.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
-void func_802A8F80(Gfx *, u8, s8, s32 *); /* extern */
-void func_802A91E4(Gfx *, u8, s8, s32 *); /* extern */
-void func_802A95B0(Gfx *, u8, s8, s32 *); /* extern */
-void func_802A9674(Gfx *, u8, s8, s32 *); /* extern */
-void func_802A9714(Gfx *, u8, s8, s32 *); /* extern */
-void func_802A980C(Gfx *, u8, s8, s32 *); /* extern */
-void func_802A99A4(Gfx *, u8, s8, s32 *); /* extern */
-extern s32 D_802BA270;
-extern s32 D_802BA274;
-extern Gfx *gHeapEndPtr;
-
-void display_list_unpack(u32 arg0, s32 arg1, u8 arg2) {
- Gfx *sp2C;
- Gfx *temp_s1;
- s32 temp_v1;
- u8 temp_a0;
- u8 temp_s0;
-
- temp_s0 = gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF) + 0x80000000;
- temp_s1 = gHeapEndPtr - (((arg1 + 0xF) & ~0xF) + 8);
- gHeapEndPtr = temp_s1;
- D_802BA270 = 0;
- sp2C = temp_s1;
- D_802BA274 = 0;
-case 0x31:
-case 0x32:
-loop_1:
- temp_v1 = D_802BA274;
- temp_a0 = *(temp_v1 + temp_s0);
- D_802BA274 = temp_v1 + 1;
- switch (temp_a0) { /* irregular */
- case 0x0:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x1:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x2:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x3:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x4:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x5:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x6:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x7:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x8:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x9:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0xA:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0xB:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0xC:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0xD:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0xE:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0xF:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x10:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x11:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x12:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x13:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x14:
- func_802A884C(temp_s1, temp_s0, (s8) temp_a0);
- goto loop_1;
- case 0x15:
- func_802A8B48(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x16:
- func_802A8BB4(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x17:
- func_802A8C20(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x2E:
- func_802A8C8C(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x53:
- func_802A8CF8(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x18:
- func_802A8D64(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x19:
- func_802A8DD0(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x2F:
- func_802A8E3C(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x54:
- func_802A8EA8(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x55:
- func_802A8F14(temp_s1, temp_s0, arg2);
- goto loop_1;
- case 0x1A:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x2C:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x1B:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x1C:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x1D:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x1E:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x1F:
- func_802A8F80(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x20:
- func_802A91E4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x21:
- func_802A91E4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x22:
- func_802A91E4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x23:
- func_802A91E4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x24:
- func_802A91E4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x25:
- func_802A91E4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x26:
- func_802A94D8(temp_s1, temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
- case 0x27:
- func_802A9544(temp_s1, temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
- case 0x28:
- func_802A95B0(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x33:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x34:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x35:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x36:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x37:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x38:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x39:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x3A:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x3B:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x3C:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x3D:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x3E:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x3F:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x40:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x41:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x42:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x43:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x44:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x45:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x46:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x47:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x48:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x49:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x4A:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x4B:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x4C:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x4D:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x4E:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x4F:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x50:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x51:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x52:
- func_802A9674(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x29:
- func_802A9714(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x58:
- func_802A980C(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x30:
- func_802A99A4(temp_s1, temp_s0, (s8) temp_a0, &D_802BA274);
- goto loop_1;
- case 0x2D:
- func_802A8ADC(temp_s1, temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
- case 0x2A:
- func_802A89C0(temp_s1, temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
- case 0x56:
- func_802A8A04(temp_s1, temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
- case 0x57:
- func_802A8A70(temp_s1, temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
- case 0x2B:
- func_802A8940(temp_s1, (u8 *) temp_s0, (u8) (s8) temp_a0);
- goto loop_1;
+
+UNUSED void func_802A9AEC(void) {
+
+}
+
+/**
+ * Unpacks course packed displaylists by iterating through each byte of the packed file.
+ * Each packed displaylist entry has an opcode and any number of arguments.
+ * The opcodes range from 0 to 87 which are used to run the relevant unpack function.
+ * The file pointer increments when arguments are used. This way,
+ * displaylist_unpack will always read an opcode and not an argument by accident.
+ *
+ * @warning opcodes that do not contain a definition in the switch are ignored. If an undefined opcode
+ * contained arguments the unpacker might try to unpack those arguments.
+ * This issue is prevented so long as the packed file adheres to correct opcodes and unpack code
+ * increments the file pointer the correct number of times.
+ */
+void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, u32 arg2) {
+ uintptr_t segment = SEGMENT_NUMBER2(data);
+ uintptr_t offset = SEGMENT_OFFSET(data);
+ u8 *packed_dl = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
+
+ Gfx *gfx;
+ u32 addr;
+
+ u8 opcode;
+
+ finalDisplaylistOffset = ALIGN16(finalDisplaylistOffset) + 8;
+ gHeapEndPtr -= finalDisplaylistOffset;
+ addr = gHeapEndPtr;
+ gfx = (Gfx *) gHeapEndPtr;
+ sGfxSeekPosition = 0;
+ sPackedSeekPosition = 0;
+
+ while(1) {
+
+ // Seek to the next byte
+ opcode = packed_dl[sPackedSeekPosition++];
+
+ // Break when the eof has been reached denoted by opcode 0xFF
+ if (opcode == 0xFF) break;
+
+ switch (opcode) {
+ case 0x0:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x1:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x2:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x3:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x4:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x5:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x6:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x7:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x8:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x9:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0xA:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0xB:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0xC:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0xD:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0xE:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0xF:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x10:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x11:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x12:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x13:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x14:
+ unpack_lights(gfx, packed_dl, opcode);
+ break;
+ case 0x15:
+ unpack_combine_mode1(gfx, packed_dl, arg2);
+ break;
+ case 0x16:
+ unpack_combine_mode2(gfx, packed_dl, arg2);
+ break;
+ case 0x17:
+ unpack_combine_mode_shade(gfx, packed_dl, arg2);
+ break;
+ case 0x2E:
+ unpack_combine_mode4(gfx, packed_dl, arg2);
+ break;
+ case 0x53:
+ unpack_combine_mode5(gfx, packed_dl, arg2);
+ break;
+ case 0x18:
+ unpack_render_mode_opaque(gfx, packed_dl, arg2);
+ break;
+ case 0x19:
+ unpack_render_mode_tex_edge(gfx, packed_dl, arg2);
+ break;
+ case 0x2F:
+ unpack_render_mode_translucent(gfx, packed_dl, arg2);
+ break;
+ case 0x54:
+ unpack_render_mode_opaque_decal(gfx, packed_dl, arg2);
+ break;
+ case 0x55:
+ unpack_render_mode_translucent_decal(gfx, packed_dl, arg2);
+ break;
+ case 0x1A:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x2C:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x1B:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x1C:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x1D:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x1E:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x1F:
+ unpack_tile_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x20:
+ unpack_tile_load_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x21:
+ unpack_tile_load_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x22:
+ unpack_tile_load_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x23:
+ unpack_tile_load_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x24:
+ unpack_tile_load_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x25:
+ unpack_tile_load_sync(gfx, packed_dl, opcode);
+ break;
+ case 0x26:
+ unpack_texture_on(gfx, packed_dl, opcode);
+ break;
+ case 0x27:
+ unpack_texture_off(gfx, packed_dl, opcode);
+ break;
+ case 0x28:
+ unpack_vtx1(gfx, packed_dl, opcode);
+ break;
+ case 0x33:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x34:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x35:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x36:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x37:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x38:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x39:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x3A:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x3B:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x3C:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x3D:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x3E:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x3F:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x40:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x41:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x42:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x43:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x44:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x45:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x46:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x47:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x48:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x49:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x4A:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x4B:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x4C:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x4D:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x4E:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x4F:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x50:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x51:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x52:
+ unpack_vtx2(gfx, packed_dl, opcode);
+ break;
+ case 0x29:
+ unpack_triangle(gfx, packed_dl, opcode);
+ break;
+ case 0x58:
+ unpack_quadrangle(gfx, packed_dl, opcode);
+ break;
+ case 0x30:
+ unpack_spline_3D(gfx, packed_dl, opcode);
+ break;
+ case 0x2D:
+ unpack_cull_displaylist(gfx, packed_dl, opcode);
+ break;
+ case 0x2A:
+ unpack_end_displaylist(gfx, packed_dl, opcode);
+ break;
+ case 0x56:
+ unpack_set_geometry_mode(gfx, packed_dl, opcode);
+ break;
+ case 0x57:
+ unpack_clear_geometry_mode(gfx, packed_dl, opcode);
+ break;
+ case 0x2B:
+ unpack_displaylist(gfx, packed_dl, opcode);
+ break;
+ default:
+ // Skip unknown values
+ break;
+ }
}
- set_segment_base_addr(7, sp2C);
+ set_segment_base_addr(0x7, (void *) addr);
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/display_list_unpack.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
-u32 MIO0_0F(s32, s32, s32); // extern
-extern uintptr_t gSegmentTable;
-
-void func_802AA7C8(u32 arg0) {
- void *sp20;
- s32 temp_a0;
- void *temp_s0;
- void *temp_t2;
- void *phi_s0;
- s32 phi_v0;
- void *phi_s0_2;
-
- temp_s0 = *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000;
- phi_s0 = temp_s0;
+
+struct UnkStr_802AA7C8 {
+ u8 *unk0;
+ u32 unk4;
+ u32 unk8;
+ u32 unkC;
+};
+
+void decompress_textures(u32 *arg0) {
+ u32 segment = SEGMENT_NUMBER2(arg0);
+ u32 offset = SEGMENT_OFFSET(arg0);
+ struct UnkStr_802AA7C8 *phi_s0 =
+ (struct UnkStr_802AA7C8 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
+ struct UnkStr_802AA7C8 *temp_s0;
+ u32 temp_t2;
+ u8 *temp_a0;
+ u32 phi_v0;
+ u32 sp20;
+
phi_v0 = 0;
-loop_1:
- if (phi_s0->unk0 != 0) {
- phi_s0 += 0x10;
+ temp_s0 = phi_s0;
+ while (TRUE) {
+ temp_a0 = phi_s0->unk0;
+ if ((temp_a0) == 0) {
+ break;
+ }
phi_v0 += phi_s0->unk8;
- goto loop_1;
+ phi_s0++;
}
- temp_t2 = gHeapEndPtr - phi_v0;
- gHeapEndPtr = temp_t2;
- sp20 = temp_t2;
- phi_s0_2 = temp_s0;
-loop_4:
- temp_a0 = phi_s0_2->unk0;
- if (temp_a0 != 0) {
- MIO0_0F(temp_a0, phi_s0_2->unk4, phi_s0_2->unk8);
- phi_s0_2 += 0x10;
- goto loop_4;
+ phi_s0 = temp_s0;
+ gHeapEndPtr -= phi_v0;
+ sp20 = gHeapEndPtr;
+
+ while (TRUE) {
+ temp_a0 = phi_s0->unk0;
+ if ((temp_a0) == 0) {
+ break;
+ }
+ MIO0_0F(temp_a0, phi_s0->unk4, phi_s0->unk8);
+ phi_s0++;
}
gHeapEndPtr = sp20;
- set_segment_base_addr(5, sp20);
+ temp_t2 = gHeapEndPtr;
+ set_segment_base_addr(0x5, (void *) temp_t2);
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802AA7C8.s")
-#endif
-
-#ifdef MIPS_TO_C
-//generated by m2c commit d9d3d6575355663122de59f6b2882d8f174e2355 on Dec-09-2022
-void *func_802AA88C(u8 *arg0, u8 *arg1) {
- s32 sp28;
- u8 *sp20;
- u32 sp1C;
- u32 temp_t6;
- u8 *temp_a0;
- temp_t6 = ((arg1 - arg0) + 0xF) & ~0xF;
- temp_a0 = gHeapEndPtr - temp_t6;
- sp20 = temp_a0;
- dma_copy(temp_a0, arg0, temp_t6);
- sp1C = gPrevLoadedAddress;
- sp28 = (temp_a0->unk4 + 0xF) & ~0xF;
- mio0decode(temp_a0, (u8 *) gPrevLoadedAddress);
- gPrevLoadedAddress += sp28;
- return (void *) sp1C;
+void *decompress_segments(u8 *start, u8 *end) {
+ UNUSED u32 pad;
+ u32 sp28;
+ u32 size = ALIGN16(end - start);
+ u8 *heapEnd;
+ u32 *freeSpace;
+
+ heapEnd = (u8 *) gHeapEndPtr - size;
+ // sp20 = temp_a0;
+ dma_copy(heapEnd, start, size);
+ sp28 = *(u32 *) (heapEnd + 4);
+ sp28 = ALIGN16(sp28);
+ freeSpace = (u32 *) gNextFreeMemoryAddress;
+ mio0decode(heapEnd, (u8 *)freeSpace);
+ gNextFreeMemoryAddress += sp28;
+ return (void *)freeSpace;
}
-#else
-GLOBAL_ASM("asm/non_matchings/memory/func_802AA88C.s")
-#endif
-s32 load_course(s32 courseId) {
+/**
+ * @brief Loads & DMAs course data. Vtx, textures, displaylists, etc.
+ * @param courseId
+*/
+u8 *load_course(s32 courseId) {
UNUSED s32 pad[4];
- u32 *temp_v0;
- u32 *dlRomStart;
- u32 *dlRomEnd;
- u32 *vertexRomStart;
- u32 *vertexRomEnd;
- s32 pad2;
- s32 gamestate;
+ u8 *vtxCompressed; // mio0 compressed
+ u8 *courseDataRomStart; // mio0 compressed
+ u8 *courseDataRomEnd;
+ u8 *vertexRomStart; // mio0 compressed
+ u8 *vertexRomEnd;
+ UNUSED s32 pad2[2];
u32 *textures;
- mk64_Vtx *vertexStart;
- u32 *packedStart;
+ u8 *vertexStart; // mio0 compressed
+ u8 *packedStart;
u32 vertexCount;
- u32 *finalDL;
- s32 unknown1;
+ uintptr_t finalDisplaylistOffset;
+ u32 unknown1;
s32 prevLoadedAddress_saved;
- s32 offsetRomStart;
- s32 offsetRomEnd;
+ struct course_texture *offsetRomStart;
+ struct course_texture *offsetRomEnd;
// Pointers to rom offsets
- gamestate = gGamestate;
- dlRomStart = gCourseTable[courseId].dlRomStart;
- dlRomEnd = gCourseTable[courseId].dlRomEnd;
+ //gamestate = gGamestate;
+ courseDataRomStart = gCourseTable[courseId].dlRomStart;
+ courseDataRomEnd = gCourseTable[courseId].dlRomEnd;
offsetRomStart = gCourseTable[courseId].offsetRomStart;
offsetRomEnd = gCourseTable[courseId].offsetRomEnd;
vertexRomStart = gCourseTable[courseId].vertexRomStart;
@@ -1359,26 +1343,26 @@ s32 load_course(s32 courseId) {
vertexStart = gCourseTable[courseId].vertexStart;
packedStart = gCourseTable[courseId].packedStart;
vertexCount = gCourseTable[courseId].vertexCount;
- finalDL = gCourseTable[courseId].finalDL;
+ finalDisplaylistOffset = gCourseTable[courseId].finalDisplaylistOffset;
unknown1 = gCourseTable[courseId].unknown1;
- if ((gamestate == ENDING_SEQUENCE) || (gamestate == CREDITS_SEQUENCE)) {
+ if ((gGamestate == ENDING_SEQUENCE) || (gGamestate == CREDITS_SEQUENCE)) {
gHeapEndPtr = SEG_80280000;
} else {
gHeapEndPtr = SEG_8028DF00;
}
- set_segment_base_addr(9, func_802A7D70(offsetRomStart, offsetRomEnd));
+ set_segment_base_addr(9, load_data((uintptr_t)offsetRomStart, (uintptr_t) offsetRomEnd));
if (gGamestate != ENDING_SEQUENCE) {
- set_segment_base_addr(6, func_802AA88C(dlRomStart, dlRomEnd));
+ set_segment_base_addr(6, decompress_segments(courseDataRomStart, courseDataRomEnd));
}
- prevLoadedAddress_saved = gPrevLoadedAddress;
- temp_v0 = func_802A82E4((u8 *)vertexRomStart, (u8 *)vertexRomEnd);
-
- set_segment_base_addr(0xF, (void *)temp_v0);
- func_802A87A8(vertexStart, vertexCount);
- display_list_unpack(packedStart, finalDL, unknown1);
- func_802AA7C8(textures);
- gPrevLoadedAddress = prevLoadedAddress_saved;
- return temp_v0;
+ prevLoadedAddress_saved = gNextFreeMemoryAddress;
+ vtxCompressed = dma_compressed_vtx(vertexRomStart, vertexRomEnd);
+
+ set_segment_base_addr(0xF, (void *) vtxCompressed);
+ decompress_vtx(vertexStart, vertexCount);
+ displaylist_unpack((uintptr_t *) packedStart, finalDisplaylistOffset, unknown1);
+ decompress_textures(textures);
+ gNextFreeMemoryAddress = prevLoadedAddress_saved;
+ return vtxCompressed;
}
diff --git a/src/memory.h b/src/memory.h
index fb66e7cdf..dde10da57 100644
--- a/src/memory.h
+++ b/src/memory.h
@@ -40,15 +40,18 @@ struct AllocOnlyPool {
#define ALIGN4(val) (((val) + 0x3) & ~0x3)
-s32 func_802A7B70(s32);
+extern f32 vtxStretchY;
+
+u32 *get_next_available_memory_addr(u32);
uintptr_t set_segment_base_addr(s32, void*);
void *get_segment_base_addr(s32);
void *segmented_to_virtual(const void *);
void move_segment_table_to_dmem();
-void func_802A7CF0(s32, s32);
-s32 func_802A7D1C(s32);
+void initialize_memory_pool(uintptr_t, uintptr_t);
+void *allocate_memory(u32);
+void *load_data(uintptr_t, uintptr_t);
void func_802A7D54(s32, s32);
-s32 func_802A7D70(s32, s32);
+
void main_pool_init(u32, u32);
void *main_pool_alloc(u32, u32);
u32 main_pool_free(void*);
@@ -57,41 +60,40 @@ s32 main_pool_available();
u32 main_pool_push_state();
u32 main_pool_pop_state();
void *func_802A80B0(u8*, u8*, u8*);
-void *load_segment(s32, u8*, u8*, u32);
-void *func_802A8190(s32, s32);
void func_802A81EC();
struct AllocOnlyPool *alloc_only_pool_init(u32, u32);
u32 func_802A82AC(s32);
-s32 func_802A82E4(u8*, u8*);
s32 func_802A8348(s32, s32, s32);
-s32 func_802A841C(s32, s32, s32);
-s32 func_802A84F4(s32, u32, u32);
-u32 MIO0_0F(s32, u32, u32);
+u8 *dma_textures(u8*, u32, u32);
+u32 MIO0_0F(u8*, u32, u32);
void func_802A8844();
-void func_802A884C(Gfx*, u8, s8);
-void func_802A8940(Gfx*, u8*, u8);
-void func_802A89C0(Gfx*, u8, u8);
-void func_802A8A04(Gfx*, u8, u8);
-void func_802A8A70(Gfx*, u8, u8);
-void func_802A8ADC(Gfx*, u8, u8);
-void func_802A8B48(Gfx*, u8, u8);
-void func_802A8BB4(Gfx*, u8, u8);
-void func_802A8C20(Gfx*, u8, u8);
-void func_802A8C8C(Gfx*, u8, u8);
-void func_802A8CF8(Gfx*, u8, u8);
-void func_802A8D64(Gfx*, u8, u8);
-void func_802A8DD0(Gfx*, u8, u8);
-void func_802A8E3C(Gfx*, u8, u8);
-void func_802A8EA8(Gfx*, u8, u8);
-void func_802A8F14(Gfx*, u8, u8);
-void func_802A94D8(Gfx*, u8, u8);
-void func_802A9544(Gfx*, u8, u8);
+void unpack_lights(Gfx*, u8*, s8);
+void unpack_displaylist(Gfx*, u8*, s8);
+void unpack_end_displaylist(Gfx*, u8*, s8);
+void unpack_set_geometry_mode(Gfx*, u8*, s8);
+void unpack_clear_geometry_mode(Gfx*, u8*, s8);
+void unpack_cull_displaylist(Gfx*, u8*, s8);
+void unpack_combine_mode1(Gfx*, u8*, u32);
+void unpack_combine_mode2(Gfx*, u8*, u32);
+void unpack_combine_mode_shade(Gfx*, u8*, u32);
+void unpack_combine_mode4(Gfx*, u8*, u32);
+void unpack_combine_mode5(Gfx*, u8*, u32);
+void unpack_render_mode_opaque(Gfx*, u8*, u32);
+void unpack_render_mode_tex_edge(Gfx*, u8*, u32);
+void unpack_render_mode_translucent(Gfx*, u8*, u32);
+void unpack_render_mode_opaque_decal(Gfx*, u8*, u32);
+void unpack_render_mode_translucent_decal(Gfx*, u8*, u32);
+void unpack_tile_sync(Gfx*, u8*, s8);
+void unpack_tile_load_sync(Gfx*, u8*, s8);
+void unpack_texture_on(Gfx*, u8*, s8);
+void unpack_texture_off(Gfx*, u8*, s8);
+u8 *load_course(s32);
// main.c
extern struct D_80150158 gD_80150158[];
extern s32 D_801502A0;
-extern u32 D_8015F724;
-extern u32 gPrevLoadedAddress;
+extern u32 gFreeMemorySize;
+extern u32 gNextFreeMemoryAddress;
extern u32 gHeapEndPtr;
extern u8 _other_texturesSegmentRomStart[];
diff --git a/src/profiler.c b/src/profiler.c
index dd674fc40..8090e9dbb 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -3,11 +3,9 @@
#include "types.h"
#include "profiler.h"
#include "config.h"
+#include "main.h"
struct ProfilerFrameData gProfilerFrameData[2];
-extern u32 D_800DC568;
-extern u32 D_800DC56C;
-extern Gfx *gDisplayListHead;
s32 gEnableResourceMeters = 0;
@@ -213,7 +211,7 @@ void draw_profiler_mode_0(void) {
// Two added lines in Mario Kart 64
D_800DC568 = (s32) (clockStart + renderDuration);
- D_800DC56C = rdpDuration;
+ D_800DC56C[0] = rdpDuration;
// Draw bottom profilers.
@@ -227,8 +225,6 @@ void draw_profiler_mode_0(void) {
draw_reference_profiler_bars();
}
-extern struct Controller *gControllerOne;
-
// Similar to draw_screen_borders from SM64, with a hint of draw_profiler
void resource_display(void) {
gDPPipeSync(gDisplayListHead++);
diff --git a/src/profiler.h b/src/profiler.h
index 567f302be..2416f4d44 100644
--- a/src/profiler.h
+++ b/src/profiler.h
@@ -44,6 +44,7 @@ void profiler_log_thread4_time(void);
void profiler_log_gfx_time(enum ProfilerGfxEvent eventID);
void profiler_log_vblank_time(void);
void draw_profiler(void);
+void resource_display(void);
extern s32 gEnableResourceMeters;
diff --git a/src/race_logic.c b/src/race_logic.c
index aeea42c06..91d61c7f0 100644
--- a/src/race_logic.c
+++ b/src/race_logic.c
@@ -12,9 +12,12 @@
#include "code_80057C60.h"
#include "code_80071F00.h"
#include "code_80091750.h"
+#include "code_80005FD0.h"
+#include "spawn_players.h"
#include "audio/external.h"
#include "race_logic.h"
#include "skybox_and_splitscreen.h"
+#include "math_util_2.h"
extern Player *gPlayerTwo;
extern Player *gPlayerThree;
diff --git a/src/race_logic.h b/src/race_logic.h
index eeb20932f..c4ef1dc20 100644
--- a/src/race_logic.h
+++ b/src/race_logic.h
@@ -3,6 +3,7 @@
/* Function Prototypes */
+void func_802903D8(Player*, Player*);
void func_8028DF00();
void func_8028DF38();
void func_8028E028();
diff --git a/src/render_courses.c b/src/render_courses.c
index a8025e635..f258018ca 100644
--- a/src/render_courses.c
+++ b/src/render_courses.c
@@ -4,12 +4,14 @@
#include <defines.h>
#include <types.h>
#include <packed_displaylist_symbols_gen.h>
+#include "main.h"
#include "actors.h"
#include "math_util.h"
#include "memory.h"
#include "code_80281780.h"
#include "code_802AAA70.h"
#include "render_courses.h"
+#include "skybox_and_splitscreen.h"
f32 gFloatArray802B8790[] = {
1.2, 1.0, 0.9, 0.7, 2.0, 1.8, 0.9, 2.3
@@ -42,7 +44,7 @@ s32 func_80290C20(Camera *camera) {
void func_80290CAC(uintptr_t arg0) {
s32 segment = SEGMENT_NUMBER2(arg0);
s32 offset = SEGMENT_OFFSET(arg0);
- struct Unk0CAC *data = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
+ struct Unk0CAC *data = (struct Unk0CAC *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
while(data->unk0 != 0) {
if ((data->unk6 & 0x8000) != 0) {
@@ -67,12 +69,13 @@ void func_80290CAC(uintptr_t arg0) {
extern u16 D_80152300[];
-void load_surface_map(s32 arg0, struct UnkStruct_800DC5EC *arg1) {
+void load_surface_map(uintptr_t arg0, struct UnkStruct_800DC5EC *arg1) {
Player *temp_t1 = arg1->player;
Camera *temp_a2 = arg1->camera;
u32 segment = SEGMENT_NUMBER2(arg0);
u32 offset = SEGMENT_OFFSET(arg0);
- s32 *addr = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
+ // todo: Should be Gfx*
+ s32 *addr = (s32 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
s16 var_a3;
s16 temp_v1;
s16 sp1E;
@@ -959,10 +962,9 @@ GLOBAL_ASM("asm/non_matchings/render_courses/func_8029122C.s")
#endif
void render_mario_raceway(struct UnkStruct_800DC5EC *arg0) {
- s32 pad;
+ UNUSED s32 pad;
u16 sp22 = arg0->pathCounter;
u16 temp_t0 = arg0->playerDirection;
- void *temp_a1;
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1056,7 +1058,7 @@ void render_mario_raceway(struct UnkStruct_800DC5EC *arg0) {
gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_packed_dl_3240);
gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_packed_dl_14A0);
- load_surface_map(mario_raceway_dls, arg0);
+ load_surface_map((uintptr_t) mario_raceway_dls, arg0);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
@@ -1068,7 +1070,7 @@ void render_mario_raceway(struct UnkStruct_800DC5EC *arg0) {
}
void render_choco_mountain(struct UnkStruct_800DC5EC *arg0) {
- s32 pad[13];
+ UNUSED s32 pad[13];
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1094,7 +1096,7 @@ void render_choco_mountain(struct UnkStruct_800DC5EC *arg0) {
gSPDisplayList(gDisplayListHead++, d_course_choco_mountain_packed_dl_5868);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
- load_surface_map(choco_mountain_dls, arg0);
+ load_surface_map((uintptr_t) choco_mountain_dls, arg0);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetRenderMode(gDisplayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2);
@@ -1128,7 +1130,7 @@ void render_bowsers_castle(struct UnkStruct_800DC5EC *arg0) {
if (D_802B87BC > 255) {
D_802B87BC = 0;
}
- load_surface_map(bowsers_castle_dls, arg0);
+ load_surface_map((uintptr_t) bowsers_castle_dls, arg0);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
@@ -1138,9 +1140,9 @@ void render_bowsers_castle(struct UnkStruct_800DC5EC *arg0) {
void render_banshee_boardwalk(struct UnkStruct_800DC5EC *arg0) {
Camera *camera = arg0->camera;
Mat4 spCC;
- s32 pad[6];
+ UNUSED s32 pad[6];
Vec3f spA8;
- s32 pad2[6];
+ UNUSED s32 pad2[6];
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA);
@@ -1162,7 +1164,7 @@ void render_banshee_boardwalk(struct UnkStruct_800DC5EC *arg0) {
gSPDisplayList(gDisplayListHead++, d_course_banshee_boardwalk_packed_dl_4E60);
gSPDisplayList(gDisplayListHead++, d_course_banshee_boardwalk_packed_dl_69B0);
- load_surface_map(banshee_boardwalk_dls, arg0);
+ load_surface_map((uintptr_t) banshee_boardwalk_dls, arg0);
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
@@ -1192,7 +1194,7 @@ void render_yoshi_valley(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
- load_surface_map(yoshi_valley_dls, arg0);
+ load_surface_map((uintptr_t) yoshi_valley_dls, arg0);
gDPPipeSync(gDisplayListHead++);
}
@@ -1210,7 +1212,7 @@ void render_frappe_snowland(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
- load_surface_map(frappe_snowland_dls, arg0);
+ load_surface_map((uintptr_t) frappe_snowland_dls, arg0);
}
void render_koopa_troopa_beach(struct UnkStruct_800DC5EC *arg0) {
@@ -1228,7 +1230,7 @@ void render_koopa_troopa_beach(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gSPDisplayList(gDisplayListHead++, d_course_koopa_troopa_beach_packed_dl_9688);
- load_surface_map(koopa_troopa_beach_dls, arg0);
+ load_surface_map((uintptr_t) koopa_troopa_beach_dls, arg0);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
@@ -1253,7 +1255,7 @@ void render_royal_raceway(struct UnkStruct_800DC5EC *arg0) {
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gSPDisplayList(gDisplayListHead++, d_course_royal_raceway_packed_dl_A648);
- load_surface_map(royal_raceway_dls, arg0);
+ load_surface_map((uintptr_t) royal_raceway_dls, arg0);
gSPDisplayList(gDisplayListHead++, d_course_royal_raceway_packed_dl_11A8);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
@@ -1265,7 +1267,7 @@ void render_royal_raceway(struct UnkStruct_800DC5EC *arg0) {
void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) {
- s32 pad;
+ UNUSED s32 pad;
u16 sp22 = (u16)arg0->pathCounter;
s16 prevFrame;
@@ -1282,7 +1284,7 @@ void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
- load_surface_map(luigi_raceway_dls, arg0);
+ load_surface_map((uintptr_t) luigi_raceway_dls, arg0);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
@@ -1306,22 +1308,22 @@ void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) {
}
switch (D_802B87D8) {
case 0:
- func_802A7658(D_800DC5DC, D_800DC5E0, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800));
+ func_802A7658(D_800DC5DC, D_800DC5E0, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800));
break;
case 1:
- func_802A7658(D_800DC5DC + 64, D_800DC5E0, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x10800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x10800));
break;
case 2:
- func_802A7658(D_800DC5DC, D_800DC5E0 + 32, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x11800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 32, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x11800));
break;
case 3:
- func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x12800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x12800));
break;
case 4:
- func_802A7658(D_800DC5DC, D_800DC5E0 + 64, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x13800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 64, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x13800));
break;
case 5:
- func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x14800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x14800));
break;
}
}
@@ -1329,11 +1331,11 @@ void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) {
// Missing {} around if statements necessary for matching.
void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) {
- s32 pad[13];
+ UNUSED s32 pad[13];
s16 temp_s0 = arg0->pathCounter;
s16 temp_s1 = arg0->playerDirection;
- func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1343,7 +1345,7 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) {
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_packed_dl_5640);
gSPFogPosition(gDisplayListHead++, D_802B87B0, D_802B87B4);
- load_surface_map(moo_moo_farm_dls, arg0);
+ load_surface_map((uintptr_t) moo_moo_farm_dls, arg0);
if ((temp_s0 < 14) && (temp_s0 > 10)) {
if ((temp_s1 == 2) || (temp_s1 == 3) || (temp_s1 == 1))
@@ -1393,9 +1395,9 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) {
}
void render_toads_turnpike(struct UnkStruct_800DC5EC *arg0) {
- s32 pad[13];
+ UNUSED s32 pad[13];
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) &D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1406,7 +1408,7 @@ void render_toads_turnpike(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_PASS2);
gDPSetRenderMode(gDisplayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
- load_surface_map(toads_turnpike_dls, arg0);
+ load_surface_map((uintptr_t) toads_turnpike_dls, arg0);
gDPSetRenderMode(gDisplayListHead++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2);
gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_PASS2);
@@ -1419,7 +1421,7 @@ void render_toads_turnpike(struct UnkStruct_800DC5EC *arg0) {
void render_kalimari_desert(struct UnkStruct_800DC5EC *arg0) {
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1433,7 +1435,7 @@ void render_kalimari_desert(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
- load_surface_map(kalimari_desert_dls, arg0);
+ load_surface_map((uintptr_t) kalimari_desert_dls, arg0);
gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_packed_dl_1ED8);
gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_packed_dl_1B18);
gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_packed_dl_8330);
@@ -1452,10 +1454,10 @@ void render_sherbet_land(struct UnkStruct_800DC5EC *arg0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
- load_surface_map(sherbet_land_dls, arg0);
+ load_surface_map((uintptr_t) sherbet_land_dls, arg0);
}
-void render_rainbow_road(struct UnkStruct_800DC5EC *arg0) {
+void render_rainbow_road(UNUSED struct UnkStruct_800DC5EC *arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -1481,7 +1483,7 @@ void render_wario_stadium(struct UnkStruct_800DC5EC *arg0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATERGBA, G_CC_MODULATERGBA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
- load_surface_map(wario_stadium_dls, arg0);
+ load_surface_map((uintptr_t) wario_stadium_dls, arg0);
gSPDisplayList(gDisplayListHead++, d_course_wario_stadium_packed_dl_A228);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
@@ -1505,30 +1507,30 @@ void render_wario_stadium(struct UnkStruct_800DC5EC *arg0) {
}
switch (D_802B87D8) {
case 0:
- func_802A7658(D_800DC5DC, D_800DC5E0, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x8800));
+ func_802A7658(D_800DC5DC, D_800DC5E0, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x8800));
break;
case 1:
- func_802A7658(D_800DC5DC + 64, D_800DC5E0, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x9800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x9800));
break;
case 2:
- func_802A7658(D_800DC5DC, D_800DC5E0 + 32, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xA800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 32, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xA800));
break;
case 3:
- func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xB800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xB800));
break;
case 4:
- func_802A7658(D_800DC5DC, D_800DC5E0 + 64, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xC800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 64, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xC800));
break;
case 5:
- func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xD800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[prevFrame]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xD800));
break;
}
}
}
-void render_block_fort(struct UnkStruct_800DC5EC *arg0) {
+void render_block_fort(UNUSED struct UnkStruct_800DC5EC *arg0) {
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) &D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1536,8 +1538,8 @@ void render_block_fort(struct UnkStruct_800DC5EC *arg0) {
}
-void render_skyscraper(struct UnkStruct_800DC5EC *arg0) {
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
+void render_skyscraper(UNUSED struct UnkStruct_800DC5EC *arg0) {
+ func_802B5D64((uintptr_t) &D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1553,9 +1555,9 @@ void render_skyscraper(struct UnkStruct_800DC5EC *arg0) {
}
-void render_double_deck(struct UnkStruct_800DC5EC *arg0) {
+void render_double_deck(UNUSED struct UnkStruct_800DC5EC *arg0) {
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -1566,8 +1568,8 @@ void render_double_deck(struct UnkStruct_800DC5EC *arg0) {
void render_dks_jungle_parkway(struct UnkStruct_800DC5EC *arg0) {
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
- func_802B5D64(&D_800DC610[1], D_802B87D4, D_802B87D0, 1);
+ func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) &D_800DC610[1], D_802B87D4, D_802B87D0, 1);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK | G_LIGHTING);
@@ -1582,7 +1584,7 @@ void render_dks_jungle_parkway(struct UnkStruct_800DC5EC *arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
- load_surface_map(dks_jungle_parkway_dls, arg0);
+ load_surface_map((uintptr_t) dks_jungle_parkway_dls, arg0);
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
}
@@ -1591,7 +1593,7 @@ void render_big_donut(struct UnkStruct_800DC5EC *arg0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
- func_802B5D64(&D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -1673,7 +1675,7 @@ void func_8029569C(void) {
void func_80295A38(struct UnkStruct_800DC5EC *arg0) {
- func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
+ func_802B5D64((uintptr_t) D_800DC610, D_802B87D4, 0, 1);
if (D_800DC518 != 0) {
func_8029569C();
return;
@@ -1758,14 +1760,14 @@ void func_80295BF8(s32 playerIndex) {
}
void func_80295C6C(void) {
- gPrevLoadedAddress += ALIGN16(D_8015F588 * sizeof(mk64_surface_map_ram));
+ gNextFreeMemoryAddress += ALIGN16(D_8015F588 * sizeof(mk64_surface_map_ram));
D_8015F6E8 += 20;
D_8015F6F0 += 20;
D_8015F6EA += -20;
D_8015F6F2 += -20;
D_8015F6EE += -20;
func_802AF314();
- gPrevLoadedAddress += ALIGN16(D_8015F58A * 2);
+ gNextFreeMemoryAddress += ALIGN16(D_8015F58A * 2);
}
UNUSED void func_80295D50(s16 arg0, s16 arg1) {
@@ -1779,8 +1781,6 @@ void func_80295D6C(void) {
}
void func_80295D88(void) {
- f32 phi_f10;
-
gNumActors = 0;
D_8015F6EA = 0;
D_8015F6EE = 0;
@@ -1793,7 +1793,7 @@ void func_80295D88(void) {
func_80295D6C();
D_8015F58C = 0;
D_8015F588 = 0;
- D_8015F580 = gPrevLoadedAddress;
+ D_8015F580 = (mk64_surface_map_ram *) gNextFreeMemoryAddress;
D_800DC5BC = 0;
D_800DC5C8 = 0;
switch (gCurrentCourseId) {
@@ -1804,7 +1804,7 @@ void func_80295D88(void) {
} else {
func_802AF588(d_course_mario_raceway_packed_dl_2D68);
}
- func_80290CAC(&D_06009650);
+ func_80290CAC((uintptr_t) D_06009650);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
@@ -1827,13 +1827,13 @@ void func_80295D88(void) {
nullify_displaylist(d_course_choco_mountain_packed_dl_340);
nullify_displaylist(d_course_choco_mountain_packed_dl_3C8);
}
- func_80290CAC(&D_060072D0);
+ func_80290CAC((uintptr_t) &D_060072D0);
func_802B5CAC(0x238E, 0x31C7, D_8015F590);
func_80295C6C();
D_8015F8E4 = -80.0f;
break;
case COURSE_BOWSER_CASTLE:
- func_80290CAC(&D_060093D8);
+ func_80290CAC((uintptr_t) D_060093D8);
func_80295C6C();
func_802AF8BC(d_course_bowsers_castle_packed_dl_1350, 0x32, 0, 0, 0);
D_8015F8E4 = -50.0f;
@@ -1843,24 +1843,24 @@ void func_80295D88(void) {
D_801625EC = 0;
D_801625F4 = 0;
D_801625F0 = 0;
- func_80290CAC(D_0600B458);
+ func_80290CAC((uintptr_t) D_0600B458);
func_80295C6C();
func_802AF8BC(d_course_banshee_boardwalk_packed_dl_878, 128, 0, 0, 0);
D_8015F8E4 = -80.0f;
break;
case COURSE_YOSHI_VALLEY:
- func_802B5D64(D_06016558, -0x38F0, 0x1C70, 1);
- func_80290CAC(D_06018240);
+ func_802B5D64((uintptr_t) D_06016558, -0x38F0, 0x1C70, 1);
+ func_80290CAC((uintptr_t) D_06018240);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
case COURSE_FRAPPE_SNOWLAND:
- func_80290CAC(D_060079A0);
+ func_80290CAC((uintptr_t) D_060079A0);
func_80295C6C();
D_8015F8E4 = -50.0f;
break;
case COURSE_KOOPA_BEACH:
- func_80290CAC(D_06018FD8);
+ func_80290CAC((uintptr_t) D_06018FD8);
func_80295C6C();
func_802AF8BC(d_course_koopa_troopa_beach_packed_dl_ADE0, -0x6A, 255, 255, 255);
func_802AF8BC(d_course_koopa_troopa_beach_packed_dl_A540, -0x6A, 255, 255, 255);
@@ -1868,17 +1868,17 @@ void func_80295D88(void) {
func_802AF8BC(d_course_koopa_troopa_beach_packed_dl_358, -0x6A, 255, 255, 255);
break;
case COURSE_ROYAL_RACEWAY:
- func_80290CAC(D_0600DC28);
+ func_80290CAC((uintptr_t) D_0600DC28);
func_80295C6C();
D_8015F8E4 = -60.0f;
break;
case COURSE_LUIGI_RACEWAY:
- func_80290CAC(D_0600FF28);
+ func_80290CAC((uintptr_t) D_0600FF28);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
case COURSE_MOO_MOO_FARM:
- func_80290CAC(D_060144B8);
+ func_80290CAC((uintptr_t) D_060144B8);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
@@ -1888,17 +1888,17 @@ void func_80295D88(void) {
D_801625F0 = 4;
D_802B87B0 = 993;
D_802B87B4 = 1000;
- func_80290CAC(D_06023B68);
+ func_80290CAC((uintptr_t) D_06023B68);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
case COURSE_KALAMARI_DESERT:
- func_80290CAC(D_06023070);
+ func_80290CAC((uintptr_t) D_06023070);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
case COURSE_SHERBET_LAND:
- func_80290CAC(D_06009C20);
+ func_80290CAC((uintptr_t) D_06009C20);
func_80295C6C();
D_8015F8E4 = -18.0f;
func_802AF8BC(d_course_sherbet_land_packed_dl_1EB8, -0x4C, 255, 255, 255);
@@ -1906,7 +1906,7 @@ void func_80295D88(void) {
break;
case COURSE_RAINBOW_ROAD:
D_800DC5C8 = 1;
- func_80290CAC(D_06016440);
+ func_80290CAC((uintptr_t) D_06016440);
func_80295C6C();
D_8015F8E4 = 0.0f;
func_802AF8BC(d_course_rainbow_road_packed_dl_2068, -0x6A, 255, 255, 255);
@@ -1917,7 +1917,7 @@ void func_80295D88(void) {
}
break;
case COURSE_WARIO_STADIUM:
- func_80290CAC(D_0600CC38);
+ func_80290CAC((uintptr_t) D_0600CC38);
func_80295C6C();
D_8015F8E4 = D_8015F6EE - 10.0f;
func_802AF8BC(d_course_wario_stadium_packed_dl_C50, 100, 255, 255, 255);
@@ -1947,7 +1947,7 @@ void func_80295D88(void) {
D_8015F8E4 = D_8015F6EE - 10.0f;
break;
case COURSE_DK_JUNGLE:
- func_80290CAC(D_06014338);
+ func_80290CAC((uintptr_t) D_06014338);
func_80295C6C();
D_8015F8E4 = -475.0f;
func_802AF8BC(d_course_dks_jungle_parkway_packed_dl_3FA8, 120, 255, 255, 255);
@@ -2001,7 +2001,7 @@ void func_802966A0(void) {
if (D_802B87BC >= 0x100) {
D_802B87BC = 0;
}
- func_802AF7B4(D_0600B278, 0, D_802B87BC);
+ func_802AF7B4((uintptr_t) D_0600B278, 0, D_802B87BC);
break;
case COURSE_ROYAL_RACEWAY:
D_802B87BC -= 20;
diff --git a/src/render_courses.h b/src/render_courses.h
index ae4c46ba1..88813326a 100644
--- a/src/render_courses.h
+++ b/src/render_courses.h
@@ -8,9 +8,10 @@ struct Unk0CAC {
u16 unk6;
};
+void func_8029122C(struct UnkStruct_800DC5EC*, s32);
s32 func_80290C20(Camera*);
void func_80290CAC(uintptr_t);
-void load_surface_map(s32, struct UnkStruct_800DC5EC*);
+void load_surface_map(uintptr_t, struct UnkStruct_800DC5EC*);
void func_80291198();
void func_802911C4();
void render_mario_raceway(struct UnkStruct_800DC5EC*);
@@ -44,11 +45,10 @@ void func_802969F8();
extern Gfx *gDisplayListHead;
extern s16 gCurrentCourseId;
-extern u32 gPrevLoadedAddress;
+extern u32 gNextFreeMemoryAddress;
extern s32 gActiveScreenMode;
extern u16 sRenderedFramebuffer;
-extern uintptr_t *gPhysicalFramebuffers[];
extern uintptr_t gSegmentTable[];
extern Player gPlayers[];
diff --git a/src/skybox_and_splitscreen.c b/src/skybox_and_splitscreen.c
index fd3dc97a9..68454b23e 100644
--- a/src/skybox_and_splitscreen.c
+++ b/src/skybox_and_splitscreen.c
@@ -6,57 +6,64 @@
#include <common_structs.h>
#include <variables.h>
#include <config.h>
+#include "memory.h"
#include "camera.h"
#include "common_textures.h"
#include "skybox_and_splitscreen.h"
+#include "code_8001F980.h"
+#include "code_80057C60.h"
+#include "code_80091750.h"
+#include "actors.h"
+#include "render_courses.h"
+#include "math_util.h"
+
Vp D_802B8880[] = {
- {640, 480, 511, 0,
- 640, 480, 511, 0},
+ {{{640, 480, 511, 0}, {640, 480, 511, 0}}},
};
Vtx D_802B8890[] = {
- { SCREEN_WIDTH, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
- { SCREEN_WIDTH, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
+ {{{ SCREEN_WIDTH, SCREEN_HEIGHT, -1 }, 0, { 0, 0 }, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1 }, 0, { 0, 0 }, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, 120, -1 }, 0, { 0, 0 }, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, SCREEN_HEIGHT, -1 }, 0, { 0, 0 }, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1 }, 0, { 0, 0 }, { 0x00, 0xDC, 0x00, 0xFF }}},
+ {{{ SCREEN_WIDTH, 0, -1 }, 0, { 0, 0 }, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 0, -1 }, 0, { 0, 0 }, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 120, -1 }, 0, { 0, 0 }, { 0x00, 0xDC, 0x00, 0xFF }}},
};
Vtx D_802B8910[] = {
- { SCREEN_WIDTH, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
- { SCREEN_WIDTH, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
+ {{{ SCREEN_WIDTH, SCREEN_HEIGHT, -1 }, 0, { 0, 0 }, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1 }, 0, { 0, 0 }, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, 120, -1 }, 0, { 0, 0 }, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, SCREEN_HEIGHT, -1 }, 0, { 0, 0 }, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1 }, 0, { 0, 0 }, { 0x00, 0xDC, 0x00, 0xFF }}},
+ {{{ SCREEN_WIDTH, 0, -1 }, 0, { 0, 0 }, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 0, -1 }, 0, { 0, 0 }, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 120, -1 }, 0, { 0, 0 }, { 0x00, 0xDC, 0x00, 0xFF }}},
};
-Vtx D_802B8990[] = {
- { SCREEN_WIDTH, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
- { SCREEN_WIDTH, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
+Vtx D_802B8990[] = {
+ {{{ SCREEN_WIDTH, SCREEN_HEIGHT, -1}, 0, { 0, 0 }, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1}, 0, { 0, 0 }, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, 120, -1}, 0, { 0, 0 }, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, SCREEN_HEIGHT, -1}, 0, { 0, 0 }, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1}, 0, { 0, 0 }, { 0x00, 0xDC, 0x00, 0xFF }}},
+ {{{ SCREEN_WIDTH, 0, -1}, 0, { 0, 0 }, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 0, -1}, 0, { 0, 0 }, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 120, -1}, 0, { 0, 0 }, { 0x00, 0xDC, 0x00, 0xFF }}},
};
Vtx D_802B8A10[] = {
- { SCREEN_WIDTH, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x1E, 0x1E, 0xFF, 0xFF},
- { 0, SCREEN_HEIGHT, -1, 0, 0, 0, 0xC8, 0xC8, 0xFF, 0xFF},
- { SCREEN_WIDTH, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
- { SCREEN_WIDTH, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 0, -1, 0, 0, 0, 0x78, 0xFF, 0x78, 0xFF},
- { 0, 120, -1, 0, 0, 0, 0x00, 0xDC, 0x00, 0xFF},
+ {{{ SCREEN_WIDTH, SCREEN_HEIGHT, -1}, 0, { 0, 0}, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1}, 0, { 0, 0}, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, 120, -1}, 0, { 0, 0}, { 0x1E, 0x1E, 0xFF, 0xFF }}},
+ {{{ 0, SCREEN_HEIGHT, -1}, 0, { 0, 0}, { 0xC8, 0xC8, 0xFF, 0xFF }}},
+ {{{ SCREEN_WIDTH, 120, -1}, 0, { 0, 0}, { 0x00, 0xDC, 0x00, 0xFF }}},
+ {{{ SCREEN_WIDTH, 0, -1}, 0, { 0, 0}, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 0, -1}, 0, { 0, 0}, { 0x78, 0xFF, 0x78, 0xFF }}},
+ {{{ 0, 120, -1}, 0, { 0, 0}, { 0x00, 0xDC, 0x00, 0xFF }}},
};
void func_802A3730(struct UnkStruct_800DC5EC *arg0) {
@@ -107,10 +114,6 @@ UNUSED void func_802A38AC(void) {
}
void func_802A38B4(void) {
- s32 temp_v0_3;
- void *temp_v0;
- void *temp_v0_2;
-
init_rdp();
select_framebuffer();
@@ -425,7 +428,7 @@ void func_802A450C(Vtx *skybox) {
skybox[7].v.cn[2] = D_802B8BCC[gCurrentCourseId].unk4;
}
-void func_802A487C(Vtx *arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3, UNUSED s32 arg4) {
+void func_802A487C(Vtx *arg0, UNUSED struct UnkStruct_800DC5EC *arg1, UNUSED s32 arg2, UNUSED s32 arg3, UNUSED f32 *arg4) {
init_rdp();
if (gCurrentCourseId != COURSE_RAINBOW_ROAD) {
@@ -516,8 +519,6 @@ GLOBAL_ASM("asm/non_matchings/skybox/func_802A4A0C.s")
#endif
void func_802A4D18(void) {
- f32 var_f10;
-
if (gGamestate != 4) {
D_8015014C = 6800.0f;
D_80150150 = 3.0f;
@@ -616,9 +617,9 @@ void func_802A5004(void) {
func_802A39E0(D_800DC5F0);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
+ func_802A4A0C((Vtx *) D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
func_80057FC4(2);
- func_802A487C(&D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
+ func_802A487C((Vtx *) D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
func_80093A30(2);
}
}
@@ -633,9 +634,9 @@ void func_802A50EC(void) {
func_802A39E0(D_800DC5EC);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
+ func_802A4A0C((Vtx *) D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
func_80057FC4(1);
- func_802A487C(&D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
+ func_802A487C((Vtx *) D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
func_80093A30(1);
}
}
@@ -650,9 +651,9 @@ void func_802A51D4(void) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
+ func_802A4A0C((Vtx *) D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
func_80057FC4(3);
- func_802A487C(&D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
+ func_802A487C((Vtx *) D_802B8890, D_800DC5EC, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[0]);
func_80093A30(3);
}
}
@@ -667,9 +668,9 @@ void func_802A52BC(void) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
+ func_802A4A0C((Vtx *) D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
func_80057FC4(4);
- func_802A487C(&D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
+ func_802A487C((Vtx *) D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
func_80093A30(4);
}
}
@@ -686,11 +687,11 @@ void func_802A53A4(void) {
init_z_buffer();
select_framebuffer();
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
+ func_802A4A0C((Vtx *) D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
if (gGamestate != CREDITS_SEQUENCE) {
func_80057FC4(0);
}
- func_802A487C(&D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
+ func_802A487C((Vtx *) D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
func_80093A30(0);
}
}
@@ -705,9 +706,9 @@ void func_802A54A8(void) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
+ func_802A4A0C((Vtx *) D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
func_80057FC4(8);
- func_802A487C(&D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
+ func_802A487C((Vtx *) D_802B8890, D_800DC5EC, 0x140, 0xF0, &D_80150130[0]);
func_80093A30(8);
}
}
@@ -722,9 +723,9 @@ void func_802A5590(void) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
+ func_802A4A0C((Vtx *) D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
func_80057FC4(9);
- func_802A487C(&D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
+ func_802A487C((Vtx *) D_802B8910, D_800DC5F0, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[1]);
func_80093A30(9);
}
}
@@ -739,9 +740,9 @@ void func_802A5678(void) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CLIPPING);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8990, D_800DC5F4, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[2]);
+ func_802A4A0C((Vtx *) D_802B8990, D_800DC5F4, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[2]);
func_80057FC4(10);
- func_802A487C(&D_802B8990, D_800DC5F4, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[2]);
+ func_802A487C((Vtx *) D_802B8990, D_800DC5F4, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[2]);
func_80093A30(10);
}
}
@@ -775,9 +776,9 @@ void func_802A5760(void) {
func_802A39E0(D_800DC5F8);
if (D_800DC5B4 != 0) {
- func_802A4A0C(&D_802B8A10, D_800DC5F8, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[3]);
+ func_802A4A0C(D_802B8A10, D_800DC5F8, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[3]);
func_80057FC4(11);
- func_802A487C(&D_802B8A10, D_800DC5F8, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[3]);
+ func_802A487C(D_802B8A10, D_800DC5F8, SCREEN_WIDTH, SCREEN_HEIGHT, &D_80150130[3]);
func_80093A30(11);
}
}
@@ -785,8 +786,10 @@ void func_802A5760(void) {
void func_802A59A4(void) {
Camera *camera = &cameras[0];
- u16 spAA[32];
- s32 sp5C[8];
+ UNUSED s32 pad[4];
+ u16 perspNorm;
+ UNUSED s32 pad2[3];
+ Mat4 matrix;
func_802A53A4();
init_rdp();
@@ -794,8 +797,8 @@ void func_802A59A4(void) {
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
- guPerspective(&gGfxPool->mtxPool[1], &spAA[23], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, spAA[23]);
+ guPerspective(&gGfxPool->mtxPool[1], &perspNorm, D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2],
@@ -803,16 +806,16 @@ void func_802A59A4(void) {
camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp5C);
- func_802B4FF8(sp5C, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5EC);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp5C);
- func_802B4FF8(sp5C, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5EC);
func_80058090(0);
@@ -833,25 +836,25 @@ void func_802A59A4(void) {
void func_802A5CB4(void) {
Camera *camera = &cameras[0];
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A50EC();
init_rdp();
func_802A3730(D_800DC5EC);
-
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[1], &perspNorm, D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
@@ -860,8 +863,8 @@ void func_802A5CB4(void) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5EC);
func_80058090(1);
@@ -883,33 +886,32 @@ void func_802A5CB4(void) {
void func_802A5FAC(void) {
Camera *camera = &cameras[1];
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A5004();
init_rdp();
func_802A3730(D_800DC5F0);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[2], &sp9A[17], D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[2], &perspNorm, D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[2]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
- //D_801647A8, D_801647AC, D_801647B0, D_801647B4, D_801647B8, D_801647BC, D_801647C0, D_801647C4, D_801647C8);
-
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5F0);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5F0);
func_80058090(2);
@@ -931,32 +933,34 @@ void func_802A5FAC(void) {
void func_802A62A4(void) {
Camera *camera = &cameras[0];
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A51D4();
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
init_rdp();
func_802A3730(D_800DC5EC);
+
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[1], &perspNorm, D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5EC);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5EC);
func_80058090(3);
@@ -978,32 +982,34 @@ void func_802A62A4(void) {
void func_802A65B8(void) {
Camera *camera = &cameras[1];
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A52BC();
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
init_rdp();
func_802A3730(D_800DC5F0);
+
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[2], &sp9A[17], D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[2], &perspNorm, D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[2]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5F0);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(&sp58);
- func_802B4FF8(&sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5F0);
func_80058090(4);
@@ -1025,31 +1031,32 @@ void func_802A65B8(void) {
void func_802A68CC(void) {
Camera *camera = camera1;
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A54A8();
init_rdp();
func_802A3730(D_800DC5EC);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[1], &sp9A[17], D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[1], &perspNorm, D_80150130[0], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[1]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[7], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(&sp58);
- func_802B4FF8(&sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5EC);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[7]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(&sp58);
- func_802B4FF8(&sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5EC);
func_80058090(8);
@@ -1071,31 +1078,32 @@ void func_802A68CC(void) {
void func_802A6BB0(void) {
Camera *camera = camera2;
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A5590();
init_rdp();
func_802A3730(D_800DC5F0);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[2], &sp9A[17], D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[2], &perspNorm, D_80150130[1], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[2]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[8], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5F0);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[8]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5F0);
func_80058090(9);
@@ -1117,30 +1125,32 @@ void func_802A6BB0(void) {
void func_802A6E94(void) {
Camera *camera = camera3;
- u16 sp9A[22];
- s32 sp58[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A5678();
init_rdp();
func_802A3730(D_800DC5F4);
+
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[3], &sp9A[17], D_80150130[2], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp9A[17]);
+ guPerspective(&gGfxPool->mtxPool[3], &perspNorm, D_80150130[2], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[3]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[9], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[9]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[9]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5F4);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[9]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp58);
- func_802B4FF8(sp58, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5F4);
func_80058090(10);
@@ -1162,8 +1172,9 @@ void func_802A6E94(void) {
void func_802A7178(void) {
Camera *camera = camera4;
- u16 sp92[22];
- s32 sp50[8];
+ UNUSED s32 pad[2];
+ u16 perspNorm;
+ Mat4 matrix;
func_802A5760();
if (gPlayerCountSelection1 == 3) {
@@ -1179,22 +1190,22 @@ void func_802A7178(void) {
func_802A3730(D_800DC5F8);
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH);
- guPerspective(&gGfxPool->mtxPool[4], &sp92[17], D_80150130[3], D_80150148, D_80150150, D_8015014C, 1.0f);
- gDPHalf1(gDisplayListHead++, sp92[17]);
+ guPerspective(&gGfxPool->mtxPool[4], &perspNorm, D_80150130[3], D_80150148, D_80150150, D_8015014C, 1.0f);
+ gDPHalf1(gDisplayListHead++, perspNorm);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[4]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(&gGfxPool->mtxPool[10], camera->pos[0], camera->pos[1], camera->pos[2], camera->lookAt[0], camera->lookAt[1], camera->lookAt[2], camera->up[0], camera->up[1], camera->up[2]);
if (D_800DC5C8 == 0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[10]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp50);
- func_802B4FF8(sp50, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
} else {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[10]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
func_80295A38(D_800DC5F8);
if (D_800DC5C8 == 1) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[10]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
- mtxf_identity(sp50);
- func_802B4FF8(sp50, 0);
+ mtxf_identity(matrix);
+ func_802B4FF8(matrix, 0);
}
func_802A3008(D_800DC5F8);
func_80058090(11);
@@ -1317,12 +1328,12 @@ void func_802A7728(void) {
} else if (temp_v0 > 2) {
temp_v0 = 0;
}
- func_802A7658(D_800DC5DC, D_800DC5E0, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0x8800));
- func_802A7658(D_800DC5DC + 64, D_800DC5E0, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0x9800));
- func_802A7658(D_800DC5DC, D_800DC5E0 + 32, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xA800));
- func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xB800));
- func_802A7658(D_800DC5DC, D_800DC5E0 + 64, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xC800));
- func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xD800));
+ func_802A7658(D_800DC5DC, D_800DC5E0, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0x8800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0x9800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 32, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xA800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 32, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xB800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 64, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xC800));
+ func_802A7658(D_800DC5DC + 64, D_800DC5E0 + 64, 64, 32, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5]+0xD800));
}
void func_802A7940(void) {
@@ -1340,10 +1351,10 @@ void func_802A7940(void) {
} else if (temp_v0 > 2) {
temp_v0 = 0;
}
- func_802A7658(D_800DC5DC, D_800DC5E0, 0x40, 0x20, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800));
- func_802A7658(D_800DC5DC + 0x40, D_800DC5E0, 0x40, 0x20, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x10800));
- func_802A7658(D_800DC5DC, D_800DC5E0 + 0x20, 0x40, 0x20, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x11800));
- func_802A7658(D_800DC5DC + 0x40, D_800DC5E0 + 0x20, 0x40, 0x20, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x12800));
- func_802A7658(D_800DC5DC, D_800DC5E0 + 0x40, 0x40, 0x20, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x13800));
- func_802A7658(D_800DC5DC + 0x40, D_800DC5E0 + 0x40, 0x40, 0x20, PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x14800));
+ func_802A7658(D_800DC5DC, D_800DC5E0, 0x40, 0x20, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0xF800));
+ func_802A7658(D_800DC5DC + 0x40, D_800DC5E0, 0x40, 0x20, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x10800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 0x20, 0x40, 0x20, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x11800));
+ func_802A7658(D_800DC5DC + 0x40, D_800DC5E0 + 0x20, 0x40, 0x20, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x12800));
+ func_802A7658(D_800DC5DC, D_800DC5E0 + 0x40, 0x40, 0x20, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x13800));
+ func_802A7658(D_800DC5DC + 0x40, D_800DC5E0 + 0x40, 0x40, 0x20, (u16 *) PHYSICAL_TO_VIRTUAL(gPhysicalFramebuffers[temp_v0]), (u16 *) PHYSICAL_TO_VIRTUAL(gSegmentTable[5] + 0x14800));
}
diff --git a/src/skybox_and_splitscreen.h b/src/skybox_and_splitscreen.h
index 7506ca6a0..5e25a2829 100644
--- a/src/skybox_and_splitscreen.h
+++ b/src/skybox_and_splitscreen.h
@@ -5,6 +5,8 @@
/* Function Prototypes */
+void func_802A4A0C(Vtx*, struct UnkStruct_800DC5EC*, s32, s32, f32*);
+
void func_802A3730(struct UnkStruct_800DC5EC*);
void func_802A38AC();
void func_802A38B4();
@@ -24,7 +26,7 @@ void set_viewport();
void select_framebuffer();
void func_802A4300();
void func_802A450C(Vtx*);
-void func_802A487C(Vtx*, s32, s32, s32, s32);
+void func_802A487C(Vtx*, struct UnkStruct_800DC5EC*, s32, s32, f32*);
void func_802A4D18();
void func_802A4EF4();
void func_802A5004();
@@ -65,7 +67,6 @@ extern s32 D_800E86A4;
extern s32 gMenuSelectionFromQuit;
extern u32 D_801502B4;
-extern uintptr_t gPhysicalFramebuffers[3];
extern u16 sRenderingFramebuffer;
extern s32 D_800DC5D0;
extern s32 D_800DC5D4;
diff --git a/src/spawn_players.c b/src/spawn_players.c
index 990ac5409..bc1ca8a67 100644
--- a/src/spawn_players.c
+++ b/src/spawn_players.c
@@ -12,6 +12,7 @@
#include "code_802AAA70.h"
#include "render_courses.h"
#include "spawn_players.h"
+#include "code_80005FD0.h"
// arg4 is height? Or something like that?
void spawn_player(Player *player, s8 playerIndex, f32 startingRow, f32 startingColumn, f32 arg4, f32 arg5, u16 characterId, s16 playerType) {
@@ -441,7 +442,7 @@ void func_80039F44(f32 *arg0, f32 *arg1, f32 arg2) {
D_80165560[0] = rand;
for (i = 1; i < 7; i++) {
- u16* arr = D_800E3890[gCharacterSelections[0]];
+ u16* arr = (u16 *) D_800E3890[gCharacterSelections[0]];
if (rand == arr[i]) {
D_80165560[i] = arr[0];
} else {
@@ -530,7 +531,7 @@ getRand:
D_80165560[0] = rand;
for (i = 1; i < 6; i++) {
- u16* arr = D_800E3C50[gCharacterSelections[0]][gCharacterSelections[1]];
+ u16* arr = (u16 *) D_800E3C50[gCharacterSelections[0]][gCharacterSelections[1]];
if (rand == arr[i]) {
D_80165560[i] = arr[0];
} else {
@@ -699,7 +700,7 @@ void func_8003C0F0(void) {
s16 sp5C;
s16 sp5A;
s32 temp;
- s32 pad[4];
+ UNUSED s32 pad[4];
switch (gCurrentCourseId) {
case COURSE_MARIO_RACEWAY:
case COURSE_CHOCO_MOUNTAIN:
@@ -1018,12 +1019,12 @@ void func_8003CD98(Player *player, Camera *camera, s8 arg2, s8 arg3) {
func_80027A20(player, arg2, arg3, 0);
func_80027A20(player, arg2, arg3, 1);
func_80027040(player, arg2, arg3, arg3, 0);
- mio0decode(&D_802DFB80[0][arg3][arg2], &D_802BFB80[0][arg3][arg2]);
+ mio0decode((u8 *) &D_802DFB80[0][arg3][arg2], (u8 *) &D_802BFB80[0][arg3][arg2]);
} else {
func_80027A20(player, arg2, arg3, 0);
func_80027A20(player, arg2, arg3, 1);
func_80027040(player, (s8) (arg2 + 4), arg3, (s8) (arg3 - 2), 0);
- mio0decode(&D_802DFB80[0][arg3 - 2][arg2 + 4], &D_802BFB80[0][arg3 - 2][arg2 + 4]);
+ mio0decode((u8 *) &D_802DFB80[0][arg3 - 2][arg2 + 4], (u8 *) &D_802BFB80[0][arg3 - 2][arg2 + 4]);
}
D_801650D0[arg3][arg2] = player->unk_244[arg3];
@@ -1035,7 +1036,7 @@ void func_8003CD98(Player *player, Camera *camera, s8 arg2, s8 arg3) {
}
void func_8003D080(void) {
- s32 pad;
+ UNUSED s32 pad;
Player* ptr = &gPlayers[0];
func_8005D290();
diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c
index 3e46e9611..6bddea22e 100644
--- a/src/staff_ghosts.c
+++ b/src/staff_ghosts.c
@@ -6,6 +6,8 @@
#include "framebuffers.h"
#include "code_800B45E0.h"
#include "staff_ghosts.h"
+#include "code_80091750.h"
+#include "functions.h"
extern s32 mio0encode(s32 input, s32, s32);
extern s32 func_80040174(void *, s32, s32);
@@ -52,13 +54,10 @@ s32 D_80162DFC;
s32 D_80162E00;
-u32 *D_800DC710 = &D_802BFB80[0][2][3];
-u32 *D_800DC714 = &D_802BFB80[1][1][3];
+u32 *D_800DC710 = (u32 *) &D_802BFB80[0][2][3];
+u32 *D_800DC714 = (u32 *) &D_802BFB80[1][1][3];
-extern OSIoMesg *gDmaIoMesg;
extern u8 _kart_texturesSegmentRomStart;
-extern OSMesgQueue gDmaMesgQueue;
-extern OSMesg gMainReceivedMesg;
extern s16 gCurrentCourseId;
extern s32 gModeSelection;
@@ -84,22 +83,22 @@ extern s32 D_80164394;
extern s32 D_80164398;
void func_80004EF0(void) {
- D_80162DA4 = &D_802BFB80[0][2][3];
+ D_80162DA4 = (u32 *) &D_802BFB80[0][2][3];
osInvalDCache(&D_80162DA4[0], 0x4000);
- osPiStartDma(&gDmaIoMesg, 0, 0, (D_80162DC4 & 0xFFFFFF) + &_kart_texturesSegmentRomStart, D_80162DA4, 0x4000, &gDmaMesgQueue);
- osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
+ osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) ((D_80162DC4 & 0xFFFFFF) + &_kart_texturesSegmentRomStart), D_80162DA4, 0x4000, &gDmaMesgQueue);
+ osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
D_80162D9C = (*D_80162DA4 & 0xFF0000);
D_80162DA0 = 0;
}
void func_80004FB0(void) {
- D_80162DB4 = &D_802BFB80[0][D_80162DD0][3];
+ D_80162DB4 = (u32 *) &D_802BFB80[0][D_80162DD0][3];
D_80162DAC = *D_80162DB4 & 0xFF0000;
D_80162DB0 = 0;
}
void func_80004FF8(void) {
- D_80162D94 = &D_802BFB80[0][D_80162DC8][3];
+ D_80162D94 = (u32 *) &D_802BFB80[0][D_80162DC8][3];
D_80162D8C = (s32) *D_80162D94 & 0xFF0000;
D_80162D90 = 0;
}
@@ -121,7 +120,7 @@ void set_staff_ghost(void) {
D_80162DD6 = 1;
D_80162DF4 = 1;
}
- D_80162DC4 = &d_mario_raceway_staff_ghost;
+ D_80162DC4 = (u32) &d_mario_raceway_staff_ghost;
D_80162DE4 = 0;
break;
case COURSE_ROYAL_RACEWAY:
@@ -133,7 +132,7 @@ void set_staff_ghost(void) {
D_80162DD6 = 1;
D_80162DF4 = 1;
}
- D_80162DC4 = &d_royal_raceway_staff_ghost;
+ D_80162DC4 = (u32) &d_royal_raceway_staff_ghost;
D_80162DE4 = 6;
break;
case COURSE_LUIGI_RACEWAY:
@@ -145,7 +144,7 @@ void set_staff_ghost(void) {
D_80162DD6 = 1;
D_80162DF4 = 1;
}
- D_80162DC4 = &d_luigi_raceway_staff_ghost;
+ D_80162DC4 = (u32) &d_luigi_raceway_staff_ghost;
D_80162DE4 = 1;
break;
default:
@@ -159,15 +158,15 @@ s32 func_800051C4(void) {
if (D_80162D84 != 0) {
// func_80040174 in mio0_decode.s
- func_80040174(D_80162D80, (D_80162D84 * 4) + 0x20, D_800DC710);
- phi_v0 = mio0encode(D_800DC710, (D_80162D84 * 4) + 0x20, D_800DC714);
+ func_80040174((void *) D_80162D80, (D_80162D84 * 4) + 0x20, (s32) D_800DC710);
+ phi_v0 = mio0encode((s32) D_800DC710, (D_80162D84 * 4) + 0x20, (s32) D_800DC714);
return phi_v0 + 0x1e;
}
}
void func_8000522C(void) {
- D_80162D94 = &D_802BFB80[0][D_80162DC8][3];
- mio0decode(D_800DC714, D_80162D94);
+ D_80162D94 = (u32 *) &D_802BFB80[0][D_80162DC8][3];
+ mio0decode((u8 *) D_800DC714, (u8 *) D_80162D94);
D_80162D8C = (s32) (*D_80162D94 & 0xFF0000);
D_80162D90 = 0;
D_80162E00 = 1;
@@ -218,11 +217,11 @@ void func_80005310(void) {
} else {
D_80162DD8 = 1U;
- D_80162DBC = &D_802BFB80[0][D_80162DCC][3];
+ D_80162DBC = (u32 *) &D_802BFB80[0][D_80162DCC][3];
D_80162DBC[0] = -1;
D_80162DB8 = 0;
D_80162DDC = 0;
- func_80091EE4(&D_80162DC0);
+ func_80091EE4();
if (D_80162DD4 == 0) {
func_80004FF8();
}
@@ -414,7 +413,6 @@ void func_8000599C(void) {
u32 phi_a3;
u32 temp_v1;
u32 temp_v2;
- s16 new_var;
u32 temp_v0;
u32 temp_t0;
u32 temp_a0_2;
diff --git a/src/staff_ghosts.h b/src/staff_ghosts.h
index 909650a46..a26c333cf 100644
--- a/src/staff_ghosts.h
+++ b/src/staff_ghosts.h
@@ -5,6 +5,7 @@
#include "common_structs.h"
#include <types.h>
+void func_80005B18(void);
void func_80004EF0();
void func_80004FB0();
void func_80004FF8();