From eb6ab2ba62e80a007435eeeeac87fc931fd1fc53 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 5 Dec 2018 23:57:35 -0800 Subject: [PATCH] dmnt: Implement three more easy commands --- .../dmnt/source/dmnt_debug_monitor.cpp | 18 ++++++++++++++++++ .../dmnt/source/dmnt_debug_monitor.hpp | 11 +++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/stratosphere/dmnt/source/dmnt_debug_monitor.cpp b/stratosphere/dmnt/source/dmnt_debug_monitor.cpp index 30c4e19a4..2e287e6eb 100644 --- a/stratosphere/dmnt/source/dmnt_debug_monitor.cpp +++ b/stratosphere/dmnt/source/dmnt_debug_monitor.cpp @@ -32,3 +32,21 @@ Result DebugMonitorService::CloseHandle(Handle debug_hnd) { /* This command is, entertainingly, also pretty unsafe in general... */ return svcCloseHandle(debug_hnd); } + +Result DebugMonitorService::GetProcessId(Out out_pid, Handle hnd) { + /* Nintendo discards the output of this command, but we will return it. */ + return svcGetProcessId(out_pid.GetPointer(), hnd); +} + +Result DebugMonitorService::GetProcessHandle(Out out_hnd, u64 pid) { + Result rc = svcDebugActiveProcess(out_hnd.GetPointer(), pid); + if (rc == 0xF401) { + rc = 0x4B7; + } + return rc; +} + +Result DebugMonitorService::WaitSynchronization(Handle hnd, u64 ns) { + /* Nintendo discards the output of this command, but we will return it. */ + return svcWaitSynchronizationSingle(hnd, ns); +} diff --git a/stratosphere/dmnt/source/dmnt_debug_monitor.hpp b/stratosphere/dmnt/source/dmnt_debug_monitor.hpp index 028e5173d..bd73d4a88 100644 --- a/stratosphere/dmnt/source/dmnt_debug_monitor.hpp +++ b/stratosphere/dmnt/source/dmnt_debug_monitor.hpp @@ -78,16 +78,19 @@ class DebugMonitorService final : public IServiceObject { Result BreakDebugProcess(Handle debug_hnd); Result TerminateDebugProcess(Handle debug_hnd); Result CloseHandle(Handle debug_hnd); + Result GetProcessId(Out out_pid, Handle hnd); + Result GetProcessHandle(Out out_hnd, u64 pid); + Result WaitSynchronization(Handle hnd, u64 ns); public: DEFINE_SERVICE_DISPATCH_TABLE { MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), // MakeServiceCommandMeta(), - // MakeServiceCommandMeta(), - // MakeServiceCommandMeta(), - // MakeServiceCommandMeta(), - // MakeServiceCommandMeta(), + MakeServiceCommandMeta(), + MakeServiceCommandMeta(), + MakeServiceCommandMeta(), + //MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(),