IDebugMonitorInterface.cs 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. using Ryujinx.HLE.HOS.Ipc;
  2. using Ryujinx.HLE.HOS.Kernel;
  3. using Ryujinx.HLE.HOS.Kernel.Common;
  4. using Ryujinx.HLE.HOS.Kernel.Process;
  5. namespace Ryujinx.HLE.HOS.Services.Pm
  6. {
  7. [Service("pm:dmnt")]
  8. class IDebugMonitorInterface : IpcService
  9. {
  10. public IDebugMonitorInterface(ServiceCtx context) { }
  11. [CommandHipc(65000)]
  12. // AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status
  13. public ResultCode GetProcessInfo(ServiceCtx context)
  14. {
  15. ulong pid = context.RequestData.ReadUInt64();
  16. KProcess process = KernelStatic.GetProcessByPid(pid);
  17. if (context.Process.HandleTable.GenerateHandle(process, out int processHandle) != KernelResult.Success)
  18. {
  19. throw new System.Exception("Out of handles!");
  20. }
  21. context.Response.HandleDesc = IpcHandleDesc.MakeCopy(processHandle);
  22. return ResultCode.Success;
  23. }
  24. }
  25. }