diff options
| author | Tyler McGavran <tyler.taggerung@gmail.com> | 2022-01-03 02:07:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-03 00:07:24 -0700 |
| commit | c3def3e91ffeb7116ff78fc51971acca8da25797 (patch) | |
| tree | 0f31dc3f76581baf6b191f18add7113432e25070 /src | |
| parent | 5fbfc215127d2f73c42960d7633be4fb5a4f439f (diff) | |
Match a variety of functions, identify a struct type and some related variables, regenerated some mips_to_c code (#129)
* Meaningful commit message
Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
* Identify another struct and array
Regenerated a lot of mips_to_c code based on these identifications
Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/code_80091750.c | 438 | ||||
| -rw-r--r-- | src/code_800AF9B0.c | 3 |
2 files changed, 188 insertions, 253 deletions
diff --git a/src/code_80091750.c b/src/code_80091750.c index a03305884..1816479db 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -4280,18 +4280,10 @@ void dma_copy_base_7fa3c0(s32 arg0, u32 arg1, void *arg2) { GLOBAL_ASM("asm/non_matchings/code_80091750/dma_copy_base_7fa3c0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s32 D_8018E110; -extern s32 D_8018E758; - void func_80099110(void) { - D_8018E110 = 0; - D_8018E758 = 0; + gD_8018E118TotalSize = 0; + gNumD_8018E118Entries = 0; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099110.s") -#endif void *segmented_to_virtual(segment_address_t arg0) { return gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF) + 0x80000000; @@ -4302,50 +4294,45 @@ void *segmented_to_virtual_dupe(segment_address_t arg0) { } #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 -extern s32 D_8018D9B0; -extern u8 *D_8018D9B4; -extern s32 D_8018E110; -extern ? D_8018E118; -extern s32 D_8018E758; +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +? dma_copy_base_729a30(u32, s32, s32); /* extern */ +? mio0decode(s32, s32); /* extern */ -void func_80099184(void) { - s32 temp_a0; +void func_80099184(u32 arg0) { + Mk64_Texture *temp_v0; s32 temp_t3; s32 temp_t6; s32 temp_v0_2; s32 temp_v1; u16 temp_v0_3; - void *temp_v0; + u32 temp_a0; s32 phi_v0; - void *phi_s1; + Mk64_Texture *phi_s1; s32 phi_a1; s32 phi_a1_2; s32 phi_a1_3; - temp_v0 = segmented_to_virtual(); + temp_v0 = segmented_to_virtual(arg0); phi_s1 = temp_v0; - if (temp_v0->unk4 != 0) { + if (temp_v0->segmentAddress != 0) { do { - temp_v1 = D_8018E758; + temp_v1 = gNumD_8018E118Entries; phi_v0 = 0; phi_a1 = 0; if (temp_v1 > 0) { loop_4: temp_v0_2 = phi_v0 + 1; phi_v0 = temp_v0_2; - if (*(&D_8018E118 + (phi_v0 * 8)) == phi_s1->unk4) { + if (D_8018E118[phi_v0].textureData == phi_s1->segmentAddress) { phi_a1 = 1; } else if (temp_v0_2 < temp_v1) { goto loop_4; } } if (phi_a1 == 0) { - temp_a0 = phi_s1->unk4; - if (phi_s1->unk0 == 3) { - temp_v0_3 = phi_s1->unk10; + temp_a0 = phi_s1->segmentAddress; + if (phi_s1->type == 3) { + temp_v0_3 = phi_s1->size; phi_a1_2 = 0x1000; if (temp_v0_3 != 0) { phi_a1_2 = temp_v0_3 & 0xFFFF; @@ -4355,17 +4342,17 @@ loop_4: phi_a1_3 = (((phi_a1_2 / 8) * 8) + 8) & 0xFFFF; } dma_copy_base_729a30(temp_a0, phi_a1_3, D_8018D9B4); - mio0decode(D_8018D9B4, (D_8018E110 * 2) + D_8018D9B0); + mio0decode(D_8018D9B4, (gD_8018E118TotalSize * 2) + D_8018D9B0); } else { - dma_copy_base_729a30(temp_a0, phi_s1->unkA * phi_s1->unk8 * 2, (D_8018E110 * 2) + D_8018D9B0); + dma_copy_base_729a30(temp_a0, phi_s1->height * phi_s1->width * 2, (gD_8018E118TotalSize * 2) + D_8018D9B0); } - *(&D_8018E118 + (D_8018E758 * 8)) = phi_s1->unk4; - (&D_8018E118 + (D_8018E758 * 8))->unk4 = D_8018E110; - D_8018E758 = D_8018E758 + 1; - temp_t3 = D_8018E110 + (phi_s1->unkA * phi_s1->unk8); + D_8018E118[gNumD_8018E118Entries].textureData = phi_s1->segmentAddress; + D_8018E118[gNumD_8018E118Entries].offset = gD_8018E118TotalSize; + gNumD_8018E118Entries += 1; + temp_t3 = gD_8018E118TotalSize + (phi_s1->height * phi_s1->width); temp_t6 = temp_t3; - D_8018E110 = temp_t3; - D_8018E110 = ((temp_t6 / 8) * 8) + 8; + gD_8018E118TotalSize = temp_t3; + gD_8018E118TotalSize = ((temp_t6 / 8) * 8) + 8; } phi_s1 += 0x14; } while (phi_s1->unk18 != 0); @@ -4387,51 +4374,48 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009969C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? dma_copy_base_729a30(s32, s32, u8 *); // extern -? dma_copy_base_7fa3c0(s32, s32, u8 *); // extern -void *segmented_to_virtual(segment_address_t); // extern -? tkmk00decode(u8 *, s32, s32, ?); // extern +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +? dma_copy_base_729a30(u32, s32, s32); /* extern */ +? dma_copy_base_7fa3c0(u32, s32, s32); /* extern */ +? mio0decode(s32, s32); /* extern */ +? tkmk00decode(s32, s32, s32, ?); /* extern */ extern s32 D_8018D9B0; -extern u8 *D_8018D9B4; +extern s32 D_8018D9B4; extern s32 D_8018D9B8; -extern s32 D_8018E110; -extern ? D_8018E118; -extern s32 D_8018E758; -void func_800996BC(s32 arg1) { +void func_800996BC(u32 arg0, s32 arg1) { + Mk64_Texture *temp_v0; s32 temp_t0; s32 temp_t1; s32 temp_v0_2; s32 temp_v1; u16 temp_v0_3; - void *temp_v0; s32 phi_v0; - void *phi_s0; + Mk64_Texture *phi_s0; s32 phi_a1; s32 phi_a1_2; s32 phi_a1_3; ? phi_v0_2; - temp_v0 = segmented_to_virtual(arg0); + temp_v0 = segmented_to_virtual(); phi_s0 = temp_v0; - if (temp_v0->unk4 != 0) { + if (temp_v0->segmentAddress != 0) { do { - temp_v1 = D_8018E758; + temp_v1 = gNumD_8018E118Entries; phi_v0 = 0; phi_a1 = 0; if (temp_v1 > 0) { loop_4: temp_v0_2 = phi_v0 + 1; phi_v0 = temp_v0_2; - if (*(&D_8018E118 + (phi_v0 * 8)) == phi_s0->unk4) { + if (D_8018E118[phi_v0].textureData == phi_s0->segmentAddress) { phi_a1 = 1; } else if (temp_v0_2 < temp_v1) { goto loop_4; } } if ((phi_a1 == 0) || (arg1 > 0)) { - temp_v0_3 = phi_s0->unk10; + temp_v0_3 = phi_s0->size; phi_a1_2 = 0x1000; if (temp_v0_3 != 0) { phi_a1_2 = temp_v0_3 & 0xFFFF; @@ -4440,55 +4424,37 @@ loop_4: if ((phi_a1_2 % 8) != 0) { phi_a1_3 = (((phi_a1_2 / 8) * 8) + 8) & 0xFFFF; } - if (arg1 != -1) { - if (arg1 != 0) { - if (arg1 != 1) { - if (arg1 != 2) { - - } else { - goto block_19; - } - } else { - goto block_18; - } - } else { -block_19: - dma_copy_base_7fa3c0(phi_s0->unk4, phi_a1_3, D_8018D9B4); - } - } else { -block_18: - dma_copy_base_729a30(phi_s0->unk4, phi_a1_3, D_8018D9B4); + switch (arg1) { /* irregular */ + case -1: + case 1: + dma_copy_base_729a30(phi_s0->segmentAddress, phi_a1_3, D_8018D9B4); + break; + case 0: + case 2: + dma_copy_base_7fa3c0(phi_s0->segmentAddress, phi_a1_3, D_8018D9B4); + break; } - if (arg1 != -1) { - if (arg1 != 0) { - if (arg1 != 1) { - if (arg1 != 2) { - - } else { - goto block_26; - } - } else { - goto block_25; - } - } else { -block_26: - phi_v0_2 = 1; - if (phi_s0->unk0 == 1) { - phi_v0_2 = 0xBE; - } - tkmk00decode(D_8018D9B4, D_8018D9B8, (D_8018E110 * 2) + D_8018D9B0, phi_v0_2); + switch (arg1) { /* switch 1; irregular */ + case -1: /* switch 1 */ + case 1: /* switch 1 */ + mio0decode(D_8018D9B4, (gD_8018E118TotalSize * 2) + D_8018D9B0); + break; + case 0: /* switch 1 */ + case 2: /* switch 1 */ + phi_v0_2 = 1; + if (phi_s0->type == 1) { + phi_v0_2 = 0xBE; } - } else { -block_25: - mio0decode(D_8018D9B4, (D_8018E110 * 2) + D_8018D9B0); + tkmk00decode(D_8018D9B4, D_8018D9B8, (gD_8018E118TotalSize * 2) + D_8018D9B0, phi_v0_2); + break; } - *(&D_8018E118 + (D_8018E758 * 8)) = phi_s0->unk4; - (&D_8018E118 + (D_8018E758 * 8))->unk4 = D_8018E110; - D_8018E758 = D_8018E758 + 1; - temp_t0 = D_8018E110 + (phi_s0->unkA * phi_s0->unk8); + D_8018E118[gNumD_8018E118Entries].textureData = phi_s0->segmentAddress; + D_8018E118[gNumD_8018E118Entries].offset = gD_8018E118TotalSize; + gNumD_8018E118Entries += 1; + temp_t0 = gD_8018E118TotalSize + (phi_s0->height * phi_s0->width); temp_t1 = temp_t0; - D_8018E110 = temp_t0; - D_8018E110 = ((temp_t1 / 8) * 8) + 8; + gD_8018E118TotalSize = temp_t0; + gD_8018E118TotalSize = ((temp_t1 / 8) * 8) + 8; } phi_s0 += 0x14; } while (phi_s0->unk18 != 0); @@ -4591,17 +4557,21 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099A94.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern OSMesgQueue gDmaMesgQueue; +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +? mio0decode(s32, s32); /* extern */ +? osInvalDCache(s32, s32); /* extern */ +? osPiStartDma(? *, ?, ?, void *, s32, s32, ? *); /* extern */ +? osRecvMesg(? *, ? *, ?); /* extern */ +extern s32 D_800DC50C; extern s32 D_8018D9B0; -extern void *D_8018D9B4; +extern s32 D_8018D9B4; extern void *D_8018E060; -extern ? D_8018E118; extern ? _textures_0aSegmentRomStart; +extern ? gDmaMesgQueue; void func_80099AEC(void) { ? sp6C; - void *sp68; + ? sp68; s32 sp60; ? *sp58; s32 temp_t7; @@ -4613,13 +4583,13 @@ void func_80099AEC(void) { void *temp_v0; void *temp_v0_2; s32 phi_s0; - u32 phi_s0_2; + s32 phi_s0_2; void **phi_s1; s32 phi_s0_3; - u32 phi_s0_4; + s32 phi_s0_4; s8 phi_s5; s32 phi_s0_5; - u32 phi_s0_6; + s32 phi_s0_6; s8 phi_s5_2; s8 phi_s5_3; @@ -4637,7 +4607,7 @@ void func_80099AEC(void) { phi_s0_3 = 0x1400; phi_s0_5 = 0x1400; if (temp_v1 != 0) { - phi_s0 = temp_v1; + phi_s0 = (s32) temp_v1; } phi_s0_2 = phi_s0; if ((phi_s0 % 8) != 0) { @@ -4651,12 +4621,12 @@ loop_9: temp_v0 = phi_s1->unk8; phi_s5 = phi_s5_3; if (temp_v0 == 0) { - phi_s5 = phi_s5_3 + 1; + phi_s5 = (s8) (phi_s5_3 + 1); } else { temp_v1_2 = temp_v0->unk10; temp_t7 = sp60 * 4; if (temp_v1_2 != 0) { - phi_s0_3 = temp_v1_2; + phi_s0_3 = (s32) temp_v1_2; } phi_s0_4 = phi_s0_3; if ((phi_s0_3 % 8) != 0) { @@ -4665,19 +4635,19 @@ loop_9: osInvalDCache(temp_t7 + D_8018D9B4, phi_s0_4); osPiStartDma(&sp6C, 0, 0, sp58 + (temp_v0->unk4 & 0xFFFFFF), temp_t7 + D_8018D9B4, phi_s0_4, &gDmaMesgQueue); } - mio0decode(D_8018D9B4, (((phi_s1->unk4 * 8) + &D_8018E118)->unk4 * 2) + D_8018D9B0); - phi_s1->unk0 = 0; + mio0decode(D_8018D9B4, (D_8018E118[phi_s1->unk4].offset * 2) + D_8018D9B0); + phi_s1->unk0 = NULL; temp_s1 = phi_s1 + 8; phi_s5_2 = phi_s5; if (phi_s5 == 0) { osRecvMesg(&gDmaMesgQueue, &sp68, 1); temp_v0_2 = temp_s1->unk8; if (temp_v0_2 == 0) { - phi_s5_2 = phi_s5 + 1; + phi_s5_2 = (s8) (phi_s5 + 1); } else { temp_v1_3 = temp_v0_2->unk10; if (temp_v1_3 != 0) { - phi_s0_5 = temp_v1_3; + phi_s0_5 = (s32) temp_v1_3; } phi_s0_6 = phi_s0_5; if ((phi_s0_5 % 8) != 0) { @@ -4686,7 +4656,7 @@ loop_9: osInvalDCache(D_8018D9B4, phi_s0_6); osPiStartDma(&sp6C, 0, 0, sp58 + (temp_v0_2->unk4 & 0xFFFFFF), D_8018D9B4, phi_s0_6, &gDmaMesgQueue); } - mio0decode((sp60 * 4) + D_8018D9B4, (((temp_s1->unk4 * 8) + &D_8018E118)->unk4 * 2) + D_8018D9B0); + mio0decode((sp60 * 4) + D_8018D9B4, (D_8018E118[temp_s1->unk4].offset * 2) + D_8018D9B0); temp_s1->unk0 = 0; phi_s1 = temp_s1 + 8; phi_s5_3 = phi_s5_2; @@ -4868,34 +4838,30 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A344.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009969C(s32, s32, s32 *); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern -extern ? D_8018DEE0; -extern s32 D_8018E758; +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +? func_8009969C(u32, s32, Mk64_Animation_Part *); /* extern */ -s32 func_8009A374(s32 *arg0) { +s32 func_8009A374(Mk64_Animation_Part *arg0) { s32 sp24; - void *sp1C; - ? *temp_v1; - s32 *temp_a2; - s32 *temp_v0; - s32 temp_a0; + struct_8018DEE0_entry *sp1C; + Mk64_Animation_Part *temp_a2; + Mk64_Animation_Part *temp_v0; s32 temp_a1; - s32 temp_t8; - void *temp_v1_2; + struct_8018DEE0_entry *temp_v1; + struct_8018DEE0_entry *temp_v1_2; + u32 temp_a0; s32 phi_a1; - ? *phi_v1; + struct_8018DEE0_entry *phi_v1; s32 phi_a1_2; - s32 *phi_a2; + Mk64_Animation_Part *phi_a2; temp_v0 = segmented_to_virtual_dupe(arg0); temp_a2 = temp_v0; phi_a1 = 0; phi_a1_2 = 0; phi_a2 = temp_a2; - if (D_8018DEE0.unkC != 0) { - phi_v1 = &D_8018DEE0; + if (D_8018DEE0->visible != 0) { + phi_v1 = D_8018DEE0; loop_2: temp_a1 = phi_a1 + 1; temp_v1 = phi_v1 + 0x18; @@ -4906,37 +4872,36 @@ loop_2: loop_3: goto loop_3; } - if (temp_v1->unkC == 0) { + if (temp_v1->visible == 0) { goto block_5; } goto loop_2; } block_5: - temp_t8 = phi_a1_2 * 0x18; - temp_v1_2 = &D_8018DEE0 + temp_t8; - temp_v1_2->unk0 = temp_v0; - temp_v1_2->unk4 = -1; - temp_v1_2->unk8 = 0; - temp_v1_2->unkC = 0x80000000; - temp_v1_2->unk10 = D_8018E758; - if (*temp_v0 != 0) { + temp_v1_2 = &D_8018DEE0[phi_a1_2]; + temp_v1_2->texutreSequence = temp_v0; + temp_v1_2->sequenceIndex = -1; + temp_v1_2->frameCountDown = 0; + temp_v1_2->visible = 0x80000000; + temp_v1_2->D_8018E118_index = gNumD_8018E118Entries; + if (temp_v0->texture != 0) { arg0 = temp_a2; sp24 = phi_a1_2; sp1C = temp_v1_2; - func_8009969C(*temp_a2, phi_a1_2, temp_a2); + func_8009969C(temp_a2->texture, phi_a1_2, temp_a2); phi_a2 = arg0; } temp_a0 = phi_a2->unk8; if (temp_a0 != 0) { - sp1C = &D_8018DEE0 + temp_t8; + sp1C = &D_8018DEE0[phi_a1_2]; sp24 = phi_a1_2; func_8009969C(temp_a0, phi_a1_2, phi_a2); } else { sp24 = phi_a1_2; - sp1C = &D_8018DEE0 + temp_t8; - func_8009969C(phi_a2->unk0, phi_a1_2, phi_a2); + sp1C = &D_8018DEE0[phi_a1_2]; + func_8009969C(phi_a2->texture, phi_a1_2, phi_a2); } - (&D_8018DEE0 + temp_t8)->unk14 = 0; + D_8018DEE0[phi_a1_2].unk14 = 0; return sp24; } #else @@ -4944,32 +4909,28 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A374.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80099958(s32, s32, ?, s32); // extern -void *segmented_to_virtual_dupe(segment_address_t); // extern -extern ? D_8018DEE0; -extern s32 D_8018E758; +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +? func_80099958(u32, s32, ?, s32); /* extern */ -s32 func_8009A478(s32 arg1) { +s32 func_8009A478(Mk64_Animation_Part *arg0, s32 arg1) { s32 sp2C; - void *sp24; - ? *temp_v1; - s32 *temp_s0; - s32 *temp_v0; - s32 temp_a0; + struct_8018DEE0_entry *sp24; + Mk64_Animation_Part *temp_s0; + Mk64_Animation_Part *temp_v0; s32 temp_a3; - s32 temp_t8; - void *temp_v1_2; + struct_8018DEE0_entry *temp_v1; + struct_8018DEE0_entry *temp_v1_2; + u32 temp_a0; s32 phi_a3; - ? *phi_v1; + struct_8018DEE0_entry *phi_v1; s32 phi_a3_2; temp_v0 = segmented_to_virtual_dupe(arg0); temp_s0 = temp_v0; phi_a3 = 0; phi_a3_2 = 0; - if (D_8018DEE0.unkC != 0) { - phi_v1 = &D_8018DEE0; + if (D_8018DEE0->visible != 0) { + phi_v1 = D_8018DEE0; loop_2: temp_a3 = phi_a3 + 1; temp_v1 = phi_v1 + 0x18; @@ -4980,35 +4941,34 @@ loop_2: loop_3: goto loop_3; } - if (temp_v1->unkC == 0) { + if (temp_v1->visible == 0) { goto block_5; } goto loop_2; } block_5: - temp_t8 = phi_a3_2 * 0x18; - temp_v1_2 = &D_8018DEE0 + temp_t8; - temp_v1_2->unk0 = temp_v0; - temp_v1_2->unk4 = -1; - temp_v1_2->unk8 = 0; - temp_v1_2->unkC = 0x80000000; - temp_v1_2->unk10 = D_8018E758; - if (temp_v0->unk0 != 0) { + temp_v1_2 = &D_8018DEE0[phi_a3_2]; + temp_v1_2->texutreSequence = temp_v0; + temp_v1_2->sequenceIndex = -1; + temp_v1_2->frameCountDown = 0; + temp_v1_2->visible = 0x80000000; + temp_v1_2->D_8018E118_index = gNumD_8018E118Entries; + if (temp_v0->texture != 0) { sp2C = phi_a3_2; sp24 = temp_v1_2; - func_80099958(temp_s0->unk0, arg1, 0, phi_a3_2); + func_80099958(temp_s0->texture, arg1, 0, phi_a3_2); } temp_a0 = temp_s0->unk8; if (temp_a0 != 0) { - sp24 = &D_8018DEE0 + temp_t8; + sp24 = &D_8018DEE0[phi_a3_2]; sp2C = phi_a3_2; func_80099958(temp_a0, arg1, 1, phi_a3_2); } else { sp2C = phi_a3_2; - sp24 = &D_8018DEE0 + temp_t8; - func_80099958(temp_s0->unk0, arg1, 1, phi_a3_2); + sp24 = &D_8018DEE0[phi_a3_2]; + func_80099958(temp_s0->texture, arg1, 1, phi_a3_2); } - (&D_8018DEE0 + temp_t8)->unk14 = 0; + D_8018DEE0[phi_a3_2].unk14 = 0; return sp2C; } #else @@ -5197,20 +5157,20 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A944.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -f64 func_800917B0(f64, f64); // extern +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe +f64 func_800917B0(f64, f64); /* extern */ extern s32 D_8018D9B0; -extern ? D_8018E118; -void func_8009B0A4(s32 arg0, s32 arg1) { - ? sp48; - ? *temp_s1; +void func_8009B0A4(s32 D_8018E118_index, s32 arg1) { + f32 sp48; + f32 *temp_s1; f64 temp_f10; f64 temp_f6; s16 *temp_a3_2; s32 temp_s0_2; s32 temp_t5; s32 temp_v1; + struct_8018E118_entry *temp_v0; u16 *temp_a3; u16 temp_v0_2; u16 temp_v0_3; @@ -5219,18 +5179,17 @@ void func_8009B0A4(s32 arg0, s32 arg1) { u32 temp_v1_2; u32 temp_v1_3; u32 temp_v1_4; - void *temp_v0; s32 phi_s0; f64 phi_f10; f64 phi_f6; - ? *phi_s1; + f32 *phi_s1; u32 phi_v1; u16 *phi_a3; u32 phi_v1_2; u32 phi_v1_3; s32 phi_s0_2; - temp_f6 = arg1; + temp_f6 = (f64) arg1; phi_s0 = 0; phi_f6 = temp_f6; phi_s0_2 = 0; @@ -5239,30 +5198,30 @@ void func_8009B0A4(s32 arg0, s32 arg1) { } phi_s1 = &sp48; do { - temp_f10 = phi_s0; + temp_f10 = (f64) phi_s0; phi_f10 = temp_f10; if (phi_s0 < 0) { phi_f10 = temp_f10 + 4294967296.0; } temp_s0 = phi_s0 + 1; temp_s1 = phi_s1 + 4; - temp_s1->unk-4 = func_800917B0(phi_f10 * 0.03125, (phi_f6 * 1.5 * 0.00390625) + 0.25); - phi_s0 = temp_s0; + temp_s1->unk-4 = (f32) func_800917B0(phi_f10 * 0.03125, (phi_f6 * 1.5 * 0.00390625) + 0.25); + phi_s0 = (s32) temp_s0; phi_s1 = temp_s1; - } while (temp_s0 < 0x20); - temp_v0 = (arg0 * 8) + &D_8018E118; - temp_v1 = temp_v0->unk4; + } while (temp_s0 < 0x20U); + temp_v0 = &D_8018E118[D_8018E118_index]; + temp_v1 = temp_v0->offset; temp_t5 = temp_v0->unkC - temp_v1; temp_a3 = (temp_v1 * 2) + D_8018D9B0; phi_a3 = temp_a3; if (temp_t5 != 0) { if ((temp_t5 & 1) != 0) { temp_v0_2 = *temp_a3; - temp_v1_2 = *(&sp48 + ((((((temp_v0_2 & 0xF800) >> 0xB) * 0x55) + (((temp_v0_2 & 0x7C0) >> 6) * 0x4B) + (((temp_v0_2 & 0x3E) >> 1) * 0x5F)) >> 8) * 4)) * 32.0f; + temp_v1_2 = (u32) ((&sp48)[(u32) ((((s32) (temp_v0_2 & 0xF800) >> 0xB) * 0x55) + (((s32) (temp_v0_2 & 0x7C0) >> 6) * 0x4B) + (((s32) (temp_v0_2 & 0x3E) >> 1) * 0x5F)) >> 8] * 32.0f); phi_v1 = temp_v1_2; phi_s0_2 = 1; - if (temp_v1_2 >= 0x20) { - phi_v1 = 0x1F; + if (temp_v1_2 >= 0x20U) { + phi_v1 = 0x1FU; } *temp_a3 = (phi_v1 * 0x842) + (temp_v0_2 & 1); phi_a3 = temp_a3 + 2; @@ -5274,19 +5233,19 @@ block_11: do { temp_v0_3 = phi_a3->unk0; temp_s0_2 = phi_s0_2 + 2; - temp_v1_3 = *(&sp48 + ((((((temp_v0_3 & 0xF800) >> 0xB) * 0x55) + (((temp_v0_3 & 0x7C0) >> 6) * 0x4B) + (((temp_v0_3 & 0x3E) >> 1) * 0x5F)) >> 8) * 4)) * 32.0f; + temp_v1_3 = (u32) ((&sp48)[(u32) ((((s32) (temp_v0_3 & 0xF800) >> 0xB) * 0x55) + (((s32) (temp_v0_3 & 0x7C0) >> 6) * 0x4B) + (((s32) (temp_v0_3 & 0x3E) >> 1) * 0x5F)) >> 8] * 32.0f); phi_v1_2 = temp_v1_3; phi_s0_2 = temp_s0_2; - if (temp_v1_3 >= 0x20) { - phi_v1_2 = 0x1F; + if (temp_v1_3 >= 0x20U) { + phi_v1_2 = 0x1FU; } temp_v0_4 = phi_a3->unk2; phi_a3->unk0 = (phi_v1_2 * 0x842) + (temp_v0_3 & 1); temp_a3_2 = phi_a3 + 2; - temp_v1_4 = *(&sp48 + ((((((temp_v0_4 & 0xF800) >> 0xB) * 0x55) + (((temp_v0_4 & 0x7C0) >> 6) * 0x4B) + (((temp_v0_4 & 0x3E) >> 1) * 0x5F)) >> 8) * 4)) * 32.0f; + temp_v1_4 = (u32) ((&sp48)[(u32) ((((s32) (temp_v0_4 & 0xF800) >> 0xB) * 0x55) + (((s32) (temp_v0_4 & 0x7C0) >> 6) * 0x4B) + (((s32) (temp_v0_4 & 0x3E) >> 1) * 0x5F)) >> 8] * 32.0f); phi_v1_3 = temp_v1_4; - if (temp_v1_4 >= 0x20) { - phi_v1_3 = 0x1F; + if (temp_v1_4 >= 0x20U) { + phi_v1_3 = 0x1FU; } *temp_a3_2 = (phi_v1_3 * 0x842) + (temp_v0_4 & 1); phi_a3 = temp_a3_2 + 2; @@ -5375,29 +5334,27 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B538.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe extern s32 D_8018D9B0; -extern ? D_8018E118; -extern s32 D_8018E758; -s32 func_8009B8C4(s32 arg0) { +s32 func_8009B8C4(u32 arg0) { s32 sp4; s32 temp_a1; s32 temp_v1; - ? *phi_a2; + struct_8018E118_entry *phi_a2; s32 phi_v1; s32 phi_v0; - temp_a1 = D_8018E758; + temp_a1 = gNumD_8018E118Entries; phi_v1 = 0; phi_v0 = 0; if (temp_a1 > 0) { - phi_a2 = &D_8018E118; + phi_a2 = D_8018E118; loop_2: temp_v1 = phi_v1 + 1; phi_v1 = temp_v1; - if (arg0 == phi_a2->unk0) { - sp4 = phi_a2->unk4; + if (arg0 == phi_a2->textureData) { + sp4 = phi_a2->offset; phi_v0 = 1; } else { phi_a2 += 8; @@ -7763,7 +7720,7 @@ extern s32 gPlayerWinningIndex; extern u16 D_80162DD4; extern ? D_801640F4; extern s32 D_8018CA78; -extern s32 D_8018E110; +extern s32 gD_8018E118TotalSize; extern s32 *D_8018E75C; extern s8 D_8018ED90; extern s32 D_8018ED94; @@ -8226,7 +8183,7 @@ loop_3: return; case 0x2: func_8006EE44(priority); - D_8018E110 += 0x10000; + gD_8018E118TotalSize += 0x10000; func_80099184(&D_020045E8); return; case 0x3: @@ -9694,7 +9651,6 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1780.s") #endif extern Gfx D_02004A0C[]; -extern s16 gCupCourseOrder[4][4]; void func_800A1924(struct_8018D9E0_entry *arg0) { func_8009A76C(arg0->D_8018DEE0_index, 0x17, 0x84, -1); @@ -15158,44 +15114,29 @@ block_13: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAC18.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_800AAF94(s32); // extern -extern ? gCharacterGridSelections; +void func_800AAF94(struct_8018D9E0_entry*, s32); -void func_800AADD4(void *arg0) { - s32 temp_v0; +void func_800AADD4(struct_8018D9E0_entry *arg0) { + s32 playerId; + s8 characterSelectionIndex; - temp_v0 = arg0->unk0 - 0x34; - arg0->unk14 = 0xE - (temp_v0 * 2); - func_800AAF94(*(&gCharacterGridSelections + temp_v0) - 1); + playerId = arg0->type - 0x34; + characterSelectionIndex = gCharacterGridSelections[playerId]; + arg0->priority = 0xE - (playerId * 2); + func_800AAF94(arg0, characterSelectionIndex - 1); } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AADD4.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800AAFCC(s32, void *); // extern - -void func_800AAE18(void *arg0) { - s32 temp_a0; +void func_800AAE18(struct_8018D9E0_entry *arg0) { s32 temp_v0; - void *temp_a1; - temp_a1 = arg0; - temp_a0 = arg0->unk0; - arg0 = temp_a1; - temp_v0 = func_800AAFCC(temp_a0 - 0x2B, temp_a1); + temp_v0 = func_800AAFCC(arg0->type - 0x2B); if (temp_v0 >= 0) { - arg0->unk14 = 0xE - (temp_v0 * 2); - return; + arg0->priority = 0xE - (temp_v0 * 2); + } + else { + arg0->priority = 6; } - arg0->unk14 = 6; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAE18.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -15300,20 +15241,15 @@ loop_1: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAF30.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800AAEB4(?); // extern +extern struct_8018D9E0_entry *func_800AAEB4(s32); -void func_800AAF94(void *arg0, ? arg1) { - void *temp_v0; +void func_800AAF94(struct_8018D9E0_entry *arg0, s32 arg1) { + struct_8018D9E0_entry *temp_v0; temp_v0 = func_800AAEB4(arg1); - arg0->unkC = temp_v0->unkC; - arg0->unk10 = temp_v0->unk10; + arg0->column = temp_v0->column; + arg0->row = temp_v0->row; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAF94.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index 6772f0252..2b6bf5759 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -51,7 +51,6 @@ extern s8 D_8018ED16; extern s8 D_8018ED17; extern u32 D_8018EDB8; extern u32 D_8018EDBC; -extern s8 gCharacterGridSelections; // D_8018EDE4 extern s8 D_8018EDE5; extern s8 D_8018EDE6; extern s8 D_8018EDE7; @@ -2334,7 +2333,7 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B29D8.s") #endif s32 func_800B34E8(s32 arg0) { - if (arg0 == gCharacterGridSelections) { + if (arg0 == gCharacterGridSelections[0]) { return 0; } if (arg0 == D_8018EDE5) { |
