From 7a8cd13910eaec1fc74f304b3afd25881a8519ae Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 13 Nov 2025 12:21:36 -0700 Subject: [PATCH] pm: add pmshellGetProcessId (19.0.0+) --- nx/include/switch/services/pm.h | 1 + nx/source/services/pm.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/nx/include/switch/services/pm.h b/nx/include/switch/services/pm.h index 13e1fd1f..1401a5dd 100644 --- a/nx/include/switch/services/pm.h +++ b/nx/include/switch/services/pm.h @@ -138,3 +138,4 @@ Result pmshellGetApplicationProcessIdForShell(u64* pid_out); Result pmshellBoostSystemMemoryResourceLimit(u64 boost_size); Result pmshellBoostApplicationThreadResourceLimit(void); Result pmshellBoostSystemThreadResourceLimit(void); +Result pmshellGetProcessId(u64* pid_out, u64 program_id); diff --git a/nx/source/services/pm.c b/nx/source/services/pm.c index a178394b..a4c56b61 100644 --- a/nx/source/services/pm.c +++ b/nx/source/services/pm.c @@ -199,3 +199,8 @@ Result pmshellBoostSystemThreadResourceLimit(void) { if (!hosversionIsAtmosphere() && hosversionBefore(14,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return _pmCmdVoid(&g_pmshellSrv, 10); } + +Result pmshellGetProcessId(u64* pid_out, u64 program_id) { + if (!hosversionIsAtmosphere() && hosversionBefore(19,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _pmCmdInU64OutU64(pid_out, program_id, &g_pmshellSrv, 12); +}