From 9520575f8a7213cbdde23ed2d1c170c99842198b Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sat, 20 Jul 2024 17:10:26 +0100 Subject: [PATCH] Progress --- .../HOS/Services/Hid/IHidServer.cs | 181 ------------------ src/Ryujinx.Horizon/Hid/HidServer.cs | 120 +++++++++--- src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs | 21 +- .../Hid/Npad/NpadHandheldActivationMode.cs | 2 +- .../Sdk/Hid/Npad/NpadIdType.cs | 2 +- 5 files changed, 110 insertions(+), 216 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index b7f86aa35..f5c690cd9 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -152,61 +152,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid return ResultCode.Success; } - [CommandCmif(84)] // 13.0.0+ - // EnableSixAxisSensorUnalteredPassthrough(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle, u8 enabled) - public ResultCode EnableSixAxisSensorUnalteredPassthrough(ServiceCtx context) - { - _isSixAxisSensorUnalteredPassthroughEnabled = context.RequestData.ReadUInt32() != 0; - int sixAxisSensorHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _isSixAxisSensorUnalteredPassthroughEnabled }); - - return ResultCode.Success; - } - - [CommandCmif(85)] // 13.0.0+ - // IsSixAxisSensorUnalteredPassthroughEnabled(nn::applet::AppletResourceUserId, nn::hid::SixAxisSensorHandle) -> u8 enabled - public ResultCode IsSixAxisSensorUnalteredPassthroughEnabled(ServiceCtx context) - { - int sixAxisSensorHandle = context.RequestData.ReadInt32(); - context.RequestData.BaseStream.Position += 4; // Padding - long appletResourceUserId = context.RequestData.ReadInt64(); - - context.ResponseData.Write(_isSixAxisSensorUnalteredPassthroughEnabled); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle }); - - return ResultCode.Success; - } - - [CommandCmif(102)] - // SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array) - public ResultCode SetSupportedNpadIdType(ServiceCtx context) - { -#pragma warning disable IDE0059 // Remove unnecessary value assignment - long appletResourceUserId = context.RequestData.ReadInt64(); -#pragma warning restore IDE0059 - ulong arrayPosition = context.Request.PtrBuff[0].Position; - ulong arraySize = context.Request.PtrBuff[0].Size; - - ReadOnlySpan supportedPlayerIds = MemoryMarshal.Cast(context.Memory.GetSpan(arrayPosition, (int)arraySize)); - - context.Device.Hid.Npads.ClearSupportedPlayers(); - - for (int i = 0; i < supportedPlayerIds.Length; ++i) - { - if (HidUtils.IsValidNpadIdType(supportedPlayerIds[i])) - { - context.Device.Hid.Npads.SetSupportedPlayer(HidUtils.GetIndexFromNpadIdType(supportedPlayerIds[i])); - } - } - - Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{supportedPlayerIds.Length} Players: " + string.Join(",", supportedPlayerIds.ToArray())); - - return ResultCode.Success; - } - [CommandCmif(103)] // ActivateNpad(nn::applet::AppletResourceUserId) public ResultCode ActivateNpad(ServiceCtx context) @@ -214,18 +159,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid return ActiveNpadImpl(context); } - [CommandCmif(104)] - // DeactivateNpad(nn::applet::AppletResourceUserId) - public ResultCode DeactivateNpad(ServiceCtx context) - { - long appletResourceUserId = context.RequestData.ReadInt64(); - - context.Device.Hid.Npads.Active = false; - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - - return ResultCode.Success; - } - [CommandCmif(106)] // AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context) @@ -250,44 +183,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid return ResultCode.Success; } - [CommandCmif(107)] - // DisconnectNpad(nn::applet::AppletResourceUserId, uint NpadIdType) - public ResultCode DisconnectNpad(ServiceCtx context) - { - NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType }); - - return ResultCode.Success; - } - - [CommandCmif(108)] - // GetPlayerLedPattern(u32 npad_id) -> u64 led_pattern - public ResultCode GetPlayerLedPattern(ServiceCtx context) - { - NpadIdType npadId = (NpadIdType)context.RequestData.ReadUInt32(); - - ulong ledPattern = npadId switch - { - NpadIdType.Player1 => 0b0001, - NpadIdType.Player2 => 0b0011, - NpadIdType.Player3 => 0b0111, - NpadIdType.Player4 => 0b1111, - NpadIdType.Player5 => 0b1001, - NpadIdType.Player6 => 0b0101, - NpadIdType.Player7 => 0b1101, - NpadIdType.Player8 => 0b0110, - NpadIdType.Unknown => 0b0000, - NpadIdType.Handheld => 0b0000, - _ => throw new InvalidOperationException($"{nameof(npadId)} contains an invalid value: {npadId}"), - }; - - context.ResponseData.Write(ledPattern); - - return ResultCode.Success; - } - [CommandCmif(109)] // 5.0.0+ // ActivateNpadWithRevision(nn::applet::AppletResourceUserId, ulong revision) public ResultCode ActivateNpadWithRevision(ServiceCtx context) @@ -435,82 +330,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid return ResultCode.Success; } - [CommandCmif(125)] - // MergeSingleJoyAsDualJoy(uint npadIdType0, uint npadIdType1, nn::applet::AppletResourceUserId) - public ResultCode MergeSingleJoyAsDualJoy(ServiceCtx context) - { - NpadIdType npadIdType0 = (NpadIdType)context.RequestData.ReadUInt32(); - NpadIdType npadIdType1 = (NpadIdType)context.RequestData.ReadUInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); - - if (HidUtils.IsValidNpadIdType(npadIdType0) && HidUtils.IsValidNpadIdType(npadIdType1)) - { - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType0, npadIdType1 }); - } - - return ResultCode.Success; - } - - [CommandCmif(126)] - // StartLrAssignmentMode(nn::applet::AppletResourceUserId) - public ResultCode StartLrAssignmentMode(ServiceCtx context) - { - long appletResourceUserId = context.RequestData.ReadInt64(); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - - return ResultCode.Success; - } - - [CommandCmif(127)] - // StopLrAssignmentMode(nn::applet::AppletResourceUserId) - public ResultCode StopLrAssignmentMode(ServiceCtx context) - { - long appletResourceUserId = context.RequestData.ReadInt64(); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); - - return ResultCode.Success; - } - - [CommandCmif(128)] - // SetNpadHandheldActivationMode(nn::applet::AppletResourceUserId, long HidNpadHandheldActivationMode) - public ResultCode SetNpadHandheldActivationMode(ServiceCtx context) - { - long appletResourceUserId = context.RequestData.ReadInt64(); - _npadHandheldActivationMode = (NpadHandheldActivationMode)context.RequestData.ReadInt64(); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); - - return ResultCode.Success; - } - - [CommandCmif(129)] - // GetNpadHandheldActivationMode(nn::applet::AppletResourceUserId) -> long HidNpadHandheldActivationMode - public ResultCode GetNpadHandheldActivationMode(ServiceCtx context) - { - long appletResourceUserId = context.RequestData.ReadInt64(); - - context.ResponseData.Write((long)_npadHandheldActivationMode); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); - - return ResultCode.Success; - } - - [CommandCmif(130)] - // SwapNpadAssignment(uint OldNpadAssignment, uint NewNpadAssignment, nn::applet::AppletResourceUserId) - public ResultCode SwapNpadAssignment(ServiceCtx context) - { - int oldNpadAssignment = context.RequestData.ReadInt32(); - int newNpadAssignment = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); - - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment }); - - return ResultCode.Success; - } - [CommandCmif(131)] // IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context) diff --git a/src/Ryujinx.Horizon/Hid/HidServer.cs b/src/Ryujinx.Horizon/Hid/HidServer.cs index f3f6f0029..2970bceeb 100644 --- a/src/Ryujinx.Horizon/Hid/HidServer.cs +++ b/src/Ryujinx.Horizon/Hid/HidServer.cs @@ -449,17 +449,21 @@ namespace Ryujinx.Horizon.Hid } [CmifCommand(84)] - public Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool arg2, [ClientProcessId] ulong pid) + public Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool sixAxisSensorUnalteredPassthrough, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + _isSixAxisSensorUnalteredPassthroughEnabled = sixAxisSensorUnalteredPassthrough; + + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle, _isSixAxisSensorUnalteredPassthroughEnabled }); return Result.Success; } [CmifCommand(85)] - public Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, [ClientProcessId] ulong pid) + public Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool sixAxisSensorUnalteredPassthrough, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + sixAxisSensorUnalteredPassthrough = _isSixAxisSensorUnalteredPassthroughEnabled; + + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, sixAxisSensorHandle }); return Result.Success; } @@ -529,9 +533,19 @@ namespace Ryujinx.Horizon.Hid } [CmifCommand(102)] - public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan arg1, [ClientProcessId] ulong pid) + public Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, [Buffer(HipcBufferFlags.In | HipcBufferFlags.Pointer)] ReadOnlySpan npadIds, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + Npads.ClearSupportedPlayers(); + + for (int i = 0; i < npadIds.Length; i++) + { + if (IsValidNpadIdType(npadIds[i])) + { + Npads.SetSupportedPlayer(GetIndexFromNpadIdType(npadIds[i])); + } + } + + Logger.Stub?.PrintStub(LogClass.ServiceHid, $"{npadIds.Length} Players: " + string.Join(",", npadIds.ToArray())); return Result.Success; } @@ -547,7 +561,8 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(104)] public Result DeactivateNpad(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + Npads.Active = false; + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); return Result.Success; } @@ -561,17 +576,30 @@ namespace Ryujinx.Horizon.Hid } [CmifCommand(107)] - public Result DisconnectNpad(AppletResourceUserId appletResourceUserId, uint arg1, [ClientProcessId] ulong pid) + public Result DisconnectNpad(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType }); return Result.Success; } [CmifCommand(108)] - public Result GetPlayerLedPattern(out ulong arg0, uint arg1) + public Result GetPlayerLedPattern(out ulong ledPattern, NpadIdType npadId) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + ledPattern = npadId switch + { + NpadIdType.Player1 => 0b0001, + NpadIdType.Player2 => 0b0011, + NpadIdType.Player3 => 0b0111, + NpadIdType.Player4 => 0b1111, + NpadIdType.Player5 => 0b1001, + NpadIdType.Player6 => 0b0101, + NpadIdType.Player7 => 0b1101, + NpadIdType.Player8 => 0b0110, + NpadIdType.Unknown => 0b0000, + NpadIdType.Handheld => 0b0000, + _ => throw new InvalidOperationException($"{nameof(npadId)} contains an invalid value: {npadId}"), + }; return Result.Success; } @@ -617,17 +645,23 @@ namespace Ryujinx.Horizon.Hid } [CmifCommand(124)] - public Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, uint arg1, [ClientProcessId] ulong pid) + public Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + if (IsValidNpadIdType(npadIdType)) + { + // context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Dual; + } return Result.Success; } [CmifCommand(125)] - public Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, [ClientProcessId] ulong pid) + public Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType0, NpadIdType npadIdType1, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + if (IsValidNpadIdType(npadIdType0) && IsValidNpadIdType(npadIdType1)) + { + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType0, npadIdType1 }); + } return Result.Success; } @@ -635,7 +669,7 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(126)] public Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); return Result.Success; } @@ -643,31 +677,35 @@ namespace Ryujinx.Horizon.Hid [CmifCommand(127)] public Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId }); return Result.Success; } [CmifCommand(128)] - public Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, long arg1, [ClientProcessId] ulong pid) + public Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, NpadHandheldActivationMode npadHandheldActivationMode, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + _npadHandheldActivationMode = npadHandheldActivationMode; + + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); return Result.Success; } [CmifCommand(129)] - public Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out long arg1, [ClientProcessId] ulong pid) + public Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out NpadHandheldActivationMode npadHandheldActivationMode, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + npadHandheldActivationMode = _npadHandheldActivationMode; + + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); return Result.Success; } [CmifCommand(130)] - public Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, [ClientProcessId] ulong pid) + public Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint oldNpadAssignment, uint newNpadAssignment, [ClientProcessId] ulong pid) { - Logger.Stub?.PrintStub(LogClass.ServiceHid); + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment }); return Result.Success; } @@ -1348,6 +1386,42 @@ namespace Ryujinx.Horizon.Hid return Result.Success; } + public static PlayerIndex GetIndexFromNpadIdType(NpadIdType npadIdType) + => npadIdType switch + { +#pragma warning disable IDE0055 // Disable formatting + NpadIdType.Player1 => PlayerIndex.Player1, + NpadIdType.Player2 => PlayerIndex.Player2, + NpadIdType.Player3 => PlayerIndex.Player3, + NpadIdType.Player4 => PlayerIndex.Player4, + NpadIdType.Player5 => PlayerIndex.Player5, + NpadIdType.Player6 => PlayerIndex.Player6, + NpadIdType.Player7 => PlayerIndex.Player7, + NpadIdType.Player8 => PlayerIndex.Player8, + NpadIdType.Handheld => PlayerIndex.Handheld, + NpadIdType.Unknown => PlayerIndex.Unknown, + _ => throw new ArgumentOutOfRangeException(nameof(npadIdType)), +#pragma warning restore IDE0055 + }; + + public static NpadIdType GetNpadIdTypeFromIndex(PlayerIndex index) + => index switch + { +#pragma warning disable IDE0055 // Disable formatting + PlayerIndex.Player1 => NpadIdType.Player1, + PlayerIndex.Player2 => NpadIdType.Player2, + PlayerIndex.Player3 => NpadIdType.Player3, + PlayerIndex.Player4 => NpadIdType.Player4, + PlayerIndex.Player5 => NpadIdType.Player5, + PlayerIndex.Player6 => NpadIdType.Player6, + PlayerIndex.Player7 => NpadIdType.Player7, + PlayerIndex.Player8 => NpadIdType.Player8, + PlayerIndex.Handheld => NpadIdType.Handheld, + PlayerIndex.Unknown => NpadIdType.Unknown, + _ => throw new ArgumentOutOfRangeException(nameof(index)), +#pragma warning restore IDE0055 + }; + private static bool IsValidNpadIdType(NpadIdType npadIdType) { return (npadIdType >= NpadIdType.Player1 && npadIdType <= NpadIdType.Player8) || diff --git a/src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs b/src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs index 1674573b0..2cae092ca 100644 --- a/src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs +++ b/src/Ryujinx.Horizon/Sdk/Hid/IHidServer.cs @@ -1,5 +1,6 @@ using Ryujinx.Horizon.Common; using Ryujinx.Horizon.Sdk.Applet; +using Ryujinx.Horizon.Sdk.Hid.Npad; using Ryujinx.Horizon.Sdk.Hid.SixAxis; using Ryujinx.Horizon.Sdk.Hid.Vibration; using Ryujinx.Horizon.Sdk.Sf; @@ -46,8 +47,8 @@ namespace Ryujinx.Horizon.Sdk.Hid Result ResetGyroscopeZeroDriftMode(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); Result IsSixAxisSensorAtRest(out bool isAtRest, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); Result IsFirmwareUpdateAvailableForSixAxisSensor(out bool isFirmwareUpdateAvailableForSixAxisSensor, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); - Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool arg2, ulong pid); - Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); + Result EnableSixAxisSensorUnalteredPassthrough(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, bool sixAxisSensorUnalteredPassthrough, ulong pid); + Result IsSixAxisSensorUnalteredPassthroughEnabled(out bool sixAxisSensorUnalteredPassthrough, AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); Result StoreSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, SixAxisSensorHandle sixAxisSensorHandle, in SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, ulong pid); Result LoadSixAxisSensorCalibrationParameter(AppletResourceUserId appletResourceUserId, out SixAxisSensorCalibrationParameter sixAxisSensorCalibrationParameter, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); Result GetSixAxisSensorIcInformation(AppletResourceUserId appletResourceUserId, out SixAxisSensorIcInformation sixAxisSensorIcInformation, SixAxisSensorHandle sixAxisSensorHandle, ulong pid); @@ -55,24 +56,24 @@ namespace Ryujinx.Horizon.Sdk.Hid Result ActivateGesture(AppletResourceUserId appletResourceUserId, int unknown, ulong pid); Result SetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, NpadStyleTag supportedStyleSets, ulong pid); Result GetSupportedNpadStyleSet(AppletResourceUserId appletResourceUserId, out NpadStyleTag supportedStyleSets, ulong pid); - Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, ReadOnlySpan arg1, ulong pid); + Result SetSupportedNpadIdType(AppletResourceUserId appletResourceUserId, ReadOnlySpan npadIds, ulong pid); Result ActivateNpad(AppletResourceUserId appletResourceUserId, ulong pid); Result DeactivateNpad(AppletResourceUserId appletResourceUserId, ulong pid); Result AcquireNpadStyleSetUpdateEventHandle(AppletResourceUserId appletResourceUserId, out int arg1, uint arg2, ulong arg3, ulong pid); - Result DisconnectNpad(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid); - Result GetPlayerLedPattern(out ulong arg0, uint arg1); + Result DisconnectNpad(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, ulong pid); + Result GetPlayerLedPattern(out ulong ledPattern, NpadIdType npadId); Result ActivateNpadWithRevision(AppletResourceUserId appletResourceUserId, int arg1, ulong pid); Result SetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, long arg1, ulong pid); Result GetNpadJoyHoldType(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid); Result SetNpadJoyAssignmentModeSingleByDefault(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid); Result SetNpadJoyAssignmentModeSingle(AppletResourceUserId appletResourceUserId, uint arg1, long arg2, ulong pid); - Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, uint arg1, ulong pid); - Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, ulong pid); + Result SetNpadJoyAssignmentModeDual(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType, ulong pid); + Result MergeSingleJoyAsDualJoy(AppletResourceUserId appletResourceUserId, NpadIdType npadIdType0, NpadIdType npadIdType1, ulong pid); Result StartLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid); Result StopLrAssignmentMode(AppletResourceUserId appletResourceUserId, ulong pid); - Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, long arg1, ulong pid); - Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out long arg1, ulong pid); - Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint arg1, uint arg2, ulong pid); + Result SetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, NpadHandheldActivationMode npadHandheldActivationMode, ulong pid); + Result GetNpadHandheldActivationMode(AppletResourceUserId appletResourceUserId, out NpadHandheldActivationMode npadHandheldActivationMode, ulong pid); + Result SwapNpadAssignment(AppletResourceUserId appletResourceUserId, uint oldNpadAssignment, uint newNpadAssignment, ulong pid); Result IsUnintendedHomeButtonInputProtectionEnabled(out bool arg0, AppletResourceUserId appletResourceUserId, uint arg2, ulong pid); Result EnableUnintendedHomeButtonInputProtection(AppletResourceUserId appletResourceUserId, uint arg1, bool arg2, ulong pid); Result SetNpadJoyAssignmentModeSingleWithDestination(out bool arg0, out uint arg1, AppletResourceUserId appletResourceUserId, uint arg3, long arg4, ulong pid); diff --git a/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadHandheldActivationMode.cs b/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadHandheldActivationMode.cs index c8e00597a..7bc2c5d1e 100644 --- a/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadHandheldActivationMode.cs +++ b/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadHandheldActivationMode.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Horizon.Sdk.Hid.Npad { - public enum NpadHandheldActivationMode + public enum NpadHandheldActivationMode : long { Dual, Single, diff --git a/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadIdType.cs b/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadIdType.cs index f4bc91c12..dfc5f3b29 100644 --- a/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadIdType.cs +++ b/src/Ryujinx.Horizon/Sdk/Hid/Npad/NpadIdType.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Horizon.Sdk.Hid.Npad { - public enum NpadIdType + public enum NpadIdType : uint { Player1 = 0, Player2 = 1,