diff --git a/source/firm.c b/source/firm.c index 14e0870..57cc3b1 100755 --- a/source/firm.c +++ b/source/firm.c @@ -294,6 +294,8 @@ u32 patch1x2xNativeAndSafeFirm(u32 devMode) ret = 0; ret += ISN3DS ? patchFirmWrites(process9Offset, process9Size) : patchOldFirmWrites(process9Offset, process9Size); + + ret += patchOldSignatureChecks(process9Offset, process9Size); if(devMode != 0) { diff --git a/source/patches.c b/source/patches.c index aa382ac..7b69ea4 100644 --- a/source/patches.c +++ b/source/patches.c @@ -118,6 +118,28 @@ u32 patchSignatureChecks(u8 *pos, u32 size) return 0; } +u32 patchOldSignatureChecks(u8 *pos, u32 size) +{ + // Look for signature checks + // Pattern 2 works for 1.x, 2.x + factory FIRM. + // For patchSignatureChecks-style (temp - 1 instead of temp - 3): + // 1.x+2.x: pattern2[] = {0xB5, 0x23, 0x4E, 0x0C}; + // factory: pattern2[] = {0xB5, 0x16, 0x4E, 0x0C}; + const u8 pattern[] = {0xC0, 0x1C, 0xBD, 0xE7}, + pattern2[] = {0x4E, 0x0C, 0x00, 0x71, 0x68}; + + u16 *off = (u16 *)memsearch(pos, pattern, size, sizeof(pattern)); + u8 *temp = memsearch(pos, pattern2, size, sizeof(pattern2)); + + if(off == NULL || temp == NULL) return 1; + + u16 *off2 = (u16 *)(temp - 3); + *off = off2[0] = 0x2000; + off2[1] = 0x4770; + + return 0; +} + u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr) { //Look for firmlaunch code diff --git a/source/patches.h b/source/patches.h index 4f20015..8e07a39 100644 --- a/source/patches.h +++ b/source/patches.h @@ -37,6 +37,7 @@ extern CfgData configData; u8 *getProcess9Info(u8 *pos, u32 size, u32 *process9Size, u32 *process9MemAddr); u32 *getKernel11Info(u8 *pos, u32 size, u32 *baseK11VA, u8 **freeK11Space, u32 **arm11SvcHandler, u32 **arm11DAbtHandler, u32 **arm11ExceptionsPage); u32 patchSignatureChecks(u8 *pos, u32 size); +u32 patchOldSignatureChecks(u8 *pos, u32 size); u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr); u32 patchFirmWrites(u8 *pos, u32 size); u32 patchOldFirmWrites(u8 *pos, u32 size);