mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 13:02:38 +02:00
Make fsp-ldr use domains
This commit is contained in:
parent
d67ae02bc5
commit
86a25e1edd
@ -22,6 +22,10 @@ Result fsldrInitialize(void) {
|
|||||||
|
|
||||||
Result rc = smGetService(&g_fsldrSrv, "fsp-ldr");
|
Result rc = smGetService(&g_fsldrSrv, "fsp-ldr");
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
rc = serviceConvertToDomain(&g_fsldrSrv);
|
||||||
|
}
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc) && kernelAbove400()) {
|
if (R_SUCCEEDED(rc) && kernelAbove400()) {
|
||||||
rc = fsldrSetCurrentProcess();
|
rc = fsldrSetCurrentProcess();
|
||||||
}
|
}
|
||||||
@ -47,7 +51,7 @@ Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out) {
|
|||||||
u64 tid;
|
u64 tid;
|
||||||
} *raw;
|
} *raw;
|
||||||
|
|
||||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
raw = serviceIpcPrepareHeader(&g_fsldrSrv, &c, sizeof(*raw));
|
||||||
raw->magic = SFCI_MAGIC;
|
raw->magic = SFCI_MAGIC;
|
||||||
raw->cmd_id = 0;
|
raw->cmd_id = 0;
|
||||||
raw->tid = tid;
|
raw->tid = tid;
|
||||||
@ -57,17 +61,18 @@ Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out) {
|
|||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
IpcParsedCommand r;
|
IpcParsedCommand r;
|
||||||
ipcParse(&r);
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u64 magic;
|
u64 magic;
|
||||||
u64 result;
|
u64 result;
|
||||||
} *resp = r.Raw;
|
} *resp;
|
||||||
|
|
||||||
|
serviceIpcParse(&g_fsldrSrv, &r, sizeof(*resp));
|
||||||
|
resp = r.Raw;
|
||||||
|
|
||||||
rc = resp->result;
|
rc = resp->result;
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
serviceCreate(&out->s, r.Handles[0]);
|
serviceCreateSubservice(&out->s, &g_fsldrSrv, &r, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +89,7 @@ Result fsldrIsArchivedProgram(u64 pid, bool *out) {
|
|||||||
u64 pid;
|
u64 pid;
|
||||||
} *raw;
|
} *raw;
|
||||||
|
|
||||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
raw = serviceIpcPrepareHeader(&g_fsldrSrv, &c, sizeof(*raw));
|
||||||
raw->magic = SFCI_MAGIC;
|
raw->magic = SFCI_MAGIC;
|
||||||
raw->cmd_id = 1;
|
raw->cmd_id = 1;
|
||||||
raw->pid = pid;
|
raw->pid = pid;
|
||||||
@ -93,13 +98,14 @@ Result fsldrIsArchivedProgram(u64 pid, bool *out) {
|
|||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
IpcParsedCommand r;
|
IpcParsedCommand r;
|
||||||
ipcParse(&r);
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u64 magic;
|
u64 magic;
|
||||||
u64 result;
|
u64 result;
|
||||||
u8 is_archived;
|
u8 is_archived;
|
||||||
} *resp = r.Raw;
|
} *resp;
|
||||||
|
|
||||||
|
serviceIpcParse(&g_fsldrSrv, &r, sizeof(*resp));
|
||||||
|
resp = r.Raw;
|
||||||
|
|
||||||
rc = resp->result;
|
rc = resp->result;
|
||||||
|
|
||||||
@ -122,7 +128,7 @@ Result fsldrSetCurrentProcess(void) {
|
|||||||
u64 unk;
|
u64 unk;
|
||||||
} *raw;
|
} *raw;
|
||||||
|
|
||||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
raw = serviceIpcPrepareHeader(&g_fsldrSrv, &c, sizeof(*raw));
|
||||||
|
|
||||||
raw->magic = SFCI_MAGIC;
|
raw->magic = SFCI_MAGIC;
|
||||||
raw->cmd_id = 2;
|
raw->cmd_id = 2;
|
||||||
@ -132,12 +138,13 @@ Result fsldrSetCurrentProcess(void) {
|
|||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
IpcParsedCommand r;
|
IpcParsedCommand r;
|
||||||
ipcParse(&r);
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u64 magic;
|
u64 magic;
|
||||||
u64 result;
|
u64 result;
|
||||||
} *resp = r.Raw;
|
} *resp;
|
||||||
|
|
||||||
|
serviceIpcParse(&g_fsldrSrv, &r, sizeof(*resp));
|
||||||
|
resp = r.Raw;
|
||||||
|
|
||||||
rc = resp->result;
|
rc = resp->result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user