diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 8fa2b66..3e518cf 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -334,7 +334,7 @@ void patchCode(u64 progId, u8 *code, u32 size) case 0x000400300000B102LL: // TWN Menu { static const u8 regionFreePattern[] = { - 0x00, 0x00, 0x55, 0xE3, 0x01, 0x10, 0xA0 + 0x0A, 0x0C, 0x00, 0x10 }, regionFreePatch[] = { 0x01, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 @@ -342,8 +342,8 @@ void patchCode(u64 progId, u8 *code, u32 size) //Patch SMDH region checks patchMemory(code, size, - regionFreePattern, - sizeof(regionFreePattern), -16, + regionFreePattern, + sizeof(regionFreePattern), -31, regionFreePatch, sizeof(regionFreePatch), 1 ); @@ -378,7 +378,7 @@ void patchCode(u64 progId, u8 *code, u32 size) case 0x0004013000003202LL: // FRIENDS { static const u8 fpdVerPattern[] = { - 0xE0, 0x1E, 0xFF, 0x2F, 0xE1, 0x01, 0x01 + 0x42, 0xE0, 0x1E, 0xFF }; u8 mostRecentFpdVer = 8; @@ -388,7 +388,7 @@ void patchCode(u64 progId, u8 *code, u32 size) if(fpdVer == NULL) svcBreak(USERBREAK_ASSERT); //Allow online access to work with old friends modules - if(fpdVer[9] < mostRecentFpdVer) fpdVer[9] = mostRecentFpdVer; + if(fpdVer[0xA] < mostRecentFpdVer) fpdVer[0xA] = mostRecentFpdVer; break; } @@ -402,7 +402,7 @@ void patchCode(u64 progId, u8 *code, u32 size) { if(CONFIG(PATCHVERSTRING)) { - static const u16 verPattern[] = u"Ver."; + static const u16 verPattern[] = u"Ve"; static u16 *verString; u32 verStringSize = 0, currentNand = BOOTCFG_NAND; @@ -523,13 +523,13 @@ void patchCode(u64 progId, u8 *code, u32 size) case 0x0004013000003702LL: // RO { static const u8 sigCheckPattern[] = { - 0x30, 0x40, 0x2D, 0xE9, 0x02 + 0x20, 0xA0, 0xE1, 0x8B }, sha256ChecksPattern1[] = { - 0x30, 0x40, 0x2D, 0xE9, 0x24 + 0xE1, 0x30, 0x40, 0x2D }, sha256ChecksPattern2[] = { - 0xF8, 0x4F, 0x2D, 0xE9, 0x01 + 0x2D, 0xE9, 0x01, 0x70 }, stub[] = { 0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 // mov r0, #0; bx lr @@ -538,7 +538,7 @@ void patchCode(u64 progId, u8 *code, u32 size) //Disable CRR0 signature (RSA2048 with SHA256) check patchMemory(code, size, sigCheckPattern, - sizeof(sigCheckPattern), 0, + sizeof(sigCheckPattern), -9, stub, sizeof(stub), 1 ); @@ -546,14 +546,14 @@ void patchCode(u64 progId, u8 *code, u32 size) //Disable CRO0/CRR0 SHA256 hash checks (section hashes, and hash table) patchMemory(code, size, sha256ChecksPattern1, - sizeof(sha256ChecksPattern1), 0, + sizeof(sha256ChecksPattern1), 1, stub, sizeof(stub), 1 ); patchMemory(code, size, sha256ChecksPattern2, - sizeof(sha256ChecksPattern2), 0, + sizeof(sha256ChecksPattern2), -2, stub, sizeof(stub), 1 ); @@ -566,7 +566,7 @@ void patchCode(u64 progId, u8 *code, u32 size) if(MULTICONFIG(DEVOPTIONS) == 1) { static const u8 unitinfoCheckPattern1[] = { - 0x14, 0x00, 0xD0, 0xE5, 0xDB + 0x00, 0xD0, 0xE5, 0xDB }, unitinfoCheckPattern2[] = { 0x14, 0x00, 0xD0, 0xE5, 0x01 @@ -577,7 +577,7 @@ void patchCode(u64 progId, u8 *code, u32 size) patchMemory(code, size, unitinfoCheckPattern1, - sizeof(unitinfoCheckPattern1), 0, + sizeof(unitinfoCheckPattern1), -1, unitinfoCheckPatch, sizeof(unitinfoCheckPatch), 1 ); diff --git a/patches/emunand.s b/patches/emunand.s index 7afc43a..b3433f6 100644 --- a/patches/emunand.s +++ b/patches/emunand.s @@ -1,3 +1,5 @@ +; Code by Normmatt + .arm.little .create "build/emunand.bin", 0 diff --git a/patches/k11modules.s b/patches/k11modules.s index 7d05979..cd803cb 100644 --- a/patches/k11modules.s +++ b/patches/k11modules.s @@ -20,7 +20,7 @@ ; Notices displayed by works containing it. ; -; This is mainly Subv's code, big thanks to him. +; Code originally from Subv .arm.little diff --git a/patches/reboot.s b/patches/reboot.s index 0199ff0..2b320be 100644 --- a/patches/reboot.s +++ b/patches/reboot.s @@ -1,3 +1,5 @@ +; Code originally from delebile and mid-kid + .arm.little payload_addr equ 0x23F00000 ; Brahma payload address diff --git a/source/emunand.c b/source/emunand.c index 9125a6b..4d43aae 100644 --- a/source/emunand.c +++ b/source/emunand.c @@ -20,6 +20,10 @@ * Notices displayed by works containing it. */ +/* +* Code for locating the SDMMC struct by Normmatt +*/ + #include "emunand.h" #include "memory.h" #include "fatfs/sdmmc/sdmmc.h" diff --git a/source/emunand.h b/source/emunand.h index f978d51..59c9e38 100644 --- a/source/emunand.h +++ b/source/emunand.h @@ -20,6 +20,10 @@ * Notices displayed by works containing it. */ +/* +* Code for locating the SDMMC struct by Normmatt +*/ + #pragma once #include "types.h" diff --git a/source/patches.c b/source/patches.c index 7df6f5b..1e18265 100644 --- a/source/patches.c +++ b/source/patches.c @@ -21,7 +21,11 @@ */ /* +* Signature patches by an unknown author +* firmlaunches patching code originally by delebile +* FIRM partition writes patches by delebile * ARM11 modules patching code originally by Subv +* Idea for svcBreak patches from yellows8 and others on #3dsdev */ #include "patches.h" @@ -369,8 +373,7 @@ u32 getInfoForArm11ExceptionHandlers(u8 *pos, u32 size, u32 *codeSetOffset) u32 patchSvcBreak9(u8 *pos, u32 size, u32 kernel9Address) { - /* Stub svcBreak with "bkpt 65535" so we can debug the panic. - Thanks @yellows8 and others for mentioning this idea on #3dsdev */ + //Stub svcBreak with "bkpt 65535" so we can debug the panic //Look for the svc handler const u8 pattern[] = {0x00, 0xE0, 0x4F, 0xE1}; //mrs lr, spsr diff --git a/source/patches.h b/source/patches.h index e762346..ebb0868 100644 --- a/source/patches.h +++ b/source/patches.h @@ -21,7 +21,11 @@ */ /* +* Signature patches by an unknown author +* firmlaunches patching code originally by delebile +* FIRM partition writes patches by delebile * ARM11 modules patching code originally by Subv +* Idea for svcBreak patches from yellows8 and others on #3dsdev */ #pragma once diff --git a/source/start.s b/source/start.s index d51774a..b7765cb 100644 --- a/source/start.s +++ b/source/start.s @@ -28,7 +28,7 @@ _start: .global launchedFirmTidLow launchedFirmTidLow: - .hword 0, 0, 0, 0, 0, 0, 0, 0 + .hword 0, 0, 0, 0, 0, 0, 0, 0 start: @ Disable interrupts