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); +}