diff --git a/sysmodules/pm/source/info.c b/sysmodules/pm/source/info.c index 19c771f..a324580 100644 --- a/sysmodules/pm/source/info.c +++ b/sysmodules/pm/source/info.c @@ -126,12 +126,13 @@ Result GetTitleExHeaderFlags(ExHeader_Arm11CoreInfo *outCoreInfo, ExHeader_Syste return res; } -Result GetCurrentAppTitleId(u64 *outTitleId) +Result GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid) { ProcessList_Lock(&g_manager.processList); Result res; if (g_manager.runningApplicationData != NULL) { *outTitleId = g_manager.runningApplicationData->titleId; + *outPid = g_manager.runningApplicationData->pid; res = 0; } else { *outTitleId = 0; diff --git a/sysmodules/pm/source/info.h b/sysmodules/pm/source/info.h index 38ce43d..214af62 100644 --- a/sysmodules/pm/source/info.h +++ b/sysmodules/pm/source/info.h @@ -12,4 +12,4 @@ Result listMergeUniqueDependencies(ProcessData **procs, u64 *dependencies, u32 * Result GetTitleExHeaderFlags(ExHeader_Arm11CoreInfo *outCoreInfo, ExHeader_SystemInfoFlags *outSiFlags, const FS_ProgramInfo *programInfo); // Custom -Result GetCurrentAppTitleId(u64 *outTitleId); +Result GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid); diff --git a/sysmodules/pm/source/pmdbg.c b/sysmodules/pm/source/pmdbg.c index 0dd0fbf..f846e94 100644 --- a/sysmodules/pm/source/pmdbg.c +++ b/sysmodules/pm/source/pmdbg.c @@ -14,6 +14,7 @@ void pmDbgHandleCommands(void *ctx) Handle debug; u64 titleId; + u32 pid; switch (cmdhdr >> 16) { case 1: @@ -40,9 +41,11 @@ void pmDbgHandleCommands(void *ctx) // Custom case 0x100: titleId = 0; - cmdbuf[1] = GetCurrentAppTitleId(&titleId); - cmdbuf[0] = IPC_MakeHeader(0x100, 3, 0); + pid = 0xFFFFFFFF; + cmdbuf[1] = GetCurrentAppTitleIdAndPid(&titleId, &pid); + cmdbuf[0] = IPC_MakeHeader(0x100, 4, 0); memcpy(cmdbuf + 2, &titleId, 8); + cmdbuf[4] = pid; break; case 0x101: cmdbuf[1] = DebugNextApplicationByForce(); diff --git a/sysmodules/rosalina/include/pmdbgext.h b/sysmodules/rosalina/include/pmdbgext.h index 19d1d67..f5d1236 100644 --- a/sysmodules/rosalina/include/pmdbgext.h +++ b/sysmodules/rosalina/include/pmdbgext.h @@ -5,6 +5,6 @@ #include <3ds/services/pmapp.h> -Result PMDBG_GetCurrentAppTitleId(u64 *outTitleId); +Result PMDBG_GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid); Result PMDBG_DebugNextApplicationByForce(void); Result PMDBG_LaunchTitleDebug(Handle *outDebug, const FS_ProgramInfo *programInfo, u32 launchFlags); diff --git a/sysmodules/rosalina/source/menus/miscellaneous.c b/sysmodules/rosalina/source/menus/miscellaneous.c index 90f6f3d..82530ff 100644 --- a/sysmodules/rosalina/source/menus/miscellaneous.c +++ b/sysmodules/rosalina/source/menus/miscellaneous.c @@ -55,7 +55,8 @@ void MiscellaneousMenu_SwitchBoot3dsxTargetTitle(void) if(HBLDR_3DSX_TID == HBLDR_DEFAULT_3DSX_TID) { - res = PMDBG_GetCurrentAppTitleId(&titleId); + u32 pid; + res = PMDBG_GetCurrentAppTitleIdAndPid(&titleId, &pid); if(R_SUCCEEDED(res)) { HBLDR_3DSX_TID = titleId; diff --git a/sysmodules/rosalina/source/pmdbgext.c b/sysmodules/rosalina/source/pmdbgext.c index 4f69cdf..420c452 100644 --- a/sysmodules/rosalina/source/pmdbgext.c +++ b/sysmodules/rosalina/source/pmdbgext.c @@ -10,7 +10,7 @@ #include <3ds/services/pmdbg.h> #include <3ds/ipc.h> -Result PMDBG_GetCurrentAppTitleId(u64 *outTitleId) +Result PMDBG_GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid) { Result ret = 0; u32 *cmdbuf = getThreadCommandBuffer(); @@ -18,6 +18,7 @@ Result PMDBG_GetCurrentAppTitleId(u64 *outTitleId) if(R_FAILED(ret = svcSendSyncRequest(*pmDbgGetSessionHandle()))) return ret; memcpy(outTitleId, cmdbuf + 2, 8); + *outPid = cmdbuf[4]; return cmdbuf[1]; }