Name more pak symbols

This commit is contained in:
Ryan Dwyer 2023-06-25 22:33:57 +10:00
parent 83e8265d5b
commit 3b4451a2d1
18 changed files with 612 additions and 655 deletions

View File

@ -948,7 +948,7 @@ void func0f14aee0(void)
thing->unk078 = 0;
pak0f117150(i, thing->unk0d8);
pak0f1171b4(SAVEDEVICE_CONTROLLERPAK1, 3, 0);
pak0f1171b4(SAVEDEVICE_CONTROLLERPAK1, PAK00C_03, 0);
func0f14aed0(i);
thing->unk094 = 0;
@ -1200,7 +1200,7 @@ void func0f14b8ac(s32 index)
}
switch (pakGetUnk008(func0f14a5a4())) {
case 12:
case PAK008_12:
func0f14a95c();
func0f14aa48();
func0f14e790(var800a45a0->unk470);
@ -1209,10 +1209,10 @@ void func0f14b8ac(s32 index)
func0f14a16c(1);
func0f14bc04();
break;
case 1:
case PAK008_01:
pak0f11d4dc(func0f14a5a4());
break;
case 11:
case PAK008_11:
pak0f11d9c4(func0f14a5a4(), var800a45a0->unk470, 0, 0);
func0f14d064(index, var800a45a0->unk470);
pak0f11d478(func0f14a5a4());
@ -1320,7 +1320,7 @@ void func0f14bd34(s32 index)
struct var8007f8dc *thing = &var8007f8dc[index];
if (thing->unk080 != -1) {
pak0f1171b4(func0f14a5a4(), 3, 0);
pak0f1171b4(func0f14a5a4(), PAK00C_03, 0);
pak0f11d540(func0f14a5a4(), thing->unk0b6[thing->unk080]);
}
}
@ -1402,7 +1402,7 @@ void func0f14bec8(s32 index)
for (i = 0; i < ARRAYCOUNT(thing->unk0b6); i++);
pak0f1171b4(func0f14a5a4(), 3, 0);
pak0f1171b4(func0f14a5a4(), PAK00C_03, 0);
pak0f11d478(func0f14a5a4());
break;
case 3:
@ -1446,7 +1446,7 @@ void func0f14c1cc(s32 index)
switch (thing->unk0f4) {
case 0:
pak0f1171b4(func0f14a5a4(), 0, 0);
pak0f1171b4(func0f14a5a4(), PAK00C_00, 0);
pak0f11d5b0(func0f14a5a4());
thing->unk0f4 = 1;
break;
@ -1510,13 +1510,13 @@ void func0f14c3a4(s32 index)
pak0f11d620(func0f14a5a4());
switch (pakGetUnk008(func0f14a5a4())) {
case 1:
case PAK008_01:
func0f14c1cc(index);
break;
case 11:
case PAK008_11:
func0f14bec8(index);
break;
case 12:
case PAK008_12:
func0f14bdbc(index);
break;
}
@ -1712,7 +1712,7 @@ void func0f14cdb8(s32 index, u8 *arg1)
void func0f14ce84(void)
{
if (pak0f11d3f8(func0f14a5a4())) {
if (pakGetUnk008(func0f14a5a4()) != 12) {
if (pakGetUnk008(func0f14a5a4()) != PAK008_12) {
var8007f8dc[func0f14a5a4()].unk0f8 = 1;
var8007f8dc[func0f14a5a4()].unk0d4_00 = false;
@ -1739,7 +1739,7 @@ void func0f14cf6c(void)
case 4:
case 5:
case 6:
pak0f1171b4(func0f14a5a4(), 3, 0);
pak0f1171b4(func0f14a5a4(), PAK00C_03, 0);
g_MpPlayerNum = 0;
menuSetBanner(-1, false);
break;
@ -1762,7 +1762,7 @@ void func0f14d064(s32 index, u8 *arg1)
g_MpPlayerNum = index;
menuSetBanner(MENUBANNER_CALIBRATINGCAMERA, false);
func0f14a16c(1);
pak0f1171b4(func0f14a5a4(), 1, 1);
pak0f1171b4(func0f14a5a4(), PAK00C_01, 1);
thing->unk0f8 = 3;
return;
}
@ -1801,12 +1801,12 @@ void func0f14d064(s32 index, u8 *arg1)
}
if (thing->unk0f8 == 6) {
pak0f1171b4(func0f14a5a4(), 3, 0);
pak0f1171b4(func0f14a5a4(), PAK00C_03, 0);
thing->unk0f8 = 6;
thing->unk100 = thing->unk0fc;
g_MpPlayerNum = index;
menuSetBanner(-1, false);
pak0f1171b4(func0f14a5a4(), 3, 0);
pak0f1171b4(func0f14a5a4(), PAK00C_03, 0);
var8007f8dc[var800a45a0->unk000].unk0d4_04 = true;
thing->unk0f8 = 0;
}

View File

@ -22,7 +22,7 @@
#include "data.h"
#include "types.h"
s32 var800a2330[5];
s32 g_FilelistKnownPlugCounts[5];
struct filelist *g_FileLists[MAX_PLAYERS] = { NULL };
bool var80075bd0[] = { true, true, true, true };
@ -60,7 +60,7 @@ void filelistCreate(s32 listnum, u8 filetype)
g_FileLists[listnum]->filetype = filetype;
if (var80062944 == 0) {
joy0001398c(3);
joySetPfsPollInterval(3);
}
var80062944 = 1;
@ -92,9 +92,9 @@ s32 filelistFindOrCreate(u8 filetype)
}
#if VERSION >= VERSION_NTSC_1_0
void func0f110d90(s32 device)
void filelistInvalidatePak(s32 device)
{
var800a2330[device] = -1;
g_FilelistKnownPlugCounts[device] = -1;
}
#endif
@ -103,36 +103,36 @@ void filelistsTick(void)
u32 updateall;
u32 update;
s32 i;
static bool var80075bf4 = false;
static bool doneinit = false;
if (!var80075bf4) {
for (i = 0; i < ARRAYCOUNT(var800a2330); i++) {
var800a2330[i] = -1;
if (!doneinit) {
for (i = 0; i < ARRAYCOUNT(g_FilelistKnownPlugCounts); i++) {
g_FilelistKnownPlugCounts[i] = -1;
}
var80075bf4 = true;
doneinit = true;
}
#if VERSION >= VERSION_NTSC_1_0
for (i = 0, updateall = false; i < ARRAYCOUNT(var800a2330); i++) {
if (pak0f1167d8(i) && var800a2330[i] != pakGetUnk264(i)) {
for (i = 0, updateall = false; i < ARRAYCOUNT(g_FilelistKnownPlugCounts); i++) {
if (pak0f1167d8(i) && pakGetPlugCount(i) != g_FilelistKnownPlugCounts[i]) {
updateall = true;
var800a2330[i] = pakGetUnk264(i);
g_FilelistKnownPlugCounts[i] = pakGetPlugCount(i);
}
}
#else
for (i = 0, updateall = false; i < ARRAYCOUNT(var800a2330); i++) {
s32 tmp = pakGetUnk264(i);
for (i = 0, updateall = false; i < ARRAYCOUNT(g_FilelistKnownPlugCounts); i++) {
s32 plugcount = pakGetPlugCount(i);
pak0f11698c(i);
if (pak0f1167d8(i)) {
tmp = 0;
plugcount = 0;
}
if (var800a2330[i] != tmp) {
if (g_FilelistKnownPlugCounts[i] != plugcount) {
updateall = true;
var800a2330[i] = tmp;
g_FilelistKnownPlugCounts[i] = plugcount;
}
}
#endif

View File

@ -2187,7 +2187,7 @@ MenuItemHandlerResult pakDeleteGameNoteMenuHandler(s32 operation, struct menuite
g_Menus[g_MpPlayerNum].fm.device1 = g_Menus[g_MpPlayerNum].fm.device;
if (result) {
if (result != PAK_ERR1_OK) {
filemgrPushErrorDialog(FILEERROR_DELETENOTEFAILED);
}
}
@ -2314,14 +2314,14 @@ MenuDialogHandlerResult pakGameNotesMenuDialog(s32 operation, struct menudialogd
if (operation == MENUOP_TICK) {
if (g_Menus[g_MpPlayerNum].curdialog
&& g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) {
s32 value = pak0f1168c4(g_Menus[g_MpPlayerNum].fm.device, &g_EditingPak);
PakErr1 ret = pak0f1168c4(g_Menus[g_MpPlayerNum].fm.device, &g_EditingPak);
if (value) {
if (ret != PAK_ERR1_OK) {
menuCloseDialog();
g_EditingPak = NULL;
g_Menus[g_MpPlayerNum].fm.device1 = g_Menus[g_MpPlayerNum].fm.device;
if (value == 1) {
if (ret == PAK_ERR1_NOPAK) {
filemgrPushErrorDialog(FILEERROR_PAKREMOVED);
}
@ -2403,7 +2403,7 @@ char *pakMenuTextEditingPakName(struct menuitem *item)
MenuItemHandlerResult pakSelectionMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_CHECKDISABLED) {
if (!pakIsMemoryPak((s8)item->param)) {
if (!mempakIsOkay((s8)item->param)) {
return true;
}
}
@ -2426,7 +2426,7 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
#if VERSION >= VERSION_NTSC_1_0
switch (operation) {
case MENUOP_OPEN:
joy0001398c(3);
joySetPfsPollInterval(3);
g_Menus[g_MpPlayerNum].fm.unke24 = 0;
break;
case MENUOP_TICK:
@ -2438,20 +2438,20 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
for (i = 0; i < MAX_PLAYERS; i++) {
if (g_Menus[g_MpPlayerNum].fm.unke24 & (1 << i)) {
g_Vars.unk0004e4 &= 0xfff0;
g_Vars.unk0004e4 |= 0x0008;
g_Vars.unk0004e4 |= 1 << (i + 8);
g_Vars.pakstocheck &= 0xfff0;
g_Vars.pakstocheck |= 0x0008;
g_Vars.pakstocheck |= 1 << (i + 8);
}
}
}
joy000139c8();
joySetDefaultPfsPollInterval();
break;
}
#else
switch (operation) {
case MENUOP_OPEN:
joy0001398c(3);
joy0001398c(-1);
joySetPfsPollInterval(3);
joySetPfsPollInterval(-1);
g_Menus[g_MpPlayerNum].fm.unke24 = 0;
break;
case MENUOP_TICK:
@ -2467,7 +2467,7 @@ MenuDialogHandlerResult pakChoosePakMenuDialog(s32 operation, struct menudialogd
}
}
}
joy000139c8();
joySetDefaultPfsPollInterval();
pak0f1189d0();
break;
}

View File

@ -166,7 +166,7 @@ void gamefileLoadDefaults(struct gamefile *file)
pakSetBitflag(GAMEFILEFLAG_P1_FORWARDPITCH, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_P1_AUTOAIM, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_P1_AIMCONTROL, file->flags, AIMCONTROL_HOLD);
pakSetBitflag(GAMEFILEFLAG_P1_AIMCONTROL, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_P1_SIGHTONSCREEN, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_P1_LOOKAHEAD, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_P1_AMMOONSCREEN, file->flags, true);
@ -180,7 +180,7 @@ void gamefileLoadDefaults(struct gamefile *file)
pakSetBitflag(GAMEFILEFLAG_P2_FORWARDPITCH, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_P2_AUTOAIM, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_P2_AIMCONTROL, file->flags, AIMCONTROL_HOLD);
pakSetBitflag(GAMEFILEFLAG_P2_AIMCONTROL, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_P2_SIGHTONSCREEN, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_P2_LOOKAHEAD, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_P2_AMMOONSCREEN, file->flags, true);
@ -198,8 +198,8 @@ void gamefileLoadDefaults(struct gamefile *file)
pakSetBitflag(GAMEFILEFLAG_P2_SHOWMISSIONTIME, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_P2_PAINTBALL, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_SCREENSPLIT, file->flags, SCREENSPLIT_HORIZONTAL);
pakSetBitflag(GAMEFILEFLAG_SCREENRATIO, file->flags, SCREENRATIO_NORMAL);
pakSetBitflag(GAMEFILEFLAG_SCREENSPLIT, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_SCREENRATIO, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_SCREENSIZE_CINEMA, file->flags, false);
pakSetBitflag(GAMEFILEFLAG_SCREENSIZE_WIDE, file->flags, false);
@ -215,7 +215,7 @@ void gamefileLoadDefaults(struct gamefile *file)
pakSetBitflag(GAMEFILEFLAG_COOPRADARON, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_COOPFRIENDLYFIRE, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_ANTIRADARON, file->flags, true);
pakSetBitflag(GAMEFILEFLAG_ANTIPLAYERNUM, file->flags, 1);
pakSetBitflag(GAMEFILEFLAG_ANTIPLAYERNUM, file->flags, true);
#if VERSION >= VERSION_PAL_BETA
pakSetBitflag(GAMEFILEFLAG_LANGBIT1, g_GameFile.flags, ((g_Vars.language & 0x01) == 0x01));

View File

@ -241,7 +241,7 @@ void lvReset(s32 stagenum)
var80084010 = 0;
#if VERSION >= VERSION_NTSC_1_0
joy00013900();
joyLockCyclicPolling();
g_Vars.joydisableframestogo = 10;
#else
@ -252,8 +252,8 @@ void lvReset(s32 stagenum)
}
#endif
g_Vars.paksconnected2 = 0;
g_Vars.paksconnected = 0;
g_Vars.paksneededforgame = 0;
g_Vars.paksneededformenu = 0;
g_Vars.stagenum = stagenum;
cheatsReset();
@ -1997,7 +1997,7 @@ void lvTick(void)
lvCheckPauseStateChanged();
#if VERSION >= VERSION_NTSC_1_0
if (g_Vars.unk0004e4) {
if (g_Vars.pakstocheck) {
paksTick();
}
#endif
@ -2006,7 +2006,7 @@ void lvTick(void)
g_Vars.joydisableframestogo--;
} else if (g_Vars.joydisableframestogo == 0) {
#if VERSION >= VERSION_NTSC_1_0
joy00013938();
joyUnlockCyclicPolling();
#else
if (!joyIsCyclicPollingEnabled()) {
joyEnableCyclicPolling(3278, "lv.c");
@ -2017,9 +2017,9 @@ void lvTick(void)
|| g_Vars.stagenum == STAGE_BOOTPAKMENU
|| g_Vars.stagenum == STAGE_CREDITS
|| g_Vars.stagenum == STAGE_4MBMENU) {
g_Vars.paksconnected2 = 0;
g_Vars.paksneededforgame = 0;
} else {
g_Vars.paksconnected2 = 31;
g_Vars.paksneededforgame = 0x1f;
pakEnableRumbleForAllPlayers();
}

View File

@ -5623,7 +5623,7 @@ MenuDialogHandlerResult menudialog000fcd48(s32 operation, struct menudialogdef *
if (operation == MENUOP_TICK) {
if (g_Menus[g_MpPlayerNum].curdialog
&& g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef
&& joy000155b4(g_Menus[g_MpPlayerNum].fm.device3) == 0) {
&& joyGetPakState(g_Menus[g_MpPlayerNum].fm.device3) == PAKSTATE_NOPAK) {
func0f0f3704(&g_PakRemovedMenuDialog);
}
}
@ -5655,12 +5655,12 @@ MenuItemHandlerResult menuhandlerRepairPak(s32 operation, struct menuitem *item,
return 0;
}
void func0f0fce8c(struct menudialogdef *dialogdef, s32 playernum, s32 arg2)
void menuPushPakDialogForPlayer(struct menudialogdef *dialogdef, s32 playernum, s32 paknum)
{
s32 prevplayernum = g_MpPlayerNum;
g_MpPlayerNum = playernum;
g_Menus[g_MpPlayerNum].fm.device3 = arg2;
g_Menus[g_MpPlayerNum].fm.device3 = paknum;
if (g_Menus[g_MpPlayerNum].curdialog == NULL) {
if (PLAYERCOUNT() == 1) {
@ -5880,11 +5880,11 @@ MenuItemHandlerResult menuhandlerRetrySavePak(s32 operation, struct menuitem *it
menuPopDialog();
#if VERSION >= VERSION_NTSC_1_0
g_Vars.unk0004e4 &= 0xfff0;
g_Vars.unk0004e4 |= 8;
g_Vars.unk0004e4 |= 1 << ((u8)g_Menus[g_MpPlayerNum].fm.device3 + 8);
g_Vars.pakstocheck &= 0xfff0;
g_Vars.pakstocheck |= 0x0008;
g_Vars.pakstocheck |= 1 << ((u8)g_Menus[g_MpPlayerNum].fm.device3 + 8);
#else
pak0f1169c8(g_Menus[g_MpPlayerNum].fm.device3, 0);
pak0f1169c8(g_Menus[g_MpPlayerNum].fm.device3, false);
#endif
}
@ -5904,18 +5904,18 @@ MenuItemHandlerResult menuhandlerWarnRepairPak(s32 operation, struct menuitem *i
return 0;
}
u32 func0f0fd118(u32 playernum)
s32 menuPakNumToPlayerNum(s32 paknum)
{
u32 result = 0;
if (g_Vars.normmplayerisrunning) {
if (g_MpSetup.chrslots & (1 << playernum)) {
result = playernum;
if (g_MpSetup.chrslots & (1 << paknum)) {
result = paknum;
}
} else {
if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0)
&& PLAYERCOUNT() >= 2
&& playernum == 1) {
&& paknum == 1) {
result = 1;
}
}
@ -5923,9 +5923,9 @@ u32 func0f0fd118(u32 playernum)
return result;
}
bool func0f0fd1f4(s32 arg0, s32 arg1)
bool menuIsReadyForPakError(s32 paknum, s32 pakerrordialog)
{
s32 playernum = func0f0fd118(arg0);
s32 playernum = menuPakNumToPlayerNum(paknum);
bool result = true;
if (g_Vars.lvframenum < 20) {
@ -5950,8 +5950,7 @@ bool func0f0fd1f4(s32 arg0, s32 arg1)
|| g_Menus[playernum].curdialog->definition == &g_PakAttemptRepairMenuDialog
|| g_Menus[playernum].curdialog->definition == &g_PakRemovedMenuDialog
|| g_Menus[playernum].curdialog->definition == &g_PakRepairSuccessMenuDialog
|| g_Menus[playernum].curdialog->definition == &g_PakRepairFailedMenuDialog
) {
|| g_Menus[playernum].curdialog->definition == &g_PakRepairFailedMenuDialog) {
result = false;
}
} else if (g_MenuData.nextbg != 255 || g_MenuData.bg || g_MenuData.unk5d4) {
@ -5961,21 +5960,21 @@ bool func0f0fd1f4(s32 arg0, s32 arg1)
return result;
}
void func0f0fd320(s32 arg0, s32 arg1)
void menuPushPakErrorDialog(s32 paknum, s32 pakerrordialog)
{
s32 prevplayernum = g_MpPlayerNum;
s32 playernum = func0f0fd118(arg0);
s32 playernum = menuPakNumToPlayerNum(paknum);
bool found;
s32 i;
g_MpPlayerNum = playernum;
switch (arg1) {
case 1:
case 2:
func0f0fce8c(&g_PakDamagedMenuDialog, playernum, arg0);
switch (pakerrordialog) {
case PAKERRORDIALOG_CORRUPT:
case PAKERRORDIALOG_DEVICEERROR:
menuPushPakDialogForPlayer(&g_PakDamagedMenuDialog, playernum, paknum);
break;
case 0:
case PAKERRORDIALOG_FULL:
found = false;
for (i = 0; i < g_Menus[g_MpPlayerNum].depth; i++) {
@ -5986,15 +5985,15 @@ void func0f0fd320(s32 arg0, s32 arg1)
}
if (!found) {
func0f0fce8c(&g_PakFullMenuDialog, playernum, arg0);
menuPushPakDialogForPlayer(&g_PakFullMenuDialog, playernum, paknum);
}
break;
#if VERSION >= VERSION_NTSC_1_0
case 3:
func0f0fce8c(&g_PakCannotReadGameBoyMenuDialog, playernum, arg0);
case PAKERRORDIALOG_GB_UNREADABLE:
menuPushPakDialogForPlayer(&g_PakCannotReadGameBoyMenuDialog, playernum, paknum);
break;
case 4:
func0f0fce8c(&g_PakDataLostMenuDialog, playernum, arg0);
case PAKERRORDIALOG_DATALOST:
menuPushPakDialogForPlayer(&g_PakDataLostMenuDialog, playernum, paknum);
break;
#endif
}

View File

@ -32,7 +32,7 @@ void menuStop(void)
if (var80062944) {
var80062944 = 0;
var80062948 = 0;
joy000139c8();
joySetDefaultPfsPollInterval();
func0f110bf8();
}
}

View File

@ -697,7 +697,7 @@ void menuTick(void)
}
}
g_Vars.paksconnected = 0;
g_Vars.paksneededformenu = 0;
for (i = 0; i < PLAYERCOUNT(); i++) {
s32 mpindex = -1;
@ -731,7 +731,7 @@ void menuTick(void)
case MENUROOT_4MBMAINMENU:
case MENUROOT_TRAINING:
if (g_Menus[mpindex].curdialog) {
g_Vars.paksconnected = 0x1f;
g_Vars.paksneededformenu = 0x1f;
}
break;
}

File diff suppressed because it is too large Load Diff

View File

@ -3264,33 +3264,57 @@
#define PADFLAG_AIDUCK 0x10000
#define PADFLAG_AIBOTINUSE 0x20000
#define PAK010_00 0
#define PAK010_01 1
#define PAK010_02 2
#define PAK010_03 3
#define PAK010_04 4
#define PAK010_05 5
#define PAK010_06 6
#define PAK010_07 7
#define PAK010_08 8
#define PAK010_09 9
#define PAK010_10 10
#define PAK010_11 11
#define PAK010_12 12
#define PAK010_13 13
#define PAK010_14 14
#define PAK010_15 15
#define PAK010_16 16
#define PAK010_17 17
#define PAK010_18 18
#define PAK010_19 19
#define PAK010_20 20
#define PAK010_21 21
#define PAK010_22 22
#define PAK010_24 24
#define PAK010_25 25
#define PAK010_26 26
#define PAK010_27 27
#define PAK008_00 0
#define PAK008_01 1
#define PAK008_02 2
#define PAK008_03 3
#define PAK008_04 4
#define PAK008_05 5
#define PAK008_06 6
#define PAK008_07 7
#define PAK008_08 8
#define PAK008_09 9
#define PAK008_11 11
#define PAK008_12 12
#define PAK00C_00 0
#define PAK00C_01 1
#define PAK00C_02 2
#define PAK00C_03 3
#define PAKERRORDIALOG_FULL 0
#define PAKERRORDIALOG_CORRUPT 1
#define PAKERRORDIALOG_DEVICEERROR 2
#define PAKERRORDIALOG_GB_UNREADABLE 3
#define PAKERRORDIALOG_DATALOST 4
#define PAKSTATE_NOPAK 0
#define PAKSTATE_UNPLUGGING 1
#define PAKSTATE_PROBE 2
#define PAKSTATE_MEM_DISPATCH 3
#define PAKSTATE_MEM_PRE_PREPARE 4
#define PAKSTATE_MEM_PREPARE 5
#define PAKSTATE_MEM_POST_PREPARE 6
#define PAKSTATE_07 7
#define PAKSTATE_GB_PRE_PREPARE 8
#define PAKSTATE_GB_PREPARE 9
#define PAKSTATE_GB_POST_PREPARE1 10
#define PAKSTATE_READY 11
#define PAKSTATE_12 12
#define PAKSTATE_13 13
#define PAKSTATE_MEM_ENTER_DEVICEERROR 14
#define PAKSTATE_MEM_ENTER_CORRUPT 15
#define PAKSTATE_MEM_ENTER_FULL 16
#define PAKSTATE_17 17
#define PAKSTATE_18 18
#define PAKSTATE_MEM_DEVICEERROR 19
#define PAKSTATE_MEM_CORRUPT 20
#define PAKSTATE_MEM_FULL 21
#define PAKSTATE_22 22
#define PAKSTATE_GB_POST_PREPARE2 24
#define PAKSTATE_GB_POST_PREPARE3 25
#define PAKSTATE_GB_OPEN_UNREADABLE 26
#define PAKSTATE_GB_IDLE_UNREADABLE 27
#define PAK_ERR1_OK 0
#define PAK_ERR1_NOPAK PFS_ERR_NOPACK /* no memory card is plugged */

View File

@ -38,7 +38,7 @@ extern s32 g_SoundMode;
extern s32 g_SndNumPlaying;
extern struct audiorussmapping g_AudioRussMappings[];
extern struct audioconfig g_AudioConfigs[];
extern bool var8005eedc;
extern bool g_JoyPfsPollMasterEnabled;
extern f32 var8005ef10[2];
extern s32 g_NumGlobalAilists;
extern s32 g_NumLvAilists;

View File

@ -8,7 +8,7 @@ void func0f110bf0(void);
void func0f110bf8(void);
void filelistCreate(s32 listnum, u8 filetype);
s32 filelistFindOrCreate(u8 filetype);
void func0f110d90(s32 device);
void filelistInvalidatePak(s32 device);
void filelistsTick(void);
void filelistUpdate(struct filelist *list);

View File

@ -97,11 +97,11 @@ Gfx *menuRenderBackgroundLayer2(Gfx *gdl, u8 bg, f32 frac);
Gfx *menuRender(Gfx *gdl);
u32 menuChooseMusic(void);
u32 menuGetRoot(void);
void func0f0fce8c(struct menudialogdef *dialogdef, s32 playernum, s32 arg2);
void menuPushPakDialogForPlayer(struct menudialogdef *dialogdef, s32 playernum, s32 arg2);
char *menuTextSaveDeviceName(struct menuitem *item);
u32 func0f0fd118(u32 arg0);
bool func0f0fd1f4(s32 device, s32 arg1);
void func0f0fd320(s32 arg0, s32 arg1);
s32 menuPakNumToPlayerNum(s32 paknum);
bool menuIsReadyForPakError(s32 device, s32 arg1);
void menuPushPakErrorDialog(s32 arg0, s32 arg1);
void func0f0fd494(struct coord *pos);
void func0f0fd548(s32 arg0);
struct menudialog *menuIsDialogOpen(struct menudialogdef *dialogdef);

View File

@ -9,29 +9,29 @@ u32 pakAlign(s8 device, u32 size);
s32 pakGetAlignedFileLenByBodyLen(s8 device, u32 bodylen);
u32 pakGetBodyLenByFileLen(u32 filelen);
u32 pakGenerateSerial(s8 device);
bool pakIsMemoryPak(s8 device);
bool mempakIsOkay(s8 device);
s32 pakGetFileIdsByType(s8 device, u32 filetype, u32 *fileids);
s32 pak0f1167d8(s8 device);
s32 pakReadBodyAtGuid(s8 device, s32 fileid, u8 *body, s32 arg3);
s32 pakSaveAtGuid(s8 device, s32 fileid, s32 filetype, u8 *body, s32 *outfileid, u8 *olddata);
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);
PakErr1 pakDeleteGameNote(s8 device, u16 company_code, u32 game_code, char *game_name, char *ext_name);
PakErr1 pak0f1168c4(s8 device, struct pakdata **arg1);
s32 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 pak0f1169c8(s8 device, bool tick);
bool mempakIsReady(s8 device);
bool mempakIsReadyOrFull(s8 device);
void pak0f116bdc(s8 device, u8 *arg1, u8 *arg2);
u16 _pakGetSerial(s8 device);
u32 _pakGetType(s8 device);
void pakSetUnk010(s8 device, s32 value);
void pakSetState(s8 device, s32 value);
s32 pak0f116df0(s8 device, struct pakdata **arg1);
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);
s32 pakGetPlugCount(s8 device);
u32 pakGetMaxFileSize(s8 device);
s32 pakGetBodyLenByType(s8 device, u32 filetype);
void pak0f117150(s8 device, u8 *ptr);
@ -91,8 +91,8 @@ void pakCreateInitialFiles(s8 device);
s32 pakFindMaxFileId(s8 device);
void pakMergeBlanks(s8 device);
void paksReset(void);
void pak0f11a32c(s8 device, u8 arg1, u32 line, char *file);
void pakInit(s8 arg0);
void pakSetFeatures(s8 device, u8 features, u32 line, char *file);
void pakSetDefaults(s8 arg0);
PakErr1 pakReadWriteBlock(s8 device, OSPfs *pfs, s32 file_no, u8 flag, u32 address, u32 len, u8 *buffer);
bool pakQueryTotalUsage(s8 device);
void pakQueryPdSize(s8 device);
@ -111,7 +111,7 @@ bool pakHandleResult(s32 err1, s8 device, bool arg2, u32 line);
void paksTick(void);
void pak0f11c6d0(void);
void pakExecuteDebugOperations(void);
void pak0f11ca30(void);
void pakCheckPlugged(void);
void gbpakHandleError(u32 arg0);
bool gbpakRead(s8 device, u16 address, u8 *buffer, u16 size);
bool gbpakWrite(s8 device, u16 address, u8 *buffer, u16 size);
@ -140,7 +140,7 @@ void pakEnableRumbleForPlayer(s8 playernum);
void pakDisableRumbleForAllPlayers(void);
void pakEnableRumbleForAllPlayers(void);
void pakDumpPak(void);
void pak0f11df94(s8 device);
void pakTickState(s8 device);
void pak0f11e3bc(s8 device);
void pakProbeEeprom(void);
PakErr1 pakReadEeprom(u8 address, u8 *buffer, u32 len);

View File

@ -4,15 +4,15 @@
#include "data.h"
#include "types.h"
void joy00013900(void);
void joy00013938(void);
void joy00013974(u32 value);
u32 joy00013980(void);
void joy0001398c(s32 value);
void joy000139c8(void);
void joyLockCyclicPolling(void);
void joyUnlockCyclicPolling(void);
void joySetPfsPollEnabled(bool enabled);
bool joyIsPfsPollEnabled(void);
void joySetPfsPollInterval(s32 value);
void joySetDefaultPfsPollInterval(void);
s32 joyShiftPfsStates(void);
void joyRecordPfsState(u8 pfsstate);
void joyCheckPfs(s32 arg0);
void joyPollPfs(s32 force);
void joySetPfsTemporarilyPlugged(s8 index);
void joyInit(void);
void joyDisableTemporarily(void);
@ -49,8 +49,8 @@ void joyEnableCyclicPolling(s32 line, char *file);
void joyDestroy(void);
void joyGetContpadNumsForPlayer(s8 playernum, s32 *pad1, s32 *pad2);
void joyStopRumble(s8 device, bool disablepolling);
s32 joy000155b4(s8 device);
s32 joy000155f4(s8 device);
s32 joyGetPakState(s8 device);
s32 joyGetPakState2(s8 device);
void joysTickRumble(void);
#endif

View File

@ -223,8 +223,8 @@ struct g_vars {
/*0x4b8*/ struct prop *aibuddies[4];
/*0x4c8*/ u32 dontplaynrg; // allow X music to be played (NRG = energy track)
/*0x4cc*/ s32 in_cutscene;
/*0x4d0*/ u8 paksconnected;
/*0x4d1*/ u8 paksconnected2;
/*0x4d0*/ u8 paksneededformenu;
/*0x4d1*/ u8 paksneededforgame;
/*0x4d2*/ s8 autocutnum; // cutscene scene number (0, 1 or 2), set to -1 while loading cutscene
/*0x4d3*/ s8 autocutplaying; // true if playing a cutscene via the menu, false when a button is pressed
/*0x4d4*/ s8 autocutgroupcur; // index into g_Cutscenes
@ -239,9 +239,9 @@ struct g_vars {
/*0x4e3*/ u8 langfilteron;
// 000f = Counter: if 10-15 then ticks down 1 per 7 frames, if under 10 then 1 per frame.
// 00f0 = One bit per pak. Does something with the pak if counter expired.
// 0f00 = One bit per pak. Does something with the pak if counter expired (likely opposite of the above).
/*0x4e4*/ u16 unk0004e4;
// 00f0 = One bit per pak. These paks are checked and ticked.
// 0f00 = One bit per pak. These paks are checked but not ticked.
/*0x4e4*/ u16 pakstocheck;
/*0x4e8*/ u32 unk0004e8;
/*0x4ec*/ u32 unk0004ec;
@ -4688,12 +4688,12 @@ struct pak {
/*0x004*/ u32 rumblestate;
/*0x008*/ u32 unk008;
/*0x00c*/ u32 unk00c;
/*0x010*/ s32 unk010;
/*0x014*/ u8 unk014;
/*0x010*/ s32 state;
/*0x014*/ u8 features;
/*0x018*/ struct pakdata pakdata;
/*0x25c*/ u32 maxfileid;
/*0x260*/ u32 serial;
/*0x264*/ u32 unk264;
/*0x264*/ u32 plugcount;
/*0x268*/ u32 unk268;
/*0x26c*/ u32 unk26c;
/*0x270*/ u32 unk270;
@ -4720,7 +4720,7 @@ struct pak {
/*0x2b8*/ u8 isgbpd : 1;
/*0x2b8*/ u8 unk2b8_05 : 1;
/*0x2b8*/ u8 unk2b8_06 : 1;
/*0x2b8*/ u8 unk2b8_07 : 1;
/*0x2b8*/ u8 showdatalost : 1;
/*0x2b9*/ u8 unk2b9;
/*0x2ba*/ u8 unk2ba;
/*0x2bb*/ u8 unk2bb;

View File

@ -101,84 +101,66 @@ u32 var8005eed4 = 0;
u8 var8005eed8 = 0;
#if VERSION >= VERSION_NTSC_1_0
bool var8005eedc = true;
s32 var8005eee0 = 0;
s32 var8005eee4 = -1;
u32 var8005eee8 = 0;
u32 var8005eeec = 0;
u32 var8005eef0 = 1;
bool g_JoyPfsPollMasterEnabled = true;
s32 g_JoyPfsPollInterval = 0;
s32 g_JoyPfsPollTimeRemaining = -1;
u32 g_JoyPfsPollCount = 0;
bool g_JoyPfsPollEnabled = false;
bool g_JoyCyclicPollingLocked = true;
#else
u32 var800612c8nb = 3;
u8 var800612ccnb = 0;
#endif
#if VERSION >= VERSION_NTSC_1_0
void joy00013900(void)
void joyLockCyclicPolling(void)
{
if (var8005eef0) {
if (g_JoyCyclicPollingLocked) {
joyDisableCyclicPolling();
var8005eef0 = false;
g_JoyCyclicPollingLocked = false;
}
}
void joy00013938(void)
void joyUnlockCyclicPolling(void)
{
if (!var8005eef0) {
if (!g_JoyCyclicPollingLocked) {
joyEnableCyclicPolling();
var8005eef0 = true;
g_JoyCyclicPollingLocked = true;
}
}
void joy00013974(u32 value)
void joySetPfsPollEnabled(bool enabled)
{
var8005eeec = value;
g_JoyPfsPollEnabled = enabled;
}
bool joyIsPfsPollEnabled(void)
{
return g_JoyPfsPollEnabled;
}
#endif
#if VERSION >= VERSION_NTSC_1_0
u32 joy00013980(void)
{
return var8005eeec;
}
#endif
/**
* Note: Some of the variables in this file are misnamed in NTSC beta.
* @TODO: Untangle these.
*/
void joy0001398c(s32 value)
void joySetPfsPollInterval(s32 value)
{
#if VERSION >= VERSION_NTSC_1_0
var8005eee4 = var8005eee0 = value * 11000;
g_JoyPfsPollTimeRemaining = g_JoyPfsPollInterval = value * 11000;
#else
g_JoyNextPfsStateIndex = value;
#endif
}
void joy000139c8(void)
void joySetDefaultPfsPollInterval(void)
{
joy0001398c(VERSION >= VERSION_NTSC_1_0 ? 10 : 30);
joySetPfsPollInterval(VERSION >= VERSION_NTSC_1_0 ? 10 : 30);
}
#if VERSION < VERSION_NTSC_1_0
// Same function as the one a couple above, just relocated
u32 joy00013980(void)
{
#if VERSION >= VERSION_NTSC_1_0
return var8005eeec;
#else
return var8005eed8;
#endif
}
#endif
#if VERSION >= VERSION_NTSC_1_0
/**
* Remove an item from the beginning of the g_JoyPfsStates array,
* shift the rest of the array back and return the removed item.
*/
s32 joyShiftPfsStates(void)
{
#if VERSION >= VERSION_NTSC_1_0
s32 pfsstate = 0;
s32 i;
@ -195,8 +177,10 @@ s32 joyShiftPfsStates(void)
}
return pfsstate;
}
#else
return var8005eed8;
#endif
}
#if VERSION >= VERSION_NTSC_1_0
void joyRecordPfsState(u8 pfsstate)
@ -215,68 +199,69 @@ void joyRecordPfsState(u8 pfsstate)
#if VERSION >= VERSION_NTSC_1_0
/**
* Scan controllers for controller paks, but only under certain conditions.
* Seems to be timer based, or can be forced by passing 2 as arg0.
*
* force 0 = poll based on the configured poll frequency and if not disabled
* force 1 = poll based on the configured poll frequency even if disabled
* force 2 = poll now
*/
void joyCheckPfs(s32 arg0)
void joyPollPfs(s32 force)
{
static u32 thiscount = 0; // 8005eef4
static u32 prevcount = 0; // 8005eef8
static u32 doingit = false; // 8005eefc
static u32 thiscount = 0;
static u32 prevcount = 0;
static u32 doingit = false;
u32 diffcount;
u32 value;
if (var8005eedc
&& (arg0 == 2 || (var8005eee0 && (arg0 || ((g_JoyCyclicPollDisableCount == 0 || var8005eef0 == 0) && var8005eeec))))
if (g_JoyPfsPollMasterEnabled
&& (force == 2 || (g_JoyPfsPollInterval && (force || ((g_JoyCyclicPollDisableCount == 0 || !g_JoyCyclicPollingLocked) && g_JoyPfsPollEnabled))))
&& !doingit) {
doingit = true;
prevcount = thiscount;
thiscount = osGetCount();
diffcount = (thiscount - prevcount) / 256;
value = var8005eee0 * 2;
value = g_JoyPfsPollInterval * 2;
if (diffcount > value) {
diffcount = value;
}
var8005eee4 -= diffcount;
g_JoyPfsPollTimeRemaining -= diffcount;
if (var8005eee4 < 0
|| arg0 == 2
|| (arg0 == 1 && var8005eee4 < 0 && var8005eee0 < -var8005eee4)) {
if (g_JoyPfsPollTimeRemaining < 0
|| force == 2
|| (force == 1 && g_JoyPfsPollTimeRemaining < 0 && -g_JoyPfsPollTimeRemaining > g_JoyPfsPollInterval)) {
u8 bitpattern = 0;
var8005eee8++;
g_JoyPfsPollCount++;
if (arg0) {
if (force) {
joyDisableCyclicPolling();
}
osPfsIsPlug(&g_PiMesgQueue, &bitpattern);
if (arg0) {
if (force) {
joyEnableCyclicPolling();
}
bitpattern |= 0x10;
bitpattern |= 0x10; // eeprom
joyRecordPfsState(bitpattern);
var8005eee4 = var8005eee0;
g_JoyPfsPollTimeRemaining = g_JoyPfsPollInterval;
}
doingit = false;
}
#if VERSION < VERSION_PAL_BETA
if (arg0) {
// empty
}
if (force);
#endif
}
#endif
/**
* "Temporarily" because the next time joyCheckPfs runs, the true state will be
* "Temporarily" because the next time joyPollPfs runs, the true state will be
* recorded.
*
* Note that var8005eed8 is always zero, so this record will suggest that this
@ -527,8 +512,8 @@ void joy00014238(void)
doingit = true;
for (i = 0; i < NUM_PADS; i++) {
if (joy000155f4(i) == PAK010_13) {
pakSetUnk010(i, PAK010_11);
if (joyGetPakState2(i) == PAKSTATE_13) {
pakSetState(i, PAKSTATE_READY);
}
}
@ -551,8 +536,8 @@ void joyDebugJoy(void)
#endif
#if VERSION >= VERSION_NTSC_1_0
if (g_Vars.paksconnected) {
joyCheckPfs(1);
if (g_Vars.paksneededformenu) {
joyPollPfs(1);
}
#endif
@ -652,7 +637,7 @@ void joysHandleRetrace(void)
var8005ee68++;
#if VERSION >= VERSION_NTSC_1_0
joyCheckPfs(0);
joyPollPfs(0);
#endif
return;
}
@ -678,7 +663,7 @@ void joysHandleRetrace(void)
if (g_JoyInitDone) {
#if VERSION >= VERSION_NTSC_1_0
if (var8005ee68) {
joyCheckPfs(0);
joyPollPfs(0);
return;
}
#endif
@ -701,7 +686,7 @@ void joysHandleRetrace(void)
joy00014238();
#if VERSION >= VERSION_NTSC_1_0
joyCheckPfs(0);
joyPollPfs(0);
#else
joy0001509cnb();
#endif
@ -1078,14 +1063,14 @@ void joyStopRumble(s8 arg0, bool disablepolling)
}
}
s32 joy000155b4(s8 device)
s32 joyGetPakState(s8 device)
{
return g_Paks[device].unk010;
return g_Paks[device].state;
}
s32 joy000155f4(s8 device)
s32 joyGetPakState2(s8 device)
{
return joy000155b4(device);
return joyGetPakState(device);
}
void joysTickRumble(void)
@ -1093,7 +1078,7 @@ void joysTickRumble(void)
s32 i;
for (i = 0; i < NUM_PADS; i++) {
if (g_Paks[i].unk010 == PAK010_11 && g_Paks[i].type == PAKTYPE_RUMBLE) {
if (g_Paks[i].state == PAKSTATE_READY && g_Paks[i].type == PAKTYPE_RUMBLE) {
switch (g_Paks[i].rumblestate) {
case RUMBLESTATE_ENABLED_STARTING:
g_Paks[i].rumblestate = RUMBLESTATE_ENABLED_RUMBLING;

View File

@ -768,7 +768,7 @@ void mainLoop(void)
if (g_DoBootPakMenu) {
#if VERSION >= VERSION_NTSC_1_0
g_Vars.unk0004e4 = 0xfd;
g_Vars.pakstocheck = 0xfd;
#endif
g_StageNum = STAGE_BOOTPAKMENU;
}