mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
pm: Add remaining pm:dmnt services
This commit is contained in:
parent
0a92b0eb07
commit
8e1ba23b83
@ -18,11 +18,13 @@ void pminfoExit(void);
|
||||
Result pmshellInitialize(void);
|
||||
void pmshellExit(void);
|
||||
|
||||
Result pmdmntGetDebugProcesses(u32* out_count, u64* out_pids, size_t max_pids);
|
||||
Result pmdmntStartProcess(u64 pid);
|
||||
Result pmdmntGetTitlePid(u64* pid_out, u64 title_id);
|
||||
Result pmdmntEnableDebugForTitleId(Handle* handle_out, u64 title_id);
|
||||
Result pmdmntGetApplicationPid(u64* pid_out);
|
||||
Result pmdmntEnableDebugForApplication(Handle* handle_out);
|
||||
Result pmdmntDisableDebug(void);
|
||||
|
||||
Result pminfoGetTitleId(u64* title_id_out, u64 pid);
|
||||
|
||||
|
@ -61,6 +61,43 @@ void pmshellExit(void)
|
||||
}
|
||||
}
|
||||
|
||||
Result pmdmntGetDebugProcesses(u32* out_count, u64* out_pids, size_t max_pids) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
ipcAddRecvBuffer(&c, out_pids, sizeof(*out_pids) * max_pids, BufferType_Normal);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
} *raw;
|
||||
|
||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = kernelAbove500() ? 0 : 1;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_pmdmntSrv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
ipcParse(&r);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u32 out_count;
|
||||
} *resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (out_count) *out_count = resp->out_count;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result pmdmntStartProcess(u64 pid) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -276,6 +313,39 @@ Result pmdmntEnableDebugForApplication(Handle* handle_out) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result pmdmntDisableDebug(void) {
|
||||
if (!kernelAbove600()) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
} *raw;
|
||||
|
||||
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 6;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_pmdmntSrv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
ipcParse(&r);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
} *resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result pmshellLaunchProcess(u32 launch_flags, u64 titleID, u64 storageID, u64 *pid) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
Loading…
Reference in New Issue
Block a user