loader/pm: move "force init SD" code to pm. Greatly reduces the number of Arm9 svcBreak with 0xC8804465

This commit is contained in:
TuxSH
2020-04-27 00:47:16 +01:00
parent 9d62995799
commit f334e3b951
5 changed files with 48 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
#include "hbldr.h"
extern u32 config, multiConfig, bootConfig;
extern bool isN3DS, needToInitSd, isSdMode;
extern bool isN3DS, isSdMode;
static u8 g_ret_buf[sizeof(ExHeader_Info)];
static u64 g_cached_programHandle;

View File

@@ -7,7 +7,7 @@
#include "service_manager.h"
u32 config, multiConfig, bootConfig;
bool isN3DS, needToInitSd, isSdMode;
bool isN3DS, isSdMode;
// MAKE SURE fsreg has been init before calling this
static Result fsldrPatchPermissions(void)
@@ -38,13 +38,10 @@ static inline void loadCFWInfo(void)
assertSuccess(svcGetSystemInfo(&out, 0x10000, 0x201));
isN3DS = (bool)out;
assertSuccess(svcGetSystemInfo(&out, 0x10000, 0x202));
needToInitSd = (bool)out;
//assertSuccess(svcGetSystemInfo(&out, 0x10000, 0x202));
//needToInitSd = (bool)out;
assertSuccess(svcGetSystemInfo(&out, 0x10000, 0x203));
isSdMode = (bool)out;
IFile file;
if(needToInitSd) fileOpen(&file, ARCHIVE_SDMC, "/", FS_OPEN_READ); //Init SD card if SAFE_MODE is being booted
}
void __ctru_exit(int rc) { (void)rc; } // needed to avoid linking error

View File

@@ -39,7 +39,7 @@ enum singleOptions
};
extern u32 config, multiConfig, bootConfig;
extern bool isN3DS, needToInitSd, isSdMode;
extern bool isN3DS, isSdMode;
void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 roSize, u32 dataSize, u32 roAddress, u32 dataAddress);
Result fileOpen(IFile *file, FS_ArchiveID archiveId, const char *path, int flags);