Implement IIrSensorServer GetIrsensorSharedMemoryHandle (#664)
* Implement IIrSensorServer GetIrsensorSharedMemoryHandle Resolves #620 * Set _irsSharedMem
This commit is contained in:
parent
bea73895f5
commit
9e923b1473
3 changed files with 33 additions and 5 deletions
|
@ -1,6 +1,8 @@
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -12,14 +14,19 @@ namespace Ryujinx.HLE.HOS.Services.Irs
|
|||
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
|
||||
|
||||
public IIrSensorServer()
|
||||
private KSharedMemory _irsSharedMem;
|
||||
|
||||
public IIrSensorServer(KSharedMemory irsSharedMem)
|
||||
{
|
||||
_commands = new Dictionary<int, ServiceProcessRequest>
|
||||
{
|
||||
{ 302, ActivateIrsensor },
|
||||
{ 303, DeactivateIrsensor },
|
||||
{ 311, GetNpadIrCameraHandle }
|
||||
{ 302, ActivateIrsensor },
|
||||
{ 303, DeactivateIrsensor },
|
||||
{ 304, GetIrsensorSharedMemoryHandle },
|
||||
{ 311, GetNpadIrCameraHandle }
|
||||
};
|
||||
|
||||
_irsSharedMem = irsSharedMem;
|
||||
}
|
||||
|
||||
// ActivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
||||
|
@ -42,6 +49,21 @@ namespace Ryujinx.HLE.HOS.Services.Irs
|
|||
return 0;
|
||||
}
|
||||
|
||||
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy>
|
||||
public long GetIrsensorSharedMemoryHandle(ServiceCtx context)
|
||||
{
|
||||
var handleTable = context.Process.HandleTable;
|
||||
|
||||
if (handleTable.GenerateHandle(_irsSharedMem, out int handle) != KernelResult.Success)
|
||||
{
|
||||
throw new InvalidOperationException("Out of handles!");
|
||||
}
|
||||
|
||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle
|
||||
public long GetNpadIrCameraHandle(ServiceCtx context)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue