From e34ca4471581696609cb5fc3ee4810fa0771b531 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 11 Feb 2016 00:45:24 +0100 Subject: [PATCH] Reduced pattern size, fixed N3DS NAND0 FIRM size It's actually a little smaller --- source/emunand.c | 8 ++++---- source/firm.c | 2 +- source/patches.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/emunand.c b/source/emunand.c index b9d3ba3..253e72a 100644 --- a/source/emunand.c +++ b/source/emunand.c @@ -23,8 +23,8 @@ void getEmunandSect(u32 *off, u32 *head){ void getSDMMC(void *pos, u32 *off, u32 size){ //Look for struct code - unsigned char pattern[] = {0x01, 0x21, 0x20, 0x18, 0x20, 0x30}; - *off = (u32)memsearch(pos, pattern, size, 6); + unsigned char pattern[] = {0x01, 0x21, 0x20, 0x18, 0x20}; + *off = (u32)memsearch(pos, pattern, size, 5); //Get DCD values unsigned char buf[4]; @@ -50,9 +50,9 @@ void getEmuRW(void *pos, u32 size, u32 *readOff, u32 *writeOff){ void getMPU(void *pos, u32 *off, u32 size){ //Look for MPU pattern - unsigned char pattern[] = {0x03, 0x00, 0x24, 0x00, 0x00, 0x00, 0x10}; + unsigned char pattern[] = {0x03, 0x00, 0x24, 0x00, 0x00}; - *off = (u32)memsearch(pos, pattern, size, 7); + *off = (u32)memsearch(pos, pattern, size, 5); } void getEmuCode(void *pos, u32 *off, u32 size){ diff --git a/source/firm.c b/source/firm.c index 23dfce9..6519932 100755 --- a/source/firm.c +++ b/source/firm.c @@ -29,7 +29,7 @@ u8 loadFirm(void){ if((pressed & BUTTON_L1R1) == BUTTON_L1R1){ mode = 0; //Read FIRM from NAND and write to FCRAM - firmSize = console ? 0xF2C00 : 0xE9000; + firmSize = console ? 0xF2000 : 0xE9000; nandFirm0((u8*)firmLocation, firmSize, console); if(memcmp((u8*)firmLocation, "FIRM", 4) != 0) return 1; } diff --git a/source/patches.c b/source/patches.c index c099479..17f5a9f 100644 --- a/source/patches.c +++ b/source/patches.c @@ -34,18 +34,18 @@ u8 sigPat2[4] = {0x00, 0x20, 0x70, 0x47}; void getSignatures(void *pos, u32 size, u32 *off, u32 *off2){ //Look for signature checks - unsigned char pattern[] = {0xC0, 0x1C, 0x76, 0xE7, 0x20}; + unsigned char pattern[] = {0xC0, 0x1C, 0x76, 0xE7}; unsigned char pattern2[] = {0x70, 0xB5, 0x22, 0x4D, 0x0C}; - *off = (u32)memsearch(pos, pattern, size, 5); + *off = (u32)memsearch(pos, pattern, size, 4); *off2 = (u32)memsearch(pos, pattern2, size, 5); } void getReboot(void *pos, u32 size, u32 *off, u32 *off2){ //Look for FIRM reboot code - unsigned char pattern[] = {0x8D, 0xE5, 0x00, 0xC0, 0x91, 0xE5}; + unsigned char pattern[] = {0x8D, 0xE5, 0x00, 0xC0, 0x91}; unsigned char pattern2[] = {0xF0, 0x4F, 0x2D, 0xE9, 0x3C}; - *off = (u32)memsearch(pos, pattern, size, 6) + 2; + *off = (u32)memsearch(pos, pattern, size, 5) + 2; *off2 = (u32)memsearch(pos, pattern2, size, 5); } \ No newline at end of file