Skip to content

Commit

Permalink
loader: change defaults when kext not present
Browse files Browse the repository at this point in the history
E.g. if ran through emulation
  • Loading branch information
TuxSH committed Dec 29, 2024
1 parent 1399d7e commit b15e5fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions sysmodules/loader/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/loader/source/patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
countryId,
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);
if(!patchLayeredFs(progId, code, size, textSize, roSize, dataSize, roAddress, dataAddress)) goto error;
}
Expand Down
2 changes: 1 addition & 1 deletion sysmodules/loader/source/patcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b15e5fa

Please sign in to comment.