diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2023-05-22 13:05:54 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-22 13:05:54 -0600 |
| commit | e371f88b2d94047889f79b20d655684e0f74103d (patch) | |
| tree | b8a70ac4dac47bdbb86b9bad666e169dfbefb889 /src | |
| parent | eda4a3f1173d1b129ca765464eafb9fe6760e785 (diff) | |
UI and print debug matches (#310)
* various decomp
Diffstat (limited to 'src')
| -rw-r--r-- | src/actors_extended.c | 4 | ||||
| -rw-r--r-- | src/code_80057C60.c | 220 | ||||
| -rw-r--r-- | src/code_80086E70.c | 2 | ||||
| -rw-r--r-- | src/code_80086E70.h | 2 | ||||
| -rw-r--r-- | src/code_8008C1D0.c | 2 | ||||
| -rw-r--r-- | src/code_80091750.c | 5 | ||||
| -rw-r--r-- | src/code_80280650.c | 2 | ||||
| -rw-r--r-- | src/code_80281C40.c | 2 | ||||
| -rw-r--r-- | src/crash_screen.c | 4 | ||||
| -rw-r--r-- | src/gbiMacro.c | 6 | ||||
| -rw-r--r-- | src/hud_renderer.c (renamed from src/code_800431B0.c) | 1343 | ||||
| -rw-r--r-- | src/hud_renderer.h (renamed from src/code_800431B0.h) | 10 | ||||
| -rw-r--r-- | src/main.c | 4 | ||||
| -rw-r--r-- | src/math_util.c | 34 | ||||
| -rw-r--r-- | src/menus.c | 17 | ||||
| -rw-r--r-- | src/spawn_players.c | 3 |
16 files changed, 612 insertions, 1048 deletions
diff --git a/src/actors_extended.c b/src/actors_extended.c index 16a913ecf..0c94d4716 100644 --- a/src/actors_extended.c +++ b/src/actors_extended.c @@ -712,8 +712,8 @@ void update_obj_banana(struct BananaActor *banana) { } else { controller = &gControllers[banana->rot[0]]; } - if ((controller->buttonDepressed & 0x2000) != 0) { - controller->buttonDepressed &= ~0x2000; + if ((controller->buttonDepressed & Z_TRIG) != 0) { + controller->buttonDepressed &= ~Z_TRIG; banana->state = 1; banana->unk_04 = 0x00B4; player->statusEffects &= ~0x40000; diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 836ca50d0..734398596 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -9,7 +9,7 @@ #include "math_util_2.h" #include "code_80005FD0.h" #include "code_8001F980.h" -#include "code_800431B0.h" +#include "hud_renderer.h" #include "code_80057C60.h" #include "code_80071F00.h" #include "code_80086E70.h" @@ -2837,17 +2837,14 @@ loop_2: GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005D1F4.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 dma_textures(? *, ?, ?); // extern -extern ? D_0F05D1E8; -extern ? D_0F05D420; -extern ? D_0F05D674; -extern ? D_0F05DA50; -extern ? D_0F05DDFC; -extern ? D_0F05DFC0; -extern ? D_0F05E19C; -extern ? D_0F05E3E0; +extern Gfx D_0F05D1E8[]; +extern Gfx D_0F05D420[]; +extern Gfx D_0F05D674[]; +extern Gfx D_0F05DA50[]; +extern Gfx D_0F05DDFC[]; +extern Gfx D_0F05DFC0[]; +extern Gfx D_0F05E19C[]; +extern Gfx D_0F05E3E0[]; extern s32 D_8018D420; extern s32 D_8018D424; extern s32 D_8018D438; @@ -2865,13 +2862,10 @@ extern s32 D_8018D464; extern s32 D_8018D468; extern s32 D_8018D46C; extern s32 D_8018D470; -extern s32 D_8018D474; extern s32 D_8018D478; extern s32 D_8018D480; extern s32 D_8018D484; extern s32 D_8018D488; -extern s32 D_8018D48C; -extern s32 D_8018D490; extern s32 D_8018D494; extern s32 D_8018D498; extern s32 D_8018D49C; @@ -2886,35 +2880,35 @@ extern s32 D_8018D4BC; extern s32 D_8018D4C0; extern s32 D_8018D4C4; extern s32 D_8018D4C8; -extern ? gTexture69B03C; -extern ? gTexture69B140; -extern ? gTexture69B378; -extern ? gTexture69B960; -extern ? gTexture69BA28; -extern ? gTexture69C1E8; -extern ? gTexture69C354; -extern ? gTexture69C4E4; -extern ? gTexture69C80C; -extern ? gTexture69C9C4; -extern ? gTexture69CB84; -extern ? gTexture69CCEC; -extern ? gTexture69CEB8; -extern ? gTexture69D148; -extern ? gTexture69D4E0; -extern ? gTexture69D8FC; -extern ? gTexture69DCB4; -extern ? gTexture69DFA0; -extern ? gTexture69E25C; -extern ? gTexture69E518; -extern ? gTexture69E7A8; -extern ? gTexture69EA18; -extern ? gTexture69EC54; -extern ? gTexture69EE38; -extern ? gTexture69EFE0; -extern ? gTextureBoingExclamation; -extern ? gTextureKartShadow; -extern ? gTextureLightningBolt0; -extern ? gTextureLightningBolt1; +extern u8 gTexture69B03C[]; +extern u8 gTexture69B140[]; +extern u8 gTexture69B378[]; +extern u8 gTexture69B960[]; +extern u8 gTexture69BA28[]; +extern u8 gTexture69C1E8[]; +extern u8 gTexture69C354[]; +extern u8 gTexture69C4E4[]; +extern u8 gTexture69C80C[]; +extern u8 gTexture69C9C4[]; +extern u8 gTexture69CB84[]; +extern u8 gTexture69CCEC[]; +extern u8 gTexture69CEB8[]; +extern u8 gTexture69D148[]; +extern u8 gTexture69D4E0[]; +extern u8 gTexture69D8FC[]; +extern u8 gTexture69DCB4[]; +extern u8 gTexture69DFA0[]; +extern u8 gTexture69E25C[]; +extern u8 gTexture69E518[]; +extern u8 gTexture69E7A8[]; +extern u8 gTexture69EA18[]; +extern u8 gTexture69EC54[]; +extern u8 gTexture69EE38[]; +extern u8 gTexture69EFE0[]; +extern u8 gTextureBoingExclamation[]; +extern u8 gTextureKartShadow[]; +extern u8 gTextureLightningBolt0[]; +extern u8 gTextureLightningBolt1[]; void func_8005D290(void) { D_8018D488 = dma_textures(&gTexture69C80C, 0x400, 0x400); @@ -2956,9 +2950,6 @@ void func_8005D290(void) { 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") -#endif void func_8005D6C0(Player* player) { s32 temp_v0; @@ -8909,126 +8900,23 @@ void func_8006AFD0(Player *player, s16 arg1, s8 arg2, s8 arg3) { func_80021E10((f32 (*)[4]) &sp140[0], &sp134, &sp12C); func_80021F84((f32 (*)[4]) &sp140[0], var_f20); func_80022180(&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0, (f32 (*)[4]) &sp140[0]); - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->words.w0 = 0x01020040; - temp_v0_3->words.w1 = (s32) (&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0) & 0x1FFFFFFF; - temp_v0_4 = gDisplayListHead; - gDisplayListHead = temp_v0_4 + 8; - temp_v0_4->words.w1 = (u32) D_0D008DB8; - temp_v0_4->words.w0 = 0x06000000; - temp_v0_5 = gDisplayListHead; - gDisplayListHead = temp_v0_5 + 8; - temp_v0_5->words.w0 = 0xFD100000; - temp_v0_5->words.w1 = (u32) &D_800E52D0; - temp_v0_6 = gDisplayListHead; - gDisplayListHead = temp_v0_6 + 8; - temp_v0_6->words.w0 = 0xE8000000; - temp_v0_6->words.w1 = 0; - temp_v0_7 = gDisplayListHead; - gDisplayListHead = temp_v0_7 + 8; - temp_v0_7->words.w0 = 0xF5000100; - temp_v0_7->words.w1 = 0x07000000; - temp_v0_8 = gDisplayListHead; - gDisplayListHead = temp_v0_8 + 8; - temp_v0_8->words.w0 = 0xE6000000; - temp_v0_8->words.w1 = 0; - temp_v0_9 = gDisplayListHead; - gDisplayListHead = temp_v0_9 + 8; - temp_v0_9->words.w0 = 0xF0000000; - temp_v0_9->words.w1 = 0x073FC000; - temp_v0_10 = gDisplayListHead; - gDisplayListHead = temp_v0_10 + 8; - spB0 = temp_v0_10; - temp_v0_10->words.w0 = 0xE7000000; - temp_v0_10->words.w1 = 0; - temp_v0_11 = gDisplayListHead; - gDisplayListHead = temp_v0_11 + 8; - spAC = temp_v0_11; - temp_v0_11->words.w0 = 0xBA000E02; - spAC->words.w1 = 0x00008000; + + gSPMatrix(gDisplayListHead++, PHYSICAL_TO_VIRTUAL(&gGfxPool->mtxPool[D_80164AF0] + 0xFAC0), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gDisplayListHead++, D_0D008DB8); + gDPLoadTLUT_pal256(gDisplayListHead++, 0x800E52D0); + gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16); + func_8004B614((s32) sp128, (s32) sp126, (s32) sp124, (s32) sp122, (s32) sp120, (s32) sp11E, 0x000000D8); - temp_v0_12 = gDisplayListHead; - gDisplayListHead = temp_v0_12 + 8; - temp_v0_12->words.w0 = 0xB900031D; - temp_v0_12->words.w1 = 0x00505978; - temp_v0_13 = gDisplayListHead; - gDisplayListHead = temp_v0_13 + 8; - temp_v0_13->words.w0 = 0xFD500000; - temp_v0_13->words.w1 = D_8018D4BC; - temp_v0_14 = gDisplayListHead; - gDisplayListHead = temp_v0_14 + 8; - temp_v0_14->words.w1 = 0x07080200; - temp_v0_14->words.w0 = 0xF5500000; - temp_v0_15 = gDisplayListHead; - gDisplayListHead = temp_v0_15 + 8; - temp_v0_15->words.w1 = 0; - temp_v0_15->words.w0 = 0xE6000000; - temp_v0_16 = gDisplayListHead; - gDisplayListHead = temp_v0_16 + 8; - temp_v0_16->words.w1 = 0x073FF100; - temp_v0_16->words.w0 = 0xF3000000; - temp_v0_17 = gDisplayListHead; - gDisplayListHead = temp_v0_17 + 8; - temp_v0_17->words.w1 = 0; - temp_v0_17->words.w0 = 0xE7000000; - temp_v0_18 = gDisplayListHead; - gDisplayListHead = temp_v0_18 + 8; - temp_v0_18->words.w0 = 0xF5481000; - temp_v0_18->words.w1 = 0x00080200; - temp_v0_19 = gDisplayListHead; - gDisplayListHead = temp_v0_19 + 8; - temp_v0_19->words.w0 = 0xF2000000; - temp_v0_19->words.w1 = 0x000FC07C; - temp_v0_20 = gDisplayListHead; - gDisplayListHead = temp_v0_20 + 8; - temp_v0_20->words.w1 = (u32) &D_800E5250; - temp_v0_20->words.w0 = 0x0400103F; - temp_v0_21 = gDisplayListHead; - gDisplayListHead = temp_v0_21 + 8; - temp_v0_21->words.w1 = (u32) D_0D008C78; - temp_v0_21->words.w0 = 0x06000000; - temp_v0_22 = gDisplayListHead; - gDisplayListHead = temp_v0_22 + 8; - temp_v0_22->words.w0 = 0xFD500000; - temp_v0_22->words.w1 = D_8018D4C0 - 0x40; - temp_v0_23 = gDisplayListHead; - gDisplayListHead = temp_v0_23 + 8; - temp_v0_23->words.w1 = 0x07080200; - temp_v0_23->words.w0 = 0xF5500000; - temp_v0_24 = gDisplayListHead; - gDisplayListHead = temp_v0_24 + 8; - temp_v0_24->words.w1 = 0; - temp_v0_24->words.w0 = 0xE6000000; - temp_v0_25 = gDisplayListHead; - gDisplayListHead = temp_v0_25 + 8; - temp_v0_25->words.w1 = 0x073FF100; - temp_v0_25->words.w0 = 0xF3000000; - temp_v0_26 = gDisplayListHead; - gDisplayListHead = temp_v0_26 + 8; - temp_v0_26->words.w1 = 0; - temp_v0_26->words.w0 = 0xE7000000; - temp_v0_27 = gDisplayListHead; - gDisplayListHead = temp_v0_27 + 8; - temp_v0_27->words.w0 = 0xF5481000; - temp_v0_27->words.w1 = 0x00080200; - temp_v0_28 = gDisplayListHead; - gDisplayListHead = temp_v0_28 + 8; - temp_v0_28->words.w0 = 0xF2000000; - temp_v0_28->words.w1 = 0x000FC07C; - temp_v0_29 = gDisplayListHead; - gDisplayListHead = temp_v0_29 + 8; - temp_v0_29->words.w1 = (u32) &D_800E5290; - temp_v0_29->words.w0 = 0x0400103F; - temp_v0_30 = gDisplayListHead; - gDisplayListHead = temp_v0_30 + 8; - temp_v0_30->words.w1 = (u32) D_0D008C78; - temp_v0_30->words.w0 = 0x06000000; - temp_v0_31 = gDisplayListHead; - gDisplayListHead = temp_v0_31 + 8; - temp_v0_31->words.w1 = 0x00010001; - temp_v0_31->words.w0 = 0xBB000000; - D_80164AF0 += 1; + + gDPSetRenderMode(gDisplayListHead++, AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); + gDPLoadTextureBlock(gDisplayListHead++, D_8018D4BC, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSPVertex(gDisplayListHead++, D_800E5250, 4, 0); + gSPDisplayList(gDisplayListHead++, D_0D008C78); + gDPLoadTextureBlock(gDisplayListHead++, D_8018D4C0 - 0x40, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSPVertex(gDisplayListHead++, D_800E5290, 4, 0); + gSPDisplayList(gDisplayListHead++, D_0D008C78); + gSPTexture(gDisplayListHead++, 0x0001, 0x0001, 0, G_TX_RENDERTILE, G_OFF); + D_80164AF0++; } #else GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8006AFD0.s") diff --git a/src/code_80086E70.c b/src/code_80086E70.c index 611f2d522..99cb080e7 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -1274,7 +1274,7 @@ UNUSED void func_8008A2CC(s32 objectIndex, s32 cameraId, u16 arg2) { } } -u32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) { +s32 func_8008A364(s32 objectIndex, s32 cameraId, u16 arg2, s32 arg3) { Camera *camera; u32 var_v1; u16 var_a2; diff --git a/src/code_80086E70.h b/src/code_80086E70.h index 4c65f0380..203960227 100644 --- a/src/code_80086E70.h +++ b/src/code_80086E70.h @@ -77,7 +77,7 @@ s32 func_8008A0B4(s32, Player*, Camera*, u16); s32 func_8008A140(s32, Camera*, u16); void func_8008A1D0(s32, s32, s32, s32); void func_8008A2CC(s32, s32, u16); -u32 func_8008A364(s32, s32, u16, s32); +s32 func_8008A364(s32, s32, u16, s32); void func_8008A454(s32, s32, s32); void func_8008A4CC(s32); void func_8008A610(s32); diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 61ae4cbbf..baa2f4525 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -8,7 +8,7 @@ #include "code_80005FD0.h" #include "code_8001F980.h" #include "code_80027D00.h" -#include "code_800431B0.h" +#include "hud_renderer.h" #include "code_80057C60.h" #include "code_8008C1D0.h" #include "audio/external.h" diff --git a/src/code_80091750.c b/src/code_80091750.c index 2b9c09c68..664913447 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -325,6 +325,7 @@ void func_80092258(void); // todo remove this line void func_80091FA4(void) { s32 i; + // todo: These sizes need to be sizeof() for shiftability if possible D_8018D9B4 = get_next_available_memory_addr(0x00002800); D_8018D9B0 = get_next_available_memory_addr(0x000124F8); D_8018D9B8 = get_next_available_memory_addr(0x00001000); @@ -11262,7 +11263,6 @@ void func_800A7790(struct_8018D9E0_entry *arg0) { s32 creditIndex; s8 slideDirection; UNUSED s32 pad; - creditIndex = arg0->type - 0x190; set_text_color(D_802850C0[creditIndex].textColor); slideDirection = D_802850C0[creditIndex].slideDirection; @@ -11292,8 +11292,7 @@ void convert_number_to_ascii(s32 number, char *buffer) { void write_dashes(char *buffer) { buffer[0] = 0x2D; buffer[1] = 0x2D; - // Terminator - buffer[2] = 0; + buffer[2] = '\0'; } // Originally func_800A78F4 diff --git a/src/code_80280650.c b/src/code_80280650.c index 2c9c789b8..200fb2f1d 100644 --- a/src/code_80280650.c +++ b/src/code_80280650.c @@ -6,7 +6,7 @@ #include "variables.h" #include "common_textures.h" #include "code_8001F980.h" -#include "code_800431B0.h" +#include "hud_renderer.h" #include "code_80280650.h" void func_80280650(void) { diff --git a/src/code_80281C40.c b/src/code_80281C40.c index 121bdd2d2..2f751c3c5 100644 --- a/src/code_80281C40.c +++ b/src/code_80281C40.c @@ -4,7 +4,7 @@ #include "main.h" #include "math_util.h" #include "skybox_and_splitscreen.h" -#include "code_800431B0.h" +#include "hud_renderer.h" #include "code_80057C60.h" #include "code_80091750.h" #include "code_80280650.h" diff --git a/src/crash_screen.c b/src/crash_screen.c index fa7b6cace..a612f48fd 100644 --- a/src/crash_screen.c +++ b/src/crash_screen.c @@ -220,7 +220,8 @@ void thread9_crash_screen(UNUSED void *arg0) // Run only on the first iteration. if (sCounter == 0) { crash_screen_draw_square((u16 *)pFramebuffer); - + //#define SKIP_DRAW_SQUARE + #ifndef SKIP_DRAW_SQUARE while(1) { read_controllers(); @@ -238,6 +239,7 @@ void thread9_crash_screen(UNUSED void *arg0) break; } } + #endif crash_screen_draw_info((u16 *) pFramebuffer, thread); } diff --git a/src/gbiMacro.c b/src/gbiMacro.c index 0741209c0..37baa4b66 100644 --- a/src/gbiMacro.c +++ b/src/gbiMacro.c @@ -17,6 +17,6 @@ UNUSED void gfx_func_80040D00(void) { gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); guOrtho(&gGfxPool->mtxPool[0], 0.0f, 320.0f, 0.0f, 240.0f, -1.0f, 1.0f, 1.0f); gDPHalf1(gDisplayListHead++, 0x0000FFFF); - gSPMatrix(gDisplayListHead++, (u32) gGfxPool & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPMatrix(gDisplayListHead++, (u32) &D_0D008E98 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -} + gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(gGfxPool), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +}
\ No newline at end of file diff --git a/src/code_800431B0.c b/src/hud_renderer.c index 2641eb03f..64b6e381b 100644 --- a/src/code_800431B0.c +++ b/src/hud_renderer.c @@ -1,16 +1,18 @@ #include <ultra64.h> +#include <PR/gbi.h> #include <macros.h> #include <defines.h> #include <common_structs.h> #include <actor_types.h> #include <config.h> #include "memory.h" +#include "math_util.h" #include "math_util_2.h" #include "objects.h" #include "variables.h" #include "common_textures.h" #include "code_8001F980.h" -#include "code_800431B0.h" +#include "hud_renderer.h" #include "code_80071F00.h" #include "code_80091750.h" #include "code_802AAA70.h" @@ -253,7 +255,7 @@ void func_80044924(s8 *image, s32 width, s32 height) { temp_v0_7->words.w1 = ((((width - 1) * 4) & 0xFFF) << 0xC) | (((height - 1) * 4) & 0xFFF); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80044924.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80044924.s") #endif UNUSED void func_80044AB8(s8 *image, s32 width, s32 height) { @@ -322,7 +324,7 @@ void func_80044DA0(s8 *image, s32 width, s32 height) { temp_v0_7->words.w1 = ((((width - 1) * 4) & 0xFFF) << 0xC) | (((height - 1) * 4) & 0xFFF); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80044DA0.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80044DA0.s") #endif #ifdef MIPS_TO_C @@ -378,7 +380,7 @@ void func_80044F34(s32 arg0, s32 arg1, s32 arg2) { temp_v0_7->unk4 = ((((arg1 - 1) * 4) & 0xFFF) << 0xC) | (((arg2 - 1) * 4) & 0xFFF); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80044F34.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80044F34.s") #endif #ifdef MIPS_TO_C @@ -436,7 +438,7 @@ void func_800450C8(s8 *image, s32 width, s32 height) { temp_v1_7->words.w1 = ((((width - 1) * 4) & 0xFFF) << 0xC) | (((height - 1) * 4) & 0xFFF); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800450C8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800450C8.s") #endif void func_800452A4(s8 *image, s32 width, s32 height) { @@ -610,7 +612,7 @@ void func_80045738(s8 *image1, s8 *image2, s32 width, s32 height) { sp1C->words.w1 = sp4 | 0x01000000 | sp0; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80045738.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80045738.s") #endif void func_80045B2C(Vtx *arg0) { @@ -687,53 +689,32 @@ void func_80045F18(s8 *arg0, Vtx *arg1, s32 width, s32 arg3, s32 height, s32 som gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80045738(s8 *, s32, s32, s32); /* extern */ - void func_80046030(s8 *arg0, s32 arg1, Vtx *arg2, s32 width, s32 arg4, s32 height) { - Gfx *temp_v0; - Gfx *temp_v0_2; - Gfx *temp_v0_3; - s32 temp_lo; s32 temp_lo_2; s32 var_s0; s32 var_s2; - s32 var_s3; s8 *var_s1; + s32 i; + s32 var; + + gSPDisplayList(gDisplayListHead++, D_0D008138); - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w0 = 0x06000000; - temp_v0->words.w1 = (u32) D_0D008138; var_s0 = 0; - temp_lo = arg4 / height; var_s1 = arg0; var_s2 = arg1; - var_s3 = 0; - if (temp_lo > 0) { - temp_lo_2 = width * (height - 1); - do { - func_80045738(var_s1, var_s2, width, height); - func_80045B2C(&arg2[var_s0]); - var_s3 += 1; - var_s1 += temp_lo_2 * 2; - var_s2 += temp_lo_2; - var_s0 += 4; - } while (var_s3 != temp_lo); + + for (i = 0; i < arg4 / height; i++) { + func_80045738(var_s1, var_s2, width, height); + func_80045B2C(&arg2[var_s0]); + var = height - 1; + temp_lo_2 = (width * var); + var_s1 += temp_lo_2 * 2; + var_s2 += temp_lo_2; + var_s0 += 4; } - temp_v0_2 = gDisplayListHead; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->words.w0 = 0xBB000000; - temp_v0_2->words.w1 = 0x00010001; - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->words.w0 = 0x06000000; - temp_v0_3->words.w1 = (u32) D_0D008120; + gSPTexture(gDisplayListHead++, 0x0001, 0x0001, 0, G_TX_RENDERTILE, G_OFF); + gSPDisplayList(gDisplayListHead++, D_0D008120); } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80046030.s") -#endif void func_800461A4(s8 *arg0, Vtx *arg1, s32 width, s32 arg3, s32 height) { s32 vertexIndex; @@ -747,7 +728,7 @@ void func_800461A4(s8 *arg0, Vtx *arg1, s32 width, s32 arg3, s32 height) { func_80045B2C(&arg1[vertexIndex]); var_s1 += width * height * 4; vertexIndex += 4; - } + } gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } @@ -763,7 +744,7 @@ void func_800462A8(s8 *arg0, Vtx *arg1, s32 width, s32 arg3, s32 height) { func_80045B2C(&arg1[vertexIndex]); var_s1 += width * (height - 1) * 4; vertexIndex += 4; - } + } gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } @@ -1340,64 +1321,27 @@ void func_80049478(s8 *arg0, Vtx *arg1, s32 arg2, s32 arg3, s32 width, s32 heigh gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044924(s8 *, s32, s32); /* extern */ - void func_8004961C(s8 *arg0, Vtx *arg1, s32 arg2, s32 arg3, s32 width, s32 height) { - s32 sp5C; - s32 sp40; - Gfx *temp_v0; - Gfx *temp_v0_2; - Gfx *temp_v0_3; - s32 temp_lo; - s32 temp_lo_2; - s32 var_s0; + s32 i; + s32 j; s32 var_s2; - s32 var_v0; s8 *var_s3; - - temp_lo = arg3 / height; var_s2 = 0; var_s3 = arg0; - sp40 = temp_lo; - var_v0 = 0; - if (temp_lo > 0) { - temp_lo_2 = arg2 / width; - do { - var_s0 = 0; - if (temp_lo_2 > 0) { - sp5C = var_v0; - do { - // gSPVertex(gDisplayListHead++, &arg2[var_s1], 4, 0); - // gSPDisplayList(gDisplayListHead++, D_0D006940); - func_80044924(var_s3, width, height); - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w0 = 0x0400103F; - var_s0 += 1; - temp_v0->words.w1 = (u32) &arg1[var_s2]; - temp_v0_2 = gDisplayListHead; - var_s3 = &var_s3[(s32) (width * height) / 2]; - gDisplayListHead = temp_v0_2 + 8; - var_s2 += 4; - temp_v0_2->words.w1 = (u32) D_0D006940; - temp_v0_2->words.w0 = 0x06000000; - } while (var_s0 != temp_lo_2); - var_v0 = sp5C; - } - var_v0 += 1; - } while (var_v0 != sp40); + + for (i = 0; i < arg3 / height; i++) { + for (j = 0; j < arg2 / width; j++) { + + func_80044924(var_s3, width, height); + gSPVertex(gDisplayListHead++, &arg1[var_s2], 4, 0); + gSPDisplayList(gDisplayListHead++, D_0D006940); + var_s3 += (width * height) / 2; + var_s2 += 4; + } } - // gSPTexture(gDisplayListHead++, 0, 0, 0, G_TX_RENDERTILE, G_OFF); - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->words.w0 = 0xBB000000; - temp_v0_3->words.w1 = 0x00010001; + + gSPTexture(gDisplayListHead++, 0x0001, 0x0001, 0, G_TX_RENDERTILE, G_OFF); } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004961C.s") -#endif void func_800497CC(s8 *arg0, Vtx *arg1, s32 arg2, s32 arg3, s32 width, s32 height) { s32 heightIndex; @@ -1419,64 +1363,25 @@ void func_800497CC(s8 *arg0, Vtx *arg1, s32 arg2, s32 arg3, s32 width, s32 heigh gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044DA0(s8 *, s32, s32); /* extern */ - void func_80049970(s8 *arg0, Vtx *arg1, s32 arg2, s32 arg3, s32 width, s32 height) { - s32 sp5C; - s32 sp40; - Gfx *temp_v0; - Gfx *temp_v0_2; - Gfx *temp_v0_3; - s32 temp_lo; - s32 temp_lo_2; - s32 var_s0; + s32 i; + s32 j; s32 var_s2; - s32 var_v0; s8 *var_s3; - - temp_lo = arg3 / height; var_s2 = 0; var_s3 = arg0; - sp40 = temp_lo; - var_v0 = 0; - if (temp_lo > 0) { - temp_lo_2 = arg2 / width; - do { - var_s0 = 0; - if (temp_lo_2 > 0) { - sp5C = var_v0; - do { - func_80044DA0(var_s3, width, height); - // gSPVertex(gDisplayListHead++, &arg2[var_s1], 4, 0); - // gSPDisplayList(gDisplayListHead++, D_0D006940); - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w0 = 0x0400103F; - var_s0 += 1; - temp_v0->words.w1 = (u32) &arg1[var_s2]; - temp_v0_2 = gDisplayListHead; - var_s3 = &var_s3[(s32) (width * height) / 2]; - gDisplayListHead = temp_v0_2 + 8; - var_s2 += 4; - temp_v0_2->words.w1 = (u32) D_0D006940; - temp_v0_2->words.w0 = 0x06000000; - } while (var_s0 != temp_lo_2); - var_v0 = sp5C; - } - var_v0 += 1; - } while (var_v0 != sp40); + + for (i = 0; i < arg3 / height; i++) { + for (j = 0; j < arg2 / width; j++) { + func_80044DA0(var_s3, width, height); + gSPVertex(gDisplayListHead++, &arg1[var_s2], 4, 0); + gSPDisplayList(gDisplayListHead++, D_0D006940); + var_s3 += (width * height) / 2; + var_s2 += 4; + } } - // gSPTexture(gDisplayListHead++, 0, 0, 0, G_TX_RENDERTILE, G_OFF); - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->words.w0 = 0xBB000000; - temp_v0_3->words.w1 = 0x00010001; + gSPTexture(gDisplayListHead++, 0x0001, 0x0001, 0, G_TX_RENDERTILE, G_OFF); } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80049970.s") -#endif void func_80049B20(s32 arg0, s32 arg1, u16 arg2, f32 arg3, s32 arg4, Vtx *arg5, s32 arg6, s32 arg7, s32 arg8, s32 arg9) { func_80042330(arg0, arg1, arg2, arg3); @@ -1833,125 +1738,82 @@ void func_8004B72C(s32 primRed, s32 primGreen, s32 primBlue, s32 envRed, s32 env gDPSetCombineLERP(gDisplayListHead++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); } -#ifdef MIPS_TO_C -//generated by m2c commit 6b6e1390bf30013247343623194964ff13d0c45b -void func_8004B7DC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { - Gfx *temp_v1; - Gfx *temp_v1_2; - Gfx *temp_v1_3; - Gfx *temp_v1_4; - Gfx *temp_v1_5; - Gfx *temp_v1_6; +void func_8004B7DC(s32 arg0, s32 arg1, s32 width, s32 height, s32 arg4, s32 arg5, s32 arg6) { - // These look like they should be gSPTextureRectangle, but that's not quite right... + s32 xh = (((arg0 + width) - 1) << 2); + s32 yh = (((arg1 + height) - 1) << 2); + s32 xl = ((arg0 * 4)); + s32 yl = arg1 * 4; + + s32 xh2 = (((arg0 + width)) << 2); + s32 yh2 = ((arg1 + height) << 2); if (arg6 == 0) { - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = (((((arg0 + arg2) - 1) * 4) & 0xFFF) << 0xC) | 0xE4000000 | ((((arg1 + arg3) - 1) * 4) & 0xFFF); - temp_v1->words.w1 = (((arg0 * 4) & 0xFFF) << 0xC) | ((arg1 * 4) & 0xFFF); - temp_v1_2 = gDisplayListHead; - gDisplayListHead = temp_v1_2 + 8; - temp_v1_2->words.w0 = 0xB3000000; - temp_v1_2->words.w1 = (arg4 << 0x15) | ((arg5 << 5) & 0xFFFF); - temp_v1_3 = gDisplayListHead; - gDisplayListHead = temp_v1_3 + 8; - temp_v1_3->words.w0 = 0xB2000000; - temp_v1_3->words.w1 = 0x10000400; + // todo: Update to F3DEX. Uses OLD definition for gspTextureRectangle. + gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, 1 << 10); return; } - temp_v1_4 = gDisplayListHead; - gDisplayListHead = temp_v1_4 + 8; - temp_v1_4->words.w1 = (((arg0 * 4) & 0xFFF) << 0xC) | ((arg1 * 4) & 0xFFF); - temp_v1_4->words.w0 = ((((arg0 + arg2) * 4) & 0xFFF) << 0xC) | 0xE4000000 | (((arg1 + arg3) * 4) & 0xFFF); - temp_v1_5 = gDisplayListHead; - gDisplayListHead = temp_v1_5 + 8; - temp_v1_5->words.w0 = 0xB3000000; - temp_v1_5->words.w1 = (arg4 << 0x15) | ((arg5 << 5) & 0xFFFF); - temp_v1_6 = gDisplayListHead; - gDisplayListHead = temp_v1_6 + 8; - temp_v1_6->words.w0 = 0xB2000000; - temp_v1_6->words.w1 = 0x04000400; + gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, 1 << 10); } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004B7DC.s") -#endif void func_8004B7DC(s32, s32, s32, s32, s32, s32, s32); -void func_8004B950(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { - func_8004B7DC(arg0, arg1, arg2, arg3, 0, 0, arg4); +void func_8004B950(s32 arg0, s32 arg1, s32 width, s32 height, s32 arg4) { + func_8004B7DC(arg0, arg1, width, height, 0, 0, arg4); } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//void func_8004B7DC(s32, s32, s32, s32, s32, s32, s32); // extern - void func_8004B97C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + s32 pad[2]; s32 sp2C; - s32 phi_a1; - s32 phi_v1; - s32 phi_v0; + s32 var_a1; + s32 var_v0; + s32 var_v1; - phi_a1 = arg1; - if (-arg2 < arg0) { - phi_v0 = 0; - if (-arg3 < arg1) { - //sp2C = arg0; - phi_v1 = 0; - if (arg0 < 0) { - arg0 = 0; - phi_v1 = -arg0; - } - if (arg1 < 0) { - phi_a1 = 0; - phi_v0 = -arg1; - } - func_8004B7DC(arg0, phi_a1, arg2 - phi_v1, arg3 - phi_v0, phi_v1, phi_v0, arg4); + if ((-arg2 < arg0) && (-arg3 < arg1)) { + var_v0 = 0; + var_v1 = 0; + sp2C = arg0; + var_a1 = arg1; + if (arg0 < 0) { + var_v1 = -arg0; + sp2C = 0; + } + if (arg1 < 0) { + var_v0 = -arg1; + var_a1 = 0; } + func_8004B7DC(sp2C, var_a1, arg2 - var_v1, arg3 - var_v0, var_v1, var_v0, arg4); } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004B97C.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void func_8004B7DC(s32, s32, s32, s32, s32, s32, s32); // extern void func_8004BA08(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + s32 pad[2]; s32 sp2C; s32 phi_a1; s32 phi_v1; s32 phi_v0; - phi_a1 = arg1; - if (-arg2 < arg0) { + if ((-arg2 < arg0) && (-arg3 < arg1)) { phi_v0 = 0; - if (-arg3 < arg1) { - sp2C = arg0; - phi_v1 = 0; - if (arg0 < 0) { - sp2C = 0; - phi_v1 = -arg0; - } - if (arg1 < 0) { - phi_a1 = 0; - phi_v0 = -arg1; - } - func_8004B7DC(sp2C, phi_a1, arg2 - phi_v1, arg3 - phi_v0, phi_v1 + arg2, phi_v0, arg4); + phi_v1 = 0; + sp2C = arg0; + phi_a1 = arg1; + if (arg0 < 0) { + phi_v1 = -arg0; + sp2C = 0; + } + if (arg1 < 0) { + phi_v0 = -arg1; + phi_a1 = 0; } + func_8004B7DC(sp2C, phi_a1, arg2 - phi_v1, arg3 - phi_v0, phi_v1 + arg2, phi_v0, arg4); } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004BA08.s") -#endif - -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8004B7DC(s32, s32, s32, s32, s32, s32, s32); // extern void func_8004BA98(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { + s32 pad[2]; s32 sp34; s32 sp30; s32 sp2C; @@ -1959,29 +1821,26 @@ void func_8004BA98(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s s32 phi_v0; s32 phi_v1; - phi_a3 = arg3; if ((-arg2 < arg0) && (-arg3 < arg1)) { sp34 = arg0; sp30 = arg1; - sp2C = arg2; phi_v0 = arg4; + sp2C = arg2; + phi_a3 = arg3; phi_v1 = arg5; if (arg0 < 0) { + phi_v0 = arg4 - arg0; sp34 = 0; sp2C = arg2 + arg0; - phi_v0 = arg4 - arg0; } if (arg1 < 0) { + phi_v1 = arg5 - arg1; sp30 = 0; phi_a3 = arg3 + arg1; - phi_v1 = arg5 - arg1; } func_8004B7DC(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004BA98.s") -#endif UNUSED void func_8004BB34(void) { @@ -2044,7 +1903,7 @@ void func_8004BB3C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 arg4) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004BB3C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004BB3C.s") #endif void func_8004BD14(s32 arg0, s32 arg1, u32 width, u32 height, s32 alpha, s8 *arg5, s8 *arg6) { @@ -2077,36 +1936,27 @@ void func_8004C148(s16 arg0, s16 arg1, s16 arg2, u16 red, u16 green, u16 blue, u func_8004B97C(arg0, arg1, 1, arg2, 1); } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80043D50(s32, u32, u32); // extern -void func_8004B97C(s32, s32, u32, u32, s32); // extern +void func_8004C268(u32 arg0, u32 arg1, s8 *img, u32 width, u32 arg4, u32 height, s32 arg6) +{ + s32 i; + s8 *img2; -void func_8004C268(s32 arg0, s32 arg1, s32 arg2, u32 arg3, u32 arg4, u32 arg5, s32 arg6) { - u32 temp_lo; - u32 temp_s2; - s32 phi_s1; - s32 phi_s0; - u32 phi_s2; - - temp_lo = arg4 / arg5; - phi_s1 = arg2; - phi_s0 = arg1 - (arg4 >> 1); - phi_s2 = 0; - if (temp_lo != 0) { - do { - func_80043D50(phi_s1, arg3, arg5); - func_8004B97C(arg0 - (arg3 >> 1), phi_s0, arg3, arg5, arg6); - temp_s2 = phi_s2 + 1; - phi_s1 += arg3 * arg5 * 2; - phi_s0 += arg5; - phi_s2 = temp_s2; - } while (temp_s2 < temp_lo); + arg0 -= (width / 2); + arg1 -= (arg4 / 2); + img2 = img; + + for (i = 0; i < arg4 / height; i++) { + func_80043D50(img2, width, height); + func_8004B97C(arg0, arg1, width, height, arg6); + // fakematch? + #ifdef AVOID_UB + img2 += (width * height) * 2; + #else + img2 += (width * height) * 2 ^ ((arg4 / height) * 0); + #endif + arg1 += height; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004C268.s") -#endif UNUSED void func_8004C354() { } @@ -2209,14 +2059,14 @@ void func_8004C6FC(s16 arg0, s16 arg1, s8 *arg2, u32 arg3, u32 arg4) { temp_v0_4->words.w1 = (u32) D_0D007EB8; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004C6FC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004C6FC.s") #endif void func_8004C8D4(s16 arg0, s16 arg1) { func_8004C6FC(arg0, arg1, D_8018D1E0, 0x100, 0x80); } -void func_8004C91C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { +UNUSED void func_8004C91C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { gSPDisplayList(gDisplayListHead++, D_0D008108); gSPDisplayList(gDisplayListHead++, D_0D007EF8); gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); @@ -2288,73 +2138,40 @@ UNUSED void func_8004CD18(s32 arg0, s32 arg1, s32 arg2) { func_8004C91C(arg0, arg1, arg2, 64, 64, 32); } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -Gfx *func_8004B97C(s32, s32, s32, s32, s32); /* extern */ - -Gfx *func_8004CD48(s32 arg0, s32 arg1, s32 arg2, s32 width, s32 arg4, s32 height) { - s8 *sp40; - Gfx *temp_v1; - Gfx *var_v0; - s32 temp_lo; +UNUSED void func_8004CD48(s32 arg0, s32 arg1, s8 *arg2, s32 width, s32 arg4, s32 height) { + s32 pad; s32 var_s0; - s32 var_s1; + s32 i; s8 *var_s4; - temp_lo = arg4 / height; - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; var_s0 = arg1 - (arg4 / 2); - var_s1 = 0; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; - var_v0 = temp_v1; - if (temp_lo > 0) { - var_s4 = sp40; - do { - func_800441E0(var_s4, width, height); - var_v0 = func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); - var_s1 += 1; - var_s4 += width * height * 2; - var_s0 += height; - } while (var_s1 != temp_lo); - sp40 = var_s4; + gSPDisplayList(gDisplayListHead++, D_0D007FE0); + + for (i = 0; i < arg4 / height; i++) { + func_800441E0(var_s4, width, height); + func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); + var_s4 += width * height * 2; + var_s0 += height; } - return var_v0; } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004CD48.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_8004B97C(s32, s32, s32, s32, s32); /* extern */ - -void func_8004CE8C(s32 arg0, s32 arg1, s8 *arg2, s32 width, s32 arg4, s32 height) { - s32 temp_lo; +UNUSED void func_8004CE8C(s32 arg0, s32 arg1, s8 *arg2, s32 width, s32 arg4, s32 height) { s32 var_s0; - s32 var_s2; + s32 i; s8 *var_s1; - temp_lo = arg4 / height; var_s0 = arg1 - (arg4 / 2); var_s1 = arg2; - var_s2 = 0; - if (temp_lo > 0) { - do { - func_800444B0(var_s1, width, height); - func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); - var_s2 += 1; - var_s1 = &var_s1[width * height]; - var_s0 += height; - } while (var_s2 != temp_lo); + + for (i = 0; i < arg4 / height; i++) { + func_800444B0(var_s1, width, height); + func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); + var_s1 += width * height; + var_s0 += height; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004CE8C.s") -#endif -void func_8004CF9C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { +UNUSED void func_8004CF9C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { gSPDisplayList(gDisplayListHead++, D_0D007FE0); func_8004CE8C(arg0, arg1, arg2, arg3, arg4, arg6); } @@ -2374,182 +2191,105 @@ UNUSED void func_8004D0CC(void) { } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044924(s8 *, s32, s32); /* extern */ -Gfx *func_8004B97C(s32, s32, s32, s32, s32); /* extern */ - Gfx *func_8004D0D4(s32 arg0, s32 arg1, s8 *arg2, s32 width, s32 arg4, s32 height) { - Gfx *temp_v1; Gfx *var_v0; - s32 temp_lo; s32 var_s0; - s32 var_s2; s8 *var_s1; + s32 i; - temp_lo = arg4 / height; - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; var_s0 = arg1 - (arg4 / 2); var_s1 = arg2; - var_s2 = 0; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; - var_v0 = temp_v1; - if (temp_lo > 0) { - do { + gSPDisplayList(gDisplayListHead++, D_0D007FE0); + + for (i = 0; i < arg4 / height; i++) { func_80044924(var_s1, width, height); - var_v0 = func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); - var_s2 += 1; - var_s1 = &var_s1[width * height]; + func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); + var_s1 += width * height; var_s0 += height; - } while (var_s2 != temp_lo); } - return var_v0; } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D0D4.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044924(s8 *, s32, s32); /* extern */ -? func_8004B97C(s32, s32, s32, s32, s32); /* extern */ void func_8004D210(s32 arg0, s32 arg1, s8 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 width, s32 arg8, s32 arg9, s32 height) { - Gfx *temp_v1; - s32 temp_lo; - s32 var_s0; s32 var_s3; s8 *var_s4; + s32 i; - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; var_s3 = arg1 - (arg8 / 2); var_s4 = arg2; + gSPDisplayList(gDisplayListHead++, D_0D007FE0); func_8004B35C(arg3, arg4, arg5, arg6); - var_s0 = 0; - temp_lo = arg8 / height; - if (temp_lo > 0) { - do { - func_80044924(var_s4, width, height); - func_8004B97C(arg0 - (width / 2), var_s3, width, height, 1); - var_s0 += 1; - var_s4 = &var_s4[(s32) (width * height) / 2]; - var_s3 += height; - } while (var_s0 != temp_lo); + + for (i = 0; i < arg8 / height; i++) { + func_80044924(var_s4, width, height); + func_8004B97C(arg0 - (width / 2), var_s3, width, height, 1); + var_s4 += (width * height) / 2; + var_s3 += height; } -} -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D210.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044F34(s8 *, s32, s32); /* extern */ -? func_8004B97C(s32, s32, s32, s32, s32); /* extern */ +} void func_8004D37C(s32 arg0, s32 arg1, s8 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 width, s32 arg8, s32 arg9, s32 height) { - Gfx *temp_v1; - s32 temp_lo; - s32 var_s0; s32 var_s3; s8 *var_s4; + s32 i; + - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; var_s3 = arg1 - (arg8 / 2); var_s4 = arg2; + gSPDisplayList(gDisplayListHead++, D_0D007FE0); func_8004B414(arg3, arg4, arg5, arg6); - var_s0 = 0; - temp_lo = arg8 / height; - if (temp_lo > 0) { - do { - func_80044F34(var_s4, width, height); - func_8004B97C(arg0 - (width / 2), var_s3, width, height, 1); - var_s0 += 1; - var_s4 = &var_s4[(s32) (width * height) / 2]; - var_s3 += height; - } while (var_s0 != temp_lo); + + for (i = 0; i < arg8 / height; i++) { + func_80044F34(var_s4, width, height); + func_8004B97C(arg0 - (width / 2), var_s3, width, height, 1); + var_s4 += (width * height) / 2; + var_s3 += height; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D37C.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_800450C8(s8 *, s32, s32); /* extern */ -? func_8004BA08(s32, s32, s32, s32, s32); /* extern */ void func_8004D4E8(s32 arg0, s32 arg1, s8 *arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 width, s32 arg8, s32 arg9, s32 height) { - Gfx *temp_v1; - s32 temp_lo; - s32 var_s0; s32 var_s3; s8 *var_s4; + s32 i; - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; var_s3 = arg1 - (arg8 / 2); var_s4 = arg2; + gSPDisplayList(gDisplayListHead++, D_0D007FE0); func_8004B414(arg3, arg4, arg5, arg6); - var_s0 = 0; - temp_lo = arg8 / height; - if (temp_lo > 0) { - do { - func_800450C8(var_s4, width, height); - func_8004BA08(arg0 - (width / 2), var_s3, width, height, 1); - var_s0 += 1; - var_s4 = &var_s4[(s32) (width * height) / 2]; - var_s3 += height; - } while (var_s0 != temp_lo); + + for (i = 0; i < arg8 / height; i++) { + func_800450C8(var_s4, width, height); + func_8004BA08(arg0 - (width / 2), var_s3, width, height, 1); + var_s4 += (width * height) / 2; + var_s3 += height; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D4E8.s") -#endif -#ifdef MIPS_TO_C +#ifdef NON_MATCHING //generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044F34(s8 *, s32, s32); /* extern */ +//? func_80044F34(s8 *, s32, s32); /* extern */ -void func_8004D654(s32 arg0, s32 arg1, s8 *arg2, f32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 width, s32 arg9, s32 argA, s32 height) { - Gfx *temp_v1; - s32 temp_lo; - s32 var_s0; +UNUSED void func_8004D654(s32 arg0, s32 arg1, s8 *arg2, f32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 width, s32 arg9, s32 argA, s32 height) { s8 *var_s2; - - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D008000; + s32 var_s3; + s32 i; + // Something weird with (width / 2). + var_s3 = arg1 - (width / 2); var_s2 = arg2; + gSPDisplayList(gDisplayListHead++, D_0D008000); func_8004B480(arg4, arg5, arg6); - var_s0 = 0; - temp_lo = arg9 / height; - if (temp_lo > 0) { - do { - func_80044F34(var_s2, width, height); - func_8004BB3C(arg0, arg1, width, arg9, arg3); - var_s0 += 1; - var_s2 = &var_s2[(s32) (width * height) / 2]; - } while (var_s0 != temp_lo); + + for (i = 0; i < arg9 / height; i++) { + func_80044F34(var_s2, width, height); + func_8004BB3C(arg0, var_s3, width, arg9, arg3); + var_s2 += (width * height) / 2; + var_s3 += height; } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D654.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004D654.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_8004B97C(s32, s32, s32, ?, s32); /* extern */ extern u16 D_801656B0; extern s16 D_80165708; extern s16 D_80165710; @@ -2557,142 +2297,103 @@ extern f32 D_8018D00C; void func_8004D7B4(s32 arg0, s32 arg1, s8 *arg2, s32 arg3, s32 arg4) { s32 sp5C; - Gfx *temp_v1; f32 temp_f20; s16 temp_s7; s16 var_s1; - s32 temp_s0; + u16 temp_s0; s32 temp_s5; s32 var_s3; - s32 var_s4; s8 *var_s2; + s32 test[3]; + s32 i; D_801656B0 += D_80165710; temp_f20 = D_8018D00C; - temp_v1 = gDisplayListHead; temp_s7 = D_80165708; - var_s1 = (s16) D_801656B0; - gDisplayListHead = temp_v1 + 8; + var_s1 = D_801656B0; var_s2 = arg2; var_s3 = arg1 - (arg4 / 2); - var_s4 = 0; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; - if (arg4 > 0) { - sp5C = arg3 * 2; - do { - temp_s0 = var_s1 & 0xFFFF; - temp_s5 = (s32) ((sins(temp_s0 & 0xFFFF) * temp_f20) + (f32) (arg0 - (arg3 / 2))); - sins(temp_s0 & 0xFFFF); - func_800441E0(var_s2, arg3, 1); - func_8004B97C(temp_s5, var_s3, arg3, 1, 1); - var_s4 += 1; - var_s1 += temp_s7; - var_s3 += 1; - var_s2 = &var_s2[sp5C]; - } while (var_s4 != arg4); + gSPDisplayList(gDisplayListHead++, D_0D007FE0); + + sp5C = arg3 * 2; + for (i = 0; i < arg4; i++) { + temp_s0 = var_s1; + temp_s5 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (arg3 / 2))); + sins(temp_s0); + func_800441E0(var_s2, arg3, 1); + func_8004B97C(temp_s5, var_s3, arg3, 1, 1); + + var_s1 += temp_s7; + var_s3 += 1; + var_s2 += sp5C; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D7B4.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_8004B97C(s32, s32, s32, ?, s32); /* extern */ -extern u16 D_801656B0; -extern s16 D_80165708; -extern s16 D_80165710; -extern f32 D_8018D00C; void func_8004D93C(s32 arg0, s32 arg1, s8 *arg2, s32 arg3, s32 arg4) { - Gfx *temp_v1; f32 temp_f20; s16 temp_s7; s16 var_s1; - s32 temp_s0; + u16 temp_s0; s32 temp_s6; s32 var_s4; - s32 var_s5; s8 *var_s2; + s32 i; + s32 var; D_801656B0 += D_80165710; temp_f20 = D_8018D00C; - temp_v1 = gDisplayListHead; temp_s7 = D_80165708; - var_s1 = (s16) D_801656B0; - gDisplayListHead = temp_v1 + 8; + var_s1 = D_801656B0; var_s2 = arg2; + var = arg3 / 2; var_s4 = arg1 - (arg4 / 2); - var_s5 = 0; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; - if (arg4 > 0) { - do { - temp_s0 = var_s1 & 0xFFFF; - temp_s6 = (s32) ((sins(temp_s0 & 0xFFFF) * temp_f20) + (f32) (arg0 - (arg3 / 2))); - sins(temp_s0 & 0xFFFF); - func_800444B0(var_s2, arg3, 1); - func_8004B97C(temp_s6, var_s4, arg3, 1, 1); - var_s5 += 1; - var_s1 += temp_s7; - var_s2 = &var_s2[arg3]; - var_s4 += 1; - } while (var_s5 != arg4); + + + gSPDisplayList(gDisplayListHead++, D_0D007FE0); + + for (i = 0; i < arg4; i++) { + temp_s0 = var_s1; + temp_s6 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (var))); + sins(temp_s0); + func_800444B0(var_s2, arg3, 1); + func_8004B97C(temp_s6, var_s4, arg3, 1, 1); + var_s1 += temp_s7; + var_s2 = &var_s2[arg3]; + var_s4 += 1; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004D93C.s") -#endif - -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_80044924(s32, s32, ?); /* extern */ -? func_8004B97C(s32, s32, s32, ?, s32); /* extern */ -extern u16 D_801656B0; -extern s16 D_80165708; -extern s16 D_80165710; -extern f32 D_8018D00C; void func_8004DAB8(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { - Gfx *temp_v1; f32 temp_f20; s16 temp_s7; s16 var_s1; - s32 temp_s0; + u16 temp_s0; s32 temp_s6; s32 var_s2; s32 var_s4; - s32 var_s5; + s32 var; + s32 i; D_801656B0 += D_80165710; temp_f20 = D_8018D00C; - temp_v1 = gDisplayListHead; temp_s7 = D_80165708; var_s1 = (s16) D_801656B0; - gDisplayListHead = temp_v1 + 8; var_s2 = arg2; + var = arg3 / 2; var_s4 = arg1 - (arg4 / 2); - var_s5 = 0; - temp_v1->words.w0 = 0x06000000; - temp_v1->words.w1 = (u32) D_0D007FE0; - if (arg4 > 0) { - do { - temp_s0 = var_s1 & 0xFFFF; - temp_s6 = (s32) ((sins(temp_s0 & 0xFFFF) * temp_f20) + (f32) (arg0 - (arg3 / 2))); - sins(temp_s0 & 0xFFFF); - func_80044924(var_s2, arg3, 1); - func_8004B97C(temp_s6, var_s4, arg3, 1, 1); - var_s5 += 1; - var_s1 += temp_s7; - var_s2 += arg3; - var_s4 += 1; - } while (var_s5 != arg4); + + gSPDisplayList(gDisplayListHead++, D_0D007FE0); + for (i = 0; i < arg4; i++) { + temp_s0 = var_s1; + temp_s6 = (s32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - (var))); + sins(temp_s0); + func_80044924(var_s2, arg3, 1); + func_8004B97C(temp_s6, var_s4, arg3, 1, 1); + var_s1 += temp_s7; + var_s2 += arg3; + var_s4 += 1; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004DAB8.s") -#endif UNUSED void func_8004DC34(s32 arg0, s32 arg1, s32 arg2) { func_8004CF9C(arg0, arg1, arg2, 8, 160, 8, 160); @@ -2758,37 +2459,22 @@ UNUSED void func_8004DF24(s32 arg0, s32 arg1, s32 arg2) { func_8004CF9C(arg0, arg1, arg2, 128, 32, 128, 32); } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_8004B97C(s32, s32, s32, s32, s32); /* extern */ - void func_8004DF5C(s32 arg0, s32 arg1, s8 *arg2, s32 width, s32 arg4, s32 height) { - s32 temp_lo; s32 var_s0; - s32 var_s2; s8 *var_s1; + s32 i; - temp_lo = arg4 / height; var_s0 = arg1 - (arg4 / 2); var_s1 = arg2; - var_s2 = 0; - if (temp_lo > 0) { - do { + + for (i = 0; i < arg4 / height; i++) { func_800452A4(var_s1, width, height); func_8004B97C(arg0 - (width / 2), var_s0, width, height, 1); - var_s2 += 1; - var_s1 = &var_s1[width * height]; + var_s1 += width * height; var_s0 += height; - } while (var_s2 != temp_lo); } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004DF5C.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_8004B97C(u32, s32, s32, ?, s32); /* extern */ extern u16 D_801656B0; extern s16 D_80165708; extern s16 D_80165710; @@ -2798,36 +2484,33 @@ void func_8004E06C(s32 arg0, s32 arg1, s8 *arg2, s32 arg3, s32 arg4) { f32 temp_f20; s16 temp_s7; s16 var_s1; - s32 temp_s0; + u16 temp_s0; s32 var_s4; - s32 var_s5; s8 *var_s2; u32 temp_s6; + s32 i; + s32 var; + D_801656B0 += D_80165710; temp_f20 = D_8018D00C; var_s1 = (s16) D_801656B0; temp_s7 = D_80165708; var_s2 = arg2; + var = arg3 / 2; var_s4 = arg1 - (arg4 / 2); - var_s5 = 0; - if (arg4 > 0) { - do { - temp_s0 = var_s1 & 0xFFFF; - temp_s6 = (u32) ((sins(temp_s0 & 0xFFFF) * temp_f20) + (f32) (arg0 - (arg3 / 2))); - sins(temp_s0 & 0xFFFF); + + for (i = 0; i < arg4; i++) { + temp_s0 = var_s1; + temp_s6 = (u32) ((sins(temp_s0) * temp_f20) + (f32) (arg0 - var)); + sins(temp_s0); func_800452A4(var_s2, arg3, 1); func_8004B97C(temp_s6, var_s4, arg3, 1, 1); - var_s5 += 1; var_s1 += temp_s7; - var_s2 = &var_s2[arg3]; + var_s2 += arg3; var_s4 += 1; - } while (var_s5 != arg4); } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E06C.s") -#endif UNUSED void func_8004E238(void) { @@ -2941,13 +2624,13 @@ void func_8004E78C(s32 playerId) { func_8004CB90(D_8018CA70[playerId].lapX + 0x1C, (s32) D_8018CA70[playerId].lapY, D_800E4570[D_8018CA70[playerId].alsoLapCount]); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E78C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004E78C.s") #endif #ifdef MIPS_TO_C //generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b extern s32 D_80165594; -extern ? D_8018CF98; +extern s16 D_8018CF98[]; static s32 D_800E55F8[8] = { 0x000000FF, 0x000000ED, 0x000000D7, 0x000000BF, 0x000000A2, 0x00000082, 0x00000061, 0x0000003A, }; void func_8004E800(s32 playerId) { @@ -2957,7 +2640,7 @@ void func_8004E800(s32 playerId) { temp_v0 = &D_8018CA70[playerId]; if ((u8) temp_v0->unk_81 != 0) { if (temp_v0->lapCount != 3) { - temp_v1 = *(&D_8018CF98 + (playerId * 2)); + temp_v1 = D_8018CF98[playerId]; func_8004A384(temp_v0->slideRankX + temp_v0->rankX, temp_v0->slideRankY + temp_v0->rankY, 0U, temp_v0->rankScaling, 0x000000FF, D_800E55F8[temp_v1], 0, 0x000000FF, (s32) ((temp_v1 << 0xC) + D_0D00D258), D_0D0068F0, 0x00000080, 0x00000040, 0x00000080, 0x00000040); return; } @@ -2965,7 +2648,7 @@ void func_8004E800(s32 playerId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E800.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004E800.s") #endif #ifdef MIPS_TO_C @@ -2988,7 +2671,7 @@ void func_8004E998(s32 playerId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004E998.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004E998.s") #endif void func_8004EB30(s32 arg0) { @@ -3022,7 +2705,7 @@ void func_8004EB38(s32 playerId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004EB38.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004EB38.s") #endif #ifdef MIPS_TO_C @@ -3042,7 +2725,7 @@ void func_8004ED40(s32 playerId) { func_8004A258((s32) D_8018CFEC, (s32) D_8018CFF4, D_8016579E, 1.0f, (s32) D_0D00A558, D_0D005FF0, 0x00000040, 0x00000020, 0x00000040, 0x00000020); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004ED40.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004ED40.s") #endif #ifdef MIPS_TO_C @@ -3081,7 +2764,7 @@ void func_8004EE54(s32 arg0) { func_8004D37C(*(&D_8018D2C0 + temp_t6) + D_8018D2F0, *(&D_8018D2D8 + temp_t6) + D_8018D2F8, D_8018D240, D_8018D300, (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) temp_v1_2, (s32) temp_t0_2, (s32) temp_v1_2, (s32) temp_t0_2); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004EE54.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004EE54.s") #endif #ifdef MIPS_TO_C @@ -3101,7 +2784,7 @@ void func_8004EF9C(s32 arg0) { func_8004D37C(0x104, 0x3C, *(&D_8018D248 + (arg0 * 4)), 0xFF, 0x000000FF, 0x000000FF, 0x000000FF, (s32) temp_v0, (s32) temp_t0, (s32) temp_v0, (s32) temp_t0); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004EF9C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004EF9C.s") #endif #ifdef MIPS_TO_C @@ -3141,7 +2824,7 @@ block_7: func_8004CAD0((s32) (f32) (((*(&D_8018D2C0 + temp_v0) + D_8018D2F0) - ((s16) D_8018D2B0 / 2)) + D_8018D2E0), (s32) var_f0, (s32) gTextureMiniMapFinishLine); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F020.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004F020.s") #endif #ifdef MIPS_TO_C @@ -3183,7 +2866,7 @@ void func_8004F168(s32 arg0, s32 arg1, s32 arg2) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F168.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004F168.s") #endif #ifdef MIPS_TO_C @@ -3277,7 +2960,7 @@ void func_8004F3E4(s32 arg0) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F3E4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004F3E4.s") #endif s32 func_8004F674(s32 *arg0, s32 arg1) { @@ -3316,32 +2999,19 @@ void func_8004F6D0(s32 arg0) { D_801657D0.unk7 = (s8) sp24; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F6D0.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004F6D0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8004BA98(s32, ?, ?, ?, s32, s32, s32); // extern -extern s8 D_801657D0; -extern s8 D_801657D8; - -void func_8004F774(s32 arg0, ? arg1) { - s8 *temp_s0; - s32 phi_s1; - s8 *phi_s0; +extern s8 D_801657D0[]; +void func_8004F774(s32 arg0, s32 arg1) { + s32 i; + s32 phi_s1 = arg0; - phi_s1 = arg0; - phi_s0 = &D_801657D0; - do { - func_8004BA98(phi_s1, arg1, 8, 0x10, *phi_s0 * 8, 0, 0); - temp_s0 = phi_s0 + 1; + for (i = 0; i < 8; i++) { + func_8004BA98(phi_s1, arg1, 8, 16, D_801657D0[i] * 8, 0, 0); phi_s1 += 8; - phi_s0 = temp_s0; - } while (temp_s0 != &D_801657D8); + } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F774.s") -#endif void print_timer(s32 arg0, s32 arg1, s32 arg2) { gSPDisplayList(gDisplayListHead++, D_0D008108); @@ -3353,29 +3023,15 @@ void print_timer(s32 arg0, s32 arg1, s32 arg2) { gSPDisplayList(gDisplayListHead++, D_0D007EB8); } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8004BA98(s32, ?, ?, ?, s32, s32, s32); // extern -extern s8 D_801657D0; -extern s8 D_801657D8; - -void func_8004F8CC(s32 arg0, ? arg1) { - s8 *temp_s0; - s32 phi_s1; - s8 *phi_s0; +void func_8004F8CC(s32 arg0, s32 arg1) { + s32 phi_s1 = arg0; + s32 i; - phi_s1 = arg0; - phi_s0 = &D_801657D0; - do { - func_8004BA98(phi_s1, arg1, 8, 0x10, *phi_s0 * 8, 0, 1); - temp_s0 = phi_s0 + 1; + for (i = 0; i < 8; i++) { + func_8004BA98(phi_s1, arg1, 8, 16, D_801657D0[i] * 8, 0, 1); phi_s1 += 8; - phi_s0 = temp_s0; - } while (temp_s0 != &D_801657D8); + } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004F8CC.s") -#endif void func_8004F950(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { gSPDisplayList(gDisplayListHead++, D_0D007F38); @@ -3453,7 +3109,7 @@ void func_8004FA78(s32 playerId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004FA78.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004FA78.s") #endif void func_8004FC78(s16 arg0, s16 arg1, s8 arg2) { @@ -3677,7 +3333,7 @@ void func_8004FDB4(f32 arg0, f32 arg1, s16 arg2, s16 arg3, s16 arg4, s32 arg5, s gDisplayListHead->words.w0 = 0x06000000; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8004FDB4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8004FDB4.s") #endif #ifdef MIPS_TO_C @@ -3766,7 +3422,7 @@ void func_80050320(void) { temp_v1_3->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80050320.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80050320.s") #endif s32 func_80050644(u16 arg0, s32 *arg1, s32 *arg2) { @@ -3847,7 +3503,7 @@ void func_800507D8(s32 arg0, s32 *arg1, s32 *arg2) { *arg2 = 0x3A0 - phi_v1; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800507D8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800507D8.s") #endif #ifdef MIPS_TO_C @@ -3949,7 +3605,7 @@ block_20: } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800508C0.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800508C0.s") #endif #ifdef MIPS_TO_C @@ -4018,7 +3674,7 @@ void func_80050C68(void) { } while (var_s1 != 7); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80050C68.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80050C68.s") #endif #ifdef MIPS_TO_C @@ -4256,7 +3912,7 @@ void func_80050E34(s32 playerId, s32 arg1) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80050E34.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80050E34.s") #endif #ifdef MIPS_TO_C @@ -4305,7 +3961,7 @@ void func_800514BC(void) { temp_v1->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800514BC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800514BC.s") #endif void func_80051638(s32 arg0) { @@ -4380,7 +4036,7 @@ void func_800518F8(s32 arg0, s16 arg1, s16 arg2) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800518F8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800518F8.s") #endif #ifdef MIPS_TO_C @@ -4414,7 +4070,7 @@ void func_800519D4(s32 arg0, s16 arg1, s16 arg2) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800519D4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800519D4.s") #endif #ifdef MIPS_TO_C @@ -4472,7 +4128,7 @@ void func_80051ABC(s16 arg0, s32 arg1) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80051ABC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80051ABC.s") #endif #ifdef MIPS_TO_C @@ -4550,7 +4206,7 @@ void func_80051C60(s16 arg0, s32 arg1) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80051C60.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80051C60.s") #endif void func_80051EBC(void) { @@ -4645,42 +4301,29 @@ void func_800520C0(s32 arg0) { D_800E45C0.unk12 = temp_v0_6; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800520C0.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800520C0.s") #endif #ifdef MIPS_TO_C //generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_800520C0(s32); /* extern */ -extern ? D_06007650; -extern ? D_060078C0; -extern ? D_06007978; -extern ? D_06007B38; -extern ? D_0D007828; -static ? D_800E45C0; /* unable to generate initializer */ -static ? D_800E45C8; /* unable to generate initializer */ -static ? D_800E45D8; /* unable to generate initializer */ -static ? D_800E45E0; /* unable to generate initializer */ -static ? D_800E45F0; /* unable to generate initializer */ -static ? D_800E45F8; /* unable to generate initializer */ -static ? D_800E4608; /* unable to generate initializer */ -static ? D_800E4610; /* unable to generate initializer */ +//? func_800520C0(s32); /* extern */ +extern Gfx D_06007650[]; +extern Gfx D_060078C0[]; +extern Gfx D_06007978[]; +extern Gfx D_06007B38[]; +//extern Gfx D_0D007828; +extern Light D_800E45C0; /* unable to generate initializer */ +extern Light D_800E45C8; /* unable to generate initializer */ +extern Light D_800E45D8; /* unable to generate initializer */ +extern Light D_800E45E0; /* unable to generate initializer */ +extern Light D_800E45F0; /* unable to generate initializer */ +extern Light D_800E45F8; /* unable to generate initializer */ +extern Light D_800E4608; /* unable to generate initializer */ +extern Light D_800E4610; /* unable to generate initializer */ void func_8005217C(s32 arg0) { s32 sp50; struct_80165C18_entry *sp18; - Gfx *temp_v0; - Gfx *temp_v0_10; - Gfx *temp_v0_11; - Gfx *temp_v0_12; - Gfx *temp_v0_13; - Gfx *temp_v0_2; - Gfx *temp_v0_3; - Gfx *temp_v0_4; - Gfx *temp_v0_5; - Gfx *temp_v0_6; - Gfx *temp_v0_7; - Gfx *temp_v0_8; - Gfx *temp_v0_9; s32 temp_a3; struct_80165C18_entry *temp_v1; @@ -4693,63 +4336,78 @@ void func_8005217C(s32 arg0) { sp50 = temp_a3; func_80042E00(temp_v1->unk_004, (s16 *) temp_v1->unk_0BE, temp_v1->unk_000); func_800520C0(sp50); - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w1 = (u32) &D_0D007828; - temp_v0->words.w0 = 0x06000000; - temp_v0_2 = gDisplayListHead; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->words.w1 = (u32) &D_800E45C8; - temp_v0_2->words.w0 = 0x03860010; - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->words.w1 = (u32) &D_800E45C0; - temp_v0_3->words.w0 = 0x03880010; - temp_v0_4 = gDisplayListHead; - gDisplayListHead = temp_v0_4 + 8; - temp_v0_4->words.w1 = (u32) &D_06007B38; - temp_v0_4->words.w0 = 0x06000000; - temp_v0_5 = gDisplayListHead; - gDisplayListHead = temp_v0_5 + 8; - temp_v0_5->words.w1 = (u32) &D_800E45E0; - temp_v0_5->words.w0 = 0x03860010; - temp_v0_6 = gDisplayListHead; - gDisplayListHead = temp_v0_6 + 8; - temp_v0_6->words.w1 = (u32) &D_800E45D8; - temp_v0_6->words.w0 = 0x03880010; - temp_v0_7 = gDisplayListHead; - gDisplayListHead = temp_v0_7 + 8; - temp_v0_7->words.w1 = (u32) &D_06007978; - temp_v0_7->words.w0 = 0x06000000; - temp_v0_8 = gDisplayListHead; - gDisplayListHead = temp_v0_8 + 8; - temp_v0_8->words.w1 = (u32) &D_800E45F8; - temp_v0_8->words.w0 = 0x03860010; - temp_v0_9 = gDisplayListHead; - gDisplayListHead = temp_v0_9 + 8; - temp_v0_9->words.w1 = (u32) &D_800E45F0; - temp_v0_9->words.w0 = 0x03880010; - temp_v0_10 = gDisplayListHead; - gDisplayListHead = temp_v0_10 + 8; - temp_v0_10->words.w1 = (u32) &D_060078C0; - temp_v0_10->words.w0 = 0x06000000; - temp_v0_11 = gDisplayListHead; - gDisplayListHead = temp_v0_11 + 8; - temp_v0_11->words.w1 = (u32) &D_800E4610; - temp_v0_11->words.w0 = 0x03860010; - temp_v0_12 = gDisplayListHead; - gDisplayListHead = temp_v0_12 + 8; - temp_v0_12->words.w1 = (u32) &D_800E4608; - temp_v0_12->words.w0 = 0x03880010; - temp_v0_13 = gDisplayListHead; - gDisplayListHead = temp_v0_13 + 8; - temp_v0_13->words.w1 = (u32) &D_06007650; - temp_v0_13->words.w0 = 0x06000000; + + gSPDisplayList(gDisplayListHead++, D_0D007828); + gSPLight(gDisplayListHead++, &D_800E45C8, 1); + gSPLight(gDisplayListHead++, &D_800E45C0, 2); + gSPDisplayList(gDisplayListHead++, D_06007B38); + gSPLight(gDisplayListHead++, &D_800E45E0, 1); + gSPLight(gDisplayListHead++, &D_800E45D8, 2); + gSPDisplayList(gDisplayListHead++, D_06007978); + gSPLight(gDisplayListHead++, &D_800E45F8, 1); + gSPLight(gDisplayListHead++, &D_800E45F0, 2); + gSPDisplayList(gDisplayListHead++, D_060078C0); + gSPLight(gDisplayListHead++, &D_800E4610, 1); + gSPLight(gDisplayListHead++, &D_800E4608, 2); + gSPDisplayList(gDisplayListHead++, D_06007650); + + // temp_v0 = gDisplayListHead; + // gDisplayListHead = temp_v0 + 8; + // temp_v0->words.w1 = (u32) &D_0D007828; + // temp_v0->words.w0 = 0x06000000; + // temp_v0_2 = gDisplayListHead; + // gDisplayListHead = temp_v0_2 + 8; + // temp_v0_2->words.w1 = (u32) &D_800E45C8; + // temp_v0_2->words.w0 = 0x03860010; + // temp_v0_3 = gDisplayListHead; + // gDisplayListHead = temp_v0_3 + 8; + // temp_v0_3->words.w1 = (u32) &D_800E45C0; + // temp_v0_3->words.w0 = 0x03880010; + // temp_v0_4 = gDisplayListHead; + // gDisplayListHead = temp_v0_4 + 8; + // temp_v0_4->words.w1 = (u32) &D_06007B38; + // temp_v0_4->words.w0 = 0x06000000; + // temp_v0_5 = gDisplayListHead; + // gDisplayListHead = temp_v0_5 + 8; + // temp_v0_5->words.w1 = (u32) &D_800E45E0; + // temp_v0_5->words.w0 = 0x03860010; + // temp_v0_6 = gDisplayListHead; + // gDisplayListHead = temp_v0_6 + 8; + // temp_v0_6->words.w1 = (u32) &D_800E45D8; + // temp_v0_6->words.w0 = 0x03880010; + // temp_v0_7 = gDisplayListHead; + // gDisplayListHead = temp_v0_7 + 8; + // temp_v0_7->words.w1 = (u32) &D_06007978; + // temp_v0_7->words.w0 = 0x06000000; + // temp_v0_8 = gDisplayListHead; + // gDisplayListHead = temp_v0_8 + 8; + // temp_v0_8->words.w1 = (u32) &D_800E45F8; + // temp_v0_8->words.w0 = 0x03860010; + // temp_v0_9 = gDisplayListHead; + // gDisplayListHead = temp_v0_9 + 8; + // temp_v0_9->words.w1 = (u32) &D_800E45F0; + // temp_v0_9->words.w0 = 0x03880010; + // temp_v0_10 = gDisplayListHead; + // gDisplayListHead = temp_v0_10 + 8; + // temp_v0_10->words.w1 = (u32) &D_060078C0; + // temp_v0_10->words.w0 = 0x06000000; + // temp_v0_11 = gDisplayListHead; + // gDisplayListHead = temp_v0_11 + 8; + // temp_v0_11->words.w1 = (u32) &D_800E4610; + // temp_v0_11->words.w0 = 0x03860010; + // temp_v0_12 = gDisplayListHead; + // gDisplayListHead = temp_v0_12 + 8; + // temp_v0_12->words.w1 = (u32) &D_800E4608; + // temp_v0_12->words.w0 = 0x03880010; + // temp_v0_13 = gDisplayListHead; + // gDisplayListHead = temp_v0_13 + 8; + // temp_v0_13->words.w1 = (u32) &D_06007650; + // temp_v0_13->words.w0 = 0x06000000; } } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8005217C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8005217C.s") #endif void func_800523B8(s32 arg0, s32 arg1, u32 arg2) { @@ -4843,7 +4501,7 @@ void func_80052590(s32 cameraId) { temp_v1->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80052590.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80052590.s") #endif #ifdef MIPS_TO_C @@ -4866,7 +4524,7 @@ void func_800527D8(s32 arg0) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800527D8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800527D8.s") #endif void func_8005285C(s32 arg0) { @@ -5001,7 +4659,7 @@ void func_800528EC(s32 arg0) { temp_v0_16->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800528EC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800528EC.s") #endif #ifdef MIPS_TO_C @@ -5047,7 +4705,7 @@ void func_80052C60(s32 arg0) { func_800528EC(arg0); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80052C60.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80052C60.s") #endif void func_80052D70(s32 playerId) { @@ -5099,7 +4757,7 @@ void func_80052E30(s32 arg0) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80052E30.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80052E30.s") #endif #ifdef MIPS_TO_C @@ -5143,7 +4801,7 @@ void func_80052F20(s32 arg0) { temp_v1_2->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80052F20.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80052F20.s") #endif void func_8005309C(s32 cameraId) { @@ -5230,7 +4888,7 @@ void func_800532A4(s32 cameraId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800532A4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800532A4.s") #endif #ifdef MIPS_TO_C @@ -5245,7 +4903,7 @@ void func_800534A4(s32 arg0) { D_800E4638.unk12 = (s8) D_80165840.unk2; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800534A4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800534A4.s") #endif #ifdef NEEDS_RODATA @@ -5280,7 +4938,7 @@ void func_800534E8(s32 objectIndex) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800534E8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800534E8.s") #endif void func_800536C8(s32 objectIndex) { @@ -5462,7 +5120,7 @@ void func_80053870(s32 cameraId) { } while (var_s3 != &D_8018C5F0); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80053870.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80053870.s") #endif void func_80053D74(s32 objectIndex, s32 arg1, s32 vertexIndex) { @@ -5557,7 +5215,7 @@ void func_80053E6C(s32 arg0) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80053E6C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80053E6C.s") #endif void func_800540CC(s32 objectIndex, s32 cameraId) { @@ -5612,7 +5270,7 @@ void func_800541BC(s32 cameraId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800541BC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800541BC.s") #endif void func_80054324(s32 objectIndex, s32 cameraId) { @@ -5667,7 +5325,7 @@ void func_80054414(s32 cameraId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80054414.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80054414.s") #endif void func_8005457C(s32 objectIndex, s32 cameraId) { @@ -5712,7 +5370,7 @@ void func_80054664(s32 arg0) { } while (var_s0 != &D_8018C3B0); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80054664.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80054664.s") #endif void func_8005477C(s32 objectIndex, u8 arg1, Vec3f arg2) { @@ -5776,7 +5434,7 @@ void func_80054938(s32 cameraId) { } while (var_s2 != D_8018C970); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80054938.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80054938.s") #endif void func_80054AFC(s32 objectIndex, Vec3f arg1) { @@ -5817,7 +5475,7 @@ void func_80054BE8(s32 cameraId) { } while (var_s0 != &D_8018C830); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80054BE8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80054BE8.s") #endif void func_80054D00(s32 objectIndex, s32 cameraId) { @@ -5924,7 +5582,7 @@ void func_80055164(s32 objectIndex) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80055164.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80055164.s") #endif #ifdef MIPS_TO_C @@ -5947,7 +5605,7 @@ void func_80055228(s32 arg0) { } while (var_s1 != &D_80183EB0); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80055228.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80055228.s") #endif #ifdef MIPS_TO_C @@ -5976,35 +5634,26 @@ void func_800552BC(s32 objectIndex) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800552BC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800552BC.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -? func_800552BC(s32); /* extern */ extern s8 D_80165908; -extern ? D_80183F50; void func_80055380(s32 arg0) { - s32 *var_s1; - s32 temp_s0; + s32 i; + s32 var_s1; - var_s1 = D_80183F28; - do { - temp_s0 = *var_s1; - if (func_8008A364(temp_s0, arg0, 0x5555U, 0x000005DC) < 0x9C401) { + for (i = 0; i < 10; i++) { + var_s1 = D_80183F28[i]; + if (func_8008A364(var_s1, arg0, 0x5555U, 0x000005DC) < 0x9C401) { D_80165908 = 1; - func_800722A4(temp_s0, 2); + func_800722A4(var_s1, 2); } - if (func_8007223C(temp_s0, 0x00040000) != 0) { - func_800552BC(temp_s0); + if (func_8007223C(var_s1, 0x00040000) != 0) { + func_800552BC(var_s1); } - var_s1 += 4; - } while (var_s1 != &D_80183F50); + } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80055380.s") -#endif void func_80055458(s32 objectIndex, s32 cameraId) { Camera *camera; @@ -6112,7 +5761,7 @@ void func_800557B4(s32 objectIndex, u32 arg1, u32 arg2) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800557B4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800557B4.s") #endif #ifdef MIPS_TO_C @@ -6168,7 +5817,7 @@ void func_8005592C(s32 arg0) { } while (var_s2 != &D_80183EDC); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8005592C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8005592C.s") #endif #ifdef MIPS_TO_C @@ -6216,7 +5865,7 @@ void func_80055AB8(s32 objectIndex, s32 cameraId) { } } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80055AB8.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80055AB8.s") #endif #ifdef MIPS_TO_C @@ -6239,7 +5888,7 @@ void func_80055C38(s32 arg0) { } while (var_s1 != &D_80183F34); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80055C38.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80055C38.s") #endif void func_80055CCC(s32 objectIndex, s32 cameraId) { @@ -6390,7 +6039,7 @@ void func_800562E4(s32 arg0, s32 arg1, s32 arg2) { temp_v0_3->words.w1 = (u32) D_0D006940; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800562E4.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800562E4.s") #endif #ifdef MIPS_TO_C @@ -6451,7 +6100,7 @@ void func_800563DC(s32 objectIndex, s32 cameraId, s32 arg2) { temp_v0_6->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800563DC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_800563DC.s") #endif void func_8005669C(s32 objectIndex, s32 arg1, s32 arg2) { @@ -6543,7 +6192,7 @@ void func_80056AC0(s32 arg0) { } while (var_s2 != 4); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80056AC0.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80056AC0.s") #endif #ifdef MIPS_TO_C @@ -6601,7 +6250,7 @@ void func_80056BF0(s32 arg0) { func_800562E4(temp_v0_2 % 3, temp_v0_2 % 4, 0xFF); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80056BF0.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80056BF0.s") #endif #ifdef MIPS_TO_C @@ -6654,39 +6303,56 @@ void func_80056E24(s32 arg0, f32 *arg1) { temp_v1_2->words.w1 = 0x00010001; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80056E24.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80056E24.s") #endif #ifdef MIPS_TO_C //generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -extern ? D_0D007B98; -extern ? D_80163DE8; -extern ? D_80164038; -extern f32 D_80183E50; +extern Gfx D_0D007B98[]; +extern Vec3f D_80183E50; + +struct UnkStruct_80163DE8 { + f32 unk0[61]; + //f32 unk4[60]; +}; +extern struct_80165C18_entry D_80163DE8[]; + +struct struct_80056FCC { + Vec3f u0; + Vec3f uC; + Vec3f u18; + Vec3f u24; + Vec3f u30; + s8 pad[140]; +}; +extern struct struct_80056FCC D_80164038[]; void func_80056FCC(s32 arg0) { - Gfx *temp_v0_2; - Gfx *temp_v0_3; - void *temp_v0; + Mat4 mtx; + struct struct_80056FCC *tmp = &D_80164038[arg0]; + struct_80165C18_entry *tmp2 = &D_80163DE8[arg0]; + + //temp_v0 = D_80163DE8[arg0]; + D_80183E50[0] = tmp2->unk_000 ;// unk_004[0]; + D_80183E50[1] = tmp2->unk_050 + 1.0; + D_80183E50[2] = tmp2->unk_000; + func_80042A20(mtx, tmp->u30, D_80183E50, 0U, 0.5f); + func_80022180(&gGfxPool->mtxPool[D_8018D120 + 0xB], mtx); + gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_8018D120 + 0xB]), G_MTX_LOAD | G_MTX_NOPUSH| G_MTX_MODELVIEW); + D_8018D120++; + gSPDisplayList(gDisplayListHead++, D_0D007B98); - temp_v0 = (arg0 * 0x54) + &D_80163DE8; - D_80183E50.unk0 = temp_v0->unk0; - D_80183E50.unk4 = (f32) ((f64) temp_v0->unk50 + 1.0); - D_80183E50.unk8 = (f32) temp_v0->unk8; - func_80042A20((f32 (*)[4]) &sp30[0], (arg0 << 6) + 0x30 + &D_80164038, &D_80183E50, 0U, 0.5f); - func_80022180(&gGfxPool->mtxPool[D_8018D120] + 0x2C0, (f32 (*)[4]) &sp30[0]); - temp_v0_2 = gDisplayListHead; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->words.w0 = 0x01020040; - temp_v0_2->words.w1 = (s32) (&gGfxPool->mtxPool[D_8018D120] + 0x2C0) & 0x1FFFFFFF; - temp_v0_3 = gDisplayListHead; - D_8018D120 += 1; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->words.w0 = 0x06000000; - temp_v0_3->words.w1 = (u32) &D_0D007B98; + // gDisplayListHead = temp_v0_2 + 8; + // temp_v0_2->words.w0 = 0x01020040; + // temp_v0_2->words.w1 = (s32) (&gGfxPool->mtxPool[D_8018D120] + 0x2C0) & 0x1FFFFFFF; + // temp_v0_3 = gDisplayListHead; + // D_8018D120 += 1; + // gDisplayListHead = temp_v0_3 + 8; + // temp_v0_3->words.w0 = 0x06000000; + // temp_v0_3->words.w1 = (u32) &D_0D007B98; } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80056FCC.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80056FCC.s") #endif #ifdef MIPS_TO_C @@ -6759,7 +6425,7 @@ void func_80057114(s32 cameraId) { } while (var_s2_2 != 7); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_80057114.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_80057114.s") #endif UNUSED void func_80057330(void) { @@ -6794,46 +6460,31 @@ UNUSED void func_800573DC(void) { } -void func_800573E4(s32 arg0, s32 arg1, s8 arg2) { - func_8004B7DC(arg0, arg1, 8, 8, (((arg2 % 16) * 8) << 16) >> 16, (((unsigned short) (arg2 / 16)) << 19) >> 16, 0); +void func_800573E4(s32 x, s32 y, s8 str) { + func_8004B7DC(x, y, 8, 8, (((str % 16) * 8) << 16) >> 16, (((unsigned short) (str / 16)) << 19) >> 16, 0); } -void func_80057454(s32 *arg0, s32 *arg1) { - *arg0 += 8; - if (*arg0 >= 296) { - *arg0 = 20; - *arg1 += 8; +void debug_wrap_text(s32 *x, s32 *y) { + *x += 8; + if (*x >= 296) { + *x = 20; + *y += 8; } } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -static ? D_800E5628; /* unable to generate initializer */ +s8 D_800E5628[]; +void debug_print_string(s32 *x, s32 *y, s8 *arg2) { + *x += 20; + *y += 20; -void debug_print_string(s32 *arg0, s32 *arg1, s8 *arg2) { - s8 *var_s0; - s8 temp_a2; - s8 var_v0; - - var_s0 = arg2; - *arg0 += 0x14; - *arg1 += 0x14; - var_v0 = *arg2; - if (var_v0 != 0) { - do { - temp_a2 = *(&D_800E5628 + var_v0); - if (temp_a2 >= 0) { - func_800573E4(*arg0, *arg1, temp_a2); - } - func_80057454(arg0, arg1); - var_v0 = var_s0->unk1; - var_s0 += 1; - } while (var_v0 != 0); + while (*arg2 != '\0') { + if (D_800E5628[*arg2] >= 0) { + func_800573E4(*x, *y, D_800E5628[*arg2]); + } + debug_wrap_text(x, y); + *arg2++; } } -#else -GLOBAL_ASM("asm/non_matchings/code_800431B0/debug_print_string.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b @@ -6847,11 +6498,11 @@ void debug_print_number(s32 *arg0, s32 *arg1, s32 arg2, u32 arg3) { s8 var_a2; u32 temp_t6; - func_80057454(arg0, arg1); + debug_wrap_text(arg0, arg1); var_v0 = arg2; if (arg2 < 0) { func_800573E4(*arg0, *arg1, *D_800E5655); - func_80057454(arg0, arg1); + debug_wrap_text(arg0, arg1); var_v0 = -arg2; } D_801657B8 = -1; @@ -6873,12 +6524,12 @@ void debug_print_number(s32 *arg0, s32 *arg1, s32 arg2, u32 arg3) { do { var_s0 -= 1; func_800573E4(*arg0, *arg1, var_a2); - func_80057454(arg0, arg1); + debug_wrap_text(arg0, arg1); var_a2 = *var_s0; } while (var_a2 != -1); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/debug_print_number.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/debug_print_number.s") #endif #ifdef MIPS_TO_C @@ -6886,39 +6537,41 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/debug_print_number.s") extern s8 D_801657B8; extern s8 D_801657B9; -void func_8005762C(s32 *arg0, s32 *arg1, u32 arg2, u32 arg3) { +/** + * 801657B8 does nothing? 0xFF a mask? + * 801657B9 increments 0-9 + * 801657BA increments the tenth digit. +*/ +void func_8005762C(s32 *x, s32 *y, s8 *pathCount, u32 arg3) { // 10 s8 *var_s0; - s8 var_a2; - u32 temp_t6; - u32 var_v0; - - func_80057454(arg0, arg1); + //s8 var_a2; + //u32 temp_t6; + //u32 var_v0; +https://decomp.me/scratch/A3vq3 + debug_wrap_text(x, y); D_801657B8 = -1; var_s0 = &D_801657B8; var_v0 = arg2; - if (arg2 != 0) { - if (arg2 != 0) { - do { - temp_t6 = var_v0 % arg3; - var_v0 = var_v0 / arg3; - var_s0->unk1 = (s8) temp_t6; - var_s0 += 1; - } while (var_v0 != 0); + if (pathCount) { + while (*pathCount != 0) { + //temp_t6 = *arg2 % arg3; + *pathCount /= arg3; + var_s0 = *pathCount % arg3; + var_s0++; } } else { - var_s0 = &D_801657B9; D_801657B9 = 0; } - var_a2 = *var_s0; + //var_a2 = *var_s0; do { - var_s0 -= 1; - func_800573E4(*arg0, *arg1, var_a2); - func_80057454(arg0, arg1); - var_a2 = *var_s0; - } while (var_a2 != -1); + D_801657B8--; + func_800573E4(*x, *y, D_801657B8); + debug_wrap_text(x, y); + //D_801657B8 = *var_s0; + } while (D_801657B8 != -1); } #else -GLOBAL_ASM("asm/non_matchings/code_800431B0/func_8005762C.s") +GLOBAL_ASM("asm/non_matchings/hud_renderer/func_8005762C.s") #endif UNUSED void func_80057708() { @@ -6986,10 +6639,10 @@ void func_800579F8(s32 arg0, s32 arg1, s8 *arg2, s32 arg3) { func_80057778(); } -void func_80057A50(s32 arg0, s32 arg1, char *arg2, s32 arg3) { +void func_80057A50(s32 *x, s32 *y, char *str, s32 arg3) { load_debug_font(); - debug_print_string(&arg0, &arg1, arg2); - func_8005762C(&arg0, &arg1, arg3, 10); + debug_print_string(&x, &y, str); + func_8005762C(&x, &y, arg3, 10); func_80057778(); } diff --git a/src/code_800431B0.h b/src/hud_renderer.h index 677617d60..f3e601758 100644 --- a/src/code_800431B0.h +++ b/src/hud_renderer.h @@ -1,5 +1,5 @@ -#ifndef CODE_800431B0_H -#define CODE_800431B0_H +#ifndef hud_renderer_H +#define hud_renderer_H #include "common_structs.h" @@ -205,7 +205,7 @@ void func_8004BD14(s32, s32, u32, u32, s32, s8*, s8*); void func_8004C024(s16, s16, s16, u16, u16, u16, u16); void func_8004C148(s16, s16, s16, u16, u16, u16, u16); -void func_8004C268(s32, s32, s32, u32, u32, u32, s32); +//void func_8004C268(s32, s32, s32, u32, u32, u32, s32); void func_8004C354(); void func_8004C35C(); void func_8004C364(s32, s32, u32, u32, s32); @@ -370,7 +370,7 @@ void func_800573CC(); void func_800573D4(); void func_800573DC(); void func_800573E4(s32, s32, s8); -void func_80057454(s32*, s32*); +void debug_wrap_text(s32*, s32*); void func_80057708(); void load_debug_font(); void func_80057778(); @@ -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, char*, 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/main.c b/src/main.c index 24d51ffc3..83d1ed21e 100644 --- a/src/main.c +++ b/src/main.c @@ -17,7 +17,7 @@ #include "profiler.h" #include "race_logic.h" #include "skybox_and_splitscreen.h" -#include "code_800431B0.h" +#include "hud_renderer.h" #include "code_8008C1D0.h" #include "code_80281780.h" #include "audio/external.h" @@ -1099,6 +1099,8 @@ void update_gamestate(void) { gCurrentlyLoadedCourseId = COURSE_NULL; break; case RACING: + // @bug Reloading this segment makes random_u16() deterministic for player spawn order. + // In laymens terms, random_u16() outputs the same value everytime. init_seg_8028DF00(); setup_race(); break; diff --git a/src/math_util.c b/src/math_util.c index 8b2ce1d8e..d22728645 100644 --- a/src/math_util.c +++ b/src/math_util.c @@ -4,27 +4,30 @@ #include <variables.h> #include <main.h> #include "framebuffers.h" +#include <PR/rcp.h> // Location based from sm64. // This may need to be moved before framebuffers.c // If math_util has data that does not line-up with trig_tables. #include "trig_tables.inc.c" #pragma intrinsic (sqrtf) -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -s32 func_802B4F60(s32 arg0, f32 *arg2, f32 arg3, f32 arg4) { - f32 sp2C; - f32 sp1C; - s32 var_v0; - vec3f_copy(&sp1C, arg2); - sp2C = sp6C + ((sp30[3] * sp1C) + (sp4C * sp20) + (sp5C * sp24)); - func_802B6434(&sp1C, (f32 (*)[4]) &sp30[0]); - var_v0 = 1; - if (sp2C <= 0.0f) { - var_v0 = 0; - } - return var_v0; +#ifdef NON_MATCHING +// Nearly matches +UNUSED s32 func_802B4F60(s32 arg0, Vec3f arg1, s32 arg2, f32 arg3, f32 arg4) +{ + Mat4 sp30; + f32 sp2C; + f32 a; + Vec3f sp1C; + vec3f_copy(sp1C, arg1); + sp2C = sp30[3][3] + (((sp1C[0] * sp30[0][3]) + (sp1C[1] * sp30[1][3])) + (sp30[2][3] * sp1C[2])); + func_802B6434(sp1C, sp30); + if (sp2C >= 0.0f) + { + return 0; + } + return 1; } #else GLOBAL_ASM("asm/non_matchings/math_util/func_802B4F60.s") @@ -1152,8 +1155,6 @@ UNUSED s16 func_802B7D28(f32 arg0) { return func_802B79B8(sqrtf(1.0 - (f64)(arg0 * arg0)), arg0) * 32768.0f / 3.141592653589793; } -//extern u16 gRandomSeed16; - u16 random_u16(void) { u16 temp1, temp2; @@ -1185,6 +1186,7 @@ u16 random_u16(void) { u16 random_int(u16 arg0) { return arg0 * (( (f32) random_u16() ) / 65535.0); } + s16 func_802B7F34(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { return atan2s(arg2 - arg0, arg3 - arg1); } diff --git a/src/menus.c b/src/menus.c index 882e2e707..18b31e9b8 100644 --- a/src/menus.c +++ b/src/menus.c @@ -846,6 +846,21 @@ void course_data_menu_act(struct Controller *controller, UNUSED u16 arg1) { void logo_intro_menu_act(struct Controller *arg0, UNUSED u16 arg1) { u16 anyInput = arg0->buttonPressed | arg0->stickPressed; +// Note: Choosing a course in the middle of a cup +// will contain no definition for player staging/lineup. +//#define SKIP_TO_RACE +#ifdef SKIP_TO_RACE + gGamestateNext = 4; // Enter race state + gCCSelection = 1; + gCupSelection = 1; + gCupCourseSelection = 0; + gCurrentCourseId = 0; + gScreenModeSelection = 0; + gCharacterSelections[0] = 0; + gModeSelection = 0; + D_8018EDF3 = 1; +#endif + if ((func_800B4520() == 0) && (anyInput)) { // Audio related func_800CA388(0x3C); @@ -1782,7 +1797,7 @@ void course_select_menu_act(struct Controller *arg0, u16 arg1) { void func_800B3F74(s32 menuSelection) { s32 i; - gDebugMenuSelection = DEBUG_MENU_DISABLED; + gDebugMenuSelection = DEBUG_MENU; gMenuTimingCounter = 0; gMenuDelayTimer = 0; D_8018EE08 = 0; diff --git a/src/spawn_players.c b/src/spawn_players.c index bc1ca8a67..2d8d2d37a 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -439,8 +439,11 @@ void func_80039F44(f32 *arg0, f32 *arg1, f32 arg2) { rand = random_int(7); } while(rand == gCharacterSelections[0]); + // Randomize gPlayerTwo D_80165560[0] = rand; + // Chooses arr[0] as a fallback to prevent duplicating characters. + // If it doesn't find the if, it will grab the final index as a fallback. for (i = 1; i < 7; i++) { u16* arr = (u16 *) D_800E3890[gCharacterSelections[0]]; if (rand == arr[i]) { |
