Skip to content

Commit

Permalink
Reduced pattern size, fixed N3DS NAND0 FIRM size
Browse files Browse the repository at this point in the history
It's actually a little smaller
  • Loading branch information
AuroraWright committed Feb 10, 2016
1 parent 899a685 commit e34ca44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions source/emunand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion source/firm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions source/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit e34ca44

Please sign in to comment.