Add documentation for piracy checks

This commit is contained in:
Ryan Dwyer
2021-02-28 16:58:51 +10:00
parent b12ee422a3
commit eeb79878be
7 changed files with 182 additions and 10 deletions
+1 -2
View File
@@ -3963,8 +3963,7 @@ void chrUncloak(struct chrdata *chr, bool value)
}
if (checksum != CHECKSUM_PLACEHOLDER) {
extern volatile u32 _antipiracyUncloakWriteAddress[];
_antipiracyUncloakWriteAddress[-2] = 0;
((u32 *)&func0002a324)[-2] = 0;
}
}
#endif
+2 -2
View File
@@ -1836,9 +1836,9 @@ glabel coreGetSlowMotionType
//u32 coreGetSlowMotionType(void)
//{
//#if PIRACYCHECKS
// u32 addr = sub54321(0xb000de8d);
// u32 addr = sub54321(0xb0000a5c + 54321);
// u32 actual;
// u32 expected = sub54321(0x1741d42a);
// u32 expected = sub54321(0x1740fff9);
// osPiReadIo(addr, &actual);
//
// if (actual != expected) {
+4 -4
View File
@@ -44680,11 +44680,11 @@ void func0f08e2ac(struct doorobj *door)
}
#if PIRACYCHECKS
if (osCicId != decodeXorAaaaaaaa(0xaaaabd73)) {
if (osCicId != decodeXorAaaaaaaa(6105 ^ 0xaaaaaaaa)) {
u32 *ptr = (u32 *)func0f08f968;
ptr[0] = 0x00001025;
ptr[1] = 0x03e00008;
ptr[2] = 0x00000000;
ptr[0] = 0x00001025; // li v0, 0
ptr[1] = 0x03e00008; // jr ra
ptr[2] = 0x00000000; // nop
}
#endif
}
+1
View File
@@ -79,6 +79,7 @@ f32 func000296a0(struct collisionthing *arg0, struct coord *pos, struct tilethin
bool func00029ffc(struct coord *pos, f32 width, f32 foreheadheight, f32 inversefeettoeyesheight, s16 *rooms, u32 arg5, struct coord *laddernormal);
u32 func0002a13c(void);
f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype, u16 *floorflags, s16 *floorroom, s32 *inlift, struct prop **lift);
f32 func0002a324(void);
f32 cdFindGroundYSimple(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol, u8 *floortype);
f32 func0002a36c(struct coord *coord, s16 *rooms, u16 *floorcol, s32 arg3);
s32 func0002a400(struct coord *pos, s16 *rooms);
+7
View File
@@ -7211,6 +7211,13 @@ f32 cdFindGroundY(struct coord *pos, f32 width, s16 *rooms, u16 *floorcol,
return ground;
}
/**
* This function must come immediately after cdFindGroundY.
*
* A piracy check looks for this function, then backtracks two instructions to
* nop the jr ra at the end of cdFindGroundY, causing it to flow into this
* function and return 0.
*/
f32 func0002a324(void)
{
return 0;