Fix A9LH patches not being applied after firmlaunch
This commit is contained in:
parent
e07c230106
commit
121792bebe
@ -109,7 +109,7 @@ u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStora
|
|||||||
return firmVersion;
|
return firmVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isSdMode, u32 devMode)
|
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSdMode, u32 devMode)
|
||||||
{
|
{
|
||||||
u8 *arm9Section = (u8 *)firm + firm->section[2].offset,
|
u8 *arm9Section = (u8 *)firm + firm->section[2].offset,
|
||||||
*arm11Section1 = (u8 *)firm + firm->section[1].offset;
|
*arm11Section1 = (u8 *)firm + firm->section[1].offset;
|
||||||
@ -145,7 +145,7 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
|
|||||||
if(nandType != FIRMWARE_SYSNAND) ret += patchEmuNand(arm9Section, firm->section[2].size, process9Offset, process9Size, emuHeader, firm->section[2].address);
|
if(nandType != FIRMWARE_SYSNAND) ret += patchEmuNand(arm9Section, firm->section[2].size, process9Offset, process9Size, emuHeader, firm->section[2].address);
|
||||||
|
|
||||||
//Apply FIRM0/1 writes patches on sysNAND to protect A9LH
|
//Apply FIRM0/1 writes patches on sysNAND to protect A9LH
|
||||||
else if(ISA9LH || (ISFIRMLAUNCH && BOOTCFG_A9LH != 0)) ret += patchFirmWrites(process9Offset, process9Size);
|
else if(isA9lhInstalled) ret += patchFirmWrites(process9Offset, process9Size);
|
||||||
|
|
||||||
//Apply firmlaunch patches
|
//Apply firmlaunch patches
|
||||||
ret += patchFirmlaunches(process9Offset, process9Size, process9MemAddr, isSdMode);
|
ret += patchFirmlaunches(process9Offset, process9Size, process9MemAddr, isSdMode);
|
||||||
@ -165,7 +165,7 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
|
|||||||
//Apply UNITINFO patch
|
//Apply UNITINFO patch
|
||||||
if(devMode == 2) ret += patchUnitInfoValueSet(arm9Section, firm->section[2].size);
|
if(devMode == 2) ret += patchUnitInfoValueSet(arm9Section, firm->section[2].size);
|
||||||
|
|
||||||
if(devMode != 0 && ISA9LH)
|
if(devMode != 0 && isA9lhInstalled)
|
||||||
{
|
{
|
||||||
//ARM11 exception handlers
|
//ARM11 exception handlers
|
||||||
u32 codeSetOffset,
|
u32 codeSetOffset,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSdMode);
|
u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSdMode);
|
||||||
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isSdMode, u32 devMode);
|
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSdMode, u32 devMode);
|
||||||
u32 patchTwlFirm(u32 firmVersion, u32 devMode);
|
u32 patchTwlFirm(u32 firmVersion, u32 devMode);
|
||||||
u32 patchAgbFirm(u32 devMode);
|
u32 patchAgbFirm(u32 devMode);
|
||||||
u32 patch1x2xNativeAndSafeFirm(u32 devMode);
|
u32 patch1x2xNativeAndSafeFirm(u32 devMode);
|
||||||
|
@ -36,6 +36,7 @@ extern FirmwareSource firmSource;
|
|||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
|
bool isA9lhInstalled;
|
||||||
u32 configTemp,
|
u32 configTemp,
|
||||||
emuHeader;
|
emuHeader;
|
||||||
FirmwareType firmType;
|
FirmwareType firmType;
|
||||||
@ -65,6 +66,7 @@ void main(void)
|
|||||||
|
|
||||||
nandType = (FirmwareSource)BOOTCFG_NAND;
|
nandType = (FirmwareSource)BOOTCFG_NAND;
|
||||||
firmSource = (FirmwareSource)BOOTCFG_FIRM;
|
firmSource = (FirmwareSource)BOOTCFG_FIRM;
|
||||||
|
isA9lhInstalled = BOOTCFG_A9LH != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -75,6 +77,7 @@ void main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
firmType = NATIVE_FIRM;
|
firmType = NATIVE_FIRM;
|
||||||
|
isA9lhInstalled = ISA9LH;
|
||||||
|
|
||||||
//Get pressed buttons
|
//Get pressed buttons
|
||||||
u32 pressed = HID_PAD;
|
u32 pressed = HID_PAD;
|
||||||
@ -231,11 +234,11 @@ void main(void)
|
|||||||
switch(firmType)
|
switch(firmType)
|
||||||
{
|
{
|
||||||
case NATIVE_FIRM:
|
case NATIVE_FIRM:
|
||||||
res = patchNativeFirm(firmVersion, nandType, emuHeader, isSdMode, devMode);
|
res = patchNativeFirm(firmVersion, nandType, emuHeader, isA9lhInstalled, isSdMode, devMode);
|
||||||
break;
|
break;
|
||||||
case SAFE_FIRM:
|
case SAFE_FIRM:
|
||||||
case NATIVE_FIRM1X2X:
|
case NATIVE_FIRM1X2X:
|
||||||
res = ISA9LH ? patch1x2xNativeAndSafeFirm(devMode) : 0;
|
res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(devMode) : 0;
|
||||||
break;
|
break;
|
||||||
case TWL_FIRM:
|
case TWL_FIRM:
|
||||||
res = patchTwlFirm(firmVersion, devMode);
|
res = patchTwlFirm(firmVersion, devMode);
|
||||||
|
Reference in New Issue
Block a user