Remove PIRACYCHECKS ifdefs
This commit is contained in:
parent
3619bcb2f2
commit
4ac661160c
|
|
@ -2466,18 +2466,6 @@ u8 func0f15b508(s32 index)
|
|||
return var800a4cd0[index];
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
u32 not(u32 arg)
|
||||
{
|
||||
return ~arg;
|
||||
}
|
||||
|
||||
u32 xorBabebabe(u32 value)
|
||||
{
|
||||
return value ^ 0xbabebabe;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
/**
|
||||
* The following two functions were surely debug code that was accidentally left
|
||||
|
|
@ -2696,23 +2684,6 @@ void bgReset(s32 stagenum)
|
|||
|
||||
g_BgSection3 = section2start + section2compsize + 4;
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 addr = not(PAL ? ~0xb0000340 : ~0xb0000454);
|
||||
u32 actualvalue;
|
||||
u32 expectedvalue = xorBabebabe((PAL ? 0x0330c820 : 0x0109082b) ^ 0xbabebabe);
|
||||
|
||||
osPiReadIo(addr, &actualvalue);
|
||||
|
||||
if (actualvalue != expectedvalue) {
|
||||
// Copy 0x40 bytes from a random location in ROM to a random
|
||||
// location in RAM. The write address can be anywhere in the
|
||||
// boot segment or in the lib segment up to modelRenderNodeDl.
|
||||
dmaExec((void *)(PHYS_TO_K0(0x1000) + (random() & 0x1fff8)), random() & 0x1fffe, 0x40);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var800a4920 = *(u32 *)g_BgPrimaryData;
|
||||
|
||||
if (var800a4920 == 0) {
|
||||
|
|
@ -3403,34 +3374,6 @@ void func0f15c920(void)
|
|||
var8007fc3c = 1;
|
||||
func0f15cd28();
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
if ((var8007fc3c & 0xff) == 0xff) {
|
||||
u32 checksum = 0;
|
||||
s32 *ptr = (s32 *)&menuTickTimers;
|
||||
s32 *end = (s32 *)&menuGetSinOscFrac;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum ^= ~*ptr;
|
||||
checksum ^= *ptr << 5;
|
||||
checksum ^= *ptr >> 15;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
ptr = (s32 *)&bgBuildTables + 20;
|
||||
|
||||
if (1) {
|
||||
end = &ptr[4];
|
||||
}
|
||||
|
||||
while (ptr < end) {
|
||||
*ptr -= 0x24e21;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void bgTick(void)
|
||||
|
|
|
|||
|
|
@ -544,31 +544,6 @@ struct prop *bodyAllocateEyespy(struct pad *pad, s16 room)
|
|||
rooms[0] = room;
|
||||
rooms[1] = -1;
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 stack[2];
|
||||
u32 checksum = 0;
|
||||
s32 *ptr = (s32 *)&lvReset;
|
||||
s32 *end = (s32 *)&lvConfigureFade;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum <<= 1;
|
||||
checksum ^= *ptr;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
s32 *ptr2 = (s32 *)_memaFree;
|
||||
s32 *end2 = (s32 *)memaInit;
|
||||
|
||||
while (ptr2 < end2) {
|
||||
ptr2[0] = 0;
|
||||
ptr2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
model = bodyAllocateModel(BODY_EYESPY, 0, 0);
|
||||
|
||||
if (model) {
|
||||
|
|
|
|||
|
|
@ -4016,31 +4016,6 @@ void bgunTickGunLoad(void)
|
|||
|
||||
osSyncPrintf("BriGun: Set Load State: GUN_LOADSTATE_LOADED\n");
|
||||
player->gunctrl.gunloadstate = GUNLOADSTATE_LOADED;
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
s32 *ptr = (s32 *)&tagsReset;
|
||||
s32 *end = (s32 *)&tagFindById;
|
||||
u32 checksum = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum -= ~*ptr;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
ptr = (s32 *)&tagsReset + 3;
|
||||
|
||||
if (1);
|
||||
end = &ptr[7];
|
||||
|
||||
while (ptr < end) {
|
||||
*ptr |= 0xff;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1548,9 +1548,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
|||
}
|
||||
|
||||
if (g_Vars.currentplayer->speedboost > 1.25f) {
|
||||
#if PIRACYCHECKS
|
||||
piracyRestore();
|
||||
#endif
|
||||
g_Vars.currentplayer->speedboost = 1.25f;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -780,13 +780,6 @@ void bwalkUpdateVertical(void)
|
|||
ground = -30000;
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
if (g_Vars.currentplayer->inlift && newinlift == false) {
|
||||
// Exiting a lift
|
||||
piracyRestore();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_Vars.currentplayer->inlift && newinlift && g_Vars.currentplayer->onladder == false) {
|
||||
// Remaining in a lift
|
||||
moveamount = ground - g_Vars.currentplayer->vv_ground;
|
||||
|
|
|
|||
|
|
@ -262,13 +262,6 @@ void botSpawnAll(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
u32 add87654321(u32 value)
|
||||
{
|
||||
return value + 0x87654321;
|
||||
}
|
||||
#endif
|
||||
|
||||
u32 botPickupProp(struct prop *prop, struct chrdata *chr)
|
||||
{
|
||||
struct defaultobj *obj = prop->obj;
|
||||
|
|
@ -309,26 +302,6 @@ u32 botPickupProp(struct prop *prop, struct chrdata *chr)
|
|||
u32 padding[1];
|
||||
s32 qty;
|
||||
s32 i;
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 *ptr = (u32 *)&doorFinishClose;
|
||||
u32 *end = (u32 *)&doorSetMode;
|
||||
u32 checksum = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum += *ptr;
|
||||
checksum *= 2;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
u32 *ptr = (u32 *)chrCheckTargetInSight;
|
||||
ptr[0] = add87654321(0x24020001 - 0x87654321); // li v0, 1
|
||||
ptr[1] = add87654321(0x03e00008 - 0x87654321); // jr ra
|
||||
ptr[2] = add87654321(0x00000000 - 0x87654321); // nop
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i != 19; i++) {
|
||||
qty = crate->slots[i].quantity;
|
||||
|
|
|
|||
|
|
@ -400,30 +400,6 @@ s32 cheatMenuHandleDialog(s32 operation, struct menudialogdef *dialogdef, union
|
|||
if (gbpakIsAnyPerfectDark()) {
|
||||
gamefileSetFlag(GAMEFILEFLAG_USED_TRANSFERPAK);
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 *ptr = (u32 *)&__scHandleTasks;
|
||||
u32 *end = (u32 *)&__scHandleRSP;
|
||||
u32 checksum = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum ^= ~*ptr;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
ptr = (u32 *)&__scHandleTasks + 20;
|
||||
if (1);
|
||||
end = &ptr[4];
|
||||
|
||||
while (ptr < end) {
|
||||
*ptr = 0x00000012;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (operation == MENUOP_CLOSE) {
|
||||
|
|
|
|||
|
|
@ -1957,23 +1957,6 @@ void chrUncloak(struct chrdata *chr, bool value)
|
|||
if (value) {
|
||||
propsnd0f0939f8(0, chr->prop, SFX_CLOAK_OFF, -1, -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1);
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 checksum = 0;
|
||||
u32 *i = (u32 *)&botPickupProp;
|
||||
u32 *end = (u32 *)&botTestPropForPickup;
|
||||
|
||||
while (i < end) {
|
||||
checksum += ~*i;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
((u32 *)&cdReturnZero)[-2] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5246,23 +5229,6 @@ void chrsCheckForNoise(f32 noiseradius)
|
|||
|
||||
if (distance > 1.0f) {
|
||||
chrRecordLastHearTargetTime(&g_ChrSlots[i]);
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
s32 *i = (s32 *)&__scHandleRetrace;
|
||||
s32 *end = (s32 *)&__scHandleTasks;
|
||||
u32 checksum = 0;
|
||||
|
||||
while (i < end) {
|
||||
checksum *= 2;
|
||||
checksum += *i;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
g_HeadsAndBodies[BODY_SKEDARKING].filenum = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7527,28 +7527,6 @@ bool chrConsiderGrenadeThrow(struct chrdata *chr, u32 attackflags, u32 entityid)
|
|||
struct prop *rightprop = chrGetHeldProp(chr, HAND_RIGHT);
|
||||
struct weaponobj *weapon;
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 checksum = 0;
|
||||
s32 *i = (s32 *)&bgReset;
|
||||
s32 *end = (s32 *)&bgBuildTables;
|
||||
u32 stackpadding[1];
|
||||
|
||||
while (i < end) {
|
||||
checksum += *i;
|
||||
checksum += (*i >> 1);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
// Make player explode continuously
|
||||
g_Vars.currentplayer->bondexploding = true;
|
||||
g_Vars.currentplayer->bondnextexplode = g_Vars.lvframe60 + 120;
|
||||
g_Vars.currentplayer->bondcurexplode = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If grenade is equipped in either hand, use it
|
||||
if (rightprop) {
|
||||
weapon = rightprop->weapon;
|
||||
|
|
|
|||
|
|
@ -201,35 +201,6 @@ void explosionAlertChrs(f32 *radius, struct coord *noisepos)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 checksum = 0;
|
||||
s32 *ptr = (s32 *)&glassDestroy;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum ^= *ptr;
|
||||
checksum <<= 1;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
struct explosiontype *type = &g_ExplosionTypes[0];
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i != NUM_EXPLOSIONTYPES - 1; i++) {
|
||||
type->rangeh = 80;
|
||||
type->rangev = 60;
|
||||
type->changerateh = 15;
|
||||
type->changeratev = 5;
|
||||
type->innersize = 1500;
|
||||
type->blastradius = 200;
|
||||
type->damageradius = 3600;
|
||||
type++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exprooms,
|
||||
|
|
|
|||
|
|
@ -56,31 +56,6 @@ void menuTickTimers(void)
|
|||
if (g_Lv80SecIntervalFrac > 1.0f) {
|
||||
g_Lv80SecIntervalFrac -= 1.0f;
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 *ptr = (u32 *)&mtxGetObfuscatedRomBase;
|
||||
u32 *end = (u32 *)&mtx00016054;
|
||||
u32 checksum = 0;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum ^= ~*ptr;
|
||||
checksum <<= 1;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
u32 *ptr = (u32 *)&bgReset;
|
||||
ptr += random() % 0x40;
|
||||
end = &ptr[4];
|
||||
|
||||
while (ptr < end) {
|
||||
*ptr = 0x00000012;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -457,34 +457,6 @@ void lvReset(s32 stagenum)
|
|||
var80084018 = 1;
|
||||
schedResetArtifacts();
|
||||
lvSetPaused(0);
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 checksum = 0;
|
||||
s32 *i = (s32 *)&lvGetSlowMotionType;
|
||||
s32 *end = (s32 *)&lvTick;
|
||||
|
||||
while (i < end) {
|
||||
checksum += *i;
|
||||
i++;
|
||||
}
|
||||
|
||||
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;
|
||||
buffer[1] = 0xffffffff;
|
||||
buffer[2] = 0x020f0100;
|
||||
buffer[3] = 0xcd31100b;
|
||||
osEepromLongWrite(&g_PiMesgQueue, address, (u8 *)&buffer, 0x10);
|
||||
g_Paks[SAVEDEVICE_GAMEPAK].headercachecount = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void lvConfigureFade(u32 color, s16 num_frames)
|
||||
|
|
@ -1849,20 +1821,6 @@ void lvUpdateSoloHandicaps(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
|
||||
#if PAL
|
||||
#define SUBAMOUNT 6661
|
||||
#else
|
||||
#define SUBAMOUNT 54321
|
||||
#endif
|
||||
|
||||
s32 sub54321(s32 value)
|
||||
{
|
||||
return value - SUBAMOUNT;
|
||||
}
|
||||
#endif
|
||||
|
||||
void lvUpdateCutsceneTime(void)
|
||||
{
|
||||
if (g_Vars.in_cutscene) {
|
||||
|
|
@ -1875,30 +1833,6 @@ void lvUpdateCutsceneTime(void)
|
|||
|
||||
s32 lvGetSlowMotionType(void)
|
||||
{
|
||||
#if PIRACYCHECKS
|
||||
#if PAL
|
||||
u32 addr = sub54321(0xb0000340 + SUBAMOUNT);
|
||||
u32 actual;
|
||||
u32 expected = sub54321(0x0330c820 + SUBAMOUNT);
|
||||
#else
|
||||
u32 addr = sub54321(0xb0000a5c + SUBAMOUNT);
|
||||
u32 actual;
|
||||
u32 expected = sub54321(0x1740fff9 + SUBAMOUNT);
|
||||
#endif
|
||||
|
||||
osPiReadIo(addr, &actual);
|
||||
|
||||
if (actual != expected) {
|
||||
u32 *ptr = (u32 *)&rspbootTextStart;
|
||||
u32 *end = (u32 *)(u32)ptr + 1024;
|
||||
|
||||
while (ptr < end) {
|
||||
*ptr += 8;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_Vars.normmplayerisrunning) {
|
||||
if (g_MpSetup.options & MPOPTION_SLOWMOTION_ON) {
|
||||
return SLOWMOTION_ON;
|
||||
|
|
|
|||
|
|
@ -36,43 +36,6 @@ u32 var8009d0cc;
|
|||
s32 g_ObjectiveLastIndex = -1;
|
||||
bool g_ObjectiveChecksDisabled = false;
|
||||
|
||||
#if PIRACYCHECKS
|
||||
u32 xorBaffbeff(u32 value)
|
||||
{
|
||||
return value ^ 0xbaffbeff;
|
||||
}
|
||||
|
||||
u32 xorBabeffff(u32 value)
|
||||
{
|
||||
return value ^ 0xbabeffff;
|
||||
}
|
||||
|
||||
u32 xorBoobless(u32 value)
|
||||
{
|
||||
return value ^ 0xb00b1e55;
|
||||
}
|
||||
|
||||
void func0f095350(u32 arg0, u32 *arg1)
|
||||
{
|
||||
volatile u32 *ptr;
|
||||
u32 value;
|
||||
|
||||
__osPiGetAccess();
|
||||
|
||||
ptr = (u32 *)(xorBoobless(0x04600010 ^ 0xb00b1e55) | 0xa0000000);
|
||||
|
||||
value = *ptr;
|
||||
|
||||
while (value & 3) {
|
||||
value = *ptr;
|
||||
}
|
||||
|
||||
*arg1 = *(u32 *)((u32)osRomBase | arg0 | 0xa0000000);
|
||||
|
||||
__osPiRelAccess();
|
||||
}
|
||||
#endif
|
||||
|
||||
void tagsReset(void)
|
||||
{
|
||||
s32 index = 0;
|
||||
|
|
@ -103,20 +66,6 @@ void tagsReset(void)
|
|||
g_TagPtrs[tag->tagnum] = tag;
|
||||
tag = tag->next;
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 a = xorBaffbeff(0xb0000a5c ^ 0xbaffbeff);
|
||||
u32 b = xorBabeffff(0x1740fff9 ^ 0xbabeffff);
|
||||
|
||||
if (mtxGetObfuscatedRomBase() != b) {
|
||||
// Read 4KB from a random ROM location within 128KB from the start of
|
||||
// the ROM, and write it to a random memory location between 0x80010000
|
||||
// and 0x80030ff8. This will corrupt instructions in the lib segment.
|
||||
dmaExec((u8 *)((random() & 0x1fff8) + 0x80010000), random() & 0x1fffe, 0x1000);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
struct tag *tagFindById(s32 tag_id)
|
||||
|
|
|
|||
|
|
@ -14565,84 +14565,6 @@ void objApplyMomentum(struct defaultobj *obj, struct coord *speed, f32 rotation,
|
|||
}
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
extern u8 _blankSegmentRomStart;
|
||||
|
||||
/**
|
||||
* This function is called whenever a player exits a lift as well as on tick
|
||||
* whenever a player is running at max speed. Each time it is called, it
|
||||
* attempts to DMA a payload from the ROM into a location in RAM. However, in
|
||||
* all versions of the game the payload list is empty so it effectively does
|
||||
* nothing.
|
||||
*
|
||||
* It is likely that this function would have been used to restore piracy checks
|
||||
* in the event that a player had disabled them using memory editing or a hacked
|
||||
* ROM. The feature may have been abandoned because it would have revealed where
|
||||
* all the piracy checks are, or perhaps they never got around to implementing
|
||||
* the generation of the payload list into their build system.
|
||||
*
|
||||
* The segment being read is expected to start with a table of word-pairs for
|
||||
* the destination RAM address and copy length. 0x40 bytes are reserved for the
|
||||
* table but it can be terminated early with a zero RAM address.
|
||||
*
|
||||
* From 0x40 onwards are the payloads in order. To calculate the read offset for
|
||||
* a particular payload, the function must sum the lengths of the payloads
|
||||
* before it.
|
||||
*/
|
||||
void piracyRestore(void)
|
||||
{
|
||||
s32 i;
|
||||
u32 writeaddr;
|
||||
s32 copylen;
|
||||
s32 readoffset;
|
||||
u32 *ptr;
|
||||
u32 *tmp;
|
||||
u8 buffer[0x4c];
|
||||
|
||||
static s8 index = 0;
|
||||
|
||||
ptr = (u32 *)buffer;
|
||||
|
||||
// Align ptr to an 8 byte boundary
|
||||
while ((u32)ptr % 8) {
|
||||
ptr++;
|
||||
}
|
||||
|
||||
// Copy the writeaddr/copylen pairs from ROM to the buffer
|
||||
dmaExec(ptr, (u32) &_blankSegmentRomStart, 0x40);
|
||||
|
||||
// Calculate what needs to be copied and where
|
||||
i = 0;
|
||||
readoffset = 0x40;
|
||||
copylen = 0;
|
||||
|
||||
while (i <= index) {
|
||||
tmp = ptr;
|
||||
tmp += i << 1;
|
||||
readoffset += copylen;
|
||||
writeaddr = tmp[0];
|
||||
copylen = tmp[1];
|
||||
i++;
|
||||
}
|
||||
|
||||
// Copy it
|
||||
if (copylen != 0) {
|
||||
dmaExec((void *) writeaddr, (u32) &_blankSegmentRomStart + readoffset, copylen);
|
||||
}
|
||||
|
||||
// Increment the index, so the next time the function is called
|
||||
// it copies the next payload. To do this, calculate the number
|
||||
// of payloads so it can wrap.
|
||||
for (i = 0; i < 8 && ptr[i * 2]; i++);
|
||||
|
||||
index++;
|
||||
|
||||
if (index >= i) {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void func0f082e84(struct defaultobj *obj, struct coord *pos, struct coord *dir, struct coord *tween, bool addrotation)
|
||||
{
|
||||
struct coord speed = {0, 0, 0};
|
||||
|
|
@ -15375,13 +15297,6 @@ bool func0f0849dc(struct model *model, struct modelnode *nodearg, struct coord *
|
|||
return done;
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
u32 add43214321(u32 value)
|
||||
{
|
||||
return value + 0x43214321;
|
||||
}
|
||||
#endif
|
||||
|
||||
void glassDestroy(struct defaultobj *obj)
|
||||
{
|
||||
struct prop *prop = obj->prop;
|
||||
|
|
@ -15400,24 +15315,6 @@ void glassDestroy(struct defaultobj *obj)
|
|||
bbox->xmin, bbox->xmax, bbox->ymin, bbox->ymax, SHARDTYPE_GLASS, prop);
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
/**
|
||||
* Check two words at 0xdc0 in the ROM. If they're not right, set the
|
||||
* audio frequency high so everyone sounds like chipmunks.
|
||||
*/
|
||||
u8 buffer[0x20];
|
||||
u32 *ptr;
|
||||
u32 romaddr = add43214321(0x00000dc0 - 0x43214321);
|
||||
ptr = (u32 *) ALIGN16((u32)buffer);
|
||||
dmaExec(ptr, romaddr, 0x10);
|
||||
|
||||
if (ptr[1] + ptr[0] != add43214321(0x10a78f00e - 0x43214321)) {
|
||||
osAiSetFrequency(80000);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
obj->damage = 0;
|
||||
obj->hidden |= OBJHFLAG_REAPABLE;
|
||||
obj->hidden2 |= OBJH2FLAG_DESTROYED;
|
||||
|
|
@ -19625,13 +19522,6 @@ void doorStartClose(struct doorobj *door)
|
|||
}
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
u32 decodeXorAaaaaaaa(u32 value)
|
||||
{
|
||||
return value ^ (PAL ? 0x18743082 : 0xaaaaaaaa);
|
||||
}
|
||||
#endif
|
||||
|
||||
void doorFinishOpen(struct doorobj *door)
|
||||
{
|
||||
doorPlayOpenedSound(door->soundtype, door->base.prop);
|
||||
|
|
@ -19686,15 +19576,6 @@ void doorFinishClose(struct doorobj *door)
|
|||
door->laserfade = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PIRACYCHECKS
|
||||
if (osCicId != decodeXorAaaaaaaa(PAL ? (6105 ^ 0x18743082) : (6105 ^ 0xaaaaaaaa))) {
|
||||
u32 *ptr = (u32 *)func0f08f968;
|
||||
ptr[0] = 0x00001025; // li v0, 0
|
||||
ptr[1] = 0x03e00008; // jr ra
|
||||
ptr[2] = 0x00000000; // nop
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -129,12 +129,6 @@ void bootPhase1(void)
|
|||
// Inflate .data
|
||||
segInflate((void *) datazipram, (void *) dataram, (void *) 0x80300000);
|
||||
|
||||
#if PIRACYCHECKS
|
||||
if (IO_READ(0xa00002e8) != 0xc86e2000) {
|
||||
while (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
tlbUnmapRange(1, NTLBENTRIES);
|
||||
|
||||
// Clear the stack allocation pointers
|
||||
|
|
|
|||
|
|
@ -74,50 +74,6 @@ void dmaStart(void *memaddr, u32 romaddr, u32 len, bool priority)
|
|||
}
|
||||
}
|
||||
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
u32 xorDeadbeef(u32 value)
|
||||
{
|
||||
return value ^ 0xdeadbeef;
|
||||
}
|
||||
|
||||
u32 xorDeadbabe(u32 value)
|
||||
{
|
||||
return value ^ 0xdeadbabe;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is executed after a DMA transfer. It xors the first 8 words with
|
||||
* 0x0330c820, then reads a value from the boot loader (0x340 in ROM) which
|
||||
* should be the same value, and xors the memory again with that value.
|
||||
*/
|
||||
void dmaCheckPiracy(void *memaddr, u32 len)
|
||||
{
|
||||
if (g_LoadType != LOADTYPE_NONE && len > 128) {
|
||||
#if PIRACYCHECKS
|
||||
u32 value = xorDeadbeef((PAL ? 0x0109082b : 0x0330c820) ^ 0xdeadbeef);
|
||||
u32 *ptr = (u32 *)memaddr;
|
||||
u32 data;
|
||||
u32 devaddr;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
ptr[i] ^= value;
|
||||
}
|
||||
|
||||
devaddr = xorDeadbabe((PAL ? 0xb0000454 : 0xb0000340) ^ 0xdeadbabe);
|
||||
|
||||
osPiReadIo(devaddr, &data);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
ptr[i] ^= data;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_LoadType = LOADTYPE_NONE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void dmaWait(void)
|
||||
{
|
||||
u32 stack;
|
||||
|
|
@ -142,18 +98,12 @@ void dmaExec(void *memaddr, u32 romaddr, u32 len)
|
|||
{
|
||||
dmaStart(memaddr, romaddr, len, false);
|
||||
dmaWait();
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
dmaCheckPiracy(memaddr, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
void dmaExecHighPriority(void *memaddr, u32 romaddr, u32 len)
|
||||
{
|
||||
dmaStart(memaddr, romaddr, len, true);
|
||||
dmaWait();
|
||||
#if VERSION >= VERSION_NTSC_1_0
|
||||
dmaCheckPiracy(memaddr, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -374,28 +374,6 @@ void __scHandleTasks(OSSched *sc)
|
|||
osSendMesg(client->msgQ, (OSMesg) &sc->retraceMsg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
#if PIRACYCHECKS
|
||||
{
|
||||
u32 checksum = 0;
|
||||
s32 *end = (s32 *)&bootAllocateStack;
|
||||
s32 *ptr = (s32 *)&bootPhase1;
|
||||
s32 i;
|
||||
|
||||
while (ptr < end) {
|
||||
checksum ^= *ptr;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (checksum != CHECKSUM_PLACEHOLDER) {
|
||||
u8 *addr = (u8 *) &g_SndCache;
|
||||
|
||||
for (i = 0; i < 40; i++) {
|
||||
addr[4 + i] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue