From b15e5fa8d673044e29084304d9142c7dca64f992 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Sun, 29 Dec 2024 20:30:38 +0100 Subject: [PATCH] loader: change defaults when kext not present E.g. if ran through emulation --- sysmodules/loader/source/main.c | 7 ++++--- sysmodules/loader/source/patcher.c | 2 +- sysmodules/loader/source/patcher.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sysmodules/loader/source/main.c b/sysmodules/loader/source/main.c index 9ad83aa0..775a3aab 100644 --- a/sysmodules/loader/source/main.c +++ b/sysmodules/loader/source/main.c @@ -10,7 +10,7 @@ #include "hbldr.h" u32 config, multiConfig, bootConfig; -bool isN3DS, isSdMode, nextGamePatchDisabled; +bool isN3DS, isSdMode, nextGamePatchDisabled, isLumaWithKext; // MAKE SURE fsreg has been init before calling this static Result fsldrPatchPermissions(void) @@ -33,7 +33,7 @@ static inline void loadCFWInfo(void) s64 out; u64 hbldrTid = 0; - bool isLumaWithKext = svcGetSystemInfo(&out, 0x20000, 0) == 1; + isLumaWithKext = svcGetSystemInfo(&out, 0x20000, 0) == 1; if (isLumaWithKext) { svcGetSystemInfo(&out, 0x10000, 3); @@ -60,7 +60,8 @@ static inline void loadCFWInfo(void) panic(0xDEADCAFE); #ifndef BUILD_FOR_EXPLOIT_DEV - config = 1u << PATCHVERSTRING; // all options 0, except maybe the MSET version display patch + // Most options 0, except select ones + config = BIT(PATCHVERSTRING) | BIT(PATCHGAMES) | BIT(LOADEXTFIRMSANDMODULES); #else config = 0; #endif diff --git a/sysmodules/loader/source/patcher.c b/sysmodules/loader/source/patcher.c index 59bc4c0e..7e51f961 100644 --- a/sysmodules/loader/source/patcher.c +++ b/sysmodules/loader/source/patcher.c @@ -966,7 +966,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro countryId, stateId; - if(loadTitleLocaleConfig(progId, &mask, ®ionId, &languageId, &countryId, &stateId)) + if(isLumaWithKext && loadTitleLocaleConfig(progId, &mask, ®ionId, &languageId, &countryId, &stateId)) svcKernelSetState(0x10001, ((u32)stateId << 24) | ((u32)countryId << 16) | ((u32)languageId << 8) | ((u32)regionId << 4) | (u32)mask , progId); if(!patchLayeredFs(progId, code, size, textSize, roSize, dataSize, roAddress, dataAddress)) goto error; } diff --git a/sysmodules/loader/source/patcher.h b/sysmodules/loader/source/patcher.h index 62539ff0..c07e216c 100644 --- a/sysmodules/loader/source/patcher.h +++ b/sysmodules/loader/source/patcher.h @@ -43,7 +43,7 @@ enum singleOptions }; extern u32 config, multiConfig, bootConfig; -extern bool isN3DS, isSdMode, nextGamePatchDisabled; +extern bool isN3DS, isSdMode, nextGamePatchDisabled, isLumaWithKext; void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 roSize, u32 dataSize, u32 roAddress, u32 dataAddress); bool loadTitleCodeSection(u64 progId, u8 *code, u32 size);