From 556be08c4e9ad9f508dc2647ef70d3b89c2c242c Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 3 May 2022 18:28:32 -0300 Subject: Implement PM GetProcessInfo atmosphere extension (partially) (#2966) --- .../HOS/Services/Pm/IDebugMonitorInterface.cs | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'Ryujinx.HLE/HOS/Services') diff --git a/Ryujinx.HLE/HOS/Services/Pm/IDebugMonitorInterface.cs b/Ryujinx.HLE/HOS/Services/Pm/IDebugMonitorInterface.cs index 06c11943..4b0df9b7 100644 --- a/Ryujinx.HLE/HOS/Services/Pm/IDebugMonitorInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Pm/IDebugMonitorInterface.cs @@ -1,8 +1,31 @@ -namespace Ryujinx.HLE.HOS.Services.Pm +using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; +using Ryujinx.HLE.HOS.Kernel.Common; +using Ryujinx.HLE.HOS.Kernel.Process; + +namespace Ryujinx.HLE.HOS.Services.Pm { [Service("pm:dmnt")] class IDebugMonitorInterface : IpcService { public IDebugMonitorInterface(ServiceCtx context) { } + + [CommandHipc(65000)] + // AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out out_loc, sf::Out out_status + public ResultCode GetProcessInfo(ServiceCtx context) + { + ulong pid = context.RequestData.ReadUInt64(); + + KProcess process = KernelStatic.GetProcessByPid(pid); + + if (context.Process.HandleTable.GenerateHandle(process, out int processHandle) != KernelResult.Success) + { + throw new System.Exception("Out of handles!"); + } + + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(processHandle); + + return ResultCode.Success; + } } } \ No newline at end of file -- cgit v1.2.3