Cleanup, removed the non-working clock speed patch
This commit is contained in:
parent
649b160292
commit
ef3ba896d5
@ -206,7 +206,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
||||
case 0x0004001000027000LL: // KOR MSET
|
||||
case 0x0004001000028000LL: // TWN MSET
|
||||
{
|
||||
if(R_SUCCEEDED(loadConfig()) && ((config >> 6) & 1))
|
||||
if(R_SUCCEEDED(loadConfig()) && ((config >> 5) & 1))
|
||||
{
|
||||
static const u16 verPattern[] = u"Ver.";
|
||||
const u32 currentNand = ((config >> 16) & 3);
|
||||
@ -279,28 +279,5 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x0004013020002202LL: // N3DS PTM
|
||||
{
|
||||
if(R_SUCCEEDED(loadConfig()) && ((config >> 4) & 1))
|
||||
{
|
||||
static const u8 configN3dsCpuPattern[] = {
|
||||
0x02, 0x98, 0x01, 0x79, 0x1C
|
||||
};
|
||||
static const u8 configN3dsCpuPatch[] = {
|
||||
0x02, 0x98, 0x03, 0x21
|
||||
};
|
||||
|
||||
//Disable SecureInfo signature check
|
||||
patchMemory(code, size,
|
||||
configN3dsCpuPattern,
|
||||
sizeof(configN3dsCpuPattern), 0,
|
||||
configN3dsCpuPatch,
|
||||
sizeof(configN3dsCpuPatch), 1
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,6 @@ void configureCFW(const char *configPath)
|
||||
"( ) Updated SysNAND mode (A9LH-only)",
|
||||
"( ) Force A9LH detection",
|
||||
"( ) Use second EmuNAND as default",
|
||||
"( ) Force max N3DS clock speed and L2 cache",
|
||||
"( ) Use developer UNITINFO",
|
||||
"( ) Show current NAND in System Settings",
|
||||
"( ) Show GBA boot screen in patched AGB_FIRM",
|
||||
|
@ -355,7 +355,7 @@ void decryptExeFs(u8 *inbuf)
|
||||
u32 exeFsSize = *(u32 *)(inbuf + 0x1A4) * 0x200;
|
||||
u8 ncchCTR[0x10];
|
||||
|
||||
memset(ncchCTR, 0, 0x10);
|
||||
memset32(ncchCTR, 0, 0x10);
|
||||
for(u32 i=0; i<8; i++)
|
||||
ncchCTR[7-i] = *(inbuf + 0x108 + i);
|
||||
ncchCTR[8] = 2;
|
||||
|
@ -25,6 +25,7 @@ static inline int strlen(const char *string)
|
||||
{
|
||||
char *stringEnd = (char *)string;
|
||||
while(*stringEnd) stringEnd++;
|
||||
|
||||
return stringEnd - string;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ void main(void)
|
||||
configureCFW(configPath);
|
||||
|
||||
//If screens are inited or the corresponding option is set, load splash screen
|
||||
if(PDN_GPU_CNT != 1 || CONFIG(8, 1)) loadSplash();
|
||||
if(PDN_GPU_CNT != 1 || CONFIG(7, 1)) loadSplash();
|
||||
|
||||
//Determine if we need to boot an emuNAND or sysNAND
|
||||
nandType = (pressed & BUTTON_L1) ? autoBootSys : ((pressed & BUTTON_R1) ? updatedSys : !autoBootSys);
|
||||
@ -182,7 +182,7 @@ void main(void)
|
||||
}
|
||||
}
|
||||
|
||||
loadFirm(firmType, !firmType && (nandType == 2 || updatedSys == !nandType));
|
||||
loadFirm(firmType, !firmType && (nandType == 2 || updatedSys == !firmSource));
|
||||
|
||||
if(!firmType) patchNativeFirm(nandType, emuHeader, a9lhInstalled);
|
||||
else patchTwlAgbFirm(firmType);
|
||||
@ -232,7 +232,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhInstalle
|
||||
nativeFirmType = (arm9Section[0x51] == 0xFF) ? 0 : 1;
|
||||
|
||||
//Decrypt ARM9Bin and patch ARM9 entrypoint to skip arm9loader
|
||||
arm9Loader((u8 *)firm + section[2].offset, nativeFirmType);
|
||||
arm9Loader(arm9Section, nativeFirmType);
|
||||
firm->arm9Entry = (u8 *)0x801B01C;
|
||||
}
|
||||
else
|
||||
@ -271,13 +271,11 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhInstalle
|
||||
*(u16 *)sigOffset2 = sigPatch[0];
|
||||
*((u16 *)sigOffset2 + 1) = sigPatch[1];
|
||||
|
||||
if(CONFIG(5, 1))
|
||||
if(CONFIG(4, 1))
|
||||
{
|
||||
//Apply UNITINFO patch
|
||||
u32 unitInfoOffset;
|
||||
|
||||
getUnitInfoValueSet(arm9Section, section[2].size, &unitInfoOffset);
|
||||
*((u8*)unitInfoOffset + 3) = unitInfoPatch;
|
||||
u8 *unitInfoOffset = getUnitInfoValueSet(arm9Section, section[2].size);
|
||||
*unitInfoOffset = unitInfoPatch;
|
||||
}
|
||||
|
||||
//Replace the FIRM loader with the injector
|
||||
@ -349,7 +347,7 @@ static inline void injectLoader(void)
|
||||
//Check that the injector CXI isn't larger than the original
|
||||
if(injector_size <= (int)loaderSize)
|
||||
{
|
||||
memset((void *)loaderOffset, 0, loaderSize);
|
||||
memset32((void *)loaderOffset, 0, loaderSize);
|
||||
memcpy((void *)loaderOffset, injector, injector_size);
|
||||
|
||||
//Patch content size and ExeFS size to match the repaced loader's ones
|
||||
@ -385,7 +383,7 @@ static inline void patchTwlAgbFirm(u32 firmType)
|
||||
|
||||
/* Calculate the amount of patches to apply. Only count the boot screen patch for AGB_FIRM
|
||||
if the matching option was enabled (keep it as last) */
|
||||
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) : (sizeof(agbPatches) / sizeof(patchData) - !CONFIG(7, 1));
|
||||
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) : (sizeof(agbPatches) / sizeof(patchData) - !CONFIG(6, 1));
|
||||
const patchData *patches = firmType == 1 ? twlPatches : agbPatches;
|
||||
|
||||
//Patch
|
||||
|
@ -17,14 +17,6 @@ void memcpy(void *dest, const void *src, u32 size)
|
||||
destc[i] = srcc[i];
|
||||
}
|
||||
|
||||
void __attribute__((used)) memset(void *dest, int filler, u32 size)
|
||||
{
|
||||
u8 *destc = (u8 *)dest;
|
||||
|
||||
for(u32 i = 0; i < size; i++)
|
||||
destc[i] = (u8)filler;
|
||||
}
|
||||
|
||||
void memset32(void *dest, u32 filler, u32 size)
|
||||
{
|
||||
u32 *dest32 = (u32 *)dest;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "types.h"
|
||||
|
||||
void memcpy(void *dest, const void *src, u32 size);
|
||||
void memset(void *dest, int filler, u32 size);
|
||||
void memset32(void *dest, u32 filler, u32 size);
|
||||
int memcmp(const void *buf1, const void *buf2, u32 size);
|
||||
u8 *memsearch(u8 *startPos, const void *pattern, u32 size, u32 patternSize);
|
@ -69,18 +69,18 @@ u16 *getFirmWrite(u8 *pos, u32 size)
|
||||
return (u16 *)memsearch(off - 0x100, pattern, 0x100, 4);
|
||||
}
|
||||
|
||||
u8 *getUnitInfoValueSet(u8 *pos, u32 size)
|
||||
{
|
||||
//Look for UNITINFO value being set
|
||||
const u8 pattern[] = {0x01, 0x10, 0xA0, 0x13};
|
||||
|
||||
return memsearch(pos, pattern, size, 4) + 3;
|
||||
}
|
||||
|
||||
void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize)
|
||||
{
|
||||
u8 *const off = memsearch(pos, "loade", size, 5);
|
||||
|
||||
*loaderOffset = (u32)off - 0x200;
|
||||
*loaderSize = *(u32 *)(off - 0xFC) * 0x200;
|
||||
}
|
||||
|
||||
void getUnitInfoValueSet(u8 *pos, u32 size, u32 *off)
|
||||
{
|
||||
//Look for UNITINFO value being set
|
||||
const u8 pattern[] = {0x01, 0x10, 0xA0, 0x13};
|
||||
|
||||
*off = (u32)memsearch(pos, pattern, size, 4);
|
||||
}
|
@ -25,5 +25,5 @@ void getSigChecks(u8 *pos, u32 size, u32 *off, u32 *off2);
|
||||
void *getReboot(u8 *pos, u32 size);
|
||||
u32 getfOpen(u8 *proc9Offset, void *rebootOffset);
|
||||
u16 *getFirmWrite(u8 *pos, u32 size);
|
||||
void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize);
|
||||
void getUnitInfoValueSet(u8 *pos, u32 size, u32* off);
|
||||
u8 *getUnitInfoValueSet(u8 *pos, u32 size);
|
||||
void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize);
|
Reference in New Issue
Block a user