aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Nfp
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-06-28 13:08:23 +0200
committerjduncanator <1518948+jduncanator@users.noreply.github.com>2019-06-28 21:08:23 +1000
commitba86a5d7f3aa0127c4732c739af3f6086fb6acd9 (patch)
tree64d2308ad44f4b87cf9aa5aaacb8933ec7bda679 /Ryujinx.HLE/HOS/Services/Nfp
parenta8965aad970549b3fca87520616674aa3600a9dd (diff)
nfp:user: Implement IUser (#714)
* nfp:user: Implement IUser - Based on RE of sysmod FW 1.0 and 3.0 with help of https://github.com/switchbrew/libnx/ and https://reswitched.github.io/SwIPC/ifaces.html#nn::nfp::detail::IUser - Accurate implementation of Initialize, AttachActivateEvent, AttachDeactivateEvent, GetState, GetDeviceState, GetNpadId and GetDeviceState. - Implementation of Finalize and ListDevices (close #638). * reorder private var * fix nits
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Nfp')
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs7
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfp/IUser.cs125
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs27
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfp/State.cs8
4 files changed, 0 insertions, 167 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs b/Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs
deleted file mode 100644
index 04527893..00000000
--- a/Ryujinx.HLE/HOS/Services/Nfp/DeviceState.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Nfp
-{
- enum DeviceState
- {
- Initialized = 0
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Nfp/IUser.cs b/Ryujinx.HLE/HOS/Services/Nfp/IUser.cs
deleted file mode 100644
index 66bff1a7..00000000
--- a/Ryujinx.HLE/HOS/Services/Nfp/IUser.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-using Ryujinx.Common.Logging;
-using Ryujinx.HLE.HOS.Ipc;
-using Ryujinx.HLE.HOS.Kernel.Common;
-using Ryujinx.HLE.HOS.Kernel.Threading;
-using Ryujinx.HLE.Input;
-using System;
-using System.Collections.Generic;
-
-namespace Ryujinx.HLE.HOS.Services.Nfp
-{
- class IUser : IpcService
- {
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- private const HidControllerId NpadId = HidControllerId.ControllerPlayer1;
-
- private State _state = State.NonInitialized;
-
- private DeviceState _deviceState = DeviceState.Initialized;
-
- private KEvent _activateEvent;
-
- private KEvent _deactivateEvent;
-
- private KEvent _availabilityChangeEvent;
-
- public IUser(Horizon system)
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, Initialize },
- { 17, AttachActivateEvent },
- { 18, AttachDeactivateEvent },
- { 19, GetState },
- { 20, GetDeviceState },
- { 21, GetNpadId },
- { 23, AttachAvailabilityChangeEvent }
- };
-
- _activateEvent = new KEvent(system);
- _deactivateEvent = new KEvent(system);
- _availabilityChangeEvent = new KEvent(system);
- }
-
- public long Initialize(ServiceCtx context)
- {
- Logger.PrintStub(LogClass.ServiceNfp);
-
- _state = State.Initialized;
-
- return 0;
- }
-
- public long AttachActivateEvent(ServiceCtx context)
- {
- Logger.PrintStub(LogClass.ServiceNfp);
-
- if (context.Process.HandleTable.GenerateHandle(_activateEvent.ReadableEvent, out int handle) != KernelResult.Success)
- {
- throw new InvalidOperationException("Out of handles!");
- }
-
- context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
-
- return 0;
- }
-
- public long AttachDeactivateEvent(ServiceCtx context)
- {
- Logger.PrintStub(LogClass.ServiceNfp);
-
- if (context.Process.HandleTable.GenerateHandle(_deactivateEvent.ReadableEvent, out int handle) != KernelResult.Success)
- {
- throw new InvalidOperationException("Out of handles!");
- }
-
- context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
-
- return 0;
- }
-
- public long GetState(ServiceCtx context)
- {
- context.ResponseData.Write((int)_state);
-
- Logger.PrintStub(LogClass.ServiceNfp);
-
- return 0;
- }
-
- public long GetDeviceState(ServiceCtx context)
- {
- context.ResponseData.Write((int)_deviceState);
-
- Logger.PrintStub(LogClass.ServiceNfp);
-
- return 0;
- }
-
- public long GetNpadId(ServiceCtx context)
- {
- context.ResponseData.Write((int)NpadId);
-
- Logger.PrintStub(LogClass.ServiceNfp);
-
- return 0;
- }
-
- public long AttachAvailabilityChangeEvent(ServiceCtx context)
- {
- Logger.PrintStub(LogClass.ServiceNfp);
-
- if (context.Process.HandleTable.GenerateHandle(_availabilityChangeEvent.ReadableEvent, out int handle) != KernelResult.Success)
- {
- throw new InvalidOperationException("Out of handles!");
- }
-
- context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs b/Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs
deleted file mode 100644
index 1bf93746..00000000
--- a/Ryujinx.HLE/HOS/Services/Nfp/IUserManager.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.HLE.HOS.Services.Nfp
-{
- class IUserManager : IpcService
- {
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IUserManager()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetUserInterface }
- };
- }
-
- public long GetUserInterface(ServiceCtx context)
- {
- MakeObject(context, new IUser(context.Device.System));
-
- return 0;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Nfp/State.cs b/Ryujinx.HLE/HOS/Services/Nfp/State.cs
deleted file mode 100644
index 0b4b3c1b..00000000
--- a/Ryujinx.HLE/HOS/Services/Nfp/State.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.HOS.Services.Nfp
-{
- enum State
- {
- NonInitialized = 0,
- Initialized = 1
- }
-} \ No newline at end of file