From c62f0db5e7306b35e38500d23fd6a8dfef4192a9 Mon Sep 17 00:00:00 2001 From: Faschz Date: Thu, 16 Dec 2021 06:48:05 -0600 Subject: [PATCH] Match func_80076924 (#199) * Match func_80076924 * Delete func_80076924.s --- .../controller_pak/func_80076924.s | 29 ------------------- src/controller_pak.c | 12 ++------ 2 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 asm/non_matchings/controller_pak/func_80076924.s diff --git a/asm/non_matchings/controller_pak/func_80076924.s b/asm/non_matchings/controller_pak/func_80076924.s deleted file mode 100644 index 61bfc9f5..00000000 --- a/asm/non_matchings/controller_pak/func_80076924.s +++ /dev/null @@ -1,29 +0,0 @@ -glabel func_80076924 -/* 077524 80076924 00047880 */ sll $t7, $a0, 2 -/* 077528 80076928 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 07752C 8007692C 01E47823 */ subu $t7, $t7, $a0 -/* 077530 80076930 000F7880 */ sll $t7, $t7, 2 -/* 077534 80076934 AFBF0014 */ sw $ra, 0x14($sp) -/* 077538 80076938 AFA60040 */ sw $a2, 0x40($sp) -/* 07753C 8007693C 01E47821 */ addu $t7, $t7, $a0 -/* 077540 80076940 3C188012 */ lui $t8, %hi(pfs) # $t8, 0x8012 -/* 077544 80076944 ACC00000 */ sw $zero, ($a2) -/* 077548 80076948 27184018 */ addiu $t8, %lo(pfs) # addiu $t8, $t8, 0x4018 -/* 07754C 8007694C 000F78C0 */ sll $t7, $t7, 3 -/* 077550 80076950 01F82021 */ addu $a0, $t7, $t8 -/* 077554 80076954 0C034160 */ jal osPfsFileState -/* 077558 80076958 27A60018 */ addiu $a2, $sp, 0x18 -/* 07755C 8007695C 14400007 */ bnez $v0, .L8007697C -/* 077560 80076960 24020009 */ li $v0, 9 -/* 077564 80076964 8FB90018 */ lw $t9, 0x18($sp) -/* 077568 80076968 8FA80040 */ lw $t0, 0x40($sp) -/* 07756C 8007696C 00001025 */ move $v0, $zero -/* 077570 80076970 10000002 */ b .L8007697C -/* 077574 80076974 AD190000 */ sw $t9, ($t0) -/* 077578 80076978 24020009 */ li $v0, 9 -.L8007697C: -/* 07757C 8007697C 8FBF0014 */ lw $ra, 0x14($sp) -/* 077580 80076980 27BD0038 */ addiu $sp, $sp, 0x38 -/* 077584 80076984 03E00008 */ jr $ra -/* 077588 80076988 00000000 */ nop - diff --git a/src/controller_pak.c b/src/controller_pak.c index 0f2a5c68..bd326e81 100644 --- a/src/controller_pak.c +++ b/src/controller_pak.c @@ -552,23 +552,17 @@ s32 read_data_from_controller_pak(s32 controllerIndex, s32 fileNum, u8 *data, s3 GLOBAL_ASM("asm/non_matchings/controller_pak/func_800766D4.s") -#ifdef NON_EQUIVALENT -// Stack issues s32 func_80076924(s32 controllerIndex, s32 arg1, s32 *arg2) { - s32 sp18; + OSPfsState state; *arg2 = 0; - if (!osPfsFileState(&pfs[controllerIndex], arg1, &sp18)) { - *arg2 = sp18; + if (osPfsFileState(&pfs[controllerIndex], arg1, &state) == 0) { + *arg2 = state.file_size; return 0; } return 9; } -#else -GLOBAL_ASM("asm/non_matchings/controller_pak/func_80076924.s") -#endif - GLOBAL_ASM("asm/non_matchings/controller_pak/func_8007698C.s") GLOBAL_ASM("asm/non_matchings/controller_pak/func_80076A38.s")