From 18f977aa7610c62fd9d220bed4c18717a249932c Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 24 Jun 2019 21:48:01 -0700 Subject: [PATCH] pm: add getters for pminfo, pmshell --- nx/include/switch/services/pm.h | 4 ++++ nx/source/services/pm.c | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/nx/include/switch/services/pm.h b/nx/include/switch/services/pm.h index 0491b29c..295a742a 100644 --- a/nx/include/switch/services/pm.h +++ b/nx/include/switch/services/pm.h @@ -54,9 +54,13 @@ Service* pmdmntGetServiceSession(void); Result pminfoInitialize(void); void pminfoExit(void); +Service* pminfoGetServiceSession(void); + Result pmshellInitialize(void); void pmshellExit(void); +Service* pmshellGetServiceSession(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); diff --git a/nx/source/services/pm.c b/nx/source/services/pm.c index 479c8bb5..3f0671cb 100644 --- a/nx/source/services/pm.c +++ b/nx/source/services/pm.c @@ -48,6 +48,11 @@ void pminfoExit(void) } } +Service* pminfoGetServiceSession(void) +{ + return &g_pminfoSrv; +} + Result pmshellInitialize(void) { atomicIncrement64(&g_pmshellRefCnt); @@ -65,6 +70,11 @@ void pmshellExit(void) } } +Service* pmshellGetServiceSession(void) +{ + return &g_pmshellSrv; +} + Result pmdmntGetDebugProcesses(u32* out_count, u64* out_pids, size_t max_pids) { IpcCommand c; ipcInitialize(&c); @@ -475,7 +485,7 @@ Result pmshellGetProcessEvent(Event* out) { if (R_SUCCEEDED(rc)) { IpcParsedCommand r; ipcParse(&r); - + struct { u64 magic; u64 result; @@ -510,7 +520,7 @@ Result pmshellGetProcessEventInfo(PmProcessEventInfo* out) { if (R_SUCCEEDED(rc)) { IpcParsedCommand r; ipcParse(&r); - + struct { u64 magic; u64 result; @@ -534,7 +544,7 @@ Result pmshellGetProcessEventInfo(PmProcessEventInfo* out) { Result pmshellFinalizeDeadProcess(u64 pid) { if (hosversionAtLeast(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - + IpcCommand c; ipcInitialize(&c); @@ -569,7 +579,7 @@ Result pmshellFinalizeDeadProcess(u64 pid) { Result pmshellClearProcessExceptionOccurred(u64 pid) { if (hosversionAtLeast(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - + IpcCommand c; ipcInitialize(&c); @@ -671,7 +681,7 @@ Result pmshellGetApplicationPid(u64* pid_out) { Result pmshellBoostSystemMemoryResourceLimit(u64 boost_size) { if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - + IpcCommand c; ipcInitialize(&c);