rosalina/pm: remove fs patch, use pm instead
This commit is contained in:
@@ -73,7 +73,11 @@ static Result loadWithoutDependencies(Handle *outDebug, ProcessData **outProcess
|
||||
u32 serviceCount;
|
||||
for(serviceCount = 0; serviceCount < 34 && *(u64 *)localcaps->service_access[serviceCount] != 0; serviceCount++);
|
||||
|
||||
TRY(FSREG_Register(pid, programHandle, programInfo, &localcaps->storage_info));
|
||||
// Not in official PM: patch local caps to give access to everything
|
||||
ExHeader_Arm11StorageInfo storageInfo = localcaps->storage_info;
|
||||
storageInfo.fs_access_info = 0xFFFFFFFF;
|
||||
|
||||
TRY(FSREG_Register(pid, programHandle, programInfo, &storageInfo));
|
||||
TRY(SRVPM_RegisterProcess(pid, serviceCount, localcaps->service_access));
|
||||
|
||||
if (localcaps->reslimit_category <= RESLIMIT_CATEGORY_OTHER) {
|
||||
|
||||
@@ -7,6 +7,21 @@
|
||||
|
||||
Manager g_manager;
|
||||
|
||||
static void giveAllFsArchiveAccessToKip(u32 pid, u64 tid)
|
||||
{
|
||||
static const ExHeader_Arm11StorageInfo storageInfo = {
|
||||
.fs_access_info = 0xFFFFFFFF,
|
||||
};
|
||||
static const u64 programHandle = 0xFFFF000000000000LL;
|
||||
|
||||
FS_ProgramInfo info = {
|
||||
.programId = tid,
|
||||
.mediaType = MEDIATYPE_NAND,
|
||||
};
|
||||
|
||||
assertSuccess(FSREG_Register(pid, programHandle, &info, &storageInfo));
|
||||
}
|
||||
|
||||
void Manager_Init(void *procBuf, size_t numProc)
|
||||
{
|
||||
memset(&g_manager, 0, sizeof(Manager));
|
||||
@@ -34,7 +49,7 @@ void Manager_RegisterKips(void)
|
||||
process->handle = processHandle;
|
||||
process->pid = i;
|
||||
process->refcount = 1;
|
||||
process->titleId = 0x0004000100001000ULL; // note: same TID for all builtins
|
||||
process->titleId = 0x0004000100001000ULL; // note: same internal TID for all builtins
|
||||
process->flags = PROCESSFLAG_KIP;
|
||||
process->terminationStatus = TERMSTATUS_RUNNING;
|
||||
|
||||
@@ -43,8 +58,14 @@ void Manager_RegisterKips(void)
|
||||
assertSuccess(svcSetProcessResourceLimits(processHandle, g_manager.reslimits[RESLIMIT_CATEGORY_OTHER]));
|
||||
}
|
||||
}
|
||||
|
||||
ProcessList_Unlock(&g_manager.processList);
|
||||
|
||||
// Give full archive access to us (PM) and Rosalina (real PIDs don't matter, they just have to be unique (?))
|
||||
// Loader doesn't depend on PM and has its own fs:REG handle so it must do it itself.
|
||||
giveAllFsArchiveAccessToKip(2, 0x0004013000001202LL); // PM
|
||||
if (numKips > 5) {
|
||||
giveAllFsArchiveAccessToKip(5, 0x0004013000006902LL); // Rosalina
|
||||
}
|
||||
}
|
||||
|
||||
Result UnregisterProcess(u64 titleId)
|
||||
|
||||
@@ -6,30 +6,10 @@
|
||||
#include "exheader_info_heap.h"
|
||||
#include "task_runner.h"
|
||||
|
||||
static Result fsRegSetupPermissions(void)
|
||||
{
|
||||
u32 pid;
|
||||
Result res;
|
||||
FS_ProgramInfo info;
|
||||
|
||||
ExHeader_Arm11StorageInfo storageInfo = {
|
||||
.fs_access_info = FSACCESS_SDMC_RW,
|
||||
};
|
||||
|
||||
info.programId = 0x0004013000001202LL; // PM's TID
|
||||
info.mediaType = MEDIATYPE_NAND;
|
||||
|
||||
if(R_SUCCEEDED(res = svcGetProcessId(&pid, CUR_PROCESS_HANDLE)))
|
||||
res = FSREG_Register(pid, 0xFFFF000000000000LL, &info, &storageInfo);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void forceMountSdCard(void)
|
||||
{
|
||||
FS_Archive sdmcArchive;
|
||||
|
||||
assertSuccess(fsRegSetupPermissions());
|
||||
assertSuccess(fsInit());
|
||||
assertSuccess(FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")));
|
||||
// No need to clean up things as we will firmlaunch straight away
|
||||
|
||||
Reference in New Issue
Block a user