Decompile __osPfsSelectBank

This commit is contained in:
Ryan Dwyer
2021-01-30 11:48:14 +10:00
parent 1cc81c13b3
commit c522335d5d
14 changed files with 59 additions and 90 deletions
+1 -1
View File
@@ -149,7 +149,7 @@
build/ROMID/lib/ultra/io/conteepwrite.o (section); \
build/ROMID/lib/lib_4c090.o (section); \
build/ROMID/lib/lib_4cc10.o (section); \
build/ROMID/lib/lib_4cde0.o (section); \
build/ROMID/lib/ultra/io/pfsselectbank.o (section); \
build/ROMID/lib/lib_4ce60.o (section); \
build/ROMID/lib/lib_4d000.o (section); \
build/ROMID/lib/lib_4d480.o (section); \
+8
View File
@@ -35,6 +35,14 @@
#define FLAGS_HASH 8
#define FLAGS_ZERO 16
#define BLOCKSIZE 32
#define ARRLEN(x) ((s32)(sizeof(x) / sizeof(x[0])))
#define ERRCK(fn) \
ret = fn; \
if (ret != 0) \
return ret;
typedef struct {
union {
-8
View File
@@ -1,8 +0,0 @@
#ifndef _IN_LIB_LIB_4CDE0_H
#define _IN_LIB_LIB_4CDE0_H
#include <ultra64.h>
#include "types.h"
u32 func0004cde0(void);
#endif
+2
View File
@@ -48,4 +48,6 @@ s32 __osAiDeviceBusy();
void __osDispatchThread();
u32 __osGetCause();
s32 __osAtomicDec(u32*);
s32 __osPfsSelectBank(OSPfs *pfs, u8 bank);
#endif
+3 -4
View File
@@ -12,7 +12,6 @@
#include "lib/lib_4b170.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cc10.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4ce60.h"
#include "lib/lib_4d000.h"
#include "lib/lib_4d480.h"
@@ -100,7 +99,7 @@ glabel func00006550
/* 6660: 00002825 */ or $a1,$zero,$zero
/* 6664: 51600008 */ beqzl $t3,.L00006688
/* 6668: 8eac005c */ lw $t4,0x5c($s5)
/* 666c: 0c013378 */ jal func0004cde0
/* 666c: 0c013378 */ jal __osPfsSelectBank
/* 6670: a2a00065 */ sb $zero,0x65($s5)
/* 6674: 50400004 */ beqzl $v0,.L00006688
/* 6678: 8eac005c */ lw $t4,0x5c($s5)
@@ -638,7 +637,7 @@ glabel func00006d60
/* 6dcc: 1000006e */ b .L00006f88
/* 6dd0: 8fbf001c */ lw $ra,0x1c($sp)
.L00006dd4:
/* 6dd4: 0c013378 */ jal func0004cde0
/* 6dd4: 0c013378 */ jal __osPfsSelectBank
/* 6dd8: 00002825 */ or $a1,$zero,$zero
/* 6ddc: 10400003 */ beqz $v0,.L00006dec
/* 6de0: 24060001 */ addiu $a2,$zero,0x1
@@ -769,7 +768,7 @@ glabel func00006f98
/* 6f9c: afbf0024 */ sw $ra,0x24($sp)
/* 6fa0: afb00020 */ sw $s0,0x20($sp)
/* 6fa4: 00808025 */ or $s0,$a0,$zero
/* 6fa8: 0c013378 */ jal func0004cde0
/* 6fa8: 0c013378 */ jal __osPfsSelectBank
/* 6fac: 00002825 */ or $a1,$zero,$zero
/* 6fb0: 10400003 */ beqz $v0,.L00006fc0
/* 6fb4: 00003025 */ or $a2,$zero,$zero
+9 -10
View File
@@ -10,7 +10,6 @@
#include "gvars/gvars.h"
#include "lib/lib_4b170.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4d6f0.h"
#include "types.h"
@@ -150,7 +149,7 @@ glabel func0004c200
/* 4c268: 924f0065 */ lbu $t7,0x65($s2)
/* 4c26c: 51e00008 */ beqzl $t7,.L0004c290
/* 4c270: 27b1007c */ addiu $s1,$sp,0x7c
/* 4c274: 0c013378 */ jal func0004cde0
/* 4c274: 0c013378 */ jal __osPfsSelectBank
/* 4c278: 00002825 */ or $a1,$zero,$zero
/* 4c27c: 50400004 */ beqzl $v0,.L0004c290
/* 4c280: 27b1007c */ addiu $s1,$sp,0x7c
@@ -162,7 +161,7 @@ glabel func0004c200
/* 4c294: 27b0009c */ addiu $s0,$sp,0x9c
/* 4c298: 02402025 */ or $a0,$s2,$zero
.L0004c29c:
/* 4c29c: 0c013378 */ jal func0004cde0
/* 4c29c: 0c013378 */ jal __osPfsSelectBank
/* 4c2a0: 326500ff */ andi $a1,$s3,0xff
/* 4c2a4: 10400003 */ beqz $v0,.L0004c2b4
/* 4c2a8: 00003025 */ or $a2,$zero,$zero
@@ -223,7 +222,7 @@ glabel func0004c200
/* 4c368: 02402025 */ or $a0,$s2,$zero
/* 4c36c: 5a600013 */ blezl $s3,.L0004c3bc
/* 4c370: 26730001 */ addiu $s3,$s3,0x1
/* 4c374: 0c013378 */ jal func0004cde0
/* 4c374: 0c013378 */ jal __osPfsSelectBank
/* 4c378: 00002825 */ or $a1,$zero,$zero
/* 4c37c: 10400003 */ beqz $v0,.L0004c38c
/* 4c380: 00003025 */ or $a2,$zero,$zero
@@ -253,7 +252,7 @@ glabel func0004c200
/* 4c3cc: 02402025 */ or $a0,$s2,$zero
/* 4c3d0: 11200007 */ beqz $t1,.L0004c3f0
/* 4c3d4: 00000000 */ nop
/* 4c3d8: 0c013378 */ jal func0004cde0
/* 4c3d8: 0c013378 */ jal __osPfsSelectBank
/* 4c3dc: 00002825 */ or $a1,$zero,$zero
/* 4c3e0: 10400003 */ beqz $v0,.L0004c3f0
/* 4c3e4: 00000000 */ nop
@@ -378,7 +377,7 @@ glabel func0004c550
/* 4c57c: 00809825 */ or $s3,$a0,$zero
/* 4c580: 51c00008 */ beqzl $t6,.L0004c5a4
/* 4c584: 240f0001 */ addiu $t7,$zero,0x1
/* 4c588: 0c013378 */ jal func0004cde0
/* 4c588: 0c013378 */ jal __osPfsSelectBank
/* 4c58c: 00002825 */ or $a1,$zero,$zero
/* 4c590: 50400004 */ beqzl $v0,.L0004c5a4
/* 4c594: 240f0001 */ addiu $t7,$zero,0x1
@@ -476,7 +475,7 @@ glabel func0004c6b4
/* 4c6c8: 00808025 */ or $s0,$a0,$zero
/* 4c6cc: 51c00008 */ beqzl $t6,.L0004c6f0
/* 4c6d0: 8e040004 */ lw $a0,0x4($s0)
/* 4c6d4: 0c013378 */ jal func0004cde0
/* 4c6d4: 0c013378 */ jal __osPfsSelectBank
/* 4c6d8: 00002825 */ or $a1,$zero,$zero
/* 4c6dc: 50400004 */ beqzl $v0,.L0004c6f0
/* 4c6e0: 8e040004 */ lw $a0,0x4($s0)
@@ -598,13 +597,13 @@ glabel func0004c860
/* 4c870: 00808025 */ or $s0,$a0,$zero
/* 4c874: 51c0000f */ beqzl $t6,.L0004c8b4
/* 4c878: 8e040004 */ lw $a0,0x4($s0)
/* 4c87c: 0c013378 */ jal func0004cde0
/* 4c87c: 0c013378 */ jal __osPfsSelectBank
/* 4c880: 00002825 */ or $a1,$zero,$zero
/* 4c884: 24010002 */ addiu $at,$zero,0x2
/* 4c888: 14410005 */ bne $v0,$at,.L0004c8a0
/* 4c88c: 00401825 */ or $v1,$v0,$zero
/* 4c890: 02002025 */ or $a0,$s0,$zero
/* 4c894: 0c013378 */ jal func0004cde0
/* 4c894: 0c013378 */ jal __osPfsSelectBank
/* 4c898: 00002825 */ or $a1,$zero,$zero
/* 4c89c: 00401825 */ or $v1,$v0,$zero
.L0004c8a0:
@@ -690,7 +689,7 @@ glabel func0004c934
/* 4c9ac: 02402025 */ or $a0,$s2,$zero
/* 4c9b0: 51200008 */ beqzl $t1,.L0004c9d4
/* 4c9b4: 93a30067 */ lbu $v1,0x67($sp)
/* 4c9b8: 0c013378 */ jal func0004cde0
/* 4c9b8: 0c013378 */ jal __osPfsSelectBank
/* 4c9bc: 00002825 */ or $a1,$zero,$zero
/* 4c9c0: 50400004 */ beqzl $v0,.L0004c9d4
/* 4c9c4: 93a30067 */ lbu $v1,0x67($sp)
-49
View File
@@ -1,49 +0,0 @@
#include <ultra64.h>
#include "constants.h"
#include "game/data/data_000000.h"
#include "game/data/data_0083d0.h"
#include "game/data/data_00e460.h"
#include "game/data/data_0160b0.h"
#include "game/data/data_01a3a0.h"
#include "game/data/data_020df0.h"
#include "game/data/data_02da90.h"
#include "gvars/gvars.h"
#include "types.h"
GLOBAL_ASM(
glabel func0004cde0
/* 4cde0: 27bdffa8 */ addiu $sp,$sp,-88
/* 4cde4: afb00020 */ sw $s0,0x20($sp)
/* 4cde8: 30b000ff */ andi $s0,$a1,0xff
/* 4cdec: afbf0024 */ sw $ra,0x24($sp)
/* 4cdf0: afa40058 */ sw $a0,0x58($sp)
/* 4cdf4: afa5005c */ sw $a1,0x5c($sp)
/* 4cdf8: 27a20038 */ addiu $v0,$sp,0x38
/* 4cdfc: 27a30058 */ addiu $v1,$sp,0x58
.L0004ce00:
/* 4ce00: 24420004 */ addiu $v0,$v0,0x4
/* 4ce04: a050fffd */ sb $s0,-0x3($v0)
/* 4ce08: a050fffe */ sb $s0,-0x2($v0)
/* 4ce0c: a050ffff */ sb $s0,-0x1($v0)
/* 4ce10: 1443fffb */ bne $v0,$v1,.L0004ce00
/* 4ce14: a050fffc */ sb $s0,-0x4($v0)
/* 4ce18: 8fae0058 */ lw $t6,0x58($sp)
/* 4ce1c: 24060400 */ addiu $a2,$zero,0x400
/* 4ce20: 27a70038 */ addiu $a3,$sp,0x38
/* 4ce24: 8dc40004 */ lw $a0,0x4($t6)
/* 4ce28: 8dc50008 */ lw $a1,0x8($t6)
/* 4ce2c: 0c012d84 */ jal __osContRamWrite
/* 4ce30: afa00010 */ sw $zero,0x10($sp)
/* 4ce34: 14400003 */ bnez $v0,.L0004ce44
/* 4ce38: 00401825 */ or $v1,$v0,$zero
/* 4ce3c: 8faf0058 */ lw $t7,0x58($sp)
/* 4ce40: a1f00065 */ sb $s0,0x65($t7)
.L0004ce44:
/* 4ce44: 8fbf0024 */ lw $ra,0x24($sp)
/* 4ce48: 8fb00020 */ lw $s0,0x20($sp)
/* 4ce4c: 27bd0058 */ addiu $sp,$sp,0x58
/* 4ce50: 03e00008 */ jr $ra
/* 4ce54: 00601025 */ or $v0,$v1,$zero
/* 4ce58: 00000000 */ nop
/* 4ce5c: 00000000 */ nop
);
+1 -2
View File
@@ -11,7 +11,6 @@
#include "lib/libc/ll.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cc10.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4d480.h"
#include "types.h"
@@ -50,7 +49,7 @@ glabel func0004d480
/* 4d4ec: 02402025 */ or $a0,$s2,$zero
/* 4d4f0: 53200008 */ beqzl $t9,.L0004d514
/* 4d4f4: 8e48005c */ lw $t0,0x5c($s2)
/* 4d4f8: 0c013378 */ jal func0004cde0
/* 4d4f8: 0c013378 */ jal __osPfsSelectBank
/* 4d4fc: 00002825 */ or $a1,$zero,$zero
/* 4d500: 50400004 */ beqzl $v0,.L0004d514
/* 4d504: 8e48005c */ lw $t0,0x5c($s2)
+1 -2
View File
@@ -10,7 +10,6 @@
#include "gvars/gvars.h"
#include "lib/libc/ll.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4d6f0.h"
#include "types.h"
@@ -168,7 +167,7 @@ glabel func0004d6f0
/* 4d90c: 02602025 */ or $a0,$s3,$zero
/* 4d910: 51c00008 */ beqzl $t6,.L0004d934
/* 4d914: 8e6d005c */ lw $t5,0x5c($s3)
/* 4d918: 0c013378 */ jal func0004cde0
/* 4d918: 0c013378 */ jal __osPfsSelectBank
/* 4d91c: 00002825 */ or $a1,$zero,$zero
/* 4d920: 50400004 */ beqzl $v0,.L0004d934
/* 4d924: 8e6d005c */ lw $t5,0x5c($s3)
+3 -4
View File
@@ -9,7 +9,6 @@
#include "game/data/data_02da90.h"
#include "gvars/gvars.h"
#include "lib/lib_16110.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4f5e0.h"
#include "lib/lib_51d50.h"
#include "types.h"
@@ -203,13 +202,13 @@ glabel func0004f854
/* 4f87c: aca00000 */ sw $zero,0x0($a1)
/* 4f880: 00a02025 */ or $a0,$a1,$zero
/* 4f884: acaf0008 */ sw $t7,0x8($a1)
/* 4f888: 0c013378 */ jal func0004cde0
/* 4f888: 0c013378 */ jal __osPfsSelectBank
/* 4f88c: 240500fe */ addiu $a1,$zero,0xfe
/* 4f890: 24010002 */ addiu $at,$zero,0x2
/* 4f894: 14410005 */ bne $v0,$at,.L0004f8ac
/* 4f898: 00401825 */ or $v1,$v0,$zero
/* 4f89c: 02002025 */ or $a0,$s0,$zero
/* 4f8a0: 0c013378 */ jal func0004cde0
/* 4f8a0: 0c013378 */ jal __osPfsSelectBank
/* 4f8a4: 24050080 */ addiu $a1,$zero,0x80
/* 4f8a8: 00401825 */ or $v1,$v0,$zero
.L0004f8ac:
@@ -238,7 +237,7 @@ glabel func0004f854
/* 4f8f8: 10000028 */ b .L0004f99c
/* 4f8fc: 2402000b */ addiu $v0,$zero,0xb
.L0004f900:
/* 4f900: 0c013378 */ jal func0004cde0
/* 4f900: 0c013378 */ jal __osPfsSelectBank
/* 4f904: 24050080 */ addiu $a1,$zero,0x80
/* 4f908: 24010002 */ addiu $at,$zero,0x2
/* 4f90c: 14410002 */ bne $v0,$at,.L0004f918
+4 -5
View File
@@ -9,7 +9,6 @@
#include "game/data/data_02da90.h"
#include "gvars/gvars.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_50480.h"
#include "types.h"
@@ -133,7 +132,7 @@ glabel func00050554
/* 50604: 02402025 */ or $a0,$s2,$zero
/* 50608: 51200008 */ beqzl $t1,.L0005062c
/* 5060c: 8e4a005c */ lw $t2,0x5c($s2)
/* 50610: 0c013378 */ jal func0004cde0
/* 50610: 0c013378 */ jal __osPfsSelectBank
/* 50614: 00002825 */ or $a1,$zero,$zero
/* 50618: 50400004 */ beqzl $v0,.L0005062c
/* 5061c: 8e4a005c */ lw $t2,0x5c($s2)
@@ -251,7 +250,7 @@ glabel func00050554
/* 50798: 02402025 */ or $a0,$s2,$zero
/* 5079c: 53280008 */ beql $t9,$t0,.L000507c0
/* 507a0: 93a90049 */ lbu $t1,0x49($sp)
/* 507a4: 0c013378 */ jal func0004cde0
/* 507a4: 0c013378 */ jal __osPfsSelectBank
/* 507a8: 03202825 */ or $a1,$t9,$zero
/* 507ac: 50400004 */ beqzl $v0,.L000507c0
/* 507b0: 93a90049 */ lbu $t1,0x49($sp)
@@ -300,7 +299,7 @@ glabel func00050554
/* 50848: 02402025 */ or $a0,$s2,$zero
/* 5084c: 53000008 */ beqzl $t8,.L00050870
/* 50850: 8e48005c */ lw $t0,0x5c($s2)
/* 50854: 0c013378 */ jal func0004cde0
/* 50854: 0c013378 */ jal __osPfsSelectBank
/* 50858: 00002825 */ or $a1,$zero,$zero
/* 5085c: 50400004 */ beqzl $v0,.L00050870
/* 50860: 8e48005c */ lw $t0,0x5c($s2)
@@ -368,7 +367,7 @@ glabel func000508d0
/* 5092c: 02202025 */ or $a0,$s1,$zero
/* 50930: 53000008 */ beqzl $t8,.L00050954
/* 50934: 8e390050 */ lw $t9,0x50($s1)
/* 50938: 0c013378 */ jal func0004cde0
/* 50938: 0c013378 */ jal __osPfsSelectBank
/* 5093c: 00002825 */ or $a1,$zero,$zero
/* 50940: 50400004 */ beqzl $v0,.L00050954
/* 50944: 8e390050 */ lw $t9,0x50($s1)
+1 -2
View File
@@ -12,7 +12,6 @@
#include "lib/lib_06330.h"
#include "lib/lib_4b170.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4d6f0.h"
#include "lib/lib_50a00.h"
#include "lib/lib_513b0.h"
@@ -58,7 +57,7 @@ glabel func00050a00
/* 50a7c: 02602025 */ or $a0,$s3,$zero
/* 50a80: 53200008 */ beqzl $t9,.L00050aa4
/* 50a84: 8e68005c */ lw $t0,0x5c($s3)
/* 50a88: 0c013378 */ jal func0004cde0
/* 50a88: 0c013378 */ jal __osPfsSelectBank
/* 50a8c: 00002825 */ or $a1,$zero,$zero
/* 50a90: 50400004 */ beqzl $v0,.L00050aa4
/* 50a94: 8e68005c */ lw $t0,0x5c($s3)
+2 -3
View File
@@ -10,7 +10,6 @@
#include "gvars/gvars.h"
#include "lib/lib_4b170.h"
#include "lib/lib_4c090.h"
#include "lib/lib_4cde0.h"
#include "lib/lib_4d6f0.h"
#include "lib/lib_513b0.h"
#include "lib/lib_52360.h"
@@ -170,7 +169,7 @@ glabel func000513b0
/* 515d8: 10000063 */ b .L00051768
/* 515dc: 8fbf001c */ lw $ra,0x1c($sp)
.L000515e0:
/* 515e0: 0c013378 */ jal func0004cde0
/* 515e0: 0c013378 */ jal __osPfsSelectBank
/* 515e4: 00002825 */ or $a1,$zero,$zero
/* 515e8: 10400003 */ beqz $v0,.L000515f8
/* 515ec: 24060001 */ addiu $a2,$zero,0x1
@@ -290,7 +289,7 @@ glabel func00051778
/* 5177c: afbf0024 */ sw $ra,0x24($sp)
/* 51780: afb00020 */ sw $s0,0x20($sp)
/* 51784: 00808025 */ or $s0,$a0,$zero
/* 51788: 0c013378 */ jal func0004cde0
/* 51788: 0c013378 */ jal __osPfsSelectBank
/* 5178c: 00002825 */ or $a1,$zero,$zero
/* 51790: 10400003 */ beqz $v0,.L000517a0
/* 51794: 00003025 */ or $a2,$zero,$zero
+24
View File
@@ -0,0 +1,24 @@
#include <ultra64.h>
s32 __osPfsSelectBank(OSPfs *pfs, u8 bank)
{
u8 temp[8][4];
int i;
s32 ret;
ret = 0;
for (i = 0; i < 8; i++) {
temp[i][1] = bank;
temp[i][2] = bank;
temp[i][3] = bank;
temp[i][0] = bank;
}
ret = __osContRamWrite(pfs->queue, pfs->channel, 1024, (u8*)temp, FALSE);
if (ret == 0) {
pfs->activebank = bank;
}
return ret;
}