Add support for 1.x NATIVE_FIRM (on sysNAND) and the O3DS v0 SAFE_FIRM

This commit is contained in:
TuxSH 2016-08-31 19:30:45 +02:00
parent 0057ab9c5a
commit 8982ff259a
3 changed files with 9 additions and 11 deletions

View File

@ -219,8 +219,8 @@ void main(void)
patchNativeFirm(firmVersion, nandType, emuHeader, isA9lh); patchNativeFirm(firmVersion, nandType, emuHeader, isA9lh);
break; break;
case SAFE_FIRM: case SAFE_FIRM:
case NATIVE_FIRM2X: case NATIVE_FIRM1X2X:
if(isA9lh) patch2xNativeAndSafeFirm(); if(isA9lh) patch1x2xNativeAndSafeFirm();
break; break;
default: default:
//Skip patching on unsupported O3DS AGB/TWL FIRMs //Skip patching on unsupported O3DS AGB/TWL FIRMs
@ -240,15 +240,13 @@ static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource)
if(!isN3DS && *firmType == NATIVE_FIRM) if(!isN3DS && *firmType == NATIVE_FIRM)
{ {
//We can't boot < 2.x SysNANDs and < 3.x EmuNANDs //We can't boot < 3.x EmuNANDs
if(firmVersion < 0x18) if(firmVersion < 0x18)
{ {
if(firmSource != FIRMWARE_SYSNAND || firmVersion < 9) if(firmSource != FIRMWARE_SYSNAND)
error("An old unsupported NAND has been detected.\nLuma3DS is unable to boot it"); error("An old unsupported EmuNAND has been detected.\nLuma3DS is unable to boot it");
if(BOOTCONFIG(5, 1)) error("SAFE_MODE is not supported on 2.x FIRM"); *firmType = NATIVE_FIRM1X2X;
*firmType = NATIVE_FIRM2X;
} }
//We can't boot a 3.x/4.x NATIVE_FIRM, load one from SD //We can't boot a 3.x/4.x NATIVE_FIRM, load one from SD
@ -334,7 +332,7 @@ static inline void patchLegacyFirm(FirmwareType firmType)
if(firmType == TWL_FIRM && CONFIG(5)) patchTwlBg((u8 *)firm + section[1].offset); if(firmType == TWL_FIRM && CONFIG(5)) patchTwlBg((u8 *)firm + section[1].offset);
} }
static inline void patch2xNativeAndSafeFirm(void) static inline void patch1x2xNativeAndSafeFirm(void)
{ {
u8 *arm9Section = (u8 *)firm + section[2].offset; u8 *arm9Section = (u8 *)firm + section[2].offset;

View File

@ -50,6 +50,6 @@ typedef struct firmHeader {
static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource); static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource);
static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lh); static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lh);
static inline void patchLegacyFirm(FirmwareType firmType); static inline void patchLegacyFirm(FirmwareType firmType);
static inline void patch2xNativeAndSafeFirm(void); static inline void patch1x2xNativeAndSafeFirm(void);
static inline void copySection0AndInjectSystemModules(void); static inline void copySection0AndInjectSystemModules(void);
static inline void launchFirm(FirmwareType firmType); static inline void launchFirm(FirmwareType firmType);

View File

@ -50,5 +50,5 @@ typedef enum FirmwareType
TWL_FIRM = 1, TWL_FIRM = 1,
AGB_FIRM = 2, AGB_FIRM = 2,
SAFE_FIRM = 3, SAFE_FIRM = 3,
NATIVE_FIRM2X = 4 NATIVE_FIRM1X2X = 4
} FirmwareType; } FirmwareType;