From 8982ff259a429cc50740a8009167c0105b537b86 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Wed, 31 Aug 2016 19:30:45 +0200 Subject: [PATCH 1/2] Add support for 1.x NATIVE_FIRM (on sysNAND) and the O3DS v0 SAFE_FIRM --- source/firm.c | 16 +++++++--------- source/firm.h | 2 +- source/types.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/source/firm.c b/source/firm.c index 2e73595..d864bd6 100755 --- a/source/firm.c +++ b/source/firm.c @@ -219,8 +219,8 @@ void main(void) patchNativeFirm(firmVersion, nandType, emuHeader, isA9lh); break; case SAFE_FIRM: - case NATIVE_FIRM2X: - if(isA9lh) patch2xNativeAndSafeFirm(); + case NATIVE_FIRM1X2X: + if(isA9lh) patch1x2xNativeAndSafeFirm(); break; default: //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) { - //We can't boot < 2.x SysNANDs and < 3.x EmuNANDs + //We can't boot < 3.x EmuNANDs if(firmVersion < 0x18) { - if(firmSource != FIRMWARE_SYSNAND || firmVersion < 9) - error("An old unsupported NAND has been detected.\nLuma3DS is unable to boot it"); + if(firmSource != FIRMWARE_SYSNAND) + 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_FIRM2X; + *firmType = NATIVE_FIRM1X2X; } //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); } -static inline void patch2xNativeAndSafeFirm(void) +static inline void patch1x2xNativeAndSafeFirm(void) { u8 *arm9Section = (u8 *)firm + section[2].offset; diff --git a/source/firm.h b/source/firm.h index 6f3f2f4..4fdce8b 100644 --- a/source/firm.h +++ b/source/firm.h @@ -50,6 +50,6 @@ typedef struct firmHeader { static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource); static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lh); static inline void patchLegacyFirm(FirmwareType firmType); -static inline void patch2xNativeAndSafeFirm(void); +static inline void patch1x2xNativeAndSafeFirm(void); static inline void copySection0AndInjectSystemModules(void); static inline void launchFirm(FirmwareType firmType); \ No newline at end of file diff --git a/source/types.h b/source/types.h index 223d38c..d5fd269 100644 --- a/source/types.h +++ b/source/types.h @@ -50,5 +50,5 @@ typedef enum FirmwareType TWL_FIRM = 1, AGB_FIRM = 2, SAFE_FIRM = 3, - NATIVE_FIRM2X = 4 + NATIVE_FIRM1X2X = 4 } FirmwareType; \ No newline at end of file From c0f042bc2a9f06d39c85971e03a7c0ea8a04812f Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 31 Aug 2016 19:49:40 +0200 Subject: [PATCH 2/2] Can not support safe_firm firmlaunches without 3ds_injector at the moment --- source/firm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/firm.c b/source/firm.c index d864bd6..d2600f0 100755 --- a/source/firm.c +++ b/source/firm.c @@ -246,6 +246,8 @@ static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource) if(firmSource != FIRMWARE_SYSNAND) 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 1.x/2.x FIRM"); + *firmType = NATIVE_FIRM1X2X; }