Discover gbpak and rumble functions

This commit is contained in:
Ryan Dwyer
2021-09-23 18:36:28 +10:00
parent 6e216d3f09
commit d1a5f42edd
31 changed files with 581 additions and 574 deletions
+28
View File
@@ -68,6 +68,23 @@ typedef struct {
char game_name[16];
} OSPfsState;
typedef struct {
u16 fixed1; /* Fixed data (0x00, 0xc3) */
u16 start_address; /* Program start address */
u8 nintendo_chr[0x30]; /* "Nintendo" character data */
u8 game_title[16]; /* Game title */
u16 company_code; /* Company code */
u8 body_code; /* Body code */
u8 cart_type; /* Game pak type */
u8 rom_size; /* ROM size */
u8 ram_size; /* RAM size */
u8 country_code; /* country code */
u8 fixed_data; /* fixed data(0x33) */
u8 version; /* Mask ROM version number */
u8 isum; /* Complement check */
u16 sum; /* Sum check */
} OSGbpakId;
/**************************************************************************
*
* Global definitions
@@ -87,11 +104,16 @@ typedef struct {
#define PFS_ERR_EXIST 9 /* file exists */
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
#define PFS_ERR_DEVICE 11 /* wrong device type */
#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */
#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
#define OS_GBPAK_POWER_OFF 0
#define OS_GBPAK_POWER_ON 1
#define PFS_FILE_NAME_LEN 16
#define PFS_FILE_EXT_LEN 4
#define BLOCKSIZE 32 /* bytes */
@@ -167,6 +189,12 @@ s32 osMotorAccess(OSPfs *pfs, u32 vibrate);
void osSetUpMempakWrite(s32 channel, OSPifRam* buf);
s32 osMotorProbe(OSMesgQueue *mq, OSPfs *pfs, s32 channel);
s32 osGbpakCheckConnector(OSPfs *pfs, u8 *status);
s32 osGbpakGetStatus(OSPfs *pfs, u8 *status);
s32 osGbpakPower(OSPfs *pfs, s32 flag);
s32 osGbpakReadId(OSPfs *pfs, OSGbpakId *id, u8 *status);
s32 osGbpakReadWrite(OSPfs *pfs, u16 flag, u16 address, u8 *buffer, u16 size);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
+17
View File
@@ -1000,6 +1000,9 @@
#define GAMEFILEFLAG_4D 0x4d
#define GAMEFILEFLAG_4E 0x4e
#define GBGAME_OTHER 0
#define GBGAME_PD 2
#define GOPOSFLAG_SPEED 0x03 // bits 0x01 and 0x02 combined
#define GOPOSFLAG_INIT 0x04
#define GOPOSFLAG_FORPATHSTART 0x08
@@ -3082,6 +3085,11 @@
#define PAKFILETYPE_GAME 0x080
#define PAKFILETYPE_100 0x100
#define PAKTYPE_NONE 0
#define PAKTYPE_RUMBLE 1
#define PAKTYPE_MEMORY 2
#define PAKTYPE_GAMEBOY 3
#define PATHFLAG_CIRCULAR 1
#define PATHFLAG_FLYING 2
#define PATHFLAG_INUSE 4
@@ -3230,6 +3238,15 @@
#define ROOMFLAG_PLAYAMBIENTTRACK 0x4000
#define ROOMFLAG_OUTDOORS 0x8000
#define RUMBLESTATE_1 1
#define RUMBLESTATE_ENABLED_STOPPED 2
#define RUMBLESTATE_ENABLED_STARTING 3
#define RUMBLESTATE_ENABLED_RUMBLING 4
#define RUMBLESTATE_ENABLED_STOPPING 5
#define RUMBLESTATE_DISABLED_STOPPING 6
#define RUMBLESTATE_DISABLED_STOPPED 7
#define RUMBLESTATE_ENABLING 8
#define SAVEDEVICE_CONTROLLERPAK1 0
#define SAVEDEVICE_CONTROLLERPAK2 1
#define SAVEDEVICE_CONTROLLERPAK3 2
+1 -1
View File
@@ -4,7 +4,7 @@
#include "data.h"
#include "types.h"
void bgun0f097ba0(s32 handnum, s32 weaponnum);
void bgunRumble(s32 handnum, s32 weaponnum);
s32 bgunGetUnequippedReloadIndex(s32 weaponnum);
void bgunTickUnequippedReload(void);
bool bgun0f097df0(struct inventory_typef *arg0, struct hand *hand);
+21 -21
View File
@@ -9,7 +9,7 @@ u32 pakAlign(s8 device, u32 size);
s32 pakGetAlignedFileLenByBodyLen(s8 device, s32 bodylen);
u32 pakGetBodyLenByFileLen(u32 filelen);
u32 pakGenerateSerial(s8 device);
bool pakIsConnected(s8 device);
bool pakIsMemoryPak(s8 device);
s32 pak0f1167b0(s8 device, u32 filetype, u32 *buffer1024);
s32 pak0f1167d8(s8 device);
s32 pak0f116800(s8 device, s32 fileid, u8 *body, s32 arg3);
@@ -17,20 +17,20 @@ s32 pak0f116828(s8 device, s32 fileid, s32 filetype, u8 *body, s32 *outfileid, s
bool pakDeleteFile(s8 device, s32 fileid);
s32 pakDeleteGameNote(s8 device, u16 company_code, u32 game_code, char *game_name, char *ext_name);
s32 pak0f1168c4(s8 device, struct pakdata **arg1);
u32 pak0f116914(s8 device);
s32 pakGetDeviceSerial(s8 device);
u32 pakGetType(s8 device);
s32 pakGetSerial(s8 device);
void pak0f11698c(s8 device);
void pak0f116994(void);
void pak0f1169c8(s8 device, s32 arg1);
bool pak0f116aec(s8 device);
bool pak0f116b5c(s8 device);
void pak0f116bdc(s8 device, u8 *arg1, u8 *arg2);
u16 pakGetSerial(s8 device);
u32 pakGetUnk000(s8 device);
u16 _pakGetSerial(s8 device);
u32 _pakGetType(s8 device);
void pakSetUnk010(s8 device, s32 value);
s32 pak0f116df0(s8 device, struct pakdata **arg1);
s32 pakDeleteGameNote2(s8 device, u16 company_code, u32 game_code, char *game_name, char *ext_name);
s32 pakDeleteFile2(s8 device, s32 fileid);
s32 _pakDeleteGameNote(s8 device, u16 company_code, u32 game_code, char *game_name, char *ext_name);
s32 _pakDeleteFile(s8 device, s32 fileid);
s32 pakGetUnk264(s8 device);
u32 pakGetMaxFileSize(s8 device);
s32 pakGetBodyLenByType(s8 device, u32 filetype);
@@ -105,9 +105,9 @@ void pak0f11c54c(void);
void pak0f11c6d0(void);
void pakExecuteDebugOperations(void);
void pak0f11ca30(void);
void pak0f11cb9c(u32 arg0);
s32 pak0f11cbd8(s8 device, s32 arg1, char *arg2, u16 arg3);
s32 pak0f11cc6c(s8 device, u16 arg1, char *buffer, u16 len);
void gbpakHandleError(u32 arg0);
bool gbpakRead(s8 device, s32 address, u8 *buffer, u16 size);
bool gbpakWrite(s8 device, u16 address, u8 *buffer, u16 size);
bool pak0f11cd00(s8 device, u16 arg1, char *arg2, s32 arg3, s32 arg4);
bool pak0f11ce00(s8 device, u16 arg1, char *arg2, s32 arg3, bool arg4);
u32 pak0f11d118(void);
@@ -123,16 +123,16 @@ u32 pak0f11d8b4(void);
u32 pak0f11d9c4(void);
#if VERSION >= VERSION_NTSC_1_0
void pak0f11dc04(s32 arg0, f32 arg1, s32 arg2, s32 arg3);
void pakRumble(s32 device, f32 numsecs, s32 onduration, s32 offduration);
#else
void pak0f11dc04(s8 arg0, f32 arg1, s32 arg2, s32 arg3);
void pakRumble(s8 device, f32 numsecs, s32 onduration, s32 offduration);
#endif
void pak0f11dcb0(s32 arg0);
void pak0f11dd58(s8 playernum);
void pak0f11de20(s8 playernum);
void pak0f11deb8(void);
void pak0f11df38(void);
void pakStopRumbleForAllPaks(bool disablepolling);
void pakDisableRumbleForPlayer(s8 playernum);
void pakEnableRumbleForPlayer(s8 playernum);
void pakDisableRumbleForAllPlayers(void);
void pakEnableRumbleForAllPlayers(void);
void pakDumpPak(void);
void pak0f11df94(s8 device);
void pak0f11e3bc(s8 device);
@@ -144,10 +144,10 @@ bool pakHasBitflag(u32 flagnum, u8 *stream);
void pakClearAllBitflags(u8 *flags);
void pakN64FontCodeToAscii(char *src, char *dst, s32 len);
s8 pakFindBySerial(s32 deviceserial);
s32 pak0f11e750(s8 arg0);
bool pak0f11e78c(void);
bool pak0f11e7f0(char *a, char *b);
s32 pak0f11e844(s8 device);
s32 pak0f11e750(s8 device);
bool gbpakIsAnyPerfectDark(void);
bool gbpakStrcmp(char *a, char *b);
s32 gbpakIdentifyGame(s8 device);
bool pak0f11ea34(s8 arg0);
extern const char var7f1b423c[];
+8 -8
View File
@@ -24,7 +24,7 @@ void joy00014238(void);
void joyDebugJoy(void);
s32 joyStartReadData(OSMesgQueue *mq);
void joyReadData(void);
void joyPoll(void);
void joysTick(void);
void joy00014810(bool value);
s32 joyGetNumSamples(void);
s32 joyGetStickXOnSample(s32 samplenum, s8 contpadnum);
@@ -37,21 +37,21 @@ s32 joyGetStickX(s8 contpadnum);
s32 joyGetStickY(s8 contpadnum);
u16 joyGetButtons(s8 contpadnum, u16 mask);
u16 joyGetButtonsPressedThisFrame(s8 contpadnum, u16 mask);
s32 joy000150c4(void);
bool joyIsCyclicPollingEnabled(void);
#if VERSION >= VERSION_NTSC_1_0
void joyGetLock(void);
void joyReleaseLock(void);
void joyDisableCyclicPolling(void);
void joyEnableCyclicPolling(void);
#else
void joyGetLock(s32 line, char *file);
void joyReleaseLock(s32 line, char *file);
void joyDisableCyclicPolling(s32 line, char *file);
void joyEnableCyclicPolling(s32 line, char *file);
#endif
void joyReset(void);
void joyGetContpadNumsForPlayer(s8 playernum, s32 *pad1, s32 *pad2);
void joy000153c4(s8 device, s32 arg1);
void joyStopRumble(s8 device, bool disablepolling);
s32 joy000155b4(s8 device);
s32 joy000155f4(s8 device);
void joy0001561c(void);
void joysTickRumble(void);
#endif
-9
View File
@@ -1,9 +0,0 @@
#ifndef _IN_LIB_LIB_06330_H
#define _IN_LIB_LIB_06330_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
s32 func00006330(OSPfs *pfs, u32 arg1);
#endif
-9
View File
@@ -1,9 +0,0 @@
#ifndef _IN_LIB_LIB_50BE0_H
#define _IN_LIB_LIB_50BE0_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
u32 func00050be0(void);
#endif
-9
View File
@@ -1,9 +0,0 @@
#ifndef _IN_LIB_LIB_50D60_H
#define _IN_LIB_LIB_50D60_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
s32 func00050d60(OSPfs *pfs, char *arg1, u8 *arg2);
#endif
-9
View File
@@ -1,9 +0,0 @@
#ifndef _IN_LIB_LIB_50F20_H
#define _IN_LIB_LIB_50F20_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
u32 func50f20(void);
#endif
-9
View File
@@ -1,9 +0,0 @@
#ifndef _IN_LIB_LIB_513B0_H
#define _IN_LIB_LIB_513B0_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
s32 func000513b0(OSPfs *pfs, bool arg1, u16 arg2, char *arg3, u16 arg4);
#endif
+6 -6
View File
@@ -5031,8 +5031,8 @@ struct pakheadercache {
};
struct pak {
/*0x000*/ s32 unk000;
/*0x004*/ u32 unk004;
/*0x000*/ s32 type;
/*0x004*/ u32 rumblestate;
/*0x008*/ u32 unk008;
/*0x00c*/ u32 unk00c;
/*0x010*/ u32 unk010;
@@ -5048,9 +5048,9 @@ struct pak {
/*0x278*/ u32 unk278;
/*0x27c*/ u32 unk27c;
/*0x280*/ u32 unk280;
/*0x284*/ s32 unk284;
/*0x288*/ u32 unk288;
/*0x28c*/ u32 unk28c;
/*0x284*/ s32 rumblepulsestopat;
/*0x288*/ u32 rumblepulselen;
/*0x28c*/ u32 rumblepulsetimer; // counts up to pulselen then loops
/*0x290*/ u32 unk290;
/*0x294*/ u32 unk294;
/*0x298*/ u32 unk298;
@@ -5060,7 +5060,7 @@ struct pak {
/*0x2a8*/ u32 numpages;
/*0x2ac*/ u32 unk2ac;
/*0x2b0*/ u32 unk2b0;
/*0x2b4*/ f32 unk2b4;
/*0x2b4*/ f32 rumblettl;
/*0x2b8*/ u8 unk2b8_01 : 1;
/*0x2b8*/ u8 unk2b8_02 : 1;
/*0x2b8*/ u8 unk2b8_03 : 1;