diff --git a/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs b/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs index 163c2dc088..051be7a88a 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/HidUtils.cs @@ -24,9 +24,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid } } - public static NpadIdType GetNpadIdTypeFromIndex(HidControllerId Index) + public static NpadIdType GetNpadIdTypeFromIndex(HidControllerId index) { - switch (Index) + switch (index) { case HidControllerId.ControllerPlayer1: return NpadIdType.Player1; case HidControllerId.ControllerPlayer2: return NpadIdType.Player2; @@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid case HidControllerId.ControllerHandheld: return NpadIdType.Handheld; case HidControllerId.ControllerUnknown: return NpadIdType.Unknown; - default: throw new ArgumentOutOfRangeException(nameof(Index)); + default: throw new ArgumentOutOfRangeException(nameof(index)); } } } diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/Device.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/Device.cs index 4ac8313955..a1f58dae1c 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/Device.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/Device.cs @@ -7,10 +7,10 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp class Device { public KEvent ActivateEvent; - public int ActivateEventHandle = 0; + public int ActivateEventHandle; public KEvent DeactivateEvent; - public int DeactivateEventHandle = 0; + public int DeactivateEventHandle; public DeviceState State = DeviceState.Unavailable; diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs index 28333f54db..d4c977793b 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/IUser.cs @@ -1,4 +1,5 @@ using Ryujinx.Common.Logging; +using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Threading; @@ -28,28 +29,28 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { 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 }, + { 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 }, + { 22, GetApplicationAreaSize }, { 23, AttachAvailabilityChangeEvent }, // 3.0.0+ - //{ 24, RecreateApplicationArea }, // 3.0.0+ + { 24, RecreateApplicationArea }, // 3.0.0+ }; } @@ -72,14 +73,14 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // Add an instance of nn::nfc::server::SaveData when it will be implemented. // TODO: When we will be able to add multiple controllers add one entry by controller here. - Device Device1 = new Device + Device device1 = new Device { NpadIdType = NpadIdType.Player1, Handle = HidUtils.GetIndexFromNpadIdType(NpadIdType.Player1), State = DeviceState.Initialized }; - _devices.Add(Device1); + _devices.Add(device1); _state = State.Initialized; @@ -126,14 +127,98 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp return 0; } + // StartDetection(bytes<8, 4>) + public long StartDetection(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // StopDetection(bytes<8, 4>) + public long StopDetection(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // Mount(bytes<8, 4>, u32, u32) + public long Mount(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // Unmount(bytes<8, 4>) + public long Unmount(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // OpenApplicationArea(bytes<8, 4>, u32) + public long OpenApplicationArea(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // GetApplicationArea(bytes<8, 4>) -> (u32, buffer) + public long GetApplicationArea(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // SetApplicationArea(bytes<8, 4>, buffer) + public long SetApplicationArea(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // Flush(bytes<8, 4>) + public long Flush(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // Restore(bytes<8, 4>) + public long Restore(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // CreateApplicationArea(bytes<8, 4>, u32, buffer) + public long CreateApplicationArea(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // GetTagInfo(bytes<8, 4>) -> buffer, 0x1a> + public long GetTagInfo(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // GetRegisterInfo(bytes<8, 4>) -> buffer, 0x1a> + public long GetRegisterInfo(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // GetCommonInfo(bytes<8, 4>) -> buffer, 0x1a> + public long GetCommonInfo(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + + // GetModelInfo(bytes<8, 4>) -> buffer, 0x1a> + public long GetModelInfo(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + // AttachActivateEvent(bytes<8, 4>) -> handle public long AttachActivateEvent(ServiceCtx context) { - uint DeviceHandle = context.RequestData.ReadUInt32(); + uint deviceHandle = context.RequestData.ReadUInt32(); for (int i = 0; i < _devices.Count; i++) { - if ((uint)_devices[i].Handle == DeviceHandle) + if ((uint)_devices[i].Handle == deviceHandle) { if (_devices[i].ActivateEventHandle == 0) { @@ -157,11 +242,11 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // AttachDeactivateEvent(bytes<8, 4>) -> handle public long AttachDeactivateEvent(ServiceCtx context) { - uint DeviceHandle = context.RequestData.ReadUInt32(); + uint deviceHandle = context.RequestData.ReadUInt32(); for (int i = 0; i < _devices.Count; i++) { - if ((uint)_devices[i].Handle == DeviceHandle) + if ((uint)_devices[i].Handle == deviceHandle) { if (_devices[i].DeactivateEventHandle == 0) { @@ -193,11 +278,11 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // GetDeviceState(bytes<8, 4>) -> u32 public long GetDeviceState(ServiceCtx context) { - uint DeviceHandle = context.RequestData.ReadUInt32(); + uint deviceHandle = context.RequestData.ReadUInt32(); for (int i = 0; i < _devices.Count; i++) { - if ((uint)_devices[i].Handle == DeviceHandle) + if ((uint)_devices[i].Handle == deviceHandle) { context.ResponseData.Write((uint)_devices[i].State); @@ -213,11 +298,11 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp // GetNpadId(bytes<8, 4>) -> u32 public long GetNpadId(ServiceCtx context) { - uint DeviceHandle = context.RequestData.ReadUInt32(); + uint deviceHandle = context.RequestData.ReadUInt32(); for (int i = 0; i < _devices.Count; i++) { - if ((uint)_devices[i].Handle == DeviceHandle) + if ((uint)_devices[i].Handle == deviceHandle) { context.ResponseData.Write((uint)HidUtils.GetNpadIdTypeFromIndex(_devices[i].Handle)); @@ -228,6 +313,12 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp return ErrorCode.MakeError(ErrorModule.Nfp, NfpError.DeviceNotFound); } + // GetApplicationAreaSize(bytes<8, 4>) -> u32 + public long GetApplicationAreaSize(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } + // AttachAvailabilityChangeEvent() -> handle public long AttachAvailabilityChangeEvent(ServiceCtx context) { @@ -245,5 +336,11 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp return 0; } + + // RecreateApplicationArea(bytes<8, 4>, u32, buffer) + public long RecreateApplicationArea(ServiceCtx context) + { + throw new ServiceNotImplementedException(context); + } } } \ No newline at end of file