Document PAKFILETYPE_TERMINATOR and related piracy check

This commit is contained in:
Ryan Dwyer 2021-09-19 13:48:11 +10:00
parent 36e988e073
commit 453a4e344b
3 changed files with 17 additions and 13 deletions

View File

@ -564,6 +564,10 @@ void lvInit(s32 stagenum)
}
if (checksum != CHECKSUM_PLACEHOLDER) {
// This is writing a file to the start of the EEPROM data.
// The file is PAKFILETYPE_TERMINATOR, which is used internally to
// mark the end of the usable space. This effectively deletes all
// save data on the game pak and makes it permanently unusable.
u32 address = 0;
u32 buffer[4];
buffer[0] = 0xbb8b80bd;

View File

@ -563,7 +563,7 @@ s32 pakGetBodyLenByType(s8 device, u32 filetype)
case PAKFILETYPE_001:
case PAKFILETYPE_002:
break;
case PAKFILETYPE_004:
case PAKFILETYPE_TERMINATOR:
len = pak0f11706c(device) - 0x10;
break;
case PAKFILETYPE_BOSS:
@ -8864,7 +8864,7 @@ s32 pakScrub(s8 device)
data[i] = random() & 0xff;
}
address = pakGetAlignedFileLenByBodyLen(device, pakGetBodyLenByType(device, PAKFILETYPE_004));
address = pakGetAlignedFileLenByBodyLen(device, pakGetBodyLenByType(device, PAKFILETYPE_TERMINATOR));
g_Paks[device].unk25c = 0x10;
#if VERSION >= VERSION_NTSC_1_0
@ -8874,7 +8874,7 @@ s32 pakScrub(s8 device)
#endif
g_Paks[device].headercachecount = 0;
pak0f11bc54(device, 0, PAKFILETYPE_004, 0, 0, 0, 0, 0, 1);
pak0f11bc54(device, 0, PAKFILETYPE_TERMINATOR, 0, 0, 0, 0, 0, 1);
result = pak0f11a504(device, PFS(device), g_Paks[device].noteindex, PFS_WRITE, address, pakGetAlignment(device), data);
@ -8922,7 +8922,7 @@ bool pak0f11b75c(s8 device, u32 *arg1)
}
#endif
if (PAKFILETYPE_004 == header.filetype) {
if (PAKFILETYPE_TERMINATOR == header.filetype) {
*arg1 = offset;
return false;
}

View File

@ -3072,15 +3072,15 @@
#define PAKERROR_EEPROM_INVALIDOP 0x83
#define PAKERROR_EEPROM_INVALIDARG 0x84
#define PAKFILETYPE_001 0x001
#define PAKFILETYPE_002 0x002
#define PAKFILETYPE_004 0x004
#define PAKFILETYPE_008 0x008 // suspected to be PerfectHead
#define PAKFILETYPE_BOSS 0x010
#define PAKFILETYPE_MPPLAYER 0x020
#define PAKFILETYPE_MPSETUP 0x040
#define PAKFILETYPE_GAME 0x080
#define PAKFILETYPE_100 0x100
#define PAKFILETYPE_001 0x001
#define PAKFILETYPE_002 0x002
#define PAKFILETYPE_TERMINATOR 0x004
#define PAKFILETYPE_008 0x008 // suspected to be PerfectHead
#define PAKFILETYPE_BOSS 0x010
#define PAKFILETYPE_MPPLAYER 0x020
#define PAKFILETYPE_MPSETUP 0x040
#define PAKFILETYPE_GAME 0x080
#define PAKFILETYPE_100 0x100
#define PATHFLAG_CIRCULAR 1
#define PATHFLAG_FLYING 2