From b5cddedb7d37e20a1451085a8b9d975ead1fe1e3 Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 26 Aug 2016 21:38:03 +0200 Subject: [PATCH 1/2] Fix config derp --- source/firm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/firm.c b/source/firm.c index f8edea0..a6cef14 100755 --- a/source/firm.c +++ b/source/firm.c @@ -51,7 +51,7 @@ void main(void) { bool isA9lh; - u32 newConfig, + u32 configTemp, emuHeader; FirmwareType firmType; @@ -100,7 +100,8 @@ void main(void) //Determine if the user chose to use the SysNAND FIRM as default for a R boot bool useSysAsDefault = isA9lh ? CONFIG(1) : false; - newConfig = (config & 0xFFFFFFC0) | ((u32)isA9lh << 3); + //Save old options and begin saving the new boot configuration + configTemp = (config & 0xFFFFFFC0) | ((u32)isA9lh << 3); //If it's a MCU reboot, try to force boot options if(isA9lh && CFG_BOOTENV) @@ -113,7 +114,7 @@ void main(void) needConfig = DONT_CONFIGURE; //Flag to prevent multiple boot options-forcing - newConfig |= 1 << 4; + configTemp |= 1 << 4; } /* Else, force the last used boot options unless a button is pressed @@ -203,14 +204,14 @@ void main(void) if(!isFirmlaunch) { - newConfig |= (u32)nandType | ((u32)firmSource << 2); + configTemp |= (u32)nandType | ((u32)firmSource << 2); - /* If the boot configuration is different from previously, overwrite it. + /* If the configuration is different from previously, overwrite it. Just the no-forcing flag being set is not enough */ - if((newConfig & 0xFFFFFFEF) != config) + if((configTemp & 0xFFFFFFEF) != config) { - //Update the last boot configuration - config |= newConfig & 0x3F; + //Merge the new options and new boot configuration + config = (config & 0xFFFFFFC0) | (configTemp & 0x3F); if(!fileWrite(&config, configPath, 4)) { From 356268eae5430747488d0019ba62345eeb3446b8 Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 26 Aug 2016 22:24:23 +0200 Subject: [PATCH 2/2] Welcome back to the 1,25s speed boost --- injector/source/patcher.c | 2 +- injector/source/patcher.h | 5 +++-- source/firm.c | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 1039747..c5c2627 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -98,7 +98,7 @@ static void loadCFWInfo(void) { svcGetCFWInfo(&info); IFile file; - if(R_SUCCEEDED(fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ))) //init SD card for firmlaunch patches + if(BOOTCONFIG(5, 1) && R_SUCCEEDED(fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ))) //Init SD card if SAFE_MODE is being booted { IFile_Close(&file); } diff --git a/injector/source/patcher.h b/injector/source/patcher.h index 4c4a356..ea3ea5e 100644 --- a/injector/source/patcher.h +++ b/injector/source/patcher.h @@ -3,8 +3,9 @@ #include <3ds/types.h> #define PATH_MAX 255 -#define CONFIG(a) (((info.config >> (a + 16)) & 1) != 0) -#define MULTICONFIG(a) ((info.config >> (a * 2 + 6)) & 3) + +#define CONFIG(a) (((info.config >> (a + 16)) & 1) != 0) +#define MULTICONFIG(a) ((info.config >> (a * 2 + 6)) & 3) #define BOOTCONFIG(a, b) ((info.config >> a) & b) typedef struct __attribute__((packed)) diff --git a/source/firm.c b/source/firm.c index 11a9007..301839f 100755 --- a/source/firm.c +++ b/source/firm.c @@ -156,6 +156,9 @@ void main(void) { nandType = FIRMWARE_SYSNAND; firmSource = FIRMWARE_SYSNAND; + + //Flag to tell loader to init SD + configTemp |= 1 << 5; } else {