Decompile ciGetChrBioIndexBySlot

This commit is contained in:
Ryan Dwyer committed 2020-04-12 23:39:24 +10:00
1 parent 5c0600fb4a
commit 19c4c9335b
3 files changed
+24 -44

No files matched your search

+18 -38
View File
@@ -4603,7 +4603,7 @@ struct chrbio *ciGetChrBioByBodynum(u32 bodynum)
char *ciGetChrBioDescription(void)
{
struct chrbio *bio = ciGetChrBioByBodynum(func0f1a1210(var800888a0));
struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioIndexBySlot(var800888a0));
return langGet(bio->description);
}
@@ -4621,43 +4621,23 @@ s32 ciGetNumUnlockedChrBios(void)
return count;
}
GLOBAL_ASM(
glabel func0f1a1210
/* f1a1210: 27bdffd8 */ addiu $sp,$sp,-40
/* f1a1214: afb30020 */ sw $s3,0x20($sp)
/* f1a1218: afb2001c */ sw $s2,0x1c($sp)
/* f1a121c: afb10018 */ sw $s1,0x18($sp)
/* f1a1220: afb00014 */ sw $s0,0x14($sp)
/* f1a1224: 00809825 */ or $s3,$a0,$zero
/* f1a1228: afbf0024 */ sw $ra,0x24($sp)
/* f1a122c: 2411ffff */ addiu $s1,$zero,-1
/* f1a1230: 00008025 */ or $s0,$zero,$zero
/* f1a1234: 24120097 */ addiu $s2,$zero,0x97
.L0f1a1238:
/* f1a1238: 0fc683fb */ jal ciIsChrBioUnlocked
/* f1a123c: 02002025 */ or $a0,$s0,$zero
/* f1a1240: 10400002 */ beqz $v0,.L0f1a124c
/* f1a1244: 00000000 */ sll $zero,$zero,0x0
/* f1a1248: 26310001 */ addiu $s1,$s1,0x1
.L0f1a124c:
/* f1a124c: 56330004 */ bnel $s1,$s3,.L0f1a1260
/* f1a1250: 26100001 */ addiu $s0,$s0,0x1
/* f1a1254: 10000005 */ beqz $zero,.L0f1a126c
/* f1a1258: 02001025 */ or $v0,$s0,$zero
/* f1a125c: 26100001 */ addiu $s0,$s0,0x1
.L0f1a1260:
/* f1a1260: 1612fff5 */ bne $s0,$s2,.L0f1a1238
/* f1a1264: 00000000 */ sll $zero,$zero,0x0
/* f1a1268: 00001025 */ or $v0,$zero,$zero
.L0f1a126c:
/* f1a126c: 8fbf0024 */ lw $ra,0x24($sp)
/* f1a1270: 8fb00014 */ lw $s0,0x14($sp)
/* f1a1274: 8fb10018 */ lw $s1,0x18($sp)
/* f1a1278: 8fb2001c */ lw $s2,0x1c($sp)
/* f1a127c: 8fb30020 */ lw $s3,0x20($sp)
/* f1a1280: 03e00008 */ jr $ra
/* f1a1284: 27bd0028 */ addiu $sp,$sp,0x28
);
s32 ciGetChrBioIndexBySlot(s32 slot)
{
s32 index = -1;
s32 bodynum;
for (bodynum = 0; bodynum < NUM_BODIES; bodynum++) {
if (ciIsChrBioUnlocked(bodynum)) {
index++;
}
if (index == slot) {
return bodynum;
}
}
return 0;
}
struct miscbio *ciGetMiscBio(s32 index)
{
+5 -5
View File
@@ -2657,7 +2657,7 @@ glabel var7f1b9960
/* f1a5e50: 0043082b */ sltu $at,$v0,$v1
/* f1a5e54: 10200009 */ beqz $at,.L0f1a5e7c
/* f1a5e58: 00000000 */ sll $zero,$zero,0x0
/* f1a5e5c: 0fc68484 */ jal func0f1a1210
/* f1a5e5c: 0fc68484 */ jal ciGetChrBioIndexBySlot
/* f1a5e60: 00402025 */ or $a0,$v0,$zero
/* f1a5e64: 0fc68429 */ jal ciGetChrBioByBodynum
/* f1a5e68: 00402025 */ or $a0,$v0,$zero
@@ -2745,7 +2745,7 @@ glabel var7f1b9978
/* f1a5f54: 3c048009 */ lui $a0,%hi(var800888a0)
/* f1a5f58: afa5004c */ sw $a1,0x4c($sp)
/* f1a5f5c: afa60050 */ sw $a2,0x50($sp)
/* f1a5f60: 0fc68484 */ jal func0f1a1210
/* f1a5f60: 0fc68484 */ jal ciGetChrBioIndexBySlot
/* f1a5f64: 908488a0 */ lbu $a0,%lo(var800888a0)($a0)
/* f1a5f68: 3044ffff */ andi $a0,$v0,0xffff
/* f1a5f6c: 0fc62ef6 */ jal mpGetBodyIndexByBodyId
@@ -2983,7 +2983,7 @@ const char var7f1b989c[] = "%d\n";
char *ciMenuTextBioName(struct menu_item *item)
{
struct chrbio *bio = ciGetChrBioByBodynum(func0f1a1210(var800888a0));
struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioIndexBySlot(var800888a0));
sprintf(g_StringPointer, "%s\n", langGet(bio->name));
return g_StringPointer;
@@ -2991,7 +2991,7 @@ char *ciMenuTextBioName(struct menu_item *item)
char *ciMenuTextBioAge(struct menu_item *item)
{
struct chrbio *bio = ciGetChrBioByBodynum(func0f1a1210(var800888a0));
struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioIndexBySlot(var800888a0));
sprintf(g_StringPointer, "%s\n", langGet(bio->age));
return g_StringPointer;
@@ -2999,7 +2999,7 @@ char *ciMenuTextBioAge(struct menu_item *item)
char *ciMenuTextBioRace(struct menu_item *item)
{
struct chrbio *bio = ciGetChrBioByBodynum(func0f1a1210(var800888a0));
struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioIndexBySlot(var800888a0));
sprintf(g_StringPointer, "%s\n", langGet(bio->race));
return g_StringPointer;
+1 -1
View File
@@ -65,7 +65,7 @@ bool ciIsChrBioUnlocked(u32 bodynum);
struct chrbio *ciGetChrBioByBodynum(u32 bodynum);
char *ciGetChrBioDescription(void);
s32 ciGetNumUnlockedChrBios(void);
u32 func0f1a1210(u32 arg0);
s32 ciGetChrBioIndexBySlot(s32 slot);
struct miscbio *ciGetMiscBio(s32 index);
bool ciIsMiscBioUnlocked(s32 index);
s32 ciGetNumUnlockedMiscBios(void);