Signature patches for factory/1.x/2.x

This commit is contained in:
Michael Scire 2017-01-07 14:32:02 -08:00
parent dfbd0dc9e7
commit b35707edf9
3 changed files with 25 additions and 0 deletions

View File

@ -295,6 +295,8 @@ u32 patch1x2xNativeAndSafeFirm(u32 devMode)
ret += ISN3DS ? patchFirmWrites(process9Offset, process9Size) : patchOldFirmWrites(process9Offset, process9Size); ret += ISN3DS ? patchFirmWrites(process9Offset, process9Size) : patchOldFirmWrites(process9Offset, process9Size);
ret += patchOldSignatureChecks(process9Offset, process9Size);
if(devMode != 0) if(devMode != 0)
{ {
//ARM9 exception handlers //ARM9 exception handlers

View File

@ -118,6 +118,28 @@ u32 patchSignatureChecks(u8 *pos, u32 size)
return 0; 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) u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr)
{ {
//Look for firmlaunch code //Look for firmlaunch code

View File

@ -37,6 +37,7 @@ extern CfgData configData;
u8 *getProcess9Info(u8 *pos, u32 size, u32 *process9Size, u32 *process9MemAddr); 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 *getKernel11Info(u8 *pos, u32 size, u32 *baseK11VA, u8 **freeK11Space, u32 **arm11SvcHandler, u32 **arm11DAbtHandler, u32 **arm11ExceptionsPage);
u32 patchSignatureChecks(u8 *pos, u32 size); u32 patchSignatureChecks(u8 *pos, u32 size);
u32 patchOldSignatureChecks(u8 *pos, u32 size);
u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr); u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr);
u32 patchFirmWrites(u8 *pos, u32 size); u32 patchFirmWrites(u8 *pos, u32 size);
u32 patchOldFirmWrites(u8 *pos, u32 size); u32 patchOldFirmWrites(u8 *pos, u32 size);