PMDBG_GetCurrentAppTitleId => PMDBG_GetCurrentAppTitleIdAndPid
This commit is contained in:
parent
ea14d8a186
commit
c688600d33
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user