loader: change defaults when kext not present

E.g. if ran through emulation
This commit is contained in:
TuxSH 2024-12-29 20:30:38 +01:00
parent 1399d7ef3b
commit b15e5fa8d6
3 changed files with 6 additions and 5 deletions

View File

@ -10,7 +10,7 @@
#include "hbldr.h" #include "hbldr.h"
u32 config, multiConfig, bootConfig; u32 config, multiConfig, bootConfig;
bool isN3DS, isSdMode, nextGamePatchDisabled; bool isN3DS, isSdMode, nextGamePatchDisabled, isLumaWithKext;
// MAKE SURE fsreg has been init before calling this // MAKE SURE fsreg has been init before calling this
static Result fsldrPatchPermissions(void) static Result fsldrPatchPermissions(void)
@ -33,7 +33,7 @@ static inline void loadCFWInfo(void)
s64 out; s64 out;
u64 hbldrTid = 0; u64 hbldrTid = 0;
bool isLumaWithKext = svcGetSystemInfo(&out, 0x20000, 0) == 1; isLumaWithKext = svcGetSystemInfo(&out, 0x20000, 0) == 1;
if (isLumaWithKext) if (isLumaWithKext)
{ {
svcGetSystemInfo(&out, 0x10000, 3); svcGetSystemInfo(&out, 0x10000, 3);
@ -60,7 +60,8 @@ static inline void loadCFWInfo(void)
panic(0xDEADCAFE); panic(0xDEADCAFE);
#ifndef BUILD_FOR_EXPLOIT_DEV #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 #else
config = 0; config = 0;
#endif #endif

View File

@ -966,7 +966,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
countryId, countryId,
stateId; stateId;
if(loadTitleLocaleConfig(progId, &mask, &regionId, &languageId, &countryId, &stateId)) if(isLumaWithKext && loadTitleLocaleConfig(progId, &mask, &regionId, &languageId, &countryId, &stateId))
svcKernelSetState(0x10001, ((u32)stateId << 24) | ((u32)countryId << 16) | ((u32)languageId << 8) | ((u32)regionId << 4) | (u32)mask , progId); 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; if(!patchLayeredFs(progId, code, size, textSize, roSize, dataSize, roAddress, dataAddress)) goto error;
} }

View File

@ -43,7 +43,7 @@ enum singleOptions
}; };
extern u32 config, multiConfig, bootConfig; 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); 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); bool loadTitleCodeSection(u64 progId, u8 *code, u32 size);