Decompile osPfsInitPak

This commit is contained in:
Ryan Dwyer
2021-03-24 21:51:52 +10:00
parent 040b13e4aa
commit f423db1753
20 changed files with 253 additions and 442 deletions
+35
View File
@@ -88,12 +88,47 @@ typedef struct {
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
#define PFS_ERR_DEVICE 11 /* wrong device type */
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
#define PFS_FILE_NAME_LEN 16
#define PFS_FILE_EXT_LEN 4
#define BLOCKSIZE 32 /* bytes */
#define PFS_ONE_PAGE 8 /* blocks */
#define PFS_MAX_BANKS 62
#define PFS_INITIALIZED 0x1
#define PFS_CORRUPTED 0x2
/**************************************************************************
*
* Macro definitions
*
*/
#define SET_ACTIVEBANK_TO_ZERO \
if (pfs->activebank != 0) \
{ \
pfs->activebank = 0; \
ERRCK(__osPfsSelectBank(pfs)) \
}
#define PFS_CHECK_ID \
if (__osCheckId(pfs) == PFS_ERR_NEW_PACK) \
return PFS_ERR_NEW_PACK;
#define PFS_CHECK_STATUS \
if ((pfs->status & PFS_INITIALIZED) == 0) \
return PFS_ERR_INVALID;
#define PFS_GET_STATUS \
__osSiGetAccess(); \
ret = __osPfsGetStatus(queue, channel); \
__osSiRelAccess(); \
if (ret != 0) \
return ret;
/**************************************************************************
*
* Extern variables
+1 -1
View File
@@ -210,7 +210,7 @@ extern void *var800a2368;
extern u16 g_NumSpecialCovers;
extern u16 *g_SpecialCoverNums;
extern struct var800a2380 var800a2380[5];
extern struct var800a3180 var800a3180[4];
extern OSPfs g_Pfses[4];
extern u32 var800a33a0;
extern u32 var800a33a4;
extern struct explosion *g_Explosions;
+1
View File
@@ -34,6 +34,7 @@
#define PLAYERCOUNT3012() ((g_Vars.players[3] ? 1 : 0) + (g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0))
#define SECSTOTIME240(secs) (secs * 240)
#define SECSTOTIME60(secs) (secs * 60)
#define PFS(device) (device == SAVEDEVICE_GAMEPAK ? NULL : &g_Pfses[device])
#if VERSION >= VERSION_NTSC_1_0
#define VOLUME(volume) (volume > 0x5000 ? 0x5000 : volume)
+10 -4
View File
@@ -41,15 +41,21 @@ u32 func0f117520(s8 arg0, u32 arg1, u32 *arg2);
void pakDumpBuffer(u8 *buffer, u32 len, char *name);
void pakDumpEeprom(void);
s32 func0f11789c(s8 arg0, s32 arg1, s32 arg2, void *arg3, s32 *arg4, s32 arg5);
s32 func0f117b04(OSMesgQueue *mq, struct var800a3180 *arg1, s32 channel, s32 arg3);
#if VERSION >= VERSION_NTSC_1_0
s32 func0f117b04(OSMesgQueue *mq, OSPfs *pfs, s32 channel, s32 *arg3);
#else
s32 func0f117b04(OSMesgQueue *mq, OSPfs *pfs, s32 channel);
#endif
s32 func0f117b4c(s32 arg0, s32 arg1, u8 operation, u32 address, u32 len, u8 *buffer);
s32 func0f117c0c(s32 arg0, s32 *arg1, s32 *arg2);
s32 func0f117c80(struct var800a3180 *arg0, s32 *arg1);
s32 func0f117c80(OSPfs *pfs, s32 *arg1);
s32 func0f117ce4(s32 arg0, s32 arg1, OSPfsState *note);
u32 func0f117d90(u32 arg0, u16 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5, u32 *arg6);
u32 func0f117e00(struct var800a3180 *arg0, u16 company_code, u32 game_code, char *game_name, char *ext_name);
u32 func0f117e00(OSPfs *pfs, u16 company_code, u32 game_code, char *game_name, char *ext_name);
u32 func0f117e58(u32 arg0, u16 arg1, u32 arg2, u32 arg3, u32 arg4, u32 *arg5);
s32 func0f117ec0(struct var800a3180 *arg0, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, u32 numbytes);
s32 func0f117ec0(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, u32 numbytes);
s32 func0f117f80(s8 device);
s32 func0f117fc0(s8 device);
s32 func0f118000(s8 device);
+1 -1
View File
@@ -4,6 +4,6 @@
#include "data.h"
#include "types.h"
s32 func00006330(struct var800a3180 *arg0, u32 arg1);
s32 func00006330(OSPfs *pfs, u32 arg1);
#endif
+10 -4
View File
@@ -4,9 +4,15 @@
#include "data.h"
#include "types.h"
s32 func00006550(struct var800a3180 *arg0, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, u32 numbytes);
s32 func00006d60(OSMesgQueue *mq, struct var800a3180 *arg1, s32 channel, s32 arg3);
u32 func00006f98(void);
u32 func00007084(void);
s32 func00006550(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, u32 numbytes);
#if VERSION >= VERSION_NTSC_1_0
s32 osPfsInitPak(OSMesgQueue *mq, OSPfs *pfs, s32 channel, s32 *arg3);
#else
s32 osPfsInitPak(OSMesgQueue *mq, OSPfs *pfs, s32 channel);
#endif
s32 func00006f98(OSPfs *pfs);
s32 func00007084(OSPfs *pfs);
#endif
+3 -3
View File
@@ -5,9 +5,9 @@
#include "types.h"
u32 func0004c090(void);
u32 func0004c104(void);
u32 func0004c200(void);
u32 func0004c550(void);
s32 __osIdCheckSum(u16 *ptr, u16 *csum, u16 *icsum);
s32 __osRepairPackId(OSPfs *pfs, __OSPackId *badid, __OSPackId *newid);
s32 __osCheckPackId(OSPfs *pfs, __OSPackId *temp);
u32 func0004c6b4(void);
u32 func0004c860(void);
u32 func0004c934(void);
+1 -1
View File
@@ -4,6 +4,6 @@
#include "data.h"
#include "types.h"
s32 func0004ce60(struct var800a3180 *arg0, s32 *arg1);
s32 func0004ce60(OSPfs *pfs, s32 *arg1);
#endif
+1 -1
View File
@@ -4,7 +4,7 @@
#include "data.h"
#include "types.h"
u32 func0004d480(struct var800a3180 *arg0, u16 company_code, u32 game_code, char *game_name, char *ext_name);
u32 func0004d480(OSPfs *pfs, u16 company_code, u32 game_code, char *game_name, char *ext_name);
u32 func0004d658(void);
#endif
+1 -1
View File
@@ -4,7 +4,7 @@
#include "data.h"
#include "types.h"
u32 func0004d6f0(void);
s32 osPfsChecker(OSPfs *pfs);
u32 func0004dc28(void);
u32 func0004def4(void);
u32 func0004e090(void);
+2 -2
View File
@@ -4,9 +4,9 @@
#include "data.h"
#include "types.h"
void func0004f5e0(struct var800a3180 *arg0, u32 arg1);
void func0004f5e0(OSPfs *pfs, u32 arg1);
u32 func0004f748(void);
bool func0004f854(OSMesgQueue *mq, struct var800a3180 *arg1, s32 arg2);
bool func0004f854(OSMesgQueue *mq, OSPfs *pfs, s32 arg2);
u32 func0004f9b0(void);
u32 func0004fbc0(void);
u32 func0004fbf0(void);
+1 -1
View File
@@ -4,6 +4,6 @@
#include "data.h"
#include "types.h"
s32 func00050d60(struct var800a3180 *arg0, char *arg1, u8 *arg2);
s32 func00050d60(OSPfs *pfs, char *arg1, u8 *arg2);
#endif
+1 -1
View File
@@ -4,6 +4,6 @@
#include "data.h"
#include "types.h"
s32 func000513b0(struct var800a3180 *arg0, bool arg1, u16 arg2, char *arg3, u16 arg4);
s32 func000513b0(OSPfs *pfs, bool arg1, u16 arg2, char *arg3, u16 arg4);
#endif
-29
View File
@@ -6773,35 +6773,6 @@ struct joydata {
s32 unk200;
};
struct var800a3180 {
/*0x00*/ u32 unk00;
/*0x04*/ u32 unk04;
/*0x08*/ u32 unk08;
/*0x0c*/ u32 unk0c;
/*0x10*/ u32 unk10;
/*0x14*/ u32 unk14;
/*0x18*/ u32 unk18;
/*0x1c*/ u32 unk1c;
/*0x20*/ u32 unk20;
/*0x24*/ u32 unk24;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x34*/ u32 unk34;
/*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c;
/*0x40*/ u32 unk40;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x4c*/ u32 unk4c;
/*0x50*/ u32 unk50;
/*0x54*/ u32 unk54;
/*0x58*/ u32 unk58;
/*0x5c*/ u32 unk5c;
/*0x60*/ u32 unk60;
/*0x64*/ u32 unk64;
};
struct guncmd {
u8 type;
u8 unk01;