mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-15 05:50:17 +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;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srcProcess.Context.InvalidateCacheRegion(src, size);
|
||||||
|
|
||||||
return KernelResult.Success;
|
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")]
|
[Service("pm:dmnt")]
|
||||||
class IDebugMonitorInterface : IpcService
|
class IDebugMonitorInterface : IpcService
|
||||||
{
|
{
|
||||||
public IDebugMonitorInterface(ServiceCtx context) { }
|
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