Cleanup some userland patches, add/cleanup credits for patches

This commit is contained in:
Aurora 2016-11-01 19:05:04 +01:00
parent b3f38a8764
commit 9cdadbe834
9 changed files with 37 additions and 18 deletions

View File

@ -334,7 +334,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
case 0x000400300000B102LL: // TWN Menu case 0x000400300000B102LL: // TWN Menu
{ {
static const u8 regionFreePattern[] = { static const u8 regionFreePattern[] = {
0x00, 0x00, 0x55, 0xE3, 0x01, 0x10, 0xA0 0x0A, 0x0C, 0x00, 0x10
}, },
regionFreePatch[] = { regionFreePatch[] = {
0x01, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 0x01, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1
@ -343,7 +343,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
//Patch SMDH region checks //Patch SMDH region checks
patchMemory(code, size, patchMemory(code, size,
regionFreePattern, regionFreePattern,
sizeof(regionFreePattern), -16, sizeof(regionFreePattern), -31,
regionFreePatch, regionFreePatch,
sizeof(regionFreePatch), 1 sizeof(regionFreePatch), 1
); );
@ -378,7 +378,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
case 0x0004013000003202LL: // FRIENDS case 0x0004013000003202LL: // FRIENDS
{ {
static const u8 fpdVerPattern[] = { static const u8 fpdVerPattern[] = {
0xE0, 0x1E, 0xFF, 0x2F, 0xE1, 0x01, 0x01 0x42, 0xE0, 0x1E, 0xFF
}; };
u8 mostRecentFpdVer = 8; u8 mostRecentFpdVer = 8;
@ -388,7 +388,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
if(fpdVer == NULL) svcBreak(USERBREAK_ASSERT); if(fpdVer == NULL) svcBreak(USERBREAK_ASSERT);
//Allow online access to work with old friends modules //Allow online access to work with old friends modules
if(fpdVer[9] < mostRecentFpdVer) fpdVer[9] = mostRecentFpdVer; if(fpdVer[0xA] < mostRecentFpdVer) fpdVer[0xA] = mostRecentFpdVer;
break; break;
} }
@ -402,7 +402,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
{ {
if(CONFIG(PATCHVERSTRING)) if(CONFIG(PATCHVERSTRING))
{ {
static const u16 verPattern[] = u"Ver."; static const u16 verPattern[] = u"Ve";
static u16 *verString; static u16 *verString;
u32 verStringSize = 0, u32 verStringSize = 0,
currentNand = BOOTCFG_NAND; currentNand = BOOTCFG_NAND;
@ -523,13 +523,13 @@ void patchCode(u64 progId, u8 *code, u32 size)
case 0x0004013000003702LL: // RO case 0x0004013000003702LL: // RO
{ {
static const u8 sigCheckPattern[] = { static const u8 sigCheckPattern[] = {
0x30, 0x40, 0x2D, 0xE9, 0x02 0x20, 0xA0, 0xE1, 0x8B
}, },
sha256ChecksPattern1[] = { sha256ChecksPattern1[] = {
0x30, 0x40, 0x2D, 0xE9, 0x24 0xE1, 0x30, 0x40, 0x2D
}, },
sha256ChecksPattern2[] = { sha256ChecksPattern2[] = {
0xF8, 0x4F, 0x2D, 0xE9, 0x01 0x2D, 0xE9, 0x01, 0x70
}, },
stub[] = { stub[] = {
0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 // mov r0, #0; bx lr 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 //Disable CRR0 signature (RSA2048 with SHA256) check
patchMemory(code, size, patchMemory(code, size,
sigCheckPattern, sigCheckPattern,
sizeof(sigCheckPattern), 0, sizeof(sigCheckPattern), -9,
stub, stub,
sizeof(stub), 1 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) //Disable CRO0/CRR0 SHA256 hash checks (section hashes, and hash table)
patchMemory(code, size, patchMemory(code, size,
sha256ChecksPattern1, sha256ChecksPattern1,
sizeof(sha256ChecksPattern1), 0, sizeof(sha256ChecksPattern1), 1,
stub, stub,
sizeof(stub), 1 sizeof(stub), 1
); );
patchMemory(code, size, patchMemory(code, size,
sha256ChecksPattern2, sha256ChecksPattern2,
sizeof(sha256ChecksPattern2), 0, sizeof(sha256ChecksPattern2), -2,
stub, stub,
sizeof(stub), 1 sizeof(stub), 1
); );
@ -566,7 +566,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
if(MULTICONFIG(DEVOPTIONS) == 1) if(MULTICONFIG(DEVOPTIONS) == 1)
{ {
static const u8 unitinfoCheckPattern1[] = { static const u8 unitinfoCheckPattern1[] = {
0x14, 0x00, 0xD0, 0xE5, 0xDB 0x00, 0xD0, 0xE5, 0xDB
}, },
unitinfoCheckPattern2[] = { unitinfoCheckPattern2[] = {
0x14, 0x00, 0xD0, 0xE5, 0x01 0x14, 0x00, 0xD0, 0xE5, 0x01
@ -577,7 +577,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
patchMemory(code, size, patchMemory(code, size,
unitinfoCheckPattern1, unitinfoCheckPattern1,
sizeof(unitinfoCheckPattern1), 0, sizeof(unitinfoCheckPattern1), -1,
unitinfoCheckPatch, unitinfoCheckPatch,
sizeof(unitinfoCheckPatch), 1 sizeof(unitinfoCheckPatch), 1
); );

View File

@ -1,3 +1,5 @@
; Code by Normmatt
.arm.little .arm.little
.create "build/emunand.bin", 0 .create "build/emunand.bin", 0

View File

@ -20,7 +20,7 @@
; Notices displayed by works containing it. ; Notices displayed by works containing it.
; ;
; This is mainly Subv's code, big thanks to him. ; Code originally from Subv
.arm.little .arm.little

View File

@ -1,3 +1,5 @@
; Code originally from delebile and mid-kid
.arm.little .arm.little
payload_addr equ 0x23F00000 ; Brahma payload address payload_addr equ 0x23F00000 ; Brahma payload address

View File

@ -20,6 +20,10 @@
* Notices displayed by works containing it. * Notices displayed by works containing it.
*/ */
/*
* Code for locating the SDMMC struct by Normmatt
*/
#include "emunand.h" #include "emunand.h"
#include "memory.h" #include "memory.h"
#include "fatfs/sdmmc/sdmmc.h" #include "fatfs/sdmmc/sdmmc.h"

View File

@ -20,6 +20,10 @@
* Notices displayed by works containing it. * Notices displayed by works containing it.
*/ */
/*
* Code for locating the SDMMC struct by Normmatt
*/
#pragma once #pragma once
#include "types.h" #include "types.h"

View File

@ -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 * ARM11 modules patching code originally by Subv
* Idea for svcBreak patches from yellows8 and others on #3dsdev
*/ */
#include "patches.h" #include "patches.h"
@ -369,8 +373,7 @@ u32 getInfoForArm11ExceptionHandlers(u8 *pos, u32 size, u32 *codeSetOffset)
u32 patchSvcBreak9(u8 *pos, u32 size, u32 kernel9Address) u32 patchSvcBreak9(u8 *pos, u32 size, u32 kernel9Address)
{ {
/* Stub svcBreak with "bkpt 65535" so we can debug the panic. //Stub svcBreak with "bkpt 65535" so we can debug the panic
Thanks @yellows8 and others for mentioning this idea on #3dsdev */
//Look for the svc handler //Look for the svc handler
const u8 pattern[] = {0x00, 0xE0, 0x4F, 0xE1}; //mrs lr, spsr const u8 pattern[] = {0x00, 0xE0, 0x4F, 0xE1}; //mrs lr, spsr

View File

@ -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 * ARM11 modules patching code originally by Subv
* Idea for svcBreak patches from yellows8 and others on #3dsdev
*/ */
#pragma once #pragma once