move patches to pm

This commit is contained in:
TuxSH
2019-03-29 18:23:52 +01:00
parent ae1f85d341
commit e688ec9257
9 changed files with 68 additions and 85 deletions

View File

@@ -28,26 +28,6 @@ static u64 g_cached_prog_handle;
static ExHeader_Info g_exheader;
static char g_ret_buf[1024];
// MAKE SURE fsreg has been init before calling this
static Result fsldrPatchPermissions(void)
{
u32 pid;
Result res;
FS_ProgramInfo info;
ExHeader_Arm11StorageInfo storageInfo = {
.fs_access_info = FSACCESS_NANDRW | FSACCESS_NANDRO_RO | FSACCESS_SDMC_RW,
};
info.programId = 0x0004013000001302LL; // loader PID
info.mediaType = MEDIATYPE_NAND;
res = svcGetProcessId(&pid, CUR_PROCESS_HANDLE);
if (R_SUCCEEDED(res))
{
res = FSREG_Register(pid, 0xFFFF000000000000LL, &info, &storageInfo);
}
return res;
}
static inline void loadCFWInfo(void)
{
s64 out;
@@ -585,8 +565,10 @@ void __appInit()
svcBreak(USERBREAK_PANIC);
}
fsRegInit();
fsldrPatchPermissions();
// Wait for pm to call fs:REG Register on us
bool registered = false;
while (srvIsServiceRegistered(&registered, "pm:app"), registered)
svcSleepThread(500 * 1000LL);
//fsldrInit();
res = srvGetServiceHandle(fsGetSessionHandle(), "fs:LDR");

View File

@@ -737,17 +737,6 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
memset(start, 0, end - start);
}
s64 nbSection0Modules;
svcGetSystemInfo(&nbSection0Modules, 26, 0);
if(nbSection0Modules == 6)
{
// Makes ErrDisp to not start up
static const u64 errDispTid = 0x0004003000008A02ULL;
u32 *errDispTidLoc = (u32 *)memsearch(code, &errDispTid, size, sizeof(errDispTid));
*(errDispTidLoc - 6) = 0xE3A00000; // mov r0, #0
}
}
else if(progId == 0x0004013000001702LL) //CFG