Merge pull request #317 from SciresM/master
Add signature patches for old firmwares.
This commit is contained in:
commit
3076d56973
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
||||||
|
Reference in New Issue
Block a user