aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Nfc
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-07-12 03:13:43 +0200
committergdkchan <gab.dark.100@gmail.com>2019-07-11 22:13:43 -0300
commit560ccbeb2d55a4426ad2827bf7534d4a695431c2 (patch)
tree7e224acbd6c023ea56ff80c6207aa0966aa06ee5 /Ryujinx.HLE/HOS/Services/Nfc
parentf723f6f39aaf7b1cebc0224a055058d62e3b689c (diff)
Refactoring commands handling (#728)
* Refactoring commands handling - Use Reflection to handle commands ID. - Add all symbols (from SwIPC so not all time accurate). - Re-sort some services commands methods. - Some cleanup. - Keep some empty constructor for consistency. * Fix order in IProfile
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Nfc')
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs64
-rw-r--r--Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs19
2 files changed, 31 insertions, 52 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs
index d4c97779..32aaacac 100644
--- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs
+++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs
@@ -1,5 +1,4 @@
-using Ryujinx.Common.Logging;
-using Ryujinx.HLE.Exceptions;
+using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
@@ -18,42 +17,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
private List<Device> _devices = new List<Device>();
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IUser()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, Initialize },
- { 1, Finalize },
- { 2, ListDevices },
- { 3, StartDetection },
- { 4, StopDetection },
- { 5, Mount },
- { 6, Unmount },
- { 7, OpenApplicationArea },
- { 8, GetApplicationArea },
- { 9, SetApplicationArea },
- { 10, Flush },
- { 11, Restore },
- { 12, CreateApplicationArea },
- { 13, GetTagInfo },
- { 14, GetRegisterInfo },
- { 15, GetCommonInfo },
- { 16, GetModelInfo },
- { 17, AttachActivateEvent },
- { 18, AttachDeactivateEvent },
- { 19, GetState },
- { 20, GetDeviceState },
- { 21, GetNpadId },
- { 22, GetApplicationAreaSize },
- { 23, AttachAvailabilityChangeEvent }, // 3.0.0+
- { 24, RecreateApplicationArea }, // 3.0.0+
- };
- }
+ public IUser() { }
+ [Command(0)]
// Initialize(u64, u64, pid, buffer<unknown, 5>)
public long Initialize(ServiceCtx context)
{
@@ -87,6 +53,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return 0;
}
+ [Command(1)]
// Finalize()
public long Finalize(ServiceCtx context)
{
@@ -101,6 +68,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return 0;
}
+ [Command(2)]
// ListDevices() -> (u32, buffer<unknown, 0xa>)
public long ListDevices(ServiceCtx context)
{
@@ -127,90 +95,105 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return 0;
}
+ [Command(3)]
// StartDetection(bytes<8, 4>)
public long StartDetection(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(4)]
// StopDetection(bytes<8, 4>)
public long StopDetection(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(5)]
// Mount(bytes<8, 4>, u32, u32)
public long Mount(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(6)]
// Unmount(bytes<8, 4>)
public long Unmount(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(7)]
// OpenApplicationArea(bytes<8, 4>, u32)
public long OpenApplicationArea(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(8)]
// GetApplicationArea(bytes<8, 4>) -> (u32, buffer<unknown, 6>)
public long GetApplicationArea(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(9)]
// SetApplicationArea(bytes<8, 4>, buffer<unknown, 5>)
public long SetApplicationArea(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(10)]
// Flush(bytes<8, 4>)
public long Flush(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(11)]
// Restore(bytes<8, 4>)
public long Restore(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(12)]
// CreateApplicationArea(bytes<8, 4>, u32, buffer<unknown, 5>)
public long CreateApplicationArea(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(13)]
// GetTagInfo(bytes<8, 4>) -> buffer<unknown<0x58>, 0x1a>
public long GetTagInfo(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(14)]
// GetRegisterInfo(bytes<8, 4>) -> buffer<unknown<0x100>, 0x1a>
public long GetRegisterInfo(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(15)]
// GetCommonInfo(bytes<8, 4>) -> buffer<unknown<0x40>, 0x1a>
public long GetCommonInfo(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(16)]
// GetModelInfo(bytes<8, 4>) -> buffer<unknown<0x40>, 0x1a>
public long GetModelInfo(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(17)]
// AttachActivateEvent(bytes<8, 4>) -> handle<copy>
public long AttachActivateEvent(ServiceCtx context)
{
@@ -239,6 +222,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound);
}
+ [Command(18)]
// AttachDeactivateEvent(bytes<8, 4>) -> handle<copy>
public long AttachDeactivateEvent(ServiceCtx context)
{
@@ -267,6 +251,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound);
}
+ [Command(19)]
// GetState() -> u32
public long GetState(ServiceCtx context)
{
@@ -275,6 +260,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return 0;
}
+ [Command(20)]
// GetDeviceState(bytes<8, 4>) -> u32
public long GetDeviceState(ServiceCtx context)
{
@@ -295,6 +281,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound);
}
+ [Command(21)]
// GetNpadId(bytes<8, 4>) -> u32
public long GetNpadId(ServiceCtx context)
{
@@ -313,12 +300,14 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound);
}
+ [Command(22)]
// GetApplicationAreaSize(bytes<8, 4>) -> u32
public long GetApplicationAreaSize(ServiceCtx context)
{
throw new ServiceNotImplementedException(context);
}
+ [Command(23)] // 3.0.0+
// AttachAvailabilityChangeEvent() -> handle<copy>
public long AttachAvailabilityChangeEvent(ServiceCtx context)
{
@@ -337,6 +326,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return 0;
}
+ [Command(24)] // 3.0.0+
// RecreateApplicationArea(bytes<8, 4>, u32, buffer<unknown, 5>)
public long RecreateApplicationArea(ServiceCtx context)
{
diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs
index 8350b37c..d33c3a32 100644
--- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs
+++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUserManager.cs
@@ -1,23 +1,12 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
-namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
+namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
{
[Service("nfp:user")]
class IUserManager : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IUserManager(ServiceCtx context)
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetUserInterface }
- };
- }
+ public IUserManager(ServiceCtx context) { }
+ [Command(0)]
+ // CreateUserInterface() -> object<nn::nfp::detail::IUser>
public long GetUserInterface(ServiceCtx context)
{
MakeObject(context, new IUser());