diff --git a/data/data_credits_128480.s b/data/data_credits_128480.s index fa87ff11f..ef1615097 100644 --- a/data/data_credits_128480.s +++ b/data/data_credits_128480.s @@ -88,21 +88,14 @@ glabel D_80284ED0 .word 0x06000000, 0x070023F8, 0x06000000, 0x07002478 .word 0x06000000, 0x07003790, 0xFC127E24, 0xFFFFF3F9 .word 0xB900031D, 0x00553078, 0x06000000, 0x070006D0 -.word 0x06000000, 0x070004D0, 0x06000000 +.word 0x06000000, 0x070004D0, 0x06000000, 0x07000840 +.word 0xB8000000 +# Likely an alignment artifact, a file split should happen here +.word 0x00000000, 0x00000000, 0x00000000 -.word 0x07000840 -.word 0xB8000000, 0x00000000 - -.word 0x00000000 -.word 0x00000000 glabel D_802850C0 - -.word 0x3F4CCCCD, 0xFF380026 -.word 0x00A0001E - -glabel D_802850CC -.word 0x00040000 +.word 0x3F4CCCCD, 0xFF380026, 0x00A0001E, 0x00040000 .word 0x3F666666, 0x020800C8, 0x00A000C8, 0x01000000 .word 0x3F4CCCCD, 0xFF380026, 0x00A0001E, 0x00040000 .word 0x3F666666, 0x020800C8, 0x00A000C8, 0x01030000 @@ -162,17 +155,10 @@ glabel D_802850CC .word 0x3F333333, 0x02080096, 0x00A00096, 0x01000000 .word 0x3F333333, 0x020800AA, 0x00A000AA, 0x01030000 .word 0x3F333333, 0x020800BE, 0x00A000BE, 0x01020000 -.word 0x3EE66666, 0x020800CF, 0x00A000CF +.word 0x3EE66666, 0x020800CF, 0x00A000CF, 0x01010000 +.word 0x40000000, 0x0B6D00D2, 0x009600D2, 0x01040000 +.word 0x3F666666, 0x02080082, 0x00A00082, 0x01030000 - -.word 0x01010000 -.word 0x40000000, 0x0B6D00D2 - -.word 0x009600D2, 0x01040000 -.word 0x3F666666, 0x02080082 - - -.word 0x00A00082, 0x01030000 glabel D_802854B0 .word 0x80286BB0, 0x80286BC4, 0x80286BD8, 0x80286BE4 .word 0x80286BF8, 0x80286C04, 0x80286C14, 0x80286C28 @@ -204,25 +190,11 @@ glabel D_802854B0 .word 0x80287314, 0x80287328, 0x80287338, 0x80287348 .word 0x80287358, 0x80287374, 0x80287384, 0x80287394 .word 0x802873A8, 0x802873B8, 0x802873CC, 0x802873DC -.word 0x802873EC, 0x802873FC +.word 0x802873EC, 0x802873FC, 0x80287414, 0x8028742C +.word 0x8028743C, 0x80287448 - -.word 0x80287414 - - -.word 0x8028742C - - -.word 0x8028743C - - -.word 0x80287448 - - -.word 0x00000000 - - -.word 0x00000000 +# Likely an alignment artifact, a file split should happen here +.word 0x00000000, 0x00000000 glabel D_802856B0 diff --git a/include/common_structs.h b/include/common_structs.h index acc640d05..58c38cb76 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -590,53 +590,6 @@ typedef struct { char unk_00[0x1000]; } struct_D_802BFB80; -typedef struct { - /* 0x00 */ s32 type; // id maybe? - /* 0x04 */ s32 unk4; // sound mode, maybe some other stuff - /* 0x08 */ s32 unk8; // This is used but I can't tell what for - /* 0x0C */ s32 column; - /* 0x10 */ s32 row; - /* 0x14 */ u8 priority; // priority/depth/z-level. Higher values are drawn on top of lower values - // If equal, later entries in D_8018D9E0 are on top - /* 0x15 */ u8 visible; // active? If 1 its displayed, if 0 its not - // These seem to be generic space available for use by the struct, no 1 purpose for any given member - /* 0x16 */ s16 unk16; // Potentially unused - /* 0x18 */ s32 D_8018DEE0_index; // Index in D_8018DEE0, an array of some other struct type - /* 0x1C */ s32 unk1C; // Multi use. Sometimes cup selection, sometimes course index. - /* 0x20 */ s32 unk20; // Multi use, hard to tell what for though. Sometimes a random number, sometimes GP points - /* 0x24 */ s32 unk24; // Multi use, x scaling for some things, rotation multiplier for the question box in some menus, probably some other things -} struct_8018D9E0_entry; // size = 0x28 - -// Top byte is used as an index to gSegmentTable -// The rest of the bytes are used as an offset -typedef u32 segment_address_t; - -typedef struct { - /* 0x00 */ s16 type; - /* 0x02 */ s16 unused1; - /* 0x04 */ u64 *textureData; // This should be interpreted as a segmented address - /* 0x08 */ s16 width; - /* 0x0A */ s16 height; - /* 0x0C */ s16 dX; - /* 0x0D */ s16 dY; - /* 0x10 */ s16 size; // This size is NOT equal to width*height. Its likely the size of the compressed texture - /* 0x12 */ s16 unused2; -} MkTexture; // size = 0x14 - -typedef struct { - /* 0x00 */ MkTexture *mk64Texture; // This should be interpreted as a segmented address - /* 0x04 */ s32 frame_length; -} MkAnimation; // size = 0x8 - -typedef struct { - /* 0x00 */ MkAnimation *textureSequence; - /* 0x04 */ s32 sequenceIndex; // Index in textureSequence that the animation is currently on - /* 0x08 */ s32 frameCountDown; // Frames left for the given animation part - /* 0x0C */ u32 visible; // visbile if 0x80000000, otherwise invisbile AND paused - /* 0x10 */ s32 D_8018E118_index; // Don't know what D_8018E118 tracks - /* 0x14 */ s32 unk14; // Flip flops between 0 and 1, use unknown -} struct_8018DEE0_entry; // size = 0x18 - typedef struct { /* 0x00 */ u16 red; /* 0x02 */ u16 green; @@ -644,17 +597,6 @@ typedef struct { /* 0x06 */ u16 alpha; } RGBA16; // size = 0x08 -typedef struct { - /* 0x00 */ u64 *textureData; // This should be interpreted as a segmented address - /** - * Its hard to tell what exactly what this is meant to be, - * but it appears to be used as some sort of offset/index from the address stored in D_8018D9B0. - * This value is (roughly) the sum of (width * height) of the - * textures in all the previous entries in D_8018E118 - */ - /* 0x04 */ s32 offset; -} struct_8018E118_entry; // size = 0x08 - // Something related to human players // Also might be used for the camera during the post race screens typedef struct { diff --git a/include/variables.h b/include/variables.h index b7270131e..a0de621ad 100644 --- a/include/variables.h +++ b/include/variables.h @@ -26,7 +26,6 @@ extern s8 gCupSelection; // D_8018EE09 extern u8 gCupSelectionByCourseId[NUM_COURSES]; // D_800E7664 extern s16 gCurrentCourseId; // D_800DC5A0 -extern s32 gD_8018E118TotalSize; // D_8018E110 extern s8 gDebugMenuSelection; // D_8018EDEF extern char *gDebugSoundModeNames[NUM_SOUND_MODES]; // D_800E7700 extern Gfx *gDisplayListHead; // D_80150298 @@ -54,7 +53,6 @@ extern s32 gModeSelection; // D_800DC53C // Indicates the ID of the next title screen demo that will be played extern u8 gNextDemoId; // D_800E86BC -extern s32 gNumD_8018E118Entries; // D_8018E758 // Maps course IDs (as defined in the COURSES enum) to an index in a given cup's track order extern u8 gPerCupIndexByCourseId[NUM_COURSES]; // D_800EFD50 diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 7789c2dad..763437a96 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -2789,7 +2789,7 @@ s32 func_8000B7E4(s32, u16); // extern ? func_8002E4C4(void *, u16 *, f32 *, u16 *); // extern ? func_8003680C(void *, s16, void *, s32, void *); // extern s32 func_802B5224(void *, ? *, void *, ? *); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern +void *segmented_to_virtual_dupe(void*); // extern ? set_places(); // extern extern ? D_0D009418; extern ? D_0D009568; @@ -6289,7 +6289,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F2DC.s") ? func_80011A5C(); // extern ? func_80011AB8(s32, s32); // extern ? func_8001AB00(? *, s16, s16 *, s16); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern +void *segmented_to_virtual_dupe(void*); // extern extern ? D_0D009418; extern ? D_800DCAA0; extern f32 D_800ED050; @@ -6812,7 +6812,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F628.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s16 func_80011014(s16 *, u16 *, s32, s32); // extern s16 process_path_data(s16 *, u16 *); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern +void *segmented_to_virtual_dupe(void*); // extern extern ? D_800DC8D0; extern ? D_800DCA4C; extern ? D_801645C8; @@ -7823,7 +7823,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001168C.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual_dupe(segment_address_t); // extern +void *segmented_to_virtual_dupe(void*); // extern extern s32 D_800DC720; extern ? D_80162EB8; extern ? D_80162F08; diff --git a/src/code_80091750.c b/src/code_80091750.c index ecf4e2c19..fb85ee04d 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -4126,7 +4126,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800996BC.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? dma_copy_base_729a30(s32, s32, u8 *); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern u8 *D_8018D9B4; void func_80099958(s32 arg1, s32 arg2) { @@ -4189,7 +4189,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099A70.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern s32 D_8018E060; void func_80099A94(s32 arg1) { @@ -4343,7 +4343,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099E54.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern s32 D_8018E0E8; void func_80099E60(s32 arg1, s32 arg2) { @@ -4638,7 +4638,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A478.s") void func_80099A94(MkTexture *, s32); /* extern */ // Non-matching due to the argument registers to an addu command being swapped. -void func_8009A594(s32 arg0, s32 arg1, segment_address_t arg2) { +void func_8009A594(s32 arg0, s32 arg1, MkAnimation *arg2) { MkAnimation *temp_v0; struct_8018DEE0_entry *temp_s0; MkTexture *temp_v0_2; @@ -4666,7 +4666,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A594.s") // Non-matching due to the argument registers to an addu command being swapped. // Also some stack mangement around the segmented_to_virtual call is wrong extern void func_80099E60(MkTexture *, s32, s32); -void func_8009A640(s32 arg0, s32 arg1, s32 arg2, segment_address_t arg3) { +void func_8009A640(s32 arg0, s32 arg1, s32 arg2, MkAnimation *arg3) { MkAnimation *temp_v0; MkTexture *temp_a0; s32 thing = arg1; @@ -5197,7 +5197,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B938.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern s32 D_8018E75C; extern s32 D_8018E760; extern ? D_8018E768; @@ -5233,7 +5233,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B998.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_8018E768; extern ? D_8018E7A8; @@ -5278,7 +5278,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B9D0.s") //generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 void *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ void *func_800987D0(void *, ?, ?, u16, s32, s32, s32, s32, s32, s32); /* extern */ -void *segmented_to_virtual(segment_address_t); /* extern */ +void *segmented_to_virtual(void*); /* extern */ static ? D_02007708; /* unable to generate initializer */ static ? D_02007728; /* unable to generate initializer */ static ? D_02007748; /* unable to generate initializer */ @@ -5374,7 +5374,7 @@ void *func_80097A14(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32); // exte void *func_80097AE4(void *, ?, s32, s32, s32, s32); // extern void *func_80097E58(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); // extern s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_02007708; extern ? D_02007728; @@ -5463,7 +5463,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BC9C.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_80095BD0(void *, s32, f32, f32, s32, s32, f32, f32); // extern s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_020077F8; extern ? D_02007818; @@ -5621,7 +5621,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BEF0.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_800963F0(void *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_02007708; extern ? D_02007728; extern ? D_02007768; @@ -5709,7 +5709,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009C204.s") void *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern void *func_800963F0(void *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern void *func_80097E58(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_02007708; extern ? D_02007728; extern ? D_02007768; @@ -5805,7 +5805,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009C434.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_80097E58(void *, s8, ?, ?, s32, s32, s32, s32, u8 *, s32, s32, s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_02007708; extern ? D_02007728; extern ? D_02007748; @@ -8337,7 +8337,7 @@ void *func_8009BC9C(void *, ? *, s32, s32, s32, s32); /* extern */ ? func_800A90D4(s32, void *); /* extern */ s32 func_800B4EB4(?, ?); /* extern */ s32 func_800B555C(s32); /* extern */ -void *segmented_to_virtual(segment_address_t); /* extern */ +void *segmented_to_virtual(void*); /* extern */ ? set_text_color(s32); /* extern */ extern s32 D_800DC540; extern s32 D_800DC548; @@ -8987,7 +8987,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009F5E0.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_8009BA74(s32, s32, s32, s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_800E7AF8; extern s32 gDisplayListHead; @@ -9161,7 +9161,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0B80.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_8009BA74(s32, s32, s32, ?); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_800E7D0C; extern s32 gControllerPakNumPagesFree; extern s32 gDisplayListHead; @@ -12426,35 +12426,29 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A761C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80093324(s32, s32, s32, s32, f32, f32); // extern -? func_800936B8(s32, s32, s32, s32, f32, f32); // extern -? set_text_color(s8); // extern -extern ? D_802850C0; -extern ? D_802854B0; - -void func_800A7790(void *arg0) { +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +void func_800A7790(struct_8018D9E0_entry *arg0) { s32 sp38; - void *sp2C; + struct_802850C0_entry *sp2C; f32 temp_f0; f32 temp_f0_2; s32 temp_t0; s8 temp_v1; - void *temp_v0; + struct_802850C0_entry *temp_v0; - temp_t0 = arg0->unk0 - 0x190; - temp_v0 = (temp_t0 * 0x10) + &D_802850C0; + temp_t0 = arg0->type - 0x190; + temp_v0 = &D_802850C0[temp_t0]; sp2C = temp_v0; sp38 = temp_t0; - set_text_color(temp_v0->unkD); - temp_v1 = temp_v0->unkC; + set_text_color((s32) temp_v0->textColor); + temp_v1 = temp_v0->slideDirection; if ((temp_v1 == 0) || (temp_v1 != 1)) { - temp_f0_2 = temp_v0->unk0; - func_800936B8(arg0->unkC, arg0->unk10, *(&D_802854B0 + (temp_t0 * 4)), arg0->unk1C * temp_f0_2, arg0->unk24 * temp_f0_2, temp_f0_2); - return; + temp_f0 = temp_v0->textScaling; + func_800936B8(arg0->column, arg0->row, D_802854B0[temp_t0], (s32) ((f32) arg0->unk1C * temp_f0), (bitwise f32) arg0->unk24 * temp_f0, temp_f0); + } else { + temp_f0_2 = temp_v0->textScaling; + func_80093324(arg0->column, arg0->row, D_802854B0[temp_t0], (s32) ((f32) arg0->unk1C * temp_f0_2), (bitwise f32) arg0->unk24 * temp_f0_2, temp_f0_2); } - temp_f0 = temp_v0->unk0; - func_80093324(arg0->unkC, arg0->unk10, *(&D_802854B0 + (temp_t0 * 4)), arg0->unk1C * temp_f0, arg0->unk24 * temp_f0, temp_f0); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A7790.s") @@ -12530,68 +12524,64 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A79F4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 ? func_8009E000(?); /* extern */ -? func_8009F5E0(? *); /* extern */ -? func_800A954C(? *); /* extern */ -? func_800A9710(? *); /* extern */ -? func_800A97BC(? *); /* extern */ -? func_800A9A98(? *); /* extern */ -? func_800A9B9C(? *); /* extern */ -? func_800A9C40(? *); /* extern */ -? func_800A9D5C(? *); /* extern */ -? func_800A9E58(? *); /* extern */ -? func_800AA280(? *); /* extern */ -? func_800AA2EC(? *); /* extern */ -? func_800AA69C(? *); /* extern */ -? func_800AAA9C(? *); /* extern */ -? func_800AAB90(? *); /* extern */ -? func_800AAC18(? *); /* extern */ -? func_800AADD4(? *); /* extern */ -? func_800AAE18(? *); /* extern */ -? func_800AB020(? *); /* extern */ -? func_800AB098(? *); /* extern */ -? func_800AB164(? *); /* extern */ -? func_800AB260(? *); /* extern */ -? func_800AB290(? *); /* extern */ -? func_800AB314(? *); /* extern */ -? func_800AB904(? *); /* extern */ -? func_800AB9B0(? *); /* extern */ -? func_800ABAE8(? *); /* extern */ -? func_800ABB24(? *); /* extern */ -? func_800ABBCC(? *); /* extern */ -? func_800ABC38(? *); /* extern */ -? func_800ABEAC(? *); /* extern */ -? func_800AC300(? *); /* extern */ -? func_800AC324(? *); /* extern */ -? func_800AC458(? *); /* extern */ -? func_800AC978(? *); /* extern */ -? func_800ACA14(? *); /* extern */ -? func_800ACC50(? *); /* extern */ -? func_800ACF40(? *); /* extern */ -? func_800AD1A4(? *); /* extern */ -? func_800AD2E8(? *); /* extern */ -? func_800ADF48(? *); /* extern */ -? func_800AE218(? *); /* extern */ -? func_800AEC54(? *); /* extern */ -? func_800AEDBC(? *); /* extern */ -? func_800AEE90(? *); /* extern */ -? func_800AEEBC(? *); /* extern */ -? func_800AEEE8(? *); /* extern */ -? func_800AEF14(? *); /* extern */ -? func_800AEF74(? *); /* extern */ -? func_800AF004(? *); /* extern */ -? func_800AF1AC(? *); /* extern */ -? func_800AF270(? *); /* extern */ -? func_800AF480(? *); /* extern */ +? func_8009F5E0(struct_8018D9E0_entry *); /* extern */ +? func_800A9710(struct_8018D9E0_entry *); /* extern */ +? func_800A97BC(struct_8018D9E0_entry *); /* extern */ +? func_800A9A98(struct_8018D9E0_entry *); /* extern */ +? func_800A9B9C(struct_8018D9E0_entry *); /* extern */ +? func_800A9C40(struct_8018D9E0_entry *); /* extern */ +? func_800A9D5C(struct_8018D9E0_entry *); /* extern */ +? func_800A9E58(struct_8018D9E0_entry *); /* extern */ +? func_800AA280(struct_8018D9E0_entry *); /* extern */ +? func_800AA2EC(struct_8018D9E0_entry *); /* extern */ +? func_800AA69C(struct_8018D9E0_entry *); /* extern */ +? func_800AAA9C(struct_8018D9E0_entry *); /* extern */ +? func_800AAB90(struct_8018D9E0_entry *); /* extern */ +? func_800AAC18(struct_8018D9E0_entry *); /* extern */ +? func_800AB020(struct_8018D9E0_entry *); /* extern */ +? func_800AB098(struct_8018D9E0_entry *); /* extern */ +? func_800AB164(struct_8018D9E0_entry *); /* extern */ +? func_800AB260(struct_8018D9E0_entry *); /* extern */ +? func_800AB314(struct_8018D9E0_entry *); /* extern */ +? func_800AB904(struct_8018D9E0_entry *); /* extern */ +? func_800AB9B0(struct_8018D9E0_entry *); /* extern */ +? func_800ABAE8(struct_8018D9E0_entry *); /* extern */ +? func_800ABB24(struct_8018D9E0_entry *); /* extern */ +? func_800ABBCC(struct_8018D9E0_entry *); /* extern */ +? func_800ABC38(struct_8018D9E0_entry *); /* extern */ +? func_800ABEAC(struct_8018D9E0_entry *); /* extern */ +? func_800AC300(struct_8018D9E0_entry *); /* extern */ +? func_800AC324(struct_8018D9E0_entry *); /* extern */ +? func_800AC458(struct_8018D9E0_entry *); /* extern */ +? func_800ACA14(struct_8018D9E0_entry *); /* extern */ +? func_800ACC50(struct_8018D9E0_entry *); /* extern */ +? func_800ACF40(struct_8018D9E0_entry *); /* extern */ +? func_800AD1A4(struct_8018D9E0_entry *); /* extern */ +? func_800AD2E8(struct_8018D9E0_entry *); /* extern */ +? func_800ADF48(struct_8018D9E0_entry *); /* extern */ +? func_800AE218(struct_8018D9E0_entry *); /* extern */ +? func_800AEC54(struct_8018D9E0_entry *); /* extern */ +? func_800AEDBC(struct_8018D9E0_entry *); /* extern */ +? func_800AEE90(struct_8018D9E0_entry *); /* extern */ +? func_800AEEBC(struct_8018D9E0_entry *); /* extern */ +? func_800AEEE8(struct_8018D9E0_entry *); /* extern */ +? func_800AEF14(struct_8018D9E0_entry *); /* extern */ +? func_800AEF74(struct_8018D9E0_entry *); /* extern */ +? func_800AF004(struct_8018D9E0_entry *); /* extern */ +? func_800AF1AC(struct_8018D9E0_entry *); /* extern */ +? func_800AF270(struct_8018D9E0_entry *); /* extern */ +? func_800AF480(struct_8018D9E0_entry *); /* extern */ ? func_800CA388(?); /* extern */ ? play_sound2(?); /* extern */ -extern ? D_8018D9E0; -extern ? D_8018DEE0; +extern s32 D_8018ED94; +extern s32 D_8018EDE0; +extern s8 D_8018EDEE; +extern void *gControllerFive; +extern s8 gMainMenuSelectionDepth; void func_800A7A4C(s32 arg0) { - ? *temp_s1; - ? *temp_s1_2; f32 temp_f18; f64 temp_f0; s32 temp_s0; @@ -12599,364 +12589,427 @@ void func_800A7A4C(s32 arg0) { s32 temp_t3; s32 temp_v0; s32 temp_v0_2; - s32 temp_v0_4; + s32 temp_v0_3; s32 temp_v0_6; s8 temp_t1; s8 temp_t9; - s8 temp_v0_3; + s8 temp_v0_4; s8 temp_v0_5; - ? *phi_s1; - s8 phi_v1; - ? *phi_s1_2; - s8 phi_v1_2; + struct_8018D9E0_entry *temp_s1; + struct_8018D9E0_entry *temp_s1_2; + struct_8018D9E0_entry *phi_s1; + u8 phi_v1; + struct_8018D9E0_entry *phi_s1_2; + u8 phi_v1_2; s32 phi_s0; - phi_s1 = &D_8018D9E0; + phi_s1 = D_8018D9E0; do { - temp_v0 = phi_s1->unk0; - phi_v1 = 0; - phi_v1_2 = 0; + temp_v0 = phi_s1->type; + phi_v1 = 0U; + phi_v1_2 = 0U; if ((temp_v0 == 4) || (temp_v0 == 5) || (temp_v0 == 0xC7)) { if (arg0 != 0) { goto block_7; } } else if (arg0 == 0) { block_7: - phi_v1 = 1; + phi_v1 = 1U; } if (phi_v1 != 0) { - if (temp_v0 >= 0x10F) { - if (temp_v0 >= 0x131) { - switch (temp_v0) { /* switch 1 */ - func_800AF480(phi_s1); - break; - } - } else { - switch (temp_v0) { /* switch 2 */ - case 0x12B: /* switch 2 */ - func_800AF004(phi_s1); - break; - case 0x12C: /* switch 2 */ - case 0x12D: /* switch 2 */ - case 0x12E: /* switch 2 */ - case 0x12F: /* switch 2 */ - func_800AF1AC(phi_s1); - break; - case 0x130: /* switch 2 */ - func_800AF270(phi_s1); - break; + switch (temp_v0) { /* switch 8; irregular */ + case 0xFA: /* switch 8 */ + temp_v0_2 = D_8018ED94; + if (temp_v0_2 < 0x50) { + D_800E8534 = 3.0f; + } else if (temp_v0_2 < 0x5A) { + temp_f0 = (f64) 0.0f; + if (temp_f0 < 1.0) { + D_800E8530 = (f32) (temp_f0 + 0.1); } + D_800E8534 = (f32) ((f64) 3.0f + 0.1); + } else if (temp_v0_2 < 0xA0) { + D_800E8534 = (f32) ((f64) 3.0f + 0.1); + } else if (temp_v0_2 < 0x190) { + D_800E8534 = (f32) ((f64) 3.0f + 0.3); } - } else if (temp_v0 >= 0x38) { - switch (temp_v0) { /* switch 3 */ - case 0xFA: /* switch 3 */ - temp_v0_2 = D_8018ED94; - if (temp_v0_2 < 0x50) { - D_800E8534 = 3.0f; - } else if (temp_v0_2 < 0x5A) { - temp_f0 = 0.0f; - if (temp_f0 < 1.0) { - D_800E8530 = temp_f0 + 0.1; - } - D_800E8534 = 3.0f + 0.1; - } else if (temp_v0_2 < 0xA0) { - D_800E8534 = 3.0f + 0.1; - } else if (temp_v0_2 < 0x190) { - D_800E8534 = 3.0f + 0.3; - } - temp_f18 = D_8018EDCC - 3.0f; - D_8018EDCC = temp_f18; - D_8018ED94 = temp_v0_2 + 1; - if (temp_f18 < -360.0f) { - D_8018EDCC = temp_f18 + 360.0f; - } - temp_t2 = phi_s1->unk1C + 1; - phi_s1->unk1C = temp_t2; - if (temp_t2 == 0xB4) { - func_8009E000(0x28); - func_800CA388(0x64); - D_8018EDE0 = 0; - } - if ((phi_s1->unk20 != 0) && (phi_s1->unk1C >= 3)) { - phi_s1->unk20 = 0; - play_sound2(0x49018008); - } - break; - case 0xDA: /* switch 3 */ - func_800A954C(phi_s1); - break; - case 0xD6: /* switch 3 */ - func_800A9710(phi_s1); - break; - case 0xD4: /* switch 3 */ - func_800A97BC(phi_s1); - break; - case 0x53: /* switch 3 */ - case 0x54: /* switch 3 */ - case 0x55: /* switch 3 */ - case 0x56: /* switch 3 */ - func_800AB164(phi_s1); - temp_v0_3 = D_8018EDEC; - if (temp_v0_3 != 1) { - if ((temp_v0_3 != 2) && (temp_v0_3 != 3)) { - - } else { - func_800AB098(phi_s1); - } - } else { - func_800AB020(phi_s1); - } - break; - case 0x58: /* switch 3 */ - case 0x59: /* switch 3 */ - case 0x5A: /* switch 3 */ - case 0x5B: /* switch 3 */ - func_800AB260(phi_s1); - break; - case 0x64: /* switch 3 */ - func_800AB314(phi_s1); - break; - case 0x5F: /* switch 3 */ - case 0x60: /* switch 3 */ - case 0x61: /* switch 3 */ - case 0x62: /* switch 3 */ - func_800AB290(phi_s1); - break; - case 0x65: /* switch 3 */ - case 0x66: /* switch 3 */ - func_800AB904(phi_s1); - break; - case 0x67: /* switch 3 */ - func_800AB9B0(phi_s1); - break; - case 0x78: /* switch 3 */ - case 0x79: /* switch 3 */ - case 0x7A: /* switch 3 */ - case 0x7B: /* switch 3 */ - case 0x8C: /* switch 3 */ - func_800ABAE8(phi_s1); - break; - case 0x8D: /* switch 3 */ - func_800ABB24(phi_s1); - break; - case 0x7C: /* switch 3 */ - case 0x7D: /* switch 3 */ - case 0x7E: /* switch 3 */ - case 0x7F: /* switch 3 */ - case 0x80: /* switch 3 */ - case 0x81: /* switch 3 */ - case 0x82: /* switch 3 */ - case 0x83: /* switch 3 */ - case 0x84: /* switch 3 */ - case 0x85: /* switch 3 */ - case 0x86: /* switch 3 */ - case 0x87: /* switch 3 */ - case 0x88: /* switch 3 */ - case 0x89: /* switch 3 */ - case 0x8A: /* switch 3 */ - case 0x8B: /* switch 3 */ - func_800ABBCC(phi_s1); - break; - case 0x96: /* switch 3 */ - func_800ABC38(phi_s1); - break; - case 0x97: /* switch 3 */ - func_800ABEAC(phi_s1); - break; - case 0x5E: /* switch 3 */ - func_800AC300(phi_s1); - break; - case 0xAA: /* switch 3 */ - func_800AC324(phi_s1); - break; - case 0xAB: /* switch 3 */ - func_800AC458(phi_s1); - break; - case 0xAC: /* switch 3 */ - func_800ACA14(phi_s1); - break; - case 0xAF: /* switch 3 */ - func_800AC978(phi_s1); - break; - case 0xB0: /* switch 3 */ - func_800ACC50(phi_s1); - break; - case 0xB1: /* switch 3 */ - case 0xB2: /* switch 3 */ - case 0xB3: /* switch 3 */ - case 0xB4: /* switch 3 */ - func_800ACF40(phi_s1); - break; - case 0xB9: /* switch 3 */ - func_800AD1A4(phi_s1); - break; - case 0xBA: /* switch 3 */ - func_800AD2E8(phi_s1); - break; - case 0xBC: /* switch 3 */ - func_800AEC54(phi_s1); - break; - case 0xC7: /* switch 3 */ - func_800ADF48(phi_s1); - break; - case 0xBD: /* switch 3 */ - func_800AE218(phi_s1); - break; - case 0xE6: /* switch 3 */ - func_800AEDBC(phi_s1); - break; - case 0xE8: /* switch 3 */ - func_800AEE90(phi_s1); - break; - case 0xE9: /* switch 3 */ - func_800AEEBC(phi_s1); - break; - case 0xEA: /* switch 3 */ - func_800AEEE8(phi_s1); - break; - case 0xBE: /* switch 3 */ - func_800AEF14(phi_s1); - break; - case 0x10E: /* switch 3 */ - func_800AEF74(phi_s1); - break; + temp_f18 = D_8018EDCC - 3.0f; + D_8018EDCC = temp_f18; + D_8018ED94 = temp_v0_2 + 1; + if (temp_f18 < -360.0f) { + D_8018EDCC = temp_f18 + 360.0f; } - } else { - switch (temp_v0) { /* switch 4 */ - case 0x5: /* switch 4 */ - temp_v0_4 = phi_s1->unk4; - if (temp_v0_4 != 0) { - if (temp_v0_4 != 1) { - - } - phi_s1->unk15 = 1; - } else if ((gControllerFive->button & 0x10) != 0) { - phi_s1->unk4 = 1; + temp_t2 = phi_s1->unk1C + 1; + phi_s1->unk1C = temp_t2; + if (temp_t2 == 0xB4) { + func_8009E000(0x28); + func_800CA388(0x64); + D_8018EDE0 = 0; + } + if ((phi_s1->unk20 != 0) && (phi_s1->unk1C >= 3)) { + phi_s1->unk20 = 0; + play_sound2(0x49018008); + } + break; + case 0xDA: /* switch 8 */ + func_800A954C(phi_s1); + break; + case 0xD6: /* switch 8 */ + func_800A9710(phi_s1); + break; + case 0xD4: /* switch 8 */ + func_800A97BC(phi_s1); + break; + case 0x5: /* switch 8 */ + temp_v0_3 = phi_s1->unk4; + switch (temp_v0_3) { /* switch 9; irregular */ + case 0: /* switch 9 */ + if ((gControllerFive->unk4 & 0x10) != 0) { + phi_s1->unk4 = (s32) 1U; play_sound2(0x4900801C); } else { - phi_s1->unk15 = 0; + phi_s1->visible = 0; } break; - case 0xA: /* switch 4 */ - func_800AA280(phi_s1); - break; - case 0x10: /* switch 4 */ - case 0x11: /* switch 4 */ - temp_t9 = gMainMenuSelectionDepth; - switch (temp_t9) { /* switch 5 */ - case OPTIONS_SELECTION: /* switch 5 */ - case DATA_SELECTION: /* switch 5 */ - case PLAYER_NUM_SELECTION: /* switch 5 */ - func_800A9B9C(phi_s1); - break; - case GAME_MODE_SELECTION: /* switch 5 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 5 */ - case CONFIRM_OK_SELECTION: /* switch 5 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 5 */ - case TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT: /* switch 5 */ - func_800A9C40(phi_s1); - break; - } - break; - case 0xF: /* switch 4 */ - func_800AA280(phi_s1); - func_800A9A98(phi_s1); - break; - case 0xB: /* switch 4 */ - case 0xC: /* switch 4 */ - case 0xD: /* switch 4 */ - case 0xE: /* switch 4 */ - temp_t1 = gMainMenuSelectionDepth; - switch (temp_t1) { /* switch 6 */ - case OPTIONS_SELECTION: /* switch 6 */ - case DATA_SELECTION: /* switch 6 */ - case PLAYER_NUM_SELECTION: /* switch 6 */ - func_800A9B9C(phi_s1); - break; - case GAME_MODE_SELECTION: /* switch 6 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 6 */ - case CONFIRM_OK_SELECTION: /* switch 6 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 6 */ - case TIME_TRAILS_DATA_SELECTION_FROM_BACK_OUT: /* switch 6 */ - func_800A9C40(phi_s1); - break; - } - func_800A9D5C(phi_s1); - break; - case 0x12: /* switch 4 */ - case 0x13: /* switch 4 */ - case 0x14: /* switch 4 */ - case 0x15: /* switch 4 */ - case 0x16: /* switch 4 */ - case 0x17: /* switch 4 */ - case 0x18: /* switch 4 */ - case 0x19: /* switch 4 */ - func_800A9E58(phi_s1); - break; - case 0x1B: /* switch 4 */ - func_800AA2EC(phi_s1); - break; - case 0x34: /* switch 4 */ - case 0x35: /* switch 4 */ - case 0x36: /* switch 4 */ - case 0x37: /* switch 4 */ - func_800AADD4(phi_s1); - break; - case 0x2B: /* switch 4 */ - case 0x2C: /* switch 4 */ - case 0x2D: /* switch 4 */ - case 0x2E: /* switch 4 */ - case 0x2F: /* switch 4 */ - case 0x30: /* switch 4 */ - case 0x31: /* switch 4 */ - case 0x32: /* switch 4 */ - func_800AAC18(phi_s1); - temp_t3 = phi_s1->unk0; - switch (temp_t3) { /* switch 7 */ - func_800AA69C(phi_s1); - break; - } - temp_v0_5 = D_8018EDEE; - if (temp_v0_5 != 1) { - if ((temp_v0_5 != 2) && (temp_v0_5 != 3)) { - - } else { - func_800AAA9C(phi_s1); - } - } else { - func_800AAB90(phi_s1); - } - func_800AAE18(phi_s1); - break; - case 0x33: /* switch 4 */ - case 0x5D: /* switch 3 */ - func_800A9A98(phi_s1); + default: /* switch 9 */ + case 1: /* switch 9 */ + phi_s1->visible = 1; break; } + break; + case 0xA: /* switch 8 */ + func_800AA280(phi_s1); + break; + case 0x10: /* switch 8 */ + case 0x11: /* switch 8 */ + temp_t9 = gMainMenuSelectionDepth; + switch (temp_t9) { /* switch 5 */ + case 1: /* switch 5 */ + case 2: /* switch 5 */ + case 3: /* switch 5 */ + func_800A9B9C(phi_s1); + break; + case 4: /* switch 5 */ + case 5: /* switch 5 */ + case 6: /* switch 5 */ + case 7: /* switch 5 */ + case 8: /* switch 5 */ + func_800A9C40(phi_s1); + break; + } + break; + case 0xF: /* switch 8 */ + func_800AA280(phi_s1); + func_800A9A98(phi_s1); + break; + case 0xB: /* switch 8 */ + case 0xC: /* switch 8 */ + case 0xD: /* switch 8 */ + case 0xE: /* switch 8 */ + temp_t1 = gMainMenuSelectionDepth; + switch (temp_t1) { /* switch 6 */ + case 1: /* switch 6 */ + case 2: /* switch 6 */ + case 3: /* switch 6 */ + func_800A9B9C(phi_s1); + break; + case 4: /* switch 6 */ + case 5: /* switch 6 */ + case 6: /* switch 6 */ + case 7: /* switch 6 */ + case 8: /* switch 6 */ + func_800A9C40(phi_s1); + break; + } + func_800A9D5C(phi_s1); + break; + case 0x12: /* switch 8 */ + case 0x13: /* switch 8 */ + case 0x14: /* switch 8 */ + case 0x15: /* switch 8 */ + case 0x16: /* switch 8 */ + case 0x17: /* switch 8 */ + case 0x18: /* switch 8 */ + case 0x19: /* switch 8 */ + func_800A9E58(phi_s1); + break; + case 0x1B: /* switch 8 */ + func_800AA2EC(phi_s1); + break; + case 0x34: /* switch 8 */ + case 0x35: /* switch 8 */ + case 0x36: /* switch 8 */ + case 0x37: /* switch 8 */ + func_800AADD4(phi_s1); + break; + case 0x2B: /* switch 8 */ + case 0x2C: /* switch 8 */ + case 0x2D: /* switch 8 */ + case 0x2E: /* switch 8 */ + case 0x2F: /* switch 8 */ + case 0x30: /* switch 8 */ + case 0x31: /* switch 8 */ + case 0x32: /* switch 8 */ + func_800AAC18(phi_s1); + temp_t3 = phi_s1->type; + switch (temp_t3) { /* switch 7 */ + case 43: /* switch 7 */ + case 44: /* switch 7 */ + case 45: /* switch 7 */ + case 46: /* switch 7 */ + case 47: /* switch 7 */ + case 48: /* switch 7 */ + case 49: /* switch 7 */ + case 50: /* switch 7 */ + func_800AA69C(phi_s1); + break; + } + temp_v0_4 = D_8018EDEE; + switch (temp_v0_4) { /* switch 10; irregular */ + case 1: /* switch 10 */ + func_800AAB90(phi_s1); + break; + case 2: /* switch 10 */ + case 3: /* switch 10 */ + func_800AAA9C(phi_s1); + break; + } + func_800AAE18(phi_s1); + break; + case 0x33: /* switch 8 */ + case 0x5D: /* switch 8 */ + func_800A9A98(phi_s1); + break; + case 0x53: /* switch 8 */ + case 0x54: /* switch 8 */ + case 0x55: /* switch 8 */ + case 0x56: /* switch 8 */ + func_800AB164(phi_s1); + temp_v0_5 = D_8018EDEC; + switch (temp_v0_5) { /* switch 11; irregular */ + case 1: /* switch 11 */ + func_800AB020(phi_s1); + break; + case 2: /* switch 11 */ + case 3: /* switch 11 */ + func_800AB098(phi_s1); + break; + } + break; + case 0x58: /* switch 8 */ + case 0x59: /* switch 8 */ + case 0x5A: /* switch 8 */ + case 0x5B: /* switch 8 */ + func_800AB260(phi_s1); + break; + case 0x64: /* switch 8 */ + func_800AB314(phi_s1); + break; + case 0x5F: /* switch 8 */ + case 0x60: /* switch 8 */ + case 0x61: /* switch 8 */ + case 0x62: /* switch 8 */ + func_800AB290(phi_s1); + break; + case 0x65: /* switch 8 */ + case 0x66: /* switch 8 */ + func_800AB904(phi_s1); + break; + case 0x67: /* switch 8 */ + func_800AB9B0(phi_s1); + break; + case 0x78: /* switch 8 */ + case 0x79: /* switch 8 */ + case 0x7A: /* switch 8 */ + case 0x7B: /* switch 8 */ + case 0x8C: /* switch 8 */ + func_800ABAE8(phi_s1); + break; + case 0x8D: /* switch 8 */ + func_800ABB24(phi_s1); + break; + case 0x7C: /* switch 8 */ + case 0x7D: /* switch 8 */ + case 0x7E: /* switch 8 */ + case 0x7F: /* switch 8 */ + case 0x80: /* switch 8 */ + case 0x81: /* switch 8 */ + case 0x82: /* switch 8 */ + case 0x83: /* switch 8 */ + case 0x84: /* switch 8 */ + case 0x85: /* switch 8 */ + case 0x86: /* switch 8 */ + case 0x87: /* switch 8 */ + case 0x88: /* switch 8 */ + case 0x89: /* switch 8 */ + case 0x8A: /* switch 8 */ + case 0x8B: /* switch 8 */ + func_800ABBCC(phi_s1); + break; + case 0x96: /* switch 8 */ + func_800ABC38(phi_s1); + break; + case 0x97: /* switch 8 */ + func_800ABEAC(phi_s1); + break; + case 0x5E: /* switch 8 */ + func_800AC300(phi_s1); + break; + case 0xAA: /* switch 8 */ + func_800AC324(phi_s1); + break; + case 0xAB: /* switch 8 */ + func_800AC458(phi_s1); + break; + case 0xAC: /* switch 8 */ + func_800ACA14(phi_s1); + break; + case 0xAF: /* switch 8 */ + func_800AC978(phi_s1); + break; + case 0xB0: /* switch 8 */ + func_800ACC50(phi_s1); + break; + case 0xB1: /* switch 8 */ + case 0xB2: /* switch 8 */ + case 0xB3: /* switch 8 */ + case 0xB4: /* switch 8 */ + func_800ACF40(phi_s1); + break; + case 0xB9: /* switch 8 */ + func_800AD1A4(phi_s1); + break; + case 0xBA: /* switch 8 */ + func_800AD2E8(phi_s1); + break; + case 0xBC: /* switch 8 */ + func_800AEC54(phi_s1); + break; + case 0xC7: /* switch 8 */ + func_800ADF48(phi_s1); + break; + case 0xBD: /* switch 8 */ + func_800AE218(phi_s1); + break; + case 0xE6: /* switch 8 */ + func_800AEDBC(phi_s1); + break; + case 0xE8: /* switch 8 */ + func_800AEE90(phi_s1); + break; + case 0xE9: /* switch 8 */ + func_800AEEBC(phi_s1); + break; + case 0xEA: /* switch 8 */ + func_800AEEE8(phi_s1); + break; + case 0xBE: /* switch 8 */ + func_800AEF14(phi_s1); + break; + case 0x10E: /* switch 8 */ + func_800AEF74(phi_s1); + break; + case 0x12B: /* switch 8 */ + func_800AF004(phi_s1); + break; + case 0x12C: /* switch 8 */ + case 0x12D: /* switch 8 */ + case 0x12E: /* switch 8 */ + case 0x12F: /* switch 8 */ + func_800AF1AC(phi_s1); + break; + case 0x130: /* switch 8 */ + func_800AF270(phi_s1); + break; + case 0x190: /* switch 8 */ + case 0x191: /* switch 8 */ + case 0x192: /* switch 8 */ + case 0x193: /* switch 8 */ + case 0x194: /* switch 8 */ + case 0x195: /* switch 8 */ + case 0x196: /* switch 8 */ + case 0x197: /* switch 8 */ + case 0x198: /* switch 8 */ + case 0x199: /* switch 8 */ + case 0x19A: /* switch 8 */ + case 0x19B: /* switch 8 */ + case 0x19C: /* switch 8 */ + case 0x19D: /* switch 8 */ + case 0x19E: /* switch 8 */ + case 0x19F: /* switch 8 */ + case 0x1A0: /* switch 8 */ + case 0x1A1: /* switch 8 */ + case 0x1A2: /* switch 8 */ + case 0x1A3: /* switch 8 */ + case 0x1A4: /* switch 8 */ + case 0x1A5: /* switch 8 */ + case 0x1A6: /* switch 8 */ + case 0x1A7: /* switch 8 */ + case 0x1A8: /* switch 8 */ + case 0x1A9: /* switch 8 */ + case 0x1AA: /* switch 8 */ + case 0x1AB: /* switch 8 */ + case 0x1AC: /* switch 8 */ + case 0x1AD: /* switch 8 */ + case 0x1AE: /* switch 8 */ + case 0x1AF: /* switch 8 */ + case 0x1B0: /* switch 8 */ + case 0x1B1: /* switch 8 */ + case 0x1B2: /* switch 8 */ + case 0x1B3: /* switch 8 */ + case 0x1B4: /* switch 8 */ + case 0x1B5: /* switch 8 */ + case 0x1B6: /* switch 8 */ + case 0x1B7: /* switch 8 */ + case 0x1B8: /* switch 8 */ + case 0x1B9: /* switch 8 */ + case 0x1BA: /* switch 8 */ + case 0x1BB: /* switch 8 */ + case 0x1BC: /* switch 8 */ + case 0x1BD: /* switch 8 */ + case 0x1BE: /* switch 8 */ + case 0x1BF: /* switch 8 */ + case 0x1C0: /* switch 8 */ + case 0x1C1: /* switch 8 */ + case 0x1C2: /* switch 8 */ + case 0x1C3: /* switch 8 */ + case 0x1C4: /* switch 8 */ + case 0x1C5: /* switch 8 */ + case 0x1C6: /* switch 8 */ + case 0x1C7: /* switch 8 */ + case 0x1C8: /* switch 8 */ + case 0x1C9: /* switch 8 */ + case 0x1CA: /* switch 8 */ + case 0x1CB: /* switch 8 */ + case 0x1CC: /* switch 8 */ + case 0x1CD: /* switch 8 */ + case 0x1CE: /* switch 8 */ + func_800AF480(phi_s1); + break; } } temp_s1 = phi_s1 + 0x28; phi_s1 = temp_s1; - } while (temp_s1 != &D_8018DEE0); + } while (temp_s1 != D_8018DEE0); phi_s0 = 0; do { - phi_s1_2 = &D_8018D9E0; + phi_s1_2 = D_8018D9E0; loop_113: - temp_v0_6 = phi_s1_2->unk0; + temp_v0_6 = phi_s1_2->type; if ((temp_v0_6 == 4) || (temp_v0_6 == 5) || (temp_v0_6 == 0xC7)) { if (arg0 != 0) { goto block_119; } } else if (arg0 == 0) { block_119: - phi_v1_2 = 1; + phi_v1_2 = 1U; } - if ((phi_v1_2 != 0) && (phi_s0 == phi_s1_2->unk14)) { + if ((phi_v1_2 != 0) && (phi_s0 == phi_s1_2->priority)) { func_8009F5E0(phi_s1_2); } temp_s1_2 = phi_s1_2 + 0x28; phi_s1_2 = temp_s1_2; - if (temp_s1_2 != &D_8018DEE0) { + if (temp_s1_2 != D_8018DEE0) { goto loop_113; } temp_s0 = phi_s0 + 1; @@ -13094,7 +13147,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8270.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_800959A0(s32, s32, s32, s32, s32); // extern s32 func_80098C18(s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_0200487C; extern ? D_02004B74; extern ? D_02004E80; @@ -13412,7 +13465,7 @@ s32 func_80098FC8(s32, s32, s16, s32, s32); // extern s32 func_8009BA74(s32, ?, ?, ?); // extern s32 func_8009C204(s32, s32, s32, s16, s32); // extern s32 func_800B639C(s32); // extern -void *segmented_to_virtual(segment_address_t); // extern +void *segmented_to_virtual(void*); // extern extern ? D_02004A0C; extern ? D_800E7168; extern s8 D_8018EDEC; @@ -13460,36 +13513,19 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8F48.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_80098C18(void *, s32, s32, s32, s32, s32, s32, s32, s32); // extern -extern void *gDisplayListHead; - -void func_800A90D4(s32 arg0, void *arg1) { +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +void func_800A90D4(s32 arg0, struct_8018D9E0_entry *arg1) { s32 temp_a2; s32 temp_t1; - s32 temp_t5; s32 temp_t7; - void *temp_v0; - void *temp_v0_2; - void *temp_v0_3; - temp_t5 = arg1->unk1C; - if (temp_t5 < 0x20) { - temp_v0 = gDisplayListHead; - temp_t1 = arg1->unkC; - temp_a2 = arg1->unk10; - gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0xE7000000; - temp_v0->unk4 = 0; - temp_v0_2 = gDisplayListHead; - temp_t7 = (temp_t5 * 0x41) / 0x40; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk4 = 0xF0A4000; - temp_v0_2->unk0 = 0xB900031D; - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0xFFFCF279; - temp_v0_3->unk0 = 0xFCFFFFFF; + if (arg1->unk1C < 0x20) { + temp_t1 = arg1->column; + temp_a2 = arg1->row; + temp_t7 = (arg1->unk1C * 0x41) / 0x40; + gDPPipeSync(gDisplayListHead++); + gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); + gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); gDisplayListHead = func_80098C18(gDisplayListHead, temp_t1 + temp_t7, temp_a2, (temp_t1 - temp_t7) + 0x40, temp_a2 + 0x27, 1, 1, 1, 0xFF); } } @@ -13689,19 +13725,19 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A940C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800A94C8(void *arg0, s32 arg1, s32 arg2) { +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +void func_800A94C8(struct_8018D9E0_entry *arg0, s32 arg1, s32 arg2) { s32 temp_v0; s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; s32 phi_v1; - temp_v0 = arg0->unkC; + temp_v0 = arg0->column; temp_v1 = arg1 - temp_v0; phi_v1 = temp_v1; if (arg1 == temp_v0) { - arg0->unkC = temp_v0 + arg2; + arg0->column = temp_v0 + arg2; return; } if (temp_v1 != 0) { @@ -13719,7 +13755,7 @@ void func_800A94C8(void *arg0, s32 arg1, s32 arg2) { } } } - arg0->unkC = temp_v0 - phi_v1; + arg0->column = temp_v0 - phi_v1; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A94C8.s") @@ -14442,23 +14478,77 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA2EC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009A594(s32, s32, s32, s32 *); /* extern */ +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +s32 func_800AAFCC(s32); /* extern */ s32 random_int(?, s32); /* extern */ extern ? D_8018DEE4; extern ? D_8018EDE8; -static ? D_800E8360; /* unable to generate initializer; const */ -static ? D_800E8380; /* unable to generate initializer; const */ -static ? D_800E83A0; /* unable to generate initializer; const */ -static ? D_800E83C0; /* unable to generate initializer; const */ -static ? D_800E83E0; /* unable to generate initializer; const */ -static ? D_800E8400; /* unable to generate initializer; const */ -static ? D_800E8440; /* unable to generate initializer; const */ -static ? D_800E8460; /* unable to generate initializer; const */ -static ? D_800E8480; /* unable to generate initializer; const */ -static ? D_800E84A0; /* unable to generate initializer; const */ +static MkAnimation *D_800E8360[8] = { + D_02006708, + D_020068F0, + D_02006CC0, + D_02006EA8, + D_02007090, + D_02007280, + D_02007468, + D_02006AD8, +}; /* const */ +static MkAnimation *D_800E8380[8] = { + D_02006718, + D_02006900, + D_02006CD0, + D_02006EB8, + D_020070A0, + D_02007290, + D_02007478, + D_02006AE8, +}; /* const */ +static MkAnimation *D_800E83A0[8] = { + D_02006778, + D_02006960, + D_02006D30, + D_02006F18, + D_02007100, + D_020072F0, + D_020074D8, + D_02006B48, +}; /* const */ +static MkAnimation *D_800E83C0[8] = { + D_02006788, + D_02006970, + D_02006D40, + D_02006F28, + D_02007110, + D_02007300, + D_020074E8, + D_02006B58, +}; /* const */ +static MkAnimation *D_800E83E0[8] = { + D_020067E0, + D_020069C8, + D_02006D98, + D_02006F80, + D_02007170, + D_02007358, + D_02007540, + D_02006BB0, +}; /* const */ +static MkAnimation *D_800E8400[8] = { + D_02006838, + D_02006A20, + D_02006DF0, + D_02006FD8, + D_020071C8, + D_020073B0, + D_02007598, + D_02006C08, +}; /* const */ +static s32 D_800E8440[8] = { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }; /* const */ +static s32 D_800E8460[8] = { 9, 9, 9, 9, 0xA, 9, 9, 9 }; /* const */ +static s32 D_800E8480[8] = { 9, 9, 9, 9, 9, 9, 9, 9 }; /* const */ +static s32 D_800E84A0[8] = { 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13 }; /* const */ -void func_800AA69C(void *arg0) { +void func_800AA69C(struct_8018D9E0_entry *arg0) { s32 sp30; s32 sp24; s32 *sp20; @@ -14469,16 +14559,12 @@ void func_800AA69C(void *arg0) { s32 temp_a1; s32 temp_v0; s32 temp_v0_2; - s32 temp_v1_2; - s32 temp_v1_3; - s32 temp_v1_4; - s32 temp_v1_5; - u32 temp_v1; + s32 temp_v1; s32 phi_a0; s32 phi_v0; s32 phi_v1; - temp_a0 = arg0->unk0 - 0x2B; + temp_a0 = arg0->type - 0x2B; sp30 = temp_a0; temp_v0 = func_800AAFCC(temp_a0); temp_a1 = sp30; @@ -14492,86 +14578,78 @@ void func_800AA69C(void *arg0) { case 0: if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { arg0->unk8 = 1; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E8380[temp_a1])); return; } sp30 = temp_a1; temp_v0_2 = random_int(0xC8, temp_a1); if (temp_v0_2 >= 0xC6) { arg0->unk8 = 4; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83E0 + (temp_a1 * 4)))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E83E0[temp_a1])); return; } if (temp_v0_2 >= 0xC5) { arg0->unk8 = 5; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8400 + (temp_a1 * 4)))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E8400[temp_a1])); return; } default: return; case 1: - temp_v1_2 = temp_a1 * 4; - if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *(&D_800E8440 + temp_v1_2)) { + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= D_800E8440[temp_a1]) { arg0->unk8 = 2; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v1_2))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E83A0[temp_a1])); return; } if ((*(&D_8018EDE8 + temp_v0) == 0) && (phi_a0 != 0)) { arg0->unk8 = 3; - sp24 = temp_v1_2; - temp_a0_2 = arg0->unk18; - func_8009A594(temp_a0_2, *(&D_800E8460 + temp_v1_2) - *(&D_8018DEE4 + (temp_a0_2 * 0x18)), segmented_to_virtual_dupe(*(&D_800E83C0 + temp_v1_2))); + sp24 = temp_a1 * 4; + temp_a0_2 = arg0->D_8018DEE0_index; + func_8009A594(temp_a0_2, D_800E8460[temp_a1] - *(&D_8018DEE4 + (temp_a0_2 * 0x18)), segmented_to_virtual_dupe(D_800E83C0[temp_a1])); return; } - /* Duplicate return node #33. Try simplifying control flow for better match */ - return; + break; case 2: if ((*(&D_8018EDE8 + temp_v0) == 0) && (phi_a0 != 0)) { arg0->unk8 = 3; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83C0 + (temp_a1 * 4)))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E83C0[temp_a1])); return; } - /* Duplicate return node #33. Try simplifying control flow for better match */ - return; + break; case 3: - temp_v1_3 = temp_a1 * 4; - temp_a3 = temp_v1_3 + &D_800E8460; - if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *temp_a3) { + temp_a3 = &D_800E8460[temp_a1]; + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= *temp_a3) { arg0->unk8 = 0; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8360 + temp_v1_3))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E8360[temp_a1])); return; } if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { arg0->unk8 = 1; sp20 = temp_a3; - temp_a0_3 = arg0->unk18; - func_8009A594(temp_a0_3, *temp_a3 - *(&D_8018DEE4 + (temp_a0_3 * 0x18)), segmented_to_virtual_dupe(*(&D_800E8380 + temp_v1_3)), temp_a3); + temp_a0_3 = arg0->D_8018DEE0_index; + func_8009A594(temp_a0_3, *temp_a3 - *(&D_8018DEE4 + (temp_a0_3 * 0x18)), segmented_to_virtual_dupe(D_800E8380[temp_a1])); return; } - /* Duplicate return node #33. Try simplifying control flow for better match */ - return; + break; case 4: case 5: if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { arg0->unk8 = 1; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E8380[temp_a1])); return; } if (temp_v1 == 4) { - temp_v1_4 = temp_a1 * 4; - phi_v0 = *(&D_800E8480 + temp_v1_4); - phi_v1 = temp_v1_4; + phi_v0 = D_800E8480[temp_a1]; + phi_v1 = temp_a1 * 4; } else { - temp_v1_5 = temp_a1 * 4; - phi_v0 = *(&D_800E84A0 + temp_v1_5); - phi_v1 = temp_v1_5; + phi_v0 = D_800E84A0[temp_a1]; + phi_v1 = temp_a1 * 4; } - if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= phi_v0) { + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= phi_v0) { arg0->unk8 = 0; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8360 + phi_v1))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(*(D_800E8360 + phi_v1))); } - /* Duplicate return node #33. Try simplifying control flow for better match */ - return; + break; } } #else @@ -14579,13 +14657,16 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA69C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800AAA9C(s32 *arg0) { - s32 *temp_a1; +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +s32 func_800AAFCC(s32, struct_8018D9E0_entry *); /* extern */ +extern s8 D_8018EDEE; + +void func_800AAA9C(struct_8018D9E0_entry *arg0) { s32 temp_a0; s32 temp_t2; + s32 temp_t6; s32 temp_v0; - u32 temp_t6; + struct_8018D9E0_entry *temp_a1; temp_t6 = arg0->unk4; temp_a1 = arg0; @@ -14608,7 +14689,7 @@ void func_800AAA9C(s32 *arg0) { } /* fallthrough */ case 0: - temp_a0 = temp_a1->unk0; + temp_a0 = temp_a1->type; arg0 = temp_a1; if (func_800AAFCC(temp_a0 - 0x2B, temp_a1) >= 0) { arg0->unk4 = 2; @@ -14621,12 +14702,11 @@ block_13: return; case 4: arg0 = temp_a1; - if (func_800AAFCC(temp_a1->unk0 - 0x2B, temp_a1) >= 0) { + if (func_800AAFCC(temp_a1->type - 0x2B, temp_a1) >= 0) { arg0->unk4 = 2; goto block_13; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; } } #else @@ -14634,24 +14714,26 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAA9C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800AAB90(void *arg0) { +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +void func_800AAB90(struct_8018D9E0_entry *arg0) { s32 temp_t2; + s32 temp_t6; s32 temp_v0; - u32 temp_t6; temp_t6 = arg0->unk4; switch (temp_t6) { case 1: if (arg0->unk1C > 0) { arg0->unk4 = 3; - return; } + break; default: - return; + case 0: + case 4: + break; case 2: arg0->unk4 = 4; - return; + break; case 3: temp_v0 = arg0->unk1C; if (temp_v0 > 0) { @@ -14659,15 +14741,12 @@ void func_800AAB90(void *arg0) { arg0->unk1C = temp_t2; if (temp_t2 < 0) { arg0->unk1C = 0; - return; } - /* Duplicate return node #9. Try simplifying control flow for better match */ - return; + } else { + arg0->unk1C = 0; + arg0->unk4 = 0; } - arg0->unk1C = 0; - arg0->unk4 = 0; - /* Duplicate return node #9. Try simplifying control flow for better match */ - return; + break; } } #else @@ -14675,33 +14754,49 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAB90.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_8009A594(s32, ?, s32, void *); /* extern */ -? func_800A91D8(void *, s16, s16, void *); /* extern */ -static ? D_800E7108; /* unable to generate initializer; const */ -static ? D_800E7188; /* unable to generate initializer; const */ -static ? D_800E8340; /* unable to generate initializer; const */ +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +struct _struct_D_800E7108_0x8 { + /* 0x0 */ s16 unk0; /* inferred */ + /* 0x2 */ s16 unk2; /* inferred */ + /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ +}; /* size = 0x8 */ -void func_800AAC18(void *arg0) { +? func_800A91D8(struct_8018D9E0_entry *, s16, s16, struct_8018D9E0_entry *); /* extern */ +s32 func_800AAFCC(s32, s32, s32, struct_8018D9E0_entry *); /* extern */ +extern s8 D_8018EDEE; +extern s32 gScreenModeSelection; +static struct _struct_D_800E7108_0x8 D_800E7108[0]; /* unable to generate initializer; const */ +static ? D_800E7188; /* unable to generate initializer; const */ +static MkAnimation *D_800E8340[8] = { + D_02006778, + D_02006960, + D_02006D30, + D_02006F18, + D_02007100, + D_020072F0, + D_020074D8, + D_02006B48, +}; /* const */ + +void func_800AAC18(struct_8018D9E0_entry *arg0) { s32 sp24; - void *sp18; + struct _struct_D_800E7108_0x8 *sp18; s32 temp_a0; s32 temp_a1; s32 temp_v0; s32 temp_v0_3; - u32 temp_v1; - void *temp_a3; - void *temp_a3_2; + s32 temp_v1; + struct _struct_D_800E7108_0x8 *temp_v0_2; + struct _struct_D_800E7108_0x8 *temp_v0_4; + struct_8018D9E0_entry *temp_a3; void *temp_t0; - void *temp_v0_2; - void *temp_v0_4; - u32 phi_v1; - void *phi_a3; - void *phi_t0; + s32 phi_v1; + struct_8018D9E0_entry *phi_a3; + struct _struct_D_800E7108_0x8 *phi_t0; temp_v1 = arg0->unk4; temp_a3 = arg0; - temp_a1 = arg0->unk0 - 0x2B; + temp_a1 = arg0->type - 0x2B; phi_v1 = temp_v1; phi_a3 = temp_a3; switch (temp_v1) { @@ -14710,16 +14805,15 @@ void func_800AAC18(void *arg0) { if (D_8018EDEE == 3) { sp24 = temp_a1; arg0 = temp_a3; - temp_v0 = func_800AAFCC(temp_a0, temp_a1, MIPS2C_ERROR(Read from unset register $a2), temp_a3); - temp_a3_2 = arg0; + temp_v0 = func_800AAFCC(temp_a0, temp_a1); if (temp_v0 >= 0) { temp_t0 = (gScreenModeSelection << 5) + (temp_v0 * 8) + &D_800E7188; - temp_a3_2->unkC = temp_t0->unk0; - temp_a3_2->unk4 = 2; - temp_a3_2->unk8 = 2; - temp_a3_2->unk10 = temp_t0->unk2; - arg0 = temp_a3_2; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8340 + (temp_a1 * 4))), arg0); + arg0->column = (s32) temp_t0->unk0; + arg0->unk4 = 2; + arg0->unk8 = 2; + arg0->row = (s32) temp_t0->unk2; + arg0 = arg0; + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe(D_800E8340[temp_a1])); return; } default: @@ -14727,9 +14821,9 @@ void func_800AAC18(void *arg0) { } case 1: case 3: - temp_v0_2 = (temp_a1 * 8) + &D_800E7108; - temp_a3->unkC = temp_v0_2->unk0; - temp_a3->unk10 = temp_v0_2->unk2; + temp_v0_2 = &D_800E7108[temp_a1]; + temp_a3->column = (s32) temp_v0_2->unk0; + temp_a3->row = (s32) temp_v0_2->unk2; return; case 2: case 4: @@ -14744,9 +14838,9 @@ void func_800AAC18(void *arg0) { phi_t0 = sp18; goto block_13; } - temp_v0_4 = (temp_a1 * 8) + &D_800E7108; + temp_v0_4 = &D_800E7108[temp_a1]; phi_t0 = temp_v0_4; - if ((temp_a3->unkC == temp_v0_4->unk0) && (temp_a3->unk10 == temp_v0_4->unk2)) { + if ((temp_a3->column == temp_v0_4->unk0) && (temp_a3->row == temp_v0_4->unk2)) { temp_a3->unk4 = 0; return; } @@ -14754,8 +14848,7 @@ block_13: if ((phi_v1 != 2) || (phi_a3->unk8 != 1)) { func_800A91D8(phi_a3, phi_t0->unk0, phi_t0->unk2, phi_a3); } - /* Duplicate return node #16. Try simplifying control flow for better match */ - return; + break; } } #else @@ -15315,7 +15408,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB904.s") ? func_8009A594(s32, ?, s32); // extern ? func_800A91D8(void *, s16, s16); // extern s32 func_800B54C0(s8, s32); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern +void *segmented_to_virtual_dupe(void*); // extern extern ? D_800E7268; extern ? D_800E7E20; extern s8 D_8018EDEC; @@ -17245,7 +17338,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEC54.s") ? func_8009A594(s32, ?, s32, void *); // extern s32 func_800B5B94(); // extern ? func_800B6708(); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern +void *segmented_to_virtual_dupe(void*); // extern extern ? D_800E7E34; extern s8 gTimeTrialDataCourseIndex; extern ? D_8018EE10; @@ -17498,7 +17591,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF1AC.s") ? func_800C90F4(?, s32); /* extern */ ? func_800CA0A0(); /* extern */ ? func_800CA0B8(? *, ? *); /* extern */ -void *segmented_to_virtual_dupe(segment_address_t); /* extern */ +void *segmented_to_virtual_dupe(void*); /* extern */ extern ? D_8018DEE4; extern ? D_802874D8; static ? D_800E7458; /* unable to generate initializer; const */ @@ -17577,96 +17670,81 @@ void func_800AF270(void *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF270.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800AF4DC(); // extern -? func_800AF740(); // extern -extern ? D_802850CC; +void func_800AF480(struct_8018D9E0_entry *arg0) { + s32 idx = arg0->type - 0x190; -void func_800AF480(s32 *arg0) { - s8 temp_v1; - - temp_v1 = *(&D_802850CC + ((*arg0 - 0x190) * 0x10)); - if ((temp_v1 == 0) || (temp_v1 != 1)) { - func_800AF4DC(); - return; + if ((D_802850C0[idx].slideDirection == 0) || (D_802850C0[idx].slideDirection != 1)) { + func_800AF4DC(arg0); + } else { + func_800AF740(arg0); } - func_800AF740(); } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF480.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_800A9208(void *, s32); /* extern */ -? func_800A94C8(void *, s32, ?); /* extern */ -static ? D_802850C0; /* unable to generate initializer */ -static ? D_802854B0; /* unable to generate initializer */ +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +? func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A94C8(struct_8018D9E0_entry *, s32, ?); /* extern */ -void func_800AF4DC(void *arg0) { - void *sp20; +void func_800AF4DC(struct_8018D9E0_entry *arg0) { + struct_802850C0_entry *sp20; f64 temp_f0; s32 temp_t6; s32 temp_t6_2; + s32 temp_t9; s32 temp_v0; - u32 temp_t9; - void *temp_v1; + struct_802850C0_entry *temp_v1; temp_t9 = arg0->unk4; - temp_v0 = arg0->unk0 - 0x190; - temp_v1 = (temp_v0 * 0x10) + &D_802850C0; - arg0->unk10 = temp_v1->unk6; + temp_v0 = arg0->type - 0x190; + temp_v1 = &D_802850C0[temp_v0]; + arg0->row = (s32) temp_v1->row; switch (temp_t9) { case 0: arg0->unk4 = 1; - arg0->unkC = temp_v1->unk4; + arg0->column = (s32) temp_v1->startingColumn; sp20 = temp_v1; - arg0->unk20 = ((get_string_width(*(&D_802854B0 + (temp_v0 * 4))) * temp_v1->unk0) / 2.0f) + temp_v1->unk8; + arg0->unk20 = (s32) ((((f32) get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling) / 2.0f) + (f32) temp_v1->columnExtra); /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); - temp_t6 = (arg0->unk20 - arg0->unkC) / 4; + temp_t6 = (s32) (arg0->unk20 - arg0->column) / 4; arg0->unk1C = temp_t6; if (temp_t6 >= 9) { arg0->unk1C = 8; } - arg0->unk24 = (arg0->unk1C * 0.05) + 1.0; - if (arg0->unkC >= (arg0->unk20 - 0x14)) { + arg0->unk24 = (bitwise s32) (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + if (arg0->column >= (arg0->unk20 - 0x14)) { arg0->unk4 = 2; - arg0->unk18 = 0; + arg0->D_8018DEE0_index = 0; return; } default: return; case 2: func_800A9208(arg0, arg0->unk20); - temp_t6_2 = arg0->unk18 + 1; - temp_f0 = temp_t6_2 - 0xA; - arg0->unk1C = (arg0->unk20 - arg0->unkC) / 4; - arg0->unk18 = temp_t6_2; - arg0->unk24 = (temp_f0 * 0.0085 * temp_f0) + 0.4; - if ((temp_t6_2 >= 9) && (arg0->unk24 > 1.0)) { + temp_t6_2 = arg0->D_8018DEE0_index + 1; + temp_f0 = (f64) (temp_t6_2 - 0xA); + arg0->unk1C = (s32) (arg0->unk20 - arg0->column) / 4; + arg0->D_8018DEE0_index = temp_t6_2; + arg0->unk24 = (bitwise s32) (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); + if ((temp_t6_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { arg0->unk4 = 3; - arg0->unk24 = 1.0f; + arg0->unk24 = 0x3F800000; return; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; case 3: - if (D_8018ED91 != 0) { + if ((u8) D_8018ED91 != 0) { arg0->unk4 = 4; return; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; case 4: func_800A94C8(arg0, arg0->unk20, 1); - if (arg0->unk10 > 480.0) { - arg0->unk0 = 0; + if ((f64) arg0->row > 480.0) { + arg0->type = 0; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; } } #else @@ -17674,75 +17752,70 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF4DC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -? func_800A9208(void *, s32); /* extern */ -? func_800A94C8(void *, s32, ?); /* extern */ -static ? D_802850C0; /* unable to generate initializer */ -static ? D_802854B0; /* unable to generate initializer */ +//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +? func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ +? func_800A94C8(struct_8018D9E0_entry *, s32, ?); /* extern */ -void func_800AF740(void *arg0) { - void *sp20; +void func_800AF740(struct_8018D9E0_entry *arg0) { + struct_802850C0_entry *sp20; f64 temp_f0; s32 temp_t6; s32 temp_t6_2; + s32 temp_t9; s32 temp_v0; - u32 temp_t9; - void *temp_v1; + struct_802850C0_entry *temp_v1; temp_t9 = arg0->unk4; - temp_v0 = arg0->unk0 - 0x190; - temp_v1 = (temp_v0 * 0x10) + &D_802850C0; - arg0->unk10 = temp_v1->unk6; + temp_v0 = arg0->type - 0x190; + temp_v1 = &D_802850C0[temp_v0]; + arg0->row = (s32) temp_v1->row; switch (temp_t9) { case 0: arg0->unk4 = 1; - arg0->unkC = temp_v1->unk4; + arg0->column = (s32) temp_v1->startingColumn; sp20 = temp_v1; - arg0->unk20 = temp_v1->unk8 - ((get_string_width(*(&D_802854B0 + (temp_v0 * 4))) * temp_v1->unk0) / 2.0f); + arg0->unk20 = (s32) ((f32) temp_v1->columnExtra - (((f32) get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling) / 2.0f)); /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); - temp_t6 = (arg0->unkC - arg0->unk20) / 4; + temp_t6 = (s32) (arg0->column - arg0->unk20) / 4; arg0->unk1C = temp_t6; if (temp_t6 >= 9) { arg0->unk1C = 8; } - arg0->unk24 = (arg0->unk1C * 0.05) + 1.0; - if ((arg0->unk20 + 0x14) >= arg0->unkC) { + arg0->unk24 = (bitwise s32) (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + if ((arg0->unk20 + 0x14) >= arg0->column) { arg0->unk4 = 2; - arg0->unk18 = 0; + arg0->D_8018DEE0_index = 0; return; } default: return; case 2: func_800A9208(arg0, arg0->unk20); - temp_t6_2 = arg0->unk18 + 1; - temp_f0 = temp_t6_2 - 0xA; - arg0->unk1C = (arg0->unkC - arg0->unk20) / 4; - arg0->unk18 = temp_t6_2; - arg0->unk24 = (temp_f0 * 0.0085 * temp_f0) + 0.4; - if ((temp_t6_2 >= 9) && (arg0->unk24 > 1.0)) { + temp_t6_2 = arg0->D_8018DEE0_index + 1; + temp_f0 = (f64) (temp_t6_2 - 0xA); + arg0->unk1C = (s32) (arg0->column - arg0->unk20) / 4; + arg0->D_8018DEE0_index = temp_t6_2; + arg0->unk24 = (bitwise s32) (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); + if ((temp_t6_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { arg0->unk4 = 3; - arg0->unk24 = 1.0f; + arg0->unk24 = 0x3F800000; return; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; case 3: - if (D_8018ED91 != 0) { + if ((u8) D_8018ED91 != 0) { arg0->unk4 = 4; return; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; case 4: func_800A94C8(arg0, arg0->unk20, -1); - if (arg0->unk10 > 480.0) { - arg0->unk0 = 0; + if ((f64) arg0->row > 480.0) { + arg0->type = 0; } - /* Duplicate return node #14. Try simplifying control flow for better match */ - return; + break; } } #else diff --git a/src/code_80091750.h b/src/code_80091750.h index cc6066eab..7d552b5e8 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -5,6 +5,60 @@ #include "textures.h" #include "main.h" +/* File specific types */ + +typedef struct { + /* 0x00 */ s32 type; // id maybe? + /* 0x04 */ s32 unk4; // sound mode, maybe some other stuff + /* 0x08 */ s32 unk8; // This is used but I can't tell what for + /* 0x0C */ s32 column; + /* 0x10 */ s32 row; + /* 0x14 */ u8 priority; // priority/depth/z-level. Higher values are drawn on top of lower values + // If equal, later entries in D_8018D9E0 are on top + /* 0x15 */ u8 visible; // active? If 1 its displayed, if 0 its not + // These seem to be generic space available for use by the struct, no 1 purpose for any given member + /* 0x16 */ s16 unk16; // Potentially unused + /* 0x18 */ s32 D_8018DEE0_index; // Index in D_8018DEE0, an array of some other struct type + /* 0x1C */ s32 unk1C; // Multi use. Sometimes cup selection, sometimes course index. + /* 0x20 */ s32 unk20; // Multi use, hard to tell what for though. Sometimes a random number, sometimes GP points + /* 0x24 */ f32 unk24; // Multi use, x scaling for some things, rotation multiplier for the question box in some menus, probably some other things +} struct_8018D9E0_entry; // size = 0x28 + +typedef struct { + /* 0x00 */ MkAnimation *textureSequence; + /* 0x04 */ s32 sequenceIndex; // Index in textureSequence that the animation is currently on + /* 0x08 */ s32 frameCountDown; // Frames left for the given animation part + /* 0x0C */ u32 visible; // visbile if 0x80000000, otherwise invisbile AND paused + /* 0x10 */ s32 D_8018E118_index; // Don't know what D_8018E118 tracks + /* 0x14 */ s32 unk14; // Flip flops between 0 and 1, use unknown +} struct_8018DEE0_entry; // size = 0x18 + +typedef struct { + /* 0x00 */ u64 *textureData; // This should be interpreted as a segmented address + /** + * Its hard to tell what exactly what this is meant to be, + * but it appears to be used as some sort of offset/index from the address stored in D_8018D9B0. + * This value is (roughly) the sum of (width * height) of the + * textures in all the previous entries in D_8018E118 + */ + /* 0x04 */ s32 offset; +} struct_8018E118_entry; // size = 0x08 + +// In some way dictates how the text is written during the credit sequence +typedef struct { + // Scaling factor that affects the x/y scaling and tracking of printed text + /* 0x00 */ f32 textScaling; + // Column to start sliding in from + /* 0x04 */ s16 startingColumn; + /* 0x06 */ s16 row; + // Extra distance added to the destination column + /* 0x08 */ s16 columnExtra; + /* 0x0A */ s16 unknown; // No idea what this is for, has a value but never seems to be read + /* 0x0C */ s8 slideDirection; // 0 for slide right, 1 for slide left. May have other uses/effects + /* 0x0D */ s8 textColor; + /* 0x0E */ s16 padding; // Always seems to be 0, never read (that I can see) +} struct_802850C0_entry; // size = 0x10 + /* Function Prototypes */ f64 exponent_by_squaring(f64, s32); @@ -65,8 +119,8 @@ void func_80099E54(); void func_80099E60(MkTexture *, s32, s32); void func_80099EC4(); void func_80099A70(); -void func_8009A594(s32, s32, segment_address_t); -void func_8009A640(s32, s32, s32, segment_address_t); +void func_8009A594(s32, s32, MkAnimation*); +void func_8009A640(s32, s32, s32, MkAnimation*); void func_8009A76C(s32, s32, s32, s32); void func_8009A7EC(s32, s32, s32, s32, s32); void func_8009A878(struct_8018DEE0_entry*); @@ -119,6 +173,9 @@ struct_8018D9E0_entry *func_800AAF30(s32); s32 func_800AAF70(s32); void func_800AAF94(struct_8018D9E0_entry*, s32); void func_800AC978(struct_8018D9E0_entry*); +void func_800AF480(struct_8018D9E0_entry*); +void func_800AF4DC(struct_8018D9E0_entry*); +void func_800AF740(struct_8018D9E0_entry*); // code_80057C60.c void func_80057CE4(); @@ -128,6 +185,7 @@ void func_80057CE4(); #define D_8018D9E0_SIZE 0x20 #define D_8018DEE0_SIZE 0x10 #define D_8018E118_SIZE 0xC8 +#define D_802850C0_SIZE 0x3F /* This is where I'd put my static data, if I had any */ @@ -189,8 +247,11 @@ extern s32 D_80165754; extern s8 D_8018D9D9; extern struct_8018D9E0_entry D_8018D9E0[D_8018D9E0_SIZE]; // D_8018D9E0 extern struct_8018DEE0_entry D_8018DEE0[D_8018DEE0_SIZE]; // D_8018DEE0 +extern s32 gD_8018E118TotalSize; // D_8018E110 extern struct_8018E118_entry D_8018E118[D_8018E118_SIZE]; // D_8018E118 -extern s8 gTextColor; // D_8018E860 +extern s32 gNumD_8018E118Entries; // D_8018E758 +extern struct_802850C0_entry D_802850C0[D_802850C0_SIZE]; // D_802850C0 +extern s8 gTextColor; // D_8018E860 extern s8 D_8018ED91; extern s32 D_8018E850; extern s32 D_8018E854; diff --git a/src/textures.h b/src/textures.h index 074eae7ad..f6ca363b4 100644 --- a/src/textures.h +++ b/src/textures.h @@ -1,7 +1,24 @@ #ifndef TEXTURES_H #define TEXTURES_H -#include "common_structs.h" +#include "PR/ultratypes.h" + +typedef struct { + /* 0x00 */ s16 type; + /* 0x02 */ s16 unused1; + /* 0x04 */ u64 *textureData; // This should be interpreted as a segmented address + /* 0x08 */ s16 width; + /* 0x0A */ s16 height; + /* 0x0C */ s16 dX; + /* 0x0D */ s16 dY; + /* 0x10 */ s16 size; // This size is NOT equal to width*height. Its likely the size of the compressed texture + /* 0x12 */ s16 unused2; +} MkTexture; // size = 0x14 + +typedef struct { + /* 0x00 */ MkTexture *mk64Texture; // This should be interpreted as a segmented address + /* 0x04 */ s32 frame_length; +} MkAnimation; // size = 0x8 extern MkTexture D_02000000[2]; extern MkTexture D_02000028[2];