From b74dda42a2325030b63f9fe93c44ea0d0bc08a51 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 8 Sep 2016 13:32:49 +0200 Subject: [PATCH] Fix config derp, change the logic of the NIM update patch to only be applied when booting with R --- injector/source/patcher.c | 4 ++-- injector/source/patcher.h | 1 - source/config.c | 4 ++-- source/emunand.h | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 5242309..3147be2 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -297,8 +297,8 @@ void patchCode(u64 progId, u8 *code, u32 size) sizeof(blockAutoUpdatesPatch), 1 ); - //Apply only if the updated NAND hasn't been booted - if((BOOTCFG_NAND != 0) == (BOOTCFG_FIRM != 0 && CONFIG_USESYSFIRM)) + //Apply only if the user booted with R + if((BOOTCFG_NAND != 0) != (BOOTCFG_FIRM != 0)) { static const u8 skipEshopUpdateCheckPattern[] = { 0x30, 0xB5, 0xF1, 0xB0 diff --git a/injector/source/patcher.h b/injector/source/patcher.h index 4f7b503..e19774b 100644 --- a/injector/source/patcher.h +++ b/injector/source/patcher.h @@ -12,7 +12,6 @@ #define BOOTCFG_FIRM BOOTCONFIG(3, 1) #define BOOTCFG_SAFEMODE BOOTCONFIG(6, 1) #define CONFIG_NEWCPU MULTICONFIG(3) -#define CONFIG_USESYSFIRM CONFIG(1) #define CONFIG_USELANGEMUANDCODE CONFIG(2) #define CONFIG_SHOWNAND CONFIG(3) diff --git a/source/config.c b/source/config.c index 18f260e..3075762 100644 --- a/source/config.c +++ b/source/config.c @@ -47,7 +47,7 @@ void writeConfig(ConfigurationStatus needConfig, u32 configTemp) { /* If the configuration is different from previously, overwrite it. Just the no-forcing flag being set is not enough */ - if(needConfig == CREATE_CONFIGURATION || (configTemp & 0xFFFFFFEF) != configData.config) + if(needConfig == CREATE_CONFIGURATION || (configTemp & 0xFFFFFFDF) != configData.config) { if(needConfig == CREATE_CONFIGURATION) { @@ -57,7 +57,7 @@ void writeConfig(ConfigurationStatus needConfig, u32 configTemp) } //Merge the new options and new boot configuration - configData.config = (configData.config & 0xFFFFFFC0) | (configTemp & 0x3F); + configData.config = (configData.config & 0xFFFFFF80) | (configTemp & 0x7F); if(!fileWrite(&configData, CONFIG_PATH, sizeof(CfgData))) error("Error writing the configuration file"); diff --git a/source/emunand.h b/source/emunand.h index 81f8603..45032e9 100644 --- a/source/emunand.h +++ b/source/emunand.h @@ -25,10 +25,10 @@ #include "types.h" #define NCSD_MAGIC 0x4453434E -#define ROUND_TO_4MB(x) (((x) + 0x2000 - 1) & (~(0x2000 - 1))) +#define ROUND_TO_4MB(a) (((a) + 0x2000 - 1) & (~(0x2000 - 1))) extern u32 emuOffset; extern bool isN3DS; -void locateEmuNand(u32 *emuHeader, FirmwareSource *emuNand); +void locateEmuNand(u32 *emuHeader, FirmwareSource *nandType); void patchEmuNand(u8 *arm9Section, u32 arm9SectionSize, u8 *process9Offset, u32 process9Size, u32 emuHeader, u32 branchAdditive); \ No newline at end of file