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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetCurrentAppTitleId(u64 *outTitleId)
|
Result GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid)
|
||||||
{
|
{
|
||||||
ProcessList_Lock(&g_manager.processList);
|
ProcessList_Lock(&g_manager.processList);
|
||||||
Result res;
|
Result res;
|
||||||
if (g_manager.runningApplicationData != NULL) {
|
if (g_manager.runningApplicationData != NULL) {
|
||||||
*outTitleId = g_manager.runningApplicationData->titleId;
|
*outTitleId = g_manager.runningApplicationData->titleId;
|
||||||
|
*outPid = g_manager.runningApplicationData->pid;
|
||||||
res = 0;
|
res = 0;
|
||||||
} else {
|
} else {
|
||||||
*outTitleId = 0;
|
*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);
|
Result GetTitleExHeaderFlags(ExHeader_Arm11CoreInfo *outCoreInfo, ExHeader_SystemInfoFlags *outSiFlags, const FS_ProgramInfo *programInfo);
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
Result GetCurrentAppTitleId(u64 *outTitleId);
|
Result GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid);
|
||||||
|
@ -14,6 +14,7 @@ void pmDbgHandleCommands(void *ctx)
|
|||||||
Handle debug;
|
Handle debug;
|
||||||
|
|
||||||
u64 titleId;
|
u64 titleId;
|
||||||
|
u32 pid;
|
||||||
|
|
||||||
switch (cmdhdr >> 16) {
|
switch (cmdhdr >> 16) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -40,9 +41,11 @@ void pmDbgHandleCommands(void *ctx)
|
|||||||
// Custom
|
// Custom
|
||||||
case 0x100:
|
case 0x100:
|
||||||
titleId = 0;
|
titleId = 0;
|
||||||
cmdbuf[1] = GetCurrentAppTitleId(&titleId);
|
pid = 0xFFFFFFFF;
|
||||||
cmdbuf[0] = IPC_MakeHeader(0x100, 3, 0);
|
cmdbuf[1] = GetCurrentAppTitleIdAndPid(&titleId, &pid);
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x100, 4, 0);
|
||||||
memcpy(cmdbuf + 2, &titleId, 8);
|
memcpy(cmdbuf + 2, &titleId, 8);
|
||||||
|
cmdbuf[4] = pid;
|
||||||
break;
|
break;
|
||||||
case 0x101:
|
case 0x101:
|
||||||
cmdbuf[1] = DebugNextApplicationByForce();
|
cmdbuf[1] = DebugNextApplicationByForce();
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
|
|
||||||
#include <3ds/services/pmapp.h>
|
#include <3ds/services/pmapp.h>
|
||||||
|
|
||||||
Result PMDBG_GetCurrentAppTitleId(u64 *outTitleId);
|
Result PMDBG_GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid);
|
||||||
Result PMDBG_DebugNextApplicationByForce(void);
|
Result PMDBG_DebugNextApplicationByForce(void);
|
||||||
Result PMDBG_LaunchTitleDebug(Handle *outDebug, const FS_ProgramInfo *programInfo, u32 launchFlags);
|
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)
|
if(HBLDR_3DSX_TID == HBLDR_DEFAULT_3DSX_TID)
|
||||||
{
|
{
|
||||||
res = PMDBG_GetCurrentAppTitleId(&titleId);
|
u32 pid;
|
||||||
|
res = PMDBG_GetCurrentAppTitleIdAndPid(&titleId, &pid);
|
||||||
if(R_SUCCEEDED(res))
|
if(R_SUCCEEDED(res))
|
||||||
{
|
{
|
||||||
HBLDR_3DSX_TID = titleId;
|
HBLDR_3DSX_TID = titleId;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <3ds/services/pmdbg.h>
|
#include <3ds/services/pmdbg.h>
|
||||||
#include <3ds/ipc.h>
|
#include <3ds/ipc.h>
|
||||||
|
|
||||||
Result PMDBG_GetCurrentAppTitleId(u64 *outTitleId)
|
Result PMDBG_GetCurrentAppTitleIdAndPid(u64 *outTitleId, u32 *outPid)
|
||||||
{
|
{
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
u32 *cmdbuf = getThreadCommandBuffer();
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
@ -18,6 +18,7 @@ Result PMDBG_GetCurrentAppTitleId(u64 *outTitleId)
|
|||||||
if(R_FAILED(ret = svcSendSyncRequest(*pmDbgGetSessionHandle()))) return ret;
|
if(R_FAILED(ret = svcSendSyncRequest(*pmDbgGetSessionHandle()))) return ret;
|
||||||
|
|
||||||
memcpy(outTitleId, cmdbuf + 2, 8);
|
memcpy(outTitleId, cmdbuf + 2, 8);
|
||||||
|
*outPid = cmdbuf[4];
|
||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user