mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-15 01:40:18 +00:00
Implement GetApplicationPid atmosphere extension
This commit is contained in:
parent
f8c6a6edf4
commit
a23274cb3c
3 changed files with 36 additions and 1 deletions
|
@ -59,5 +59,15 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||
{
|
||||
return GetCurrentThread().Owner;
|
||||
}
|
||||
|
||||
internal static KProcess GetProcessByPid(long pid)
|
||||
{
|
||||
if (Context.Processes.TryGetValue(pid, out KProcess process))
|
||||
{
|
||||
return process;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1539,6 +1539,8 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
return result;
|
||||
}
|
||||
|
||||
srcProcess.Context.InvalidateCacheRegion(src, size);
|
||||
|
||||
return KernelResult.Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status
|
||||
public ResultCode GetApplicationPid(ServiceCtx context)
|
||||
{
|
||||
long pid = context.RequestData.ReadInt64();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue