Match a few functions (#167)

They appear to be related to the textures used on the controller
 pak menu

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2022-02-22 18:33:01 -05:00
committed by GitHub
parent 4e4339126e
commit a47e49249a
7 changed files with 41 additions and 163 deletions
+1 -1
View File
@@ -1803,7 +1803,7 @@ glabel gNumD_8018E118Entries
glabel D_8018E75C
.skip 4
glabel D_8018E760
glabel gNumD_8018E768Entries
.skip 8
glabel D_8018E768
@@ -1,8 +0,0 @@
glabel func_8009B938
/* 09C538 8009B938 3C0E8019 */ lui $t6, %hi(D_8018D9C0) # $t6, 0x8019
/* 09C53C 8009B93C 8DCED9C0 */ lw $t6, %lo(D_8018D9C0)($t6)
/* 09C540 8009B940 3C018019 */ lui $at, %hi(D_8018E75C) # $at, 0x8019
/* 09C544 8009B944 AC2EE75C */ sw $t6, %lo(D_8018E75C)($at)
/* 09C548 8009B948 3C018019 */ lui $at, %hi(D_8018E760)
/* 09C54C 8009B94C 03E00008 */ jr $ra
/* 09C550 8009B950 AC20E760 */ sw $zero, %lo(D_8018E760)($at)
@@ -1,18 +0,0 @@
glabel func_8009B954
/* 09C554 8009B954 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 09C558 8009B958 AFBF0014 */ sw $ra, 0x14($sp)
/* 09C55C 8009B95C 0C026449 */ jal segmented_to_virtual
/* 09C560 8009B960 00000000 */ nop
/* 09C564 8009B964 3C0E8019 */ lui $t6, %hi(D_8018E760) # $t6, 0x8019
/* 09C568 8009B968 8DCEE760 */ lw $t6, %lo(D_8018E760)($t6)
/* 09C56C 8009B96C 3C188019 */ lui $t8, %hi(D_8018E768) # $t8, 0x8019
/* 09C570 8009B970 2718E768 */ addiu $t8, %lo(D_8018E768) # addiu $t8, $t8, -0x1898
/* 09C574 8009B974 000E78C0 */ sll $t7, $t6, 3
/* 09C578 8009B978 01F81821 */ addu $v1, $t7, $t8
/* 09C57C 8009B97C 8FBF0014 */ lw $ra, 0x14($sp)
/* 09C580 8009B980 AC620000 */ sw $v0, ($v1)
/* 09C584 8009B984 3C198019 */ lui $t9, %hi(D_8018E75C) # $t9, 0x8019
/* 09C588 8009B988 8F39E75C */ lw $t9, %lo(D_8018E75C)($t9)
/* 09C58C 8009B98C 27BD0018 */ addiu $sp, $sp, 0x18
/* 09C590 8009B990 03E00008 */ jr $ra
/* 09C594 8009B994 AC790004 */ sw $t9, 4($v1)
@@ -1,15 +0,0 @@
glabel func_8009B998
/* 09C598 8009B998 3C048019 */ lui $a0, %hi(D_8018E75C) # $a0, 0x8019
/* 09C59C 8009B99C 2484E75C */ addiu $a0, %lo(D_8018E75C) # addiu $a0, $a0, -0x18a4
/* 09C5A0 8009B9A0 8C830000 */ lw $v1, ($a0)
/* 09C5A4 8009B9A4 3C058019 */ lui $a1, %hi(D_8018E760) # $a1, 0x8019
/* 09C5A8 8009B9A8 3C0FB800 */ lui $t7, 0xb800
/* 09C5AC 8009B9AC 246E0008 */ addiu $t6, $v1, 8
/* 09C5B0 8009B9B0 AC8E0000 */ sw $t6, ($a0)
/* 09C5B4 8009B9B4 24A5E760 */ addiu $a1, %lo(D_8018E760) # addiu $a1, $a1, -0x18a0
/* 09C5B8 8009B9B8 AC600004 */ sw $zero, 4($v1)
/* 09C5BC 8009B9BC AC6F0000 */ sw $t7, ($v1)
/* 09C5C0 8009B9C0 8CB80000 */ lw $t8, ($a1)
/* 09C5C4 8009B9C4 27190001 */ addiu $t9, $t8, 1
/* 09C5C8 8009B9C8 03E00008 */ jr $ra
/* 09C5CC 8009B9CC ACB90000 */ sw $t9, ($a1)
@@ -1,46 +0,0 @@
glabel func_8009B9D0
/* 09C5D0 8009B9D0 27BDFFC8 */ addiu $sp, $sp, -0x38
/* 09C5D4 8009B9D4 AFB20020 */ sw $s2, 0x20($sp)
/* 09C5D8 8009B9D8 AFB00018 */ sw $s0, 0x18($sp)
/* 09C5DC 8009B9DC AFB1001C */ sw $s1, 0x1c($sp)
/* 09C5E0 8009B9E0 3C108019 */ lui $s0, %hi(D_8018E768) # $s0, 0x8019
/* 09C5E4 8009B9E4 3C128019 */ lui $s2, %hi(D_8018E7A8) # $s2, 0x8019
/* 09C5E8 8009B9E8 00A08825 */ move $s1, $a1
/* 09C5EC 8009B9EC AFBF0024 */ sw $ra, 0x24($sp)
/* 09C5F0 8009B9F0 AFA40038 */ sw $a0, 0x38($sp)
/* 09C5F4 8009B9F4 AFA0002C */ sw $zero, 0x2c($sp)
/* 09C5F8 8009B9F8 2652E7A8 */ addiu $s2, %lo(D_8018E7A8) # addiu $s2, $s2, -0x1858
/* 09C5FC 8009B9FC 2610E768 */ addiu $s0, %lo(D_8018E768) # addiu $s0, $s0, -0x1898
.L8009BA00:
/* 09C600 8009BA00 0C026449 */ jal segmented_to_virtual
/* 09C604 8009BA04 02202025 */ move $a0, $s1
/* 09C608 8009BA08 8E0E0000 */ lw $t6, ($s0)
/* 09C60C 8009BA0C 544E0007 */ bnel $v0, $t6, .L8009BA2C
/* 09C610 8009BA10 26100008 */ addiu $s0, $s0, 8
/* 09C614 8009BA14 8E0F0004 */ lw $t7, 4($s0)
/* 09C618 8009BA18 24180001 */ li $t8, 1
/* 09C61C 8009BA1C AFB8002C */ sw $t8, 0x2c($sp)
/* 09C620 8009BA20 10000004 */ b .L8009BA34
/* 09C624 8009BA24 AFAF0034 */ sw $t7, 0x34($sp)
/* 09C628 8009BA28 26100008 */ addiu $s0, $s0, 8
.L8009BA2C:
/* 09C62C 8009BA2C 1612FFF4 */ bne $s0, $s2, .L8009BA00
/* 09C630 8009BA30 00000000 */ nop
.L8009BA34:
/* 09C634 8009BA34 8FB9002C */ lw $t9, 0x2c($sp)
/* 09C638 8009BA38 8FA80038 */ lw $t0, 0x38($sp)
/* 09C63C 8009BA3C 3C0A0600 */ lui $t2, 0x600
/* 09C640 8009BA40 13200006 */ beqz $t9, .L8009BA5C
/* 09C644 8009BA44 25090008 */ addiu $t1, $t0, 8
/* 09C648 8009BA48 AFA90038 */ sw $t1, 0x38($sp)
/* 09C64C 8009BA4C AD0A0000 */ sw $t2, ($t0)
/* 09C650 8009BA50 8FAB0034 */ lw $t3, 0x34($sp)
/* 09C654 8009BA54 AD0B0004 */ sw $t3, 4($t0)
/* 09C658 8009BA58 8FA20038 */ lw $v0, 0x38($sp)
.L8009BA5C:
/* 09C65C 8009BA5C 8FBF0024 */ lw $ra, 0x24($sp)
/* 09C660 8009BA60 8FB00018 */ lw $s0, 0x18($sp)
/* 09C664 8009BA64 8FB1001C */ lw $s1, 0x1c($sp)
/* 09C668 8009BA68 8FB20020 */ lw $s2, 0x20($sp)
/* 09C66C 8009BA6C 03E00008 */ jr $ra
/* 09C670 8009BA70 27BD0038 */ addiu $sp, $sp, 0x38
+27 -75
View File
@@ -5119,96 +5119,48 @@ loop_2:
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B8C4.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern s32 D_8018D9C0;
extern s32 D_8018E75C;
extern s32 D_8018E760;
// D_8018D9C0 is a little weird. In code_800AF9B0 its treated as a
// struct_8018EE10_entry pointer. But here its being treated as a
// Gfx pointer. It seems to be multi use.
void func_8009B938(void) {
D_8018E75C = D_8018D9C0;
D_8018E760 = 0;
gNumD_8018E768Entries = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B938.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda
extern s32 D_8018E75C;
extern s32 D_8018E760;
extern ? D_8018E768;
void func_8009B954(MkTexture *arg0) {
void *temp_v1;
temp_v1 = (D_8018E760 * 8) + &D_8018E768;
temp_v1->unk0 = segmented_to_virtual(arg0);
temp_v1->unk4 = (s32) D_8018E75C;
D_8018E768[gNumD_8018E768Entries].textures = segmented_to_virtual(arg0);
D_8018E768[gNumD_8018E768Entries].displayList = D_8018E75C;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B954.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
extern void *D_8018E75C;
extern s32 D_8018E760;
void func_8009B998(void) {
void *temp_v1;
temp_v1 = D_8018E75C;
D_8018E75C = temp_v1 + 8;
temp_v1->unk4 = 0;
temp_v1->unk0 = 0xB8000000;
D_8018E760 = D_8018E760 + 1;
gSPEndDisplayList(D_8018E75C++);
gNumD_8018E768Entries += 1;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B998.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda
extern ? D_8018E768;
extern ? D_8018E7A8;
// I don't get how this compiles, given that there's a code path
// that has no explicit return value.
// Based on the target assembly, in the event that it never finds
// the desired entry, it'll treat the return value of segmented_to_virtual
// as the return of this function. Which seems like a bug to me
Gfx *func_8009B9D0(Gfx *displayListHead, MkTexture *textures) {
Gfx *displayList;
s32 pad;
s32 found;
s32 index;
Gfx *func_8009B9D0(Gfx *arg0, MkTexture *arg1) {
u32 sp34;
s32 sp2C;
? *temp_s0;
Gfx *temp_t0;
MkTexture *temp_v0;
? *phi_s0;
Gfx *phi_v0;
sp2C = 0;
phi_s0 = &D_8018E768;
loop_1:
temp_v0 = segmented_to_virtual(arg1);
phi_v0 = (Gfx *) temp_v0;
if (temp_v0 == phi_s0->unk0) {
sp2C = 1;
sp34 = phi_s0->unk4;
} else {
temp_s0 = phi_s0 + 8;
phi_s0 = temp_s0;
if (temp_s0 != &D_8018E7A8) {
goto loop_1;
found = FALSE;
for (index = 0; index < D_8018E768_SIZE; index++) {
if (D_8018E768[index].textures == segmented_to_virtual(textures)) {
displayList = D_8018E768[index].displayList;
found = TRUE;
break;
}
}
temp_t0 = arg0;
if (sp2C != 0) {
arg0 = temp_t0 + 8;
temp_t0->words.w0 = 0x06000000;
temp_t0->words.w1 = sp34;
phi_v0 = arg0;
if (found) {
gSPDisplayList(displayListHead++, displayList);
return displayListHead;
}
return phi_v0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B9D0.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda
+13
View File
@@ -44,6 +44,11 @@ typedef struct {
/* 0x04 */ s32 offset;
} struct_8018E118_entry; // size = 0x08
typedef struct {
/* 0x00 */ MkTexture *textures;
/* 0x04 */ Gfx *displayList;
} struct_8018E768_entry; // size = 0x08
/* Function Prototypes */
f64 exponent_by_squaring(f64, s32);
@@ -118,6 +123,10 @@ void func_8009A76C(s32, s32, s32, s32);
void func_8009A7EC(s32, s32, s32, s32, s32);
void func_8009A878(struct_8018DEE0_entry*);
void func_8009A944(struct_8018DEE0_entry*, s32);
void func_8009B938();
void func_8009B954(MkTexture*);
void func_8009B998();
Gfx *func_8009B9D0(Gfx*, MkTexture*);
Gfx *func_8009BA74(Gfx *, MkTexture*, s32, s32);
Gfx *func_8009BEF0(Gfx*, s32, f32, f32, s32, f32,f32);
Gfx *func_8009C434(Gfx*, struct_8018DEE0_entry*, s32, s32, s32);
@@ -192,6 +201,7 @@ void func_80057CE4();
#define D_8018D9E0_SIZE 0x20
#define D_8018DEE0_SIZE 0x10
#define D_8018E118_SIZE 0xC8
#define D_8018E768_SIZE 0x08
/* This is where I'd put my static data, if I had any */
@@ -248,6 +258,9 @@ 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 s32 gNumD_8018E118Entries; // D_8018E758
extern Gfx *D_8018E75C; // D_8018E75C
extern s32 gNumD_8018E768Entries; // D_8018E760
extern struct_8018E768_entry D_8018E768[D_8018E768_SIZE]; // D_8018E768
extern s8 gTextColor; // D_8018E860
extern s8 D_8018ED91;
extern s32 D_8018E850;