mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-09-03 10:41:30 -04:00
Jump Table Related Disassembly (#60)
* Part 1, Commit 1 of 24 audio/effects Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 2 of 24 audio/external Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 3 of 24 audio/heap Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 4 of 24 audio/port_eu Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 5 of 24 audio/seqplayer Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 6 of 24 code_80005FD0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 7 of 24 code_8001C4D0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 8 of 24 code_80027D00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 9 of 24 code_800393C0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 10 of 24 code_8003DC40 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 11 of 24 code_800431B0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 12 of 24 code_80057C60 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 13 of 24 code_8006E9C0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 14 of 24 code_80071F00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 15 of 24 code_80086E70 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 16 of 24 code_8008C1D0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 17 of 24 code_80091750 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 18 of 24 code_800AF9B0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 19 of 24 code_8028DF00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 20 of 24 code_80290C20 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 21 of 24 code_802B0210 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 22 of 24 code_actors Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 23 of 24 memory Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 1, Commit 24 of 24 os/__osException Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 1 of 20 audio/effects.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 2 of 20 audio/external.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 3 of 24 audio/heap.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 4 of 20 audio/port_eu.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 5 of 20 audio/seqplayer.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 6 of 20 code_80005FD0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 7 of 20 code_8001C4D0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 8 of 20 code_80027D00.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 9 of 20 code_8003DC40.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 10 of 20 code_800431B0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 11 of 20 code_80057C60.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 12 of 20 code_8006E9C0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 13 of 20 code_80071F00.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 14 of 20 code_80086E70.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 15 of 20 code_80091750.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 16 of 20 code_800AF9B0.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 17 of 20 code_80290C20.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 18 of 20 code_802B0210.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 19 of 20 code_80296A50.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 2, Commit 20 of 20 memory.c Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 1 of 4 code_8008C1D0 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 2 of 4 code_8028DF00 Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 3 of 4 math_util Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Part 3, Commit 4 of 4 crash_screen Signed-off-by: Taggerung <tyler.taggerung@gmail.com> * Recreated disassemblies with a context file Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
+177
-14
@@ -6185,15 +6185,105 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800507D8.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
/*
|
||||
Failed to decompile function func_800508C0:
|
||||
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
|
||||
? func_8004C024(s16, ?, s16, s32, s32, s32, s32); /* extern */
|
||||
? func_8004C148(?, s16, s16, s32, s32, s32, s32); /* extern */
|
||||
|
||||
Unable to determine jump table for jr instruction at func_800508C0.s line 125.
|
||||
void func_800508C0(void) {
|
||||
s32 sp54;
|
||||
s32 sp50;
|
||||
u32 sp4C;
|
||||
s32 sp48;
|
||||
u16 sp42;
|
||||
u16 sp40;
|
||||
u16 sp3E;
|
||||
s32 temp_v1;
|
||||
s16 phi_s0;
|
||||
u16 phi_s0_2;
|
||||
s32 phi_s1;
|
||||
s32 phi_s2;
|
||||
u16 phi_s0_3;
|
||||
s32 phi_s1_2;
|
||||
s32 phi_s2_2;
|
||||
|
||||
There must be a read of a variable in the same block as
|
||||
the instruction, which has a name starting with "jtbl"/"jpt_".
|
||||
*/
|
||||
if (gModeSelection == 1) {
|
||||
phi_s0 = D_80164378;
|
||||
} else {
|
||||
phi_s0 = D_80164360;
|
||||
}
|
||||
temp_v1 = lapCount[phi_s0];
|
||||
sp4C = func_80050644(phi_s0 & 0xFFFF, &sp54, &sp50);
|
||||
if (temp_v1 > 0) {
|
||||
if (temp_v1 == 1) {
|
||||
phi_s0_2 = 0;
|
||||
phi_s1 = 0;
|
||||
phi_s2 = 0xFF;
|
||||
} else {
|
||||
if (temp_v1 == 2) {
|
||||
phi_s1 = 0xFF;
|
||||
} else {
|
||||
phi_s1 = 0;
|
||||
}
|
||||
phi_s0_2 = 0xFF;
|
||||
phi_s2 = 0;
|
||||
}
|
||||
sp48 = temp_v1;
|
||||
func_8004C024(0x20, 0x12, 0x104, phi_s0_2 & 0xFFFF, phi_s1, phi_s2, 0xFF);
|
||||
func_8004C148(0x124, 0x12, 0xCC, phi_s0_2 & 0xFFFF, phi_s1, phi_s2, 0xFF);
|
||||
func_8004C024(0x20, 0xDE, 0x104, phi_s0_2 & 0xFFFF, phi_s1, phi_s2, 0xFF);
|
||||
func_8004C148(0x20, 0x12, 0xCC, phi_s0_2 & 0xFFFF, phi_s1, phi_s2, 0xFF);
|
||||
sp42 = phi_s0_2;
|
||||
sp40 = phi_s1;
|
||||
sp3E = phi_s2;
|
||||
}
|
||||
phi_s0_3 = sp42;
|
||||
phi_s1_2 = sp40;
|
||||
phi_s2_2 = sp3E;
|
||||
if ((lapCount[phi_s0] >= 0) && (lapCount[phi_s0] < 3)) {
|
||||
if (lapCount[phi_s0] != 0) {
|
||||
if (lapCount[phi_s0] != 1) {
|
||||
if (lapCount[phi_s0] != 2) {
|
||||
|
||||
} else {
|
||||
phi_s1_2 = 0;
|
||||
goto block_20;
|
||||
}
|
||||
} else {
|
||||
phi_s1_2 = 0xFF;
|
||||
block_20:
|
||||
phi_s0_3 = 0xFF;
|
||||
phi_s2_2 = 0;
|
||||
}
|
||||
} else {
|
||||
phi_s0_3 = 0;
|
||||
phi_s1_2 = 0;
|
||||
phi_s2_2 = 0xFF;
|
||||
}
|
||||
switch (sp4C) {
|
||||
case 1:
|
||||
func_8004C024(0x20, 0x12, sp54, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
return;
|
||||
case 2:
|
||||
func_8004C024(0x20, 0x12, 0x104, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
func_8004C148(0x124, 0x12, sp50, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
return;
|
||||
case 3:
|
||||
func_8004C024(0x20, 0x12, 0x104, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
func_8004C148(0x124, 0x12, 0xCC, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
func_8004C024(sp54 + 0x20, 0xDE, 0x104 - sp54, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
return;
|
||||
case 4:
|
||||
func_8004C024(0x20, 0x12, 0x104, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
func_8004C148(0x124, 0x12, 0xCC, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
func_8004C024(0x20, 0xDE, 0x104, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
func_8004C148(0x20, sp50 + 0x12, 0xCC - sp50, phi_s0_3 & 0xFFFF, phi_s1_2, phi_s2_2, 0xFF);
|
||||
/* Duplicate return node #27. Try simplifying control flow for better match */
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
}
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800508C0.s")
|
||||
#endif
|
||||
@@ -7765,15 +7855,88 @@ GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800534A4.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
/*
|
||||
Failed to decompile function func_800534E8:
|
||||
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
|
||||
extern ? D_80165CBC;
|
||||
static ? D_800E4638; /* unable to generate initializer; const */
|
||||
static ? D_800E4640; /* unable to generate initializer; const */
|
||||
static ? D_800E4650; /* unable to generate initializer; const */
|
||||
static ? D_800E4658; /* unable to generate initializer; const */
|
||||
static ? D_800E4668; /* unable to generate initializer; const */
|
||||
static ? D_800E4670; /* unable to generate initializer; const */
|
||||
static ? D_800E4680; /* unable to generate initializer; const */
|
||||
static ? D_800E4688; /* unable to generate initializer; const */
|
||||
static ? D_800E4698; /* unable to generate initializer; const */
|
||||
static ? D_800E46A0; /* unable to generate initializer; const */
|
||||
|
||||
Unable to determine jump table for jr instruction at func_800534E8.s line 14.
|
||||
void func_800534E8(s32 arg0) {
|
||||
Gfx *temp_v0;
|
||||
Gfx *temp_v0_10;
|
||||
Gfx *temp_v0_2;
|
||||
Gfx *temp_v0_3;
|
||||
Gfx *temp_v0_4;
|
||||
Gfx *temp_v0_5;
|
||||
Gfx *temp_v0_6;
|
||||
Gfx *temp_v0_7;
|
||||
Gfx *temp_v0_8;
|
||||
Gfx *temp_v0_9;
|
||||
u16 temp_t7;
|
||||
|
||||
There must be a read of a variable in the same block as
|
||||
the instruction, which has a name starting with "jtbl"/"jpt_".
|
||||
*/
|
||||
temp_t7 = *(&D_80165CBC + (arg0 * 0xE0));
|
||||
switch (temp_t7) {
|
||||
case 0:
|
||||
temp_v0 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0 + 8;
|
||||
temp_v0->words.w0 = 0x3860010;
|
||||
temp_v0->words.w1 = &D_800E4640;
|
||||
temp_v0_2 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_2 + 8;
|
||||
temp_v0_2->words.w0 = 0x3880010;
|
||||
temp_v0_2->words.w1 = &D_800E4638;
|
||||
return;
|
||||
case 1:
|
||||
temp_v0_3 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_3 + 8;
|
||||
temp_v0_3->words.w0 = 0x3860010;
|
||||
temp_v0_3->words.w1 = &D_800E4658;
|
||||
temp_v0_4 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_4 + 8;
|
||||
temp_v0_4->words.w0 = 0x3880010;
|
||||
temp_v0_4->words.w1 = &D_800E4650;
|
||||
return;
|
||||
case 2:
|
||||
temp_v0_5 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_5 + 8;
|
||||
temp_v0_5->words.w0 = 0x3860010;
|
||||
temp_v0_5->words.w1 = &D_800E4670;
|
||||
temp_v0_6 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_6 + 8;
|
||||
temp_v0_6->words.w0 = 0x3880010;
|
||||
temp_v0_6->words.w1 = &D_800E4668;
|
||||
return;
|
||||
case 3:
|
||||
temp_v0_7 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_7 + 8;
|
||||
temp_v0_7->words.w0 = 0x3860010;
|
||||
temp_v0_7->words.w1 = &D_800E4688;
|
||||
temp_v0_8 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_8 + 8;
|
||||
temp_v0_8->words.w0 = 0x3880010;
|
||||
temp_v0_8->words.w1 = &D_800E4680;
|
||||
return;
|
||||
case 4:
|
||||
temp_v0_9 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_9 + 8;
|
||||
temp_v0_9->words.w0 = 0x3860010;
|
||||
temp_v0_9->words.w1 = &D_800E46A0;
|
||||
temp_v0_10 = gDisplayListHead;
|
||||
gDisplayListHead = temp_v0_10 + 8;
|
||||
temp_v0_10->words.w0 = 0x3880010;
|
||||
temp_v0_10->words.w1 = &D_800E4698;
|
||||
/* fallthrough */
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800431B0/func_800534E8.s")
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user