mirror of
https://github.com/n64decomp/mk64
synced 2026-07-11 13:48:45 -04:00
Match functions for Grand Prix save data access (#88)
* Match grand prix save data funcs Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
glabel func_800B54C0
|
||||
/* 0B60C0 800B54C0 00A03025 */ move $a2, $a1
|
||||
/* 0B60C4 800B54C4 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0B60C8 800B54C8 3C058019 */ lui $a1, %hi(D_8018ED10) # 0x8019
|
||||
/* 0B60CC 800B54CC AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0B60D0 800B54D0 00A62821 */ addu $a1, $a1, $a2
|
||||
/* 0B60D4 800B54D4 0C02D53B */ jal func_800B54EC
|
||||
/* 0B60D8 800B54D8 90A5ED10 */ lbu $a1, %lo(D_8018ED10)($a1) # -0x12f0($a1)
|
||||
/* 0B60DC 800B54DC 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0B60E0 800B54E0 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
/* 0B60E4 800B54E4 03E00008 */ jr $ra
|
||||
/* 0B60E8 800B54E8 00000000 */ nop
|
||||
@@ -1,8 +0,0 @@
|
||||
glabel func_800B54EC
|
||||
/* 0B60EC 800B54EC 00041840 */ sll $v1, $a0, 1
|
||||
/* 0B60F0 800B54F0 240E0003 */ li $t6, 3
|
||||
/* 0B60F4 800B54F4 006E7804 */ sllv $t7, $t6, $v1
|
||||
/* 0B60F8 800B54F8 00AFC024 */ and $t8, $a1, $t7
|
||||
/* 0B60FC 800B54FC 0078C806 */ srlv $t9, $t8, $v1
|
||||
/* 0B6100 800B5500 03E00008 */ jr $ra
|
||||
/* 0B6104 800B5504 332200FF */ andi $v0, $t9, 0xff
|
||||
@@ -1,11 +0,0 @@
|
||||
glabel func_800B5508
|
||||
/* 0B6108 800B5508 00041840 */ sll $v1, $a0, 1
|
||||
/* 0B610C 800B550C 240E0003 */ li $t6, 3
|
||||
/* 0B6110 800B5510 006E7804 */ sllv $t7, $t6, $v1
|
||||
/* 0B6114 800B5514 01E0C027 */ not $t8, $t7
|
||||
/* 0B6118 800B5518 00663004 */ sllv $a2, $a2, $v1
|
||||
/* 0B611C 800B551C 00B82824 */ and $a1, $a1, $t8
|
||||
/* 0B6120 800B5520 00A61025 */ or $v0, $a1, $a2
|
||||
/* 0B6124 800B5524 305900FF */ andi $t9, $v0, 0xff
|
||||
/* 0B6128 800B5528 03E00008 */ jr $ra
|
||||
/* 0B612C 800B552C 03201025 */ move $v0, $t9
|
||||
@@ -1,14 +0,0 @@
|
||||
glabel func_800B5530
|
||||
/* 0B6130 800B5530 3C0E8019 */ lui $t6, %hi(D_8018ED10) # 0x8019
|
||||
/* 0B6134 800B5534 01C47021 */ addu $t6, $t6, $a0
|
||||
/* 0B6138 800B5538 91CEED10 */ lbu $t6, %lo(D_8018ED10)($t6) # -0x12f0($t6)
|
||||
/* 0B613C 800B553C 240100FF */ li $at, 255
|
||||
/* 0B6140 800B5540 00001025 */ move $v0, $zero
|
||||
/* 0B6144 800B5544 15C10003 */ bne $t6, $at, .L800B5554
|
||||
/* 0B6148 800B5548 00000000 */ nop
|
||||
/* 0B614C 800B554C 03E00008 */ jr $ra
|
||||
/* 0B6150 800B5550 24020001 */ li $v0, 1
|
||||
|
||||
.L800B5554:
|
||||
/* 0B6154 800B5554 03E00008 */ jr $ra
|
||||
/* 0B6158 800B5558 00000000 */ nop
|
||||
@@ -1,18 +0,0 @@
|
||||
glabel func_800B555C
|
||||
/* 0B615C 800B555C 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0B6160 800B5560 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0B6164 800B5564 0C02D54C */ jal func_800B5530
|
||||
/* 0B6168 800B5568 24040002 */ li $a0, 2
|
||||
/* 0B616C 800B556C 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0B6170 800B5570 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
/* 0B6174 800B5574 03E00008 */ jr $ra
|
||||
/* 0B6178 800B5578 00000000 */ nop
|
||||
|
||||
/* 0B617C 800B557C 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 0B6180 800B5580 AFBF0014 */ sw $ra, 0x14($sp)
|
||||
/* 0B6184 800B5584 0C02D54C */ jal func_800B5530
|
||||
/* 0B6188 800B5588 24040003 */ li $a0, 3
|
||||
/* 0B618C 800B558C 8FBF0014 */ lw $ra, 0x14($sp)
|
||||
/* 0B6190 800B5590 27BD0018 */ addiu $sp, $sp, 0x18
|
||||
/* 0B6194 800B5594 03E00008 */ jr $ra
|
||||
/* 0B6198 800B5598 00000000 */ nop
|
||||
+35
-45
@@ -3519,66 +3519,56 @@ void func_800B5404(s32 arg0, s32 arg1) {
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5404.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
? func_800B54EC(u8, s32); // extern
|
||||
extern ? D_8018ED10;
|
||||
extern u8 D_8018ED10[4]; // Direct reference to the grandPrixPoints section of save data
|
||||
u8 func_800B54EC(s32, s32);
|
||||
u8 func_800B5508(s32, s32, s32);
|
||||
|
||||
void func_800B54C0(s32 arg1) {
|
||||
func_800B54EC(*(&D_8018ED10 + arg1), arg1);
|
||||
// Get Grand Prix points for a given cup and CC mode
|
||||
u8 func_800B54C0(s32 cup, s32 cc_mode) {
|
||||
return func_800B54EC(cup, D_8018ED10[cc_mode]);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B54C0.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
s32 func_800B54EC(s32 arg0, s32 arg1) {
|
||||
s32 temp_v1;
|
||||
// Get Grand Prix points scored for a given cup
|
||||
u8 func_800B54EC(s32 cup, s32 ccGrandPrixPoints) {
|
||||
s32 cup_index = cup * 2;
|
||||
u32 cup_points = ccGrandPrixPoints;
|
||||
|
||||
temp_v1 = arg0 * 2;
|
||||
return ((arg1 & (3 << temp_v1)) >> temp_v1) & 0xFF;
|
||||
cup_points &= (3 << cup_index);
|
||||
cup_points >>= cup_index;
|
||||
cup_points &= 0xFF;
|
||||
|
||||
return cup_points;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B54EC.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
s32 func_800B5508(s32 arg0, s32 arg1, s32 arg2) {
|
||||
s32 temp_v1;
|
||||
// Generate a new CC Grand Prix Points entry with points_scored
|
||||
// placed in the given cup's location
|
||||
u8 func_800B5508(s32 cup, s32 ccGrandPrixPoints, s32 points_scored) {
|
||||
s32 cup_index = cup * 2;
|
||||
|
||||
temp_v1 = arg0 * 2;
|
||||
return ((arg1 & ~(3 << temp_v1)) | (arg2 << temp_v1)) & 0xFF;
|
||||
points_scored <<= cup_index;
|
||||
ccGrandPrixPoints &= ~(3 << cup_index);
|
||||
|
||||
return (ccGrandPrixPoints | points_scored);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5508.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
extern ? D_8018ED10;
|
||||
|
||||
? func_800B5530(s32 arg0) {
|
||||
if (*(&D_8018ED10 + arg0) == 0xFF) {
|
||||
// Check if all 4 cups have gold cups scored
|
||||
// for a given CC mode
|
||||
s32 func_800B5530(s32 cc_mode) {
|
||||
if (D_8018ED10[cc_mode] == 0xFF) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5530.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
? func_800B5530(?); // extern
|
||||
|
||||
void func_800B555C(void) {
|
||||
func_800B5530(2);
|
||||
// Check if the 150CC mode has all 4 gold cups
|
||||
s32 func_800B555C(void) {
|
||||
return func_800B5530(CC_150);
|
||||
}
|
||||
|
||||
// Check if the Extra mode has all 4 gold cups
|
||||
s32 func_800B557C(void) {
|
||||
return func_800B5530(CC_EXTRA);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B555C.s")
|
||||
#endif
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
|
||||
Reference in New Issue
Block a user