Added new and working N3DS CPU patch from @TuxSH
This commit is contained in:
parent
ef3ba896d5
commit
4fabe1f704
@ -206,7 +206,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
|||||||
case 0x0004001000027000LL: // KOR MSET
|
case 0x0004001000027000LL: // KOR MSET
|
||||||
case 0x0004001000028000LL: // TWN MSET
|
case 0x0004001000028000LL: // TWN MSET
|
||||||
{
|
{
|
||||||
if(R_SUCCEEDED(loadConfig()) && ((config >> 5) & 1))
|
if(R_SUCCEEDED(loadConfig()) && ((config >> 6) & 1))
|
||||||
{
|
{
|
||||||
static const u16 verPattern[] = u"Ver.";
|
static const u16 verPattern[] = u"Ver.";
|
||||||
const u32 currentNand = ((config >> 16) & 3);
|
const u32 currentNand = ((config >> 16) & 3);
|
||||||
@ -242,6 +242,22 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
|||||||
sizeof(stopCartUpdatesPatch), 2
|
sizeof(stopCartUpdatesPatch), 2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(R_SUCCEEDED(loadConfig()) && ((config >> 4) & 1))
|
||||||
|
{
|
||||||
|
static const u8 cfgN3dsCpuPattern[] = {
|
||||||
|
0x40, 0xA0, 0xE1, 0x07, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 *cfgN3dsCpuLoc = memsearch(code, cfgN3dsCpuPattern, size, sizeof(cfgN3dsCpuPattern));
|
||||||
|
|
||||||
|
//Patch N3DS CPU Clock and L2 cache setting
|
||||||
|
if(cfgN3dsCpuLoc != NULL)
|
||||||
|
{
|
||||||
|
*(u32 *)(cfgN3dsCpuLoc + 3) = 0xE1A00000;
|
||||||
|
*(u32 *)(cfgN3dsCpuLoc + 0x1F) = 0xE3A00003;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ void configureCFW(const char *configPath)
|
|||||||
"( ) Updated SysNAND mode (A9LH-only)",
|
"( ) Updated SysNAND mode (A9LH-only)",
|
||||||
"( ) Force A9LH detection",
|
"( ) Force A9LH detection",
|
||||||
"( ) Use second EmuNAND as default",
|
"( ) Use second EmuNAND as default",
|
||||||
|
"( ) Force max N3DS clock speed and L2 cache",
|
||||||
"( ) Use developer UNITINFO",
|
"( ) Use developer UNITINFO",
|
||||||
"( ) Show current NAND in System Settings",
|
"( ) Show current NAND in System Settings",
|
||||||
"( ) Show GBA boot screen in patched AGB_FIRM",
|
"( ) Show GBA boot screen in patched AGB_FIRM",
|
||||||
|
@ -142,7 +142,7 @@ void main(void)
|
|||||||
configureCFW(configPath);
|
configureCFW(configPath);
|
||||||
|
|
||||||
//If screens are inited or the corresponding option is set, load splash screen
|
//If screens are inited or the corresponding option is set, load splash screen
|
||||||
if(PDN_GPU_CNT != 1 || CONFIG(7, 1)) loadSplash();
|
if(PDN_GPU_CNT != 1 || CONFIG(8, 1)) loadSplash();
|
||||||
|
|
||||||
//Determine if we need to boot an emuNAND or sysNAND
|
//Determine if we need to boot an emuNAND or sysNAND
|
||||||
nandType = (pressed & BUTTON_L1) ? autoBootSys : ((pressed & BUTTON_R1) ? updatedSys : !autoBootSys);
|
nandType = (pressed & BUTTON_L1) ? autoBootSys : ((pressed & BUTTON_R1) ? updatedSys : !autoBootSys);
|
||||||
@ -271,7 +271,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhInstalle
|
|||||||
*(u16 *)sigOffset2 = sigPatch[0];
|
*(u16 *)sigOffset2 = sigPatch[0];
|
||||||
*((u16 *)sigOffset2 + 1) = sigPatch[1];
|
*((u16 *)sigOffset2 + 1) = sigPatch[1];
|
||||||
|
|
||||||
if(CONFIG(4, 1))
|
if(CONFIG(5, 1))
|
||||||
{
|
{
|
||||||
//Apply UNITINFO patch
|
//Apply UNITINFO patch
|
||||||
u8 *unitInfoOffset = getUnitInfoValueSet(arm9Section, section[2].size);
|
u8 *unitInfoOffset = getUnitInfoValueSet(arm9Section, section[2].size);
|
||||||
@ -383,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
|
/* 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) */
|
if the matching option was enabled (keep it as last) */
|
||||||
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) : (sizeof(agbPatches) / sizeof(patchData) - !CONFIG(6, 1));
|
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) : (sizeof(agbPatches) / sizeof(patchData) - !CONFIG(7, 1));
|
||||||
const patchData *patches = firmType == 1 ? twlPatches : agbPatches;
|
const patchData *patches = firmType == 1 ? twlPatches : agbPatches;
|
||||||
|
|
||||||
//Patch
|
//Patch
|
||||||
|
Reference in New Issue
Block a user