aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-06-27 18:02:41 +0200
committerThomas Guillemard <me@thog.eu>2019-06-27 18:02:41 +0200
commita8965aad970549b3fca87520616674aa3600a9dd (patch)
treedd05ec75127076d7ce4dae45aa4fa49b4b3c5cc7 /Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs
parent36f62cbe72d16c94f0c87fa1712ffff314ab080a (diff)
irs: Little service cleanup (#712)
* irs: Little service cleanup * more cleanup * Fix nit * Fix condition
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs119
1 files changed, 0 insertions, 119 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs b/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs
deleted file mode 100644
index f0864c58..00000000
--- a/Ryujinx.HLE/HOS/Services/Irs/IIrSensorServer.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-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;
-
-namespace Ryujinx.HLE.HOS.Services.Irs
-{
- class IIrSensorServer : IpcService
- {
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- private KSharedMemory _irsSharedMem;
-
- public IIrSensorServer(KSharedMemory irsSharedMem)
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 302, ActivateIrsensor },
- { 303, DeactivateIrsensor },
- { 304, GetIrsensorSharedMemoryHandle },
- { 311, GetNpadIrCameraHandle },
- { 319, ActivateIrsensorWithFunctionLevel }
- };
-
- _irsSharedMem = irsSharedMem;
- }
-
- // ActivateIrsensor(nn::applet::AppletResourceUserId, pid)
- public long ActivateIrsensor(ServiceCtx context)
- {
- long appletResourceUserId = context.RequestData.ReadInt64();
-
- Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
-
- return 0;
- }
-
- // DeactivateIrsensor(nn::applet::AppletResourceUserId, pid)
- public long DeactivateIrsensor(ServiceCtx context)
- {
- long appletResourceUserId = context.RequestData.ReadInt64();
-
- Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
-
- 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)
- {
- uint npadId = context.RequestData.ReadUInt32();
-
- if (npadId >= 8 && npadId != 16 && npadId != 32)
- {
- return ErrorCode.MakeError(ErrorModule.Hid, 0x2c5);
- }
-
- if (((1 << (int)npadId) & 0x1000100FF) == 0)
- {
- return ErrorCode.MakeError(ErrorModule.Hid, 0x2c5);
- }
-
- int npadTypeId = GetNpadTypeId(npadId);
-
- context.ResponseData.Write(npadTypeId);
-
- return 0;
- }
-
- private int GetNpadTypeId(uint npadId)
- {
- switch(npadId)
- {
- case 0: return 0;
- case 1: return 1;
- case 2: return 2;
- case 3: return 3;
- case 4: return 4;
- case 5: return 5;
- case 6: return 6;
- case 7: return 7;
- case 32: return 8;
- case 16: return 9;
- default: throw new ArgumentOutOfRangeException(nameof(npadId));
- }
- }
-
- // ActivateIrsensorWithFunctionLevel(nn::applet::AppletResourceUserId, nn::irsensor::PackedFunctionLevel, pid)
- public long ActivateIrsensorWithFunctionLevel(ServiceCtx context)
- {
- long appletResourceUserId = context.RequestData.ReadInt64();
- long packedFunctionLevel = context.RequestData.ReadInt64();
-
- Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel });
-
- return 0;
- }
- }
-} \ No newline at end of file