diff options
| author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-07-16 19:31:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-16 19:31:14 +0200 |
| commit | 326749498bed4360e5a4b11fc67d5ec7cb9a3076 (patch) | |
| tree | ae21fb26f99b401ca4e9efaab72b679a81c22369 /src/Ryujinx.HLE/HOS/Services/Hid | |
| parent | fec8291c17fa106c28f58b56419e90d49a41a1ea (diff) | |
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info
Some changes were manually reverted.
* dotnet format analyzers --serverity info
Some changes have been minimally adapted.
* Restore a few unused methods and variables
* Silence dotnet format IDE0060 warnings
* Silence dotnet format IDE0052 warnings
* Address or silence dotnet format IDE1006 warnings
* Address dotnet format CA1816 warnings
* Address or silence dotnet format CA2208 warnings
* Address or silence dotnet format CA1806 and a few CA1854 warnings
* Address dotnet format CA2211 warnings
* Address dotnet format CA1822 warnings
* Address or silence dotnet format CA1069 warnings
* Make dotnet format succeed in style mode
* Address or silence dotnet format CA2211 warnings
* Address review comments
* Address dotnet format CA2208 warnings properly
* Make ProcessResult readonly
* Address most dotnet format whitespace warnings
* Apply dotnet format whitespace formatting
A few of them have been manually reverted and the corresponding warning was silenced
* Add previously silenced warnings back
I have no clue how these disappeared
* Revert formatting changes for while and for-loops
* Format if-blocks correctly
* Run dotnet format style after rebase
* Run dotnet format whitespace after rebase
* Run dotnet format style after rebase
* Run dotnet format analyzers after rebase
* Run dotnet format after rebase and remove unused usings
- analyzers
- style
- whitespace
* Disable 'prefer switch expression' rule
* Add comments to disabled warnings
* Fix a few disabled warnings
* Fix naming rule violation, Convert shader properties to auto-property and convert values to const
* Simplify properties and array initialization, Use const when possible, Remove trailing commas
* Start working on disabled warnings
* Fix and silence a few dotnet-format warnings again
* Run dotnet format after rebase
* Use using declaration instead of block syntax
* Address IDE0251 warnings
* Address a few disabled IDE0060 warnings
* Silence IDE0060 in .editorconfig
* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"
This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.
* dotnet format whitespace after rebase
* First dotnet format pass
* Fix naming rule violations
* Fix typo
* Add trailing commas, use targeted new and use array initializer
* Fix build issues
* Fix remaining build issues
* Remove SuppressMessage for CA1069 where possible
* Address dotnet format issues
* Address formatting issues
Co-authored-by: Ac_K <acoustik666@gmail.com>
* Add GetHashCode implementation for RenderingSurfaceInfo
* Explicitly silence CA1822 for every affected method in Syscall
* Address formatting issues in Demangler.cs
* Address review feedback
Co-authored-by: Ac_K <acoustik666@gmail.com>
* Revert marking service methods as static
* Next dotnet format pass
* Address review feedback
---------
Co-authored-by: Ac_K <acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Services/Hid')
84 files changed, 504 insertions, 452 deletions
diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs index e4755f78..dbcbe187 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Hid.cs @@ -26,10 +26,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid internal const int SharedMemEntryCount = 17; public DebugPadDevice DebugPad; - public TouchDevice Touchscreen; - public MouseDevice Mouse; + public TouchDevice Touchscreen; + public MouseDevice Mouse; public KeyboardDevice Keyboard; - public NpadDevices Npads; + public NpadDevices Npads; private static void CheckTypeSizeOrThrow<T>(int expectedSize) { @@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid internal Hid(in Switch device, SharedMemoryStorage storage) { - _device = device; + _device = device; _storage = storage; SharedMemory = SharedMemory.Create(); @@ -61,11 +61,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid private void InitDevices() { - DebugPad = new DebugPadDevice(_device, true); + DebugPad = new DebugPadDevice(_device, true); Touchscreen = new TouchDevice(_device, true); - Mouse = new MouseDevice(_device, false); - Keyboard = new KeyboardDevice(_device, false); - Npads = new NpadDevices(_device, true); + Mouse = new MouseDevice(_device, false); + Keyboard = new KeyboardDevice(_device, false); + Npads = new NpadDevices(_device, true); } public void RefreshInputConfig(List<InputConfig> inputConfig) @@ -86,6 +86,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid const int StickButtonThreshold = short.MaxValue / 2; ControllerKeys result = 0; +#pragma warning disable IDE0055 // Disable formatting result |= (leftStick.Dx < -StickButtonThreshold) ? ControllerKeys.LStickLeft : result; result |= (leftStick.Dx > StickButtonThreshold) ? ControllerKeys.LStickRight : result; result |= (leftStick.Dy < -StickButtonThreshold) ? ControllerKeys.LStickDown : result; @@ -95,11 +96,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid result |= (rightStick.Dx > StickButtonThreshold) ? ControllerKeys.RStickRight : result; result |= (rightStick.Dy < -StickButtonThreshold) ? ControllerKeys.RStickDown : result; result |= (rightStick.Dy > StickButtonThreshold) ? ControllerKeys.RStickUp : result; +#pragma warning restore IDE0055 return result; } - internal static ulong GetTimestampTicks() + internal ulong GetTimestampTicks() { return (ulong)PerformanceCounter.ElapsedMilliseconds * 19200; } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/BaseDevice.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/BaseDevice.cs index 0e3cd18a..a6c21fda 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/BaseDevice.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/BaseDevice.cs @@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid Active = active; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs index e3b95390..6b1d7af5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/DebugPadDevice.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid ref DebugPadState previousEntry = ref lifo.GetCurrentEntryRef(); - DebugPadState newState = new DebugPadState(); + DebugPadState newState = new(); if (Active) { @@ -25,4 +25,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid lifo.Write(ref newState); } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs index 8908b74d..0e3630f2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/KeyboardDevice.cs @@ -21,7 +21,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid ref KeyboardState previousEntry = ref lifo.GetCurrentEntryRef(); - KeyboardState newState = new KeyboardState + KeyboardState newState = new() { SamplingNumber = previousEntry.SamplingNumber + 1, }; @@ -32,4 +32,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid lifo.Write(ref newState); } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/MouseDevice.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/MouseDevice.cs index 66d1b0c4..b2dd3fea 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/MouseDevice.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/MouseDevice.cs @@ -12,8 +12,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid ref RingLifo<MouseState> lifo = ref _device.Hid.SharedMemory.Mouse; ref MouseState previousEntry = ref lifo.GetCurrentEntryRef(); - - MouseState newState = new MouseState() + + MouseState newState = new() { SamplingNumber = previousEntry.SamplingNumber + 1, }; @@ -33,4 +33,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid lifo.Write(ref newState); } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs index edcc47d8..240933ad 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs @@ -19,22 +19,22 @@ namespace Ryujinx.HLE.HOS.Services.Hid public const int MaxControllers = 9; // Players 1-8 and Handheld private ControllerType[] _configuredTypes; - private KEvent[] _styleSetUpdateEvents; - private bool[] _supportedPlayers; - private static VibrationValue _neutralVibrationValue = new VibrationValue + private readonly KEvent[] _styleSetUpdateEvents; + private readonly bool[] _supportedPlayers; + private VibrationValue _neutralVibrationValue = new() { AmplitudeLow = 0f, FrequencyLow = 160f, AmplitudeHigh = 0f, - FrequencyHigh = 320f + FrequencyHigh = 320f, }; internal NpadJoyHoldType JoyHold { get; set; } internal bool SixAxisActive = false; // TODO: link to hidserver when implemented internal ControllerType SupportedStyleSets { get; set; } - public Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>>(); - public Dictionary<PlayerIndex, (VibrationValue, VibrationValue)> LastVibrationValues = new Dictionary<PlayerIndex, (VibrationValue, VibrationValue)>(); + public Dictionary<PlayerIndex, ConcurrentQueue<(VibrationValue, VibrationValue)>> RumbleQueues = new(); + public Dictionary<PlayerIndex, (VibrationValue, VibrationValue)> LastVibrationValues = new(); public NpadDevices(Switch device, bool active = true) : base(device, active) { @@ -129,7 +129,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid if (player > PlayerIndex.Handheld) { - throw new ArgumentOutOfRangeException("Player must be Player1-8 or Handheld"); + throw new InvalidOperationException("Player must be Player1-8 or Handheld"); } if (controllerType == ControllerType.Handheld) @@ -249,6 +249,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid switch (type) { +#pragma warning disable IDE0055 // Disable formatting case ControllerType.ProController: controller.StyleSet = NpadStyleTag.FullKey; controller.DeviceType = DeviceType.FullKey; @@ -296,6 +297,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid controller.DeviceType = DeviceType.Palma; controller.AppletFooterUiType = AppletFooterUiType.None; break; +#pragma warning restore IDE0055 } _styleSetUpdateEvents[(int)player].ReadableEvent.Signal(); @@ -329,7 +331,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid { if (!Unsafe.AreSame(ref currentlyUsed, ref possiblyUnused)) { - NpadCommonState newState = new NpadCommonState(); + NpadCommonState newState = new(); WriteNewInputEntry(ref possiblyUnused, ref newState); } @@ -348,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid { if (!Unsafe.AreSame(ref currentlyUsed, ref possiblyUnused)) { - SixAxisSensorState newState = new SixAxisSensorState(); + SixAxisSensorState newState = new(); WriteNewSixInputEntry(ref possiblyUnused, ref newState); } @@ -379,23 +381,22 @@ namespace Ryujinx.HLE.HOS.Services.Hid ref RingLifo<NpadCommonState> lifo = ref GetCommonStateLifo(ref currentNpad); - NpadCommonState newState = new NpadCommonState + NpadCommonState newState = new() { - Buttons = (NpadButton)state.Buttons, + Buttons = (NpadButton)state.Buttons, AnalogStickL = new AnalogStickState { - X = state.LStick.Dx, - Y = state.LStick.Dy, + X = state.LStick.Dx, + Y = state.LStick.Dy, }, AnalogStickR = new AnalogStickState { - X = state.RStick.Dx, - Y = state.RStick.Dy, - } + X = state.RStick.Dx, + Y = state.RStick.Dy, + }, + Attributes = NpadAttribute.IsConnected, }; - newState.Attributes = NpadAttribute.IsConnected; - switch (currentNpad.StyleSet) { case NpadStyleTag.Handheld: @@ -434,7 +435,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid { ref NpadInternalState currentNpad = ref _device.Hid.SharedMemory.Npads[(int)index].InternalState; - NpadCommonState newState = new NpadCommonState(); + NpadCommonState newState = new(); WriteNewInputEntry(ref currentNpad.FullKey, ref newState); WriteNewInputEntry(ref currentNpad.Handheld, ref newState); @@ -514,33 +515,33 @@ namespace Ryujinx.HLE.HOS.Services.Hid return false; } - HidVector accel = new HidVector() + HidVector accel = new() { X = state.Accelerometer.X, Y = state.Accelerometer.Y, - Z = state.Accelerometer.Z + Z = state.Accelerometer.Z, }; - HidVector gyro = new HidVector() + HidVector gyro = new() { X = state.Gyroscope.X, Y = state.Gyroscope.Y, - Z = state.Gyroscope.Z + Z = state.Gyroscope.Z, }; - HidVector rotation = new HidVector() + HidVector rotation = new() { X = state.Rotation.X, Y = state.Rotation.Y, - Z = state.Rotation.Z + Z = state.Rotation.Z, }; - SixAxisSensorState newState = new SixAxisSensorState + SixAxisSensorState newState = new() { - Acceleration = accel, + Acceleration = accel, AngularVelocity = gyro, - Angle = rotation, - Attributes = SixAxisSensorAttribute.IsConnected + Angle = rotation, + Attributes = SixAxisSensorAttribute.IsConnected, }; state.Orientation.AsSpan().CopyTo(newState.Direction.AsSpan()); @@ -562,9 +563,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid if (!needUpdateRight && !isRightPair) { - SixAxisSensorState emptyState = new SixAxisSensorState(); - - emptyState.Attributes = SixAxisSensorAttribute.IsConnected; + SixAxisSensorState emptyState = new() + { + Attributes = SixAxisSensorAttribute.IsConnected, + }; WriteNewSixInputEntry(ref currentNpad.JoyDualRightSixAxisSensor, ref emptyState); } @@ -576,9 +578,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid { ref NpadInternalState currentNpad = ref _device.Hid.SharedMemory.Npads[(int)index].InternalState; - SixAxisSensorState newState = new SixAxisSensorState(); - - newState.Attributes = SixAxisSensorAttribute.IsConnected; + SixAxisSensorState newState = new() + { + Attributes = SixAxisSensorAttribute.IsConnected, + }; WriteNewSixInputEntry(ref currentNpad.FullKeySixAxisSensor, ref newState); WriteNewSixInputEntry(ref currentNpad.HandheldSixAxisSensor, ref newState); @@ -632,4 +635,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid return rumbleQueue; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/TouchDevice.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/TouchDevice.cs index bb58ee51..35ac1a16 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/TouchDevice.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/TouchDevice.cs @@ -14,9 +14,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid ref TouchScreenState previousEntry = ref lifo.GetCurrentEntryRef(); - TouchScreenState newState = new TouchScreenState + TouchScreenState newState = new() { - SamplingNumber = previousEntry.SamplingNumber + 1 + SamplingNumber = previousEntry.SamplingNumber + 1, }; if (Active) @@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid FingerId = (uint)i, DiameterX = pi.DiameterX, DiameterY = pi.DiameterY, - RotationAngle = pi.Angle + RotationAngle = pi.Angle, }; } } @@ -45,4 +45,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid lifo.Write(ref newState); } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/ControllerConfig.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/ControllerConfig.cs index 477e1a84..cba5c7b1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/ControllerConfig.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/ControllerConfig.cs @@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid { public struct ControllerConfig { - public PlayerIndex Player; + public PlayerIndex Player; public ControllerType Type; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/GamepadInput.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/GamepadInput.cs index 633671df..452901a0 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/GamepadInput.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/GamepadInput.cs @@ -2,9 +2,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid { public struct GamepadInput { - public PlayerIndex PlayerId; - public ControllerKeys Buttons; + public PlayerIndex PlayerId; + public ControllerKeys Buttons; public JoystickPosition LStick; public JoystickPosition RStick; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/JoystickPosition.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/JoystickPosition.cs index 6df477d6..47be8d41 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/JoystickPosition.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/JoystickPosition.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid public int Dx; public int Dy; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/KeyboardInput.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/KeyboardInput.cs index be6857fb..26fe980f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/KeyboardInput.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/KeyboardInput.cs @@ -5,4 +5,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid public int Modifier; public ulong[] Keys; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/SixAxisInput.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/SixAxisInput.cs index 4dda82c7..5c5c5d8c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/SixAxisInput.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/SixAxisInput.cs @@ -5,9 +5,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid public struct SixAxisInput { public PlayerIndex PlayerId; - public Vector3 Accelerometer; - public Vector3 Gyroscope; - public Vector3 Rotation; - public float[] Orientation; + public Vector3 Accelerometer; + public Vector3 Gyroscope; + public Vector3 Rotation; + public float[] Orientation; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/TouchPoint.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/TouchPoint.cs index 457d2b0d..ab0c8526 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/TouchPoint.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/Types/TouchPoint.cs @@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid public uint DiameterY; public uint Angle; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs index b98f6065..d76704b3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/HidUtils.cs @@ -7,6 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer 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, @@ -17,12 +18,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer NpadIdType.Player8 => PlayerIndex.Player8, NpadIdType.Handheld => PlayerIndex.Handheld, NpadIdType.Unknown => PlayerIndex.Unknown, - _ => throw new ArgumentOutOfRangeException(nameof(npadIdType)) + _ => 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, @@ -33,7 +36,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer PlayerIndex.Player8 => NpadIdType.Player8, PlayerIndex.Handheld => NpadIdType.Handheld, PlayerIndex.Unknown => NpadIdType.Unknown, - _ => throw new ArgumentOutOfRangeException(nameof(index)) + _ => throw new ArgumentOutOfRangeException(nameof(index)), +#pragma warning restore IDE0055 }; public static bool IsValidNpadIdType(NpadIdType npadIdType) @@ -43,4 +47,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer npadIdType == NpadIdType.Unknown; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs index 56f63e52..93f19c91 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IActiveVibrationDeviceList.cs @@ -8,9 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer // ActivateVibrationDevice(nn::hid::VibrationDeviceHandle) public ResultCode ActivateVibrationDevice(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment int vibrationDeviceHandle = context.RequestData.ReadInt32(); +#pragma warning restore IDE0059 return ResultCode.Success; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IAppletResource.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IAppletResource.cs index f0aaf5e3..56eb345a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IAppletResource.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/IAppletResource.cs @@ -7,8 +7,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer { class IAppletResource : IpcService { - private KSharedMemory _hidSharedMem; - private int _hidSharedMemHandle; + private readonly KSharedMemory _hidSharedMem; + private int _hidSharedMemHandle; public IAppletResource(KSharedMemory hidSharedMem) { @@ -32,4 +32,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.HidServer return ResultCode.Success; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadHandheldActivationMode.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadHandheldActivationMode.cs index 0cf4a047..02e3d803 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadHandheldActivationMode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadHandheldActivationMode.cs @@ -4,6 +4,6 @@ { Dual, Single, - None + None, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadJoyDeviceType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadJoyDeviceType.cs index 05587bfd..f52e18f2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadJoyDeviceType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Npad/NpadJoyDeviceType.cs @@ -3,6 +3,6 @@ public enum NpadJoyDeviceType { Left, - Right + Right, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/AccelerometerParameters.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/AccelerometerParameters.cs index 4fd0a1b5..8e4d80e2 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/AccelerometerParameters.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/AccelerometerParameters.cs @@ -5,4 +5,4 @@ public float X; public float Y; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/GyroscopeZeroDriftMode.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/GyroscopeZeroDriftMode.cs index db7467fa..659afa0d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/GyroscopeZeroDriftMode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/GyroscopeZeroDriftMode.cs @@ -4,6 +4,6 @@ { Loose, Standard, - Tight + Tight, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/SensorFusionParameters.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/SensorFusionParameters.cs index 2683ffee..37cef783 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/SensorFusionParameters.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/SixAxis/SensorFusionParameters.cs @@ -5,4 +5,4 @@ public float RevisePower; public float ReviseRange; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceHandle.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceHandle.cs index fe50e671..d59afe51 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceHandle.cs @@ -7,4 +7,4 @@ public byte Position; public byte Reserved; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDevicePosition.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDevicePosition.cs index 117451f1..19d52f9f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDevicePosition.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDevicePosition.cs @@ -4,6 +4,6 @@ { None, Left, - Right + Right, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceType.cs index 4e5557c9..4849c342 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceType.cs @@ -4,6 +4,6 @@ { None, LinearResonantActuator, - GcErm + GcErm, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceValue.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceValue.cs index 91a23eb7..8ac06cb7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceValue.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationDeviceValue.cs @@ -2,7 +2,7 @@ { public struct VibrationDeviceValue { - public VibrationDeviceType DeviceType; + public VibrationDeviceType DeviceType; public VibrationDevicePosition Position; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationValue.cs b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationValue.cs index 38ac9cca..c6143a01 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationValue.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/HidServer/Types/Vibration/VibrationValue.cs @@ -9,16 +9,26 @@ namespace Ryujinx.HLE.HOS.Services.Hid public float AmplitudeHigh; public float FrequencyHigh; - public override bool Equals(object obj) + public readonly override bool Equals(object obj) { return obj is VibrationValue value && AmplitudeLow == value.AmplitudeLow && AmplitudeHigh == value.AmplitudeHigh; } - public override int GetHashCode() + public readonly override int GetHashCode() { return HashCode.Combine(AmplitudeLow, AmplitudeHigh); } + + public static bool operator ==(VibrationValue left, VibrationValue right) + { + return left.Equals(right); + } + + public static bool operator !=(VibrationValue left, VibrationValue right) + { + return !(left == right); + } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs index adaaa012..0d1867db 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidDebugServer.cs @@ -5,4 +5,4 @@ { public IHidDebugServer(ServiceCtx context) { } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index d508aba4..1d1b145c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -15,8 +15,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid [Service("hid")] class IHidServer : IpcService { - private KEvent _xpadIdEvent; - private KEvent _palmaOperationCompleteEvent; + private readonly KEvent _xpadIdEvent; + private readonly KEvent _palmaOperationCompleteEvent; private int _xpadIdEventHandle; @@ -24,33 +24,33 @@ namespace Ryujinx.HLE.HOS.Services.Hid private bool _unintendedHomeButtonInputProtectionEnabled; private bool _vibrationPermitted; private bool _usbFullKeyControllerEnabled; - private bool _isFirmwareUpdateAvailableForSixAxisSensor; + private readonly bool _isFirmwareUpdateAvailableForSixAxisSensor; private bool _isSixAxisSensorUnalteredPassthroughEnabled; private NpadHandheldActivationMode _npadHandheldActivationMode; - private GyroscopeZeroDriftMode _gyroscopeZeroDriftMode; + private GyroscopeZeroDriftMode _gyroscopeZeroDriftMode; - private long _npadCommunicationMode; - private uint _accelerometerPlayMode; -#pragma warning disable CS0649 - private long _vibrationGcErmCommand; + private long _npadCommunicationMode; + private uint _accelerometerPlayMode; +#pragma warning disable CS0649 // Field is never assigned to + private readonly long _vibrationGcErmCommand; #pragma warning restore CS0649 private float _sevenSixAxisSensorFusionStrength; - private SensorFusionParameters _sensorFusionParams; + private SensorFusionParameters _sensorFusionParams; private AccelerometerParameters _accelerometerParams; public IHidServer(ServiceCtx context) : base(context.Device.System.HidServer) { - _xpadIdEvent = new KEvent(context.Device.System.KernelContext); + _xpadIdEvent = new KEvent(context.Device.System.KernelContext); _palmaOperationCompleteEvent = new KEvent(context.Device.System.KernelContext); _npadHandheldActivationMode = NpadHandheldActivationMode.Dual; - _gyroscopeZeroDriftMode = GyroscopeZeroDriftMode.Standard; + _gyroscopeZeroDriftMode = GyroscopeZeroDriftMode.Standard; _isFirmwareUpdateAvailableForSixAxisSensor = false; - _sensorFusionParams = new SensorFusionParameters(); + _sensorFusionParams = new SensorFusionParameters(); _accelerometerParams = new AccelerometerParameters(); // TODO: signal event at right place @@ -63,7 +63,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // CreateAppletResource(nn::applet::AppletResourceUserId) -> object<nn::hid::IAppletResource> public ResultCode CreateAppletResource(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 MakeObject(context, new IAppletResource(context.Device.System.HidSharedMem)); @@ -138,8 +140,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid // Initialize entries to avoid issues with some games. - KeyboardInput emptyInput = new KeyboardInput(); - emptyInput.Keys = new ulong[4]; + KeyboardInput emptyInput = new() + { + Keys = new ulong[4], + }; for (int entry = 0; entry < Hid.SharedMemEntryCount; entry++) { @@ -199,7 +203,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // ActivateXpad(nn::hid::BasicXpadId, nn::applet::AppletResourceUserId) public ResultCode ActivateXpad(ServiceCtx context) { - int basicXpadId = context.RequestData.ReadInt32(); + int basicXpadId = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, basicXpadId }); @@ -395,7 +399,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid _sensorFusionParams = new SensorFusionParameters { RevisePower = context.RequestData.ReadInt32(), - ReviseRange = context.RequestData.ReadInt32() + ReviseRange = context.RequestData.ReadInt32(), }; long appletResourceUserId = context.RequestData.ReadInt64(); @@ -447,7 +451,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid _accelerometerParams = new AccelerometerParameters { X = context.RequestData.ReadInt32(), - Y = context.RequestData.ReadInt32() + Y = context.RequestData.ReadInt32(), }; long appletResourceUserId = context.RequestData.ReadInt64(); @@ -671,7 +675,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ResultCode ActivateGesture(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); - int unknown0 = context.RequestData.ReadInt32(); + int unknown0 = context.RequestData.ReadInt32(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0 }); @@ -698,8 +702,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetSupportedNpadStyleSet(pid, nn::applet::AppletResourceUserId) -> uint nn::hid::NpadStyleTag public ResultCode GetSupportedNpadStyleSet(ServiceCtx context) { - ulong pid = context.Request.HandleDesc.PId; - long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + ulong pid = context.Request.HandleDesc.PId; +#pragma warning restore IDE0059 + long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write((int)context.Device.Hid.Npads.SupportedStyleSets); @@ -712,9 +718,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetSupportedNpadIdType(nn::applet::AppletResourceUserId, array<NpadIdType, 9>) public ResultCode SetSupportedNpadIdType(ServiceCtx context) { - long appletResourceUserId = context.RequestData.ReadInt64(); - ulong arrayPosition = context.Request.PtrBuff[0].Position; - ulong arraySize = context.Request.PtrBuff[0].Size; +#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<NpadIdType> supportedPlayerIds = MemoryMarshal.Cast<byte, NpadIdType>(context.Memory.GetSpan(arrayPosition, (int)arraySize)); @@ -756,9 +764,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // AcquireNpadStyleSetUpdateEventHandle(nn::applet::AppletResourceUserId, uint, ulong) -> nn::sf::NativeHandle public ResultCode AcquireNpadStyleSetUpdateEventHandle(ServiceCtx context) { - PlayerIndex npadId = HidUtils.GetIndexFromNpadIdType((NpadIdType)context.RequestData.ReadInt32()); - long appletResourceUserId = context.RequestData.ReadInt64(); - long npadStyleSet = context.RequestData.ReadInt64(); + PlayerIndex npadId = HidUtils.GetIndexFromNpadIdType((NpadIdType)context.RequestData.ReadInt32()); + long appletResourceUserId = context.RequestData.ReadInt64(); + long npadStyleSet = context.RequestData.ReadInt64(); KEvent evnt = context.Device.Hid.Npads.GetStyleSetUpdateEvent(npadId); if (context.Process.HandleTable.GenerateHandle(evnt.ReadableEvent, out int handle) != Result.Success) @@ -780,8 +788,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // DisconnectNpad(nn::applet::AppletResourceUserId, uint NpadIdType) public ResultCode DisconnectNpad(ServiceCtx context) { - NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); + NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, npadIdType }); @@ -796,17 +804,17 @@ namespace Ryujinx.HLE.HOS.Services.Hid 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.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 ArgumentOutOfRangeException(nameof(npadId)) + _ => throw new InvalidOperationException($"{nameof(npadId)} contains an invalid value: {npadId}"), }; context.ResponseData.Write(ledPattern); @@ -831,13 +839,13 @@ namespace Ryujinx.HLE.HOS.Services.Hid // Initialize entries to avoid issues with some games. - List<GamepadInput> emptyGamepadInputs = new List<GamepadInput>(); - List<SixAxisInput> emptySixAxisInputs = new List<SixAxisInput>(); + List<GamepadInput> emptyGamepadInputs = new(); + List<SixAxisInput> emptySixAxisInputs = new(); for (int player = 0; player < NpadDevices.MaxControllers; player++) { - GamepadInput gamepadInput = new GamepadInput(); - SixAxisInput sixaxisInput = new SixAxisInput(); + GamepadInput gamepadInput = new(); + SixAxisInput sixaxisInput = new(); gamepadInput.PlayerId = (PlayerIndex)player; sixaxisInput.PlayerId = (PlayerIndex)player; @@ -863,13 +871,15 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadJoyHoldType(nn::applet::AppletResourceUserId, ulong NpadJoyHoldType) public ResultCode SetNpadJoyHoldType(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 NpadJoyHoldType npadJoyHoldType = (NpadJoyHoldType)context.RequestData.ReadUInt64(); if (npadJoyHoldType > NpadJoyHoldType.Horizontal) { - throw new ArgumentOutOfRangeException(nameof(npadJoyHoldType)); + throw new InvalidOperationException($"{nameof(npadJoyHoldType)} contains an invalid value: {npadJoyHoldType}"); } foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers()) @@ -889,7 +899,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetNpadJoyHoldType(nn::applet::AppletResourceUserId) -> ulong NpadJoyHoldType public ResultCode GetNpadJoyHoldType(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 foreach (PlayerIndex playerIndex in context.Device.Hid.Npads.GetSupportedPlayers()) { @@ -910,7 +922,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -943,7 +957,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); context.RequestData.BaseStream.Position += 4; // Padding +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 if (HidUtils.IsValidNpadIdType(npadIdType)) { @@ -957,9 +973,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // 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(); + NpadIdType npadIdType0 = (NpadIdType)context.RequestData.ReadUInt32(); + NpadIdType npadIdType1 = (NpadIdType)context.RequestData.ReadUInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); if (HidUtils.IsValidNpadIdType(npadIdType0) && HidUtils.IsValidNpadIdType(npadIdType1)) { @@ -995,7 +1011,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadHandheldActivationMode(nn::applet::AppletResourceUserId, long HidNpadHandheldActivationMode) public ResultCode SetNpadHandheldActivationMode(ServiceCtx context) { - long appletResourceUserId = context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); _npadHandheldActivationMode = (NpadHandheldActivationMode)context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadHandheldActivationMode }); @@ -1020,8 +1036,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SwapNpadAssignment(uint OldNpadAssignment, uint NewNpadAssignment, nn::applet::AppletResourceUserId) public ResultCode SwapNpadAssignment(ServiceCtx context) { - int oldNpadAssignment = context.RequestData.ReadInt32(); - int newNpadAssignment = context.RequestData.ReadInt32(); + int oldNpadAssignment = context.RequestData.ReadInt32(); + int newNpadAssignment = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, oldNpadAssignment, newNpadAssignment }); @@ -1033,7 +1049,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // IsUnintendedHomeButtonInputProtectionEnabled(uint Unknown0, nn::applet::AppletResourceUserId) -> bool IsEnabled public ResultCode IsUnintendedHomeButtonInputProtectionEnabled(ServiceCtx context) { - uint unknown0 = context.RequestData.ReadUInt32(); + uint unknown0 = context.RequestData.ReadUInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write(_unintendedHomeButtonInputProtectionEnabled); @@ -1048,8 +1064,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ResultCode EnableUnintendedHomeButtonInputProtection(ServiceCtx context) { _unintendedHomeButtonInputProtectionEnabled = context.RequestData.ReadBoolean(); - uint unknown0 = context.RequestData.ReadUInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); + uint unknown0 = context.RequestData.ReadUInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, _unintendedHomeButtonInputProtectionEnabled }); @@ -1060,7 +1076,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadJoyAssignmentModeSingleWithDestination(uint npadIdType, uint npadJoyDeviceType, nn::applet::AppletResourceUserId) -> bool npadIdTypeIsSet, uint npadIdTypeSet public ResultCode SetNpadJoyAssignmentModeSingleWithDestination(ServiceCtx context) { - NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); + NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); NpadJoyDeviceType npadJoyDeviceType = (NpadJoyDeviceType)context.RequestData.ReadInt32(); context.RequestData.BaseStream.Position += 4; // Padding long appletResourceUserId = context.RequestData.ReadInt64(); @@ -1081,7 +1097,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid private void SetNpadJoyAssignmentModeSingleWithDestinationImpl(ServiceCtx context, NpadIdType npadIdType, long appletResourceUserId, NpadJoyDeviceType npadJoyDeviceType, out NpadIdType npadIdTypeSet, out bool npadIdTypeIsSet) { - npadIdTypeSet = default; + npadIdTypeSet = default; npadIdTypeIsSet = false; context.Device.Hid.SharedMemory.Npads[(int)HidUtils.GetIndexFromNpadIdType(npadIdType)].InternalState.JoyAssignmentMode = NpadJoyAssignmentMode.Single; @@ -1096,8 +1112,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ResultCode GetVibrationDeviceInfo(ServiceCtx context) { VibrationDeviceHandle deviceHandle = context.RequestData.ReadStruct<VibrationDeviceHandle>(); - NpadStyleIndex deviceType = (NpadStyleIndex)deviceHandle.DeviceType; - NpadIdType npadIdType = (NpadIdType)deviceHandle.PlayerId; + NpadStyleIndex deviceType = (NpadStyleIndex)deviceHandle.DeviceType; + NpadIdType npadIdType = (NpadIdType)deviceHandle.PlayerId; if (deviceType < NpadStyleIndex.System || deviceType >= NpadStyleIndex.FullKey) { @@ -1136,14 +1152,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid } else { - throw new ArgumentOutOfRangeException(nameof(deviceHandle.Position)); + throw new InvalidOperationException($"{nameof(deviceHandle.Position)} contains an invalid value: {deviceHandle.Position}"); } } - VibrationDeviceValue deviceInfo = new VibrationDeviceValue + VibrationDeviceValue deviceInfo = new() { DeviceType = vibrationDeviceType, - Position = vibrationDevicePosition + Position = vibrationDevicePosition, }; context.ResponseData.WriteStruct(deviceInfo); @@ -1158,27 +1174,30 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SendVibrationValue(nn::hid::VibrationDeviceHandle, nn::hid::VibrationValue, nn::applet::AppletResourceUserId) public ResultCode SendVibrationValue(ServiceCtx context) { - VibrationDeviceHandle deviceHandle = new VibrationDeviceHandle + VibrationDeviceHandle deviceHandle = new() { DeviceType = context.RequestData.ReadByte(), - PlayerId = context.RequestData.ReadByte(), - Position = context.RequestData.ReadByte(), - Reserved = context.RequestData.ReadByte() + PlayerId = context.RequestData.ReadByte(), + Position = context.RequestData.ReadByte(), + Reserved = context.RequestData.ReadByte(), }; - VibrationValue vibrationValue = new VibrationValue + VibrationValue vibrationValue = new() { - AmplitudeLow = context.RequestData.ReadSingle(), - FrequencyLow = context.RequestData.ReadSingle(), + AmplitudeLow = context.RequestData.ReadSingle(), + FrequencyLow = context.RequestData.ReadSingle(), AmplitudeHigh = context.RequestData.ReadSingle(), - FrequencyHigh = context.RequestData.ReadSingle() + FrequencyHigh = context.RequestData.ReadSingle(), }; +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 - Dictionary<byte, VibrationValue> dualVibrationValues = new Dictionary<byte, VibrationValue>(); - - dualVibrationValues[deviceHandle.Position] = vibrationValue; + Dictionary<byte, VibrationValue> dualVibrationValues = new() + { + [deviceHandle.Position] = vibrationValue, + }; context.Device.Hid.Npads.UpdateRumbleQueue((PlayerIndex)deviceHandle.PlayerId, dualVibrationValues); @@ -1189,15 +1208,17 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetActualVibrationValue(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationValue public ResultCode GetActualVibrationValue(ServiceCtx context) { - VibrationDeviceHandle deviceHandle = new VibrationDeviceHandle + VibrationDeviceHandle deviceHandle = new() { DeviceType = context.RequestData.ReadByte(), - PlayerId = context.RequestData.ReadByte(), - Position = context.RequestData.ReadByte(), - Reserved = context.RequestData.ReadByte() + PlayerId = context.RequestData.ReadByte(), + Position = context.RequestData.ReadByte(), + Reserved = context.RequestData.ReadByte(), }; +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 VibrationValue vibrationValue = context.Device.Hid.Npads.GetLastVibrationValue((PlayerIndex)deviceHandle.PlayerId, deviceHandle.Position); @@ -1242,7 +1263,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SendVibrationValues(nn::applet::AppletResourceUserId, buffer<array<nn::hid::VibrationDeviceHandle>, type: 9>, buffer<array<nn::hid::VibrationValue>, type: 9>) public ResultCode SendVibrationValues(ServiceCtx context) { +#pragma warning disable IDE0059 // Remove unnecessary value assignment long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 byte[] vibrationDeviceHandleBuffer = new byte[context.Request.PtrBuff[0].Size]; @@ -1252,12 +1275,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid context.Memory.Read(context.Request.PtrBuff[1].Position, vibrationValueBuffer); - Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(vibrationDeviceHandleBuffer); - Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(vibrationValueBuffer); + Span<VibrationDeviceHandle> deviceHandles = MemoryMarshal.Cast<byte, VibrationDeviceHandle>(vibrationDeviceHandleBuffer); + Span<VibrationValue> vibrationValues = MemoryMarshal.Cast<byte, VibrationValue>(vibrationValueBuffer); if (!deviceHandles.IsEmpty && vibrationValues.Length == deviceHandles.Length) { - Dictionary<byte, VibrationValue> dualVibrationValues = new Dictionary<byte, VibrationValue>(); + Dictionary<byte, VibrationValue> dualVibrationValues = new(); PlayerIndex currentIndex = (PlayerIndex)deviceHandles[0].PlayerId; for (int deviceCounter = 0; deviceCounter < deviceHandles.Length; deviceCounter++) @@ -1285,9 +1308,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SendVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::hid::VibrationGcErmCommand, nn::applet::AppletResourceUserId) public ResultCode SendVibrationGcErmCommand(ServiceCtx context) { - int vibrationDeviceHandle = context.RequestData.ReadInt32(); + int vibrationDeviceHandle = context.RequestData.ReadInt32(); long vibrationGcErmCommand = context.RequestData.ReadInt64(); - long appletResourceUserId = context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, vibrationDeviceHandle, vibrationGcErmCommand }); @@ -1298,8 +1321,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetActualVibrationGcErmCommand(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) -> nn::hid::VibrationGcErmCommand public ResultCode GetActualVibrationGcErmCommand(ServiceCtx context) { - int vibrationDeviceHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); + int vibrationDeviceHandle = context.RequestData.ReadInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write(_vibrationGcErmCommand); @@ -1332,8 +1355,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid // IsVibrationDeviceMounted(nn::hid::VibrationDeviceHandle, nn::applet::AppletResourceUserId) public ResultCode IsVibrationDeviceMounted(ServiceCtx context) { - int vibrationDeviceHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning disable IDE0059 // Remove unnecessary value assignment + int vibrationDeviceHandle = context.RequestData.ReadInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); +#pragma warning restore IDE0059 // NOTE: Service use vibrationDeviceHandle to get the PlayerIndex. // And return false if (npadIdType >= (NpadIdType)8 && npadIdType != NpadIdType.Handheld && npadIdType != NpadIdType.Unknown) @@ -1358,8 +1383,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // StartConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId) public ResultCode StartConsoleSixAxisSensor(ServiceCtx context) { - int consoleSixAxisSensorHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); + int consoleSixAxisSensorHandle = context.RequestData.ReadInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle }); @@ -1370,8 +1395,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // StopConsoleSixAxisSensor(nn::hid::ConsoleSixAxisSensorHandle, nn::applet::AppletResourceUserId) public ResultCode StopConsoleSixAxisSensor(ServiceCtx context) { - int consoleSixAxisSensorHandle = context.RequestData.ReadInt32(); - long appletResourceUserId = context.RequestData.ReadInt64(); + int consoleSixAxisSensorHandle = context.RequestData.ReadInt32(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, consoleSixAxisSensorHandle }); @@ -1416,8 +1441,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ResultCode InitializeSevenSixAxisSensor(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); - long counter0 = context.RequestData.ReadInt64(); - long counter1 = context.RequestData.ReadInt64(); + long counter0 = context.RequestData.ReadInt64(); + long counter1 = context.RequestData.ReadInt64(); // TODO: Determine if array<nn::sf::NativeHandle> is a buffer or not... @@ -1441,8 +1466,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetSevenSixAxisSensorFusionStrength(float Strength, nn::applet::AppletResourceUserId) public ResultCode SetSevenSixAxisSensorFusionStrength(ServiceCtx context) { - _sevenSixAxisSensorFusionStrength = context.RequestData.ReadSingle(); - long appletResourceUserId = context.RequestData.ReadInt64(); + _sevenSixAxisSensorFusionStrength = context.RequestData.ReadSingle(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _sevenSixAxisSensorFusionStrength }); @@ -1566,14 +1591,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid // GetPalmaConnectionHandle(uint Unknown0, nn::applet::AppletResourceUserId) -> nn::hid::PalmaConnectionHandle public ResultCode GetPalmaConnectionHandle(ServiceCtx context) { - int unknown0 = context.RequestData.ReadInt32(); + int unknown0 = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); int palmaConnectionHandle = 0; context.ResponseData.Write(palmaConnectionHandle); - Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId , unknown0, palmaConnectionHandle }); + Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknown0, palmaConnectionHandle }); return ResultCode.Success; } @@ -1628,8 +1653,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // PlayPalmaActivity(nn::hid::PalmaConnectionHandle, ulong Unknown0) public ResultCode PlayPalmaActivity(ServiceCtx context) { - int palmaConnectionHandle = context.RequestData.ReadInt32(); - long unknown0 = context.RequestData.ReadInt64(); + int palmaConnectionHandle = context.RequestData.ReadInt32(); + long unknown0 = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0 }); @@ -1642,8 +1667,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetPalmaFrModeType(nn::hid::PalmaConnectionHandle, ulong FrModeType) public ResultCode SetPalmaFrModeType(ServiceCtx context) { - int palmaConnectionHandle = context.RequestData.ReadInt32(); - long frModeType = context.RequestData.ReadInt64(); + int palmaConnectionHandle = context.RequestData.ReadInt32(); + long frModeType = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, frModeType }); @@ -1667,8 +1692,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // EnablePalmaStep(nn::hid::PalmaConnectionHandle, bool Enable) public ResultCode EnablePalmaStep(ServiceCtx context) { - int palmaConnectionHandle = context.RequestData.ReadInt32(); - bool enabledPalmaStep = context.RequestData.ReadBoolean(); + int palmaConnectionHandle = context.RequestData.ReadInt32(); + bool enabledPalmaStep = context.RequestData.ReadBoolean(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, enabledPalmaStep }); @@ -1694,9 +1719,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // ReadPalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1) public ResultCode ReadPalmaApplicationSection(ServiceCtx context) { - int palmaConnectionHandle = context.RequestData.ReadInt32(); - long unknown0 = context.RequestData.ReadInt64(); - long unknown1 = context.RequestData.ReadInt64(); + int palmaConnectionHandle = context.RequestData.ReadInt32(); + long unknown0 = context.RequestData.ReadInt64(); + long unknown1 = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 }); @@ -1707,9 +1732,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid // WritePalmaApplicationSection(nn::hid::PalmaConnectionHandle, ulong Unknown0, ulong Unknown1, nn::hid::PalmaApplicationSectionAccessBuffer) public ResultCode WritePalmaApplicationSection(ServiceCtx context) { - int palmaConnectionHandle = context.RequestData.ReadInt32(); - long unknown0 = context.RequestData.ReadInt64(); - long unknown1 = context.RequestData.ReadInt64(); + int palmaConnectionHandle = context.RequestData.ReadInt32(); + long unknown0 = context.RequestData.ReadInt64(); + long unknown1 = context.RequestData.ReadInt64(); // nn::hid::PalmaApplicationSectionAccessBuffer cast is unknown Logger.Stub?.PrintStub(LogClass.ServiceHid, new { palmaConnectionHandle, unknown0, unknown1 }); @@ -1746,7 +1771,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ResultCode SetIsPalmaAllConnectable(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); - long unknownBool = context.RequestData.ReadInt64(); + long unknownBool = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, unknownBool }); @@ -1766,8 +1791,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid // SetNpadCommunicationMode(long CommunicationMode, nn::applet::AppletResourceUserId) public ResultCode SetNpadCommunicationMode(ServiceCtx context) { - _npadCommunicationMode = context.RequestData.ReadInt64(); - long appletResourceUserId = context.RequestData.ReadInt64(); + _npadCommunicationMode = context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, _npadCommunicationMode }); @@ -1790,7 +1815,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ResultCode SetTouchScreenConfiguration(ServiceCtx context) { long touchScreenConfigurationForNx = context.RequestData.ReadInt64(); - long appletResourceUserId = context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, touchScreenConfigurationForNx }); diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs index 4a5d0e9b..685f6841 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidSystemServer.cs @@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid private ResultCode GetAppletFooterUiTypeImpl(ServiceCtx context, out AppletFooterUiType appletFooterUiType) { - NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); + NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); PlayerIndex playerIndex = HidUtils.GetIndexFromNpadIdType(npadIdType); appletFooterUiType = context.Device.Hid.SharedMemory.Npads[(int)playerIndex].InternalState.AppletFooterUiType; @@ -73,4 +73,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid return ResultCode.Success; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs index eec5292f..7c624dfc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/IHidbusServer.cs @@ -10,12 +10,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid [CommandCmif(1)] // GetBusHandle(nn::hid::NpadIdType, nn::hidbus::BusType, nn::applet::AppletResourceUserId) -> (bool HasHandle, nn::hidbus::BusHandle) +#pragma warning disable CA1822 // Mark member as static public ResultCode GetBusHandle(ServiceCtx context) +#pragma warning restore CA1822 { - NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); + NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadInt32(); context.RequestData.BaseStream.Position += 4; // Padding - BusType busType = (BusType)context.RequestData.ReadInt64(); - long appletResourceUserId = context.RequestData.ReadInt64(); + BusType busType = (BusType)context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); context.ResponseData.Write(false); context.ResponseData.BaseStream.Position += 7; // Padding @@ -26,4 +28,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid return ResultCode.Success; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs index 71353344..daff6fda 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/ISystemServer.cs @@ -5,4 +5,4 @@ { public ISystemServer(ServiceCtx context) { } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs index 130fcf68..a13e77e7 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs @@ -65,8 +65,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // StopImageProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId) public ResultCode StopImageProcessor(ServiceCtx context) { - IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); - ulong appletResourceUserId = context.RequestData.ReadUInt64(); + IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); + ulong appletResourceUserId = context.RequestData.ReadUInt64(); CheckCameraHandle(irCameraHandle); @@ -79,9 +79,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // RunMomentProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedMomentProcessorConfig) public ResultCode RunMomentProcessor(ServiceCtx context) { - IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); - ulong appletResourceUserId = context.RequestData.ReadUInt64(); - var packedMomentProcessorConfig = context.RequestData.ReadStruct<PackedMomentProcessorConfig>(); + IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); + ulong appletResourceUserId = context.RequestData.ReadUInt64(); + var packedMomentProcessorConfig = context.RequestData.ReadStruct<PackedMomentProcessorConfig>(); CheckCameraHandle(irCameraHandle); @@ -94,9 +94,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // RunClusteringProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedClusteringProcessorConfig) public ResultCode RunClusteringProcessor(ServiceCtx context) { - IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); - ulong appletResourceUserId = context.RequestData.ReadUInt64(); - var packedClusteringProcessorConfig = context.RequestData.ReadStruct<PackedClusteringProcessorConfig>(); + IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); + ulong appletResourceUserId = context.RequestData.ReadUInt64(); + var packedClusteringProcessorConfig = context.RequestData.ReadStruct<PackedClusteringProcessorConfig>(); CheckCameraHandle(irCameraHandle); @@ -109,9 +109,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // RunImageTransferProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedImageTransferProcessorConfig, u64 TransferMemorySize, TransferMemoryHandle) public ResultCode RunImageTransferProcessor(ServiceCtx context) { - IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); - ulong appletResourceUserId = context.RequestData.ReadUInt64(); - var packedImageTransferProcessorConfig = context.RequestData.ReadStruct<PackedImageTransferProcessorConfig>(); + IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); + ulong appletResourceUserId = context.RequestData.ReadUInt64(); + var packedImageTransferProcessorConfig = context.RequestData.ReadStruct<PackedImageTransferProcessorConfig>(); CheckCameraHandle(irCameraHandle); @@ -126,8 +126,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // GetImageTransferProcessorState(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId) public ResultCode GetImageTransferProcessorState(ServiceCtx context) { - IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); - ulong appletResourceUserId = context.RequestData.ReadUInt64(); + IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); + ulong appletResourceUserId = context.RequestData.ReadUInt64(); // ulong imageTransferBufferAddress = context.Request.ReceiveBuff[0].Position; ulong imageTransferBufferSize = context.Request.ReceiveBuff[0].Size; @@ -144,8 +144,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // TODO: Uses the buffer to copy the JoyCon IR data (by using a JoyCon driver) and update the following struct. context.ResponseData.WriteStruct(new ImageTransferProcessorState() { - SamplingNumber = 0, - AmbientNoiseLevel = 0 + SamplingNumber = 0, + AmbientNoiseLevel = 0, }); return ResultCode.Success; @@ -155,9 +155,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // RunTeraPluginProcessor(pid, nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, PackedTeraPluginProcessorConfig) public ResultCode RunTeraPluginProcessor(ServiceCtx context) { - IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); - ulong appletResourceUserId = context.RequestData.ReadUInt64(); - var packedTeraPluginProcessorConfig = context.RequestData.ReadStruct<PackedTeraPluginProcessorConfig>(); + IrCameraHandle irCameraHandle = context.RequestData.ReadStruct<IrCameraHandle>(); + ulong appletResourceUserId = context.RequestData.ReadUInt64(); + var packedTeraPluginProcessorConfig = context.RequestData.ReadStruct<PackedTeraPluginProcessorConfig>(); CheckCameraHandle(irCameraHandle); @@ -172,7 +172,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs { NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32(); - if (npadIdType > NpadIdType.Player8 && + if (npadIdType > NpadIdType.Player8 && npadIdType != NpadIdType.Unknown && npadIdType != NpadIdType.Handheld) { @@ -193,10 +193,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // CheckFirmwareVersion(nn::irsensor::IrCameraHandle, nn::irsensor::PackedMcuVersion, nn::applet::AppletResourceUserId, pid) public ResultCode CheckFirmwareVersion(ServiceCtx context) { - int irCameraHandle = context.RequestData.ReadInt32(); + int irCameraHandle = context.RequestData.ReadInt32(); short packedMcuVersionMajor = context.RequestData.ReadInt16(); short packedMcuVersionMinor = context.RequestData.ReadInt16(); - long appletResourceUserId = context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle, packedMcuVersionMajor, packedMcuVersionMinor }); @@ -207,7 +207,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs // StopImageProcessorAsync(nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, pid) public ResultCode StopImageProcessorAsync(ServiceCtx context) { - int irCameraHandle = context.RequestData.ReadInt32(); + int irCameraHandle = context.RequestData.ReadInt32(); long appletResourceUserId = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle }); @@ -220,7 +220,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs public ResultCode ActivateIrsensorWithFunctionLevel(ServiceCtx context) { long appletResourceUserId = context.RequestData.ReadInt64(); - long packedFunctionLevel = context.RequestData.ReadInt64(); + long packedFunctionLevel = context.RequestData.ReadInt64(); Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel }); diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs index 99fcd541..ad78d4f1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorSystemServer.cs @@ -5,4 +5,4 @@ { public IIrSensorSystemServer(ServiceCtx context) { } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs index 3afc03c2..322f9349 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs @@ -2,14 +2,14 @@ { public enum ResultCode { - ModuleId = 205, + ModuleId = 205, ErrorCodeShift = 9, Success = 0, InvalidCameraHandle = (204 << ErrorCodeShift) | ModuleId, - InvalidBufferSize = (207 << ErrorCodeShift) | ModuleId, + InvalidBufferSize = (207 << ErrorCodeShift) | ModuleId, HandlePointerIsNull = (212 << ErrorCodeShift) | ModuleId, - NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId + NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/ImageTransferProcessorState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/ImageTransferProcessorState.cs index 647aef64..7f28667c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/ImageTransferProcessorState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/ImageTransferProcessorState.cs @@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types struct ImageTransferProcessorState { public ulong SamplingNumber; - public uint AmbientNoiseLevel; - public uint Reserved; + public uint AmbientNoiseLevel; + public uint Reserved; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/IrCameraHandle.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/IrCameraHandle.cs index 8ed7201e..282f9279 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/IrCameraHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/IrCameraHandle.cs @@ -5,8 +5,8 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types [StructLayout(LayoutKind.Sequential, Size = 0x4)] struct IrCameraHandle { - public byte PlayerNumber; - public byte DeviceType; + public byte PlayerNumber; + public byte DeviceType; public ushort Reserved; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedClusteringProcessorConfig.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedClusteringProcessorConfig.cs index 735f7822..a65a1ba6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedClusteringProcessorConfig.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedClusteringProcessorConfig.cs @@ -5,21 +5,21 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types [StructLayout(LayoutKind.Sequential, Size = 0x28)] struct PackedClusteringProcessorConfig { - public long ExposureTime; - public byte LightTarget; - public byte Gain; - public byte IsNegativeImageUsed; - public byte Reserved1; - public uint Reserved2; + public long ExposureTime; + public byte LightTarget; + public byte Gain; + public byte IsNegativeImageUsed; + public byte Reserved1; + public uint Reserved2; public ushort WindowOfInterestX; public ushort WindowOfInterestY; public ushort WindowOfInterestWidth; public ushort WindowOfInterestHeight; - public uint RequiredMcuVersion; - public uint ObjectPixelCountMin; - public uint ObjectPixelCountMax; - public byte ObjectIntensityMin; - public byte IsExternalLightFilterEnabled; + public uint RequiredMcuVersion; + public uint ObjectPixelCountMin; + public uint ObjectPixelCountMax; + public byte ObjectIntensityMin; + public byte IsExternalLightFilterEnabled; public ushort Reserved3; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedImageTransferProcessorConfig.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedImageTransferProcessorConfig.cs index 094413e0..c97de27a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedImageTransferProcessorConfig.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedImageTransferProcessorConfig.cs @@ -5,15 +5,15 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types [StructLayout(LayoutKind.Sequential, Size = 0x18)] struct PackedImageTransferProcessorConfig { - public long ExposureTime; - public byte LightTarget; - public byte Gain; - public byte IsNegativeImageUsed; - public byte Reserved1; - public uint Reserved2; - public uint RequiredMcuVersion; - public byte Format; - public byte Reserved3; + public long ExposureTime; + public byte LightTarget; + public byte Gain; + public byte IsNegativeImageUsed; + public byte Reserved1; + public uint Reserved2; + public uint RequiredMcuVersion; + public byte Format; + public byte Reserved3; public ushort Reserved4; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedMomentProcessorConfig.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedMomentProcessorConfig.cs index a1b70b40..bbee2815 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedMomentProcessorConfig.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedMomentProcessorConfig.cs @@ -5,19 +5,19 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types [StructLayout(LayoutKind.Sequential, Size = 0x20)] struct PackedMomentProcessorConfig { - public long ExposureTime; - public byte LightTarget; - public byte Gain; - public byte IsNegativeImageUsed; - public byte Reserved1; - public uint Reserved2; + public long ExposureTime; + public byte LightTarget; + public byte Gain; + public byte IsNegativeImageUsed; + public byte Reserved1; + public uint Reserved2; public ushort WindowOfInterestX; public ushort WindowOfInterestY; public ushort WindowOfInterestWidth; public ushort WindowOfInterestHeight; - public uint RequiredMcuVersion; - public byte Preprocess; - public byte PreprocessIntensityThreshold; + public uint RequiredMcuVersion; + public byte Preprocess; + public byte PreprocessIntensityThreshold; public ushort Reserved3; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedTeraPluginProcessorConfig.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedTeraPluginProcessorConfig.cs index 808b0b72..4fada04a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedTeraPluginProcessorConfig.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Irs/Types/PackedTeraPluginProcessorConfig.cs @@ -11,4 +11,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs.Types public byte Unknown2; public byte Unknown3; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/ResultCode.cs b/src/Ryujinx.HLE/HOS/Services/Hid/ResultCode.cs index 9c87ac1d..993ff707 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/ResultCode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/ResultCode.cs @@ -2,14 +2,14 @@ { enum ResultCode { - ModuleId = 202, + ModuleId = 202, ErrorCodeShift = 9, Success = 0, InvalidNpadDeviceType = (122 << ErrorCodeShift) | ModuleId, - InvalidNpadIdType = (123 << ErrorCodeShift) | ModuleId, - InvalidDeviceIndex = (124 << ErrorCodeShift) | ModuleId, - InvalidBufferSize = (131 << ErrorCodeShift) | ModuleId + InvalidNpadIdType = (123 << ErrorCodeShift) | ModuleId, + InvalidDeviceIndex = (124 << ErrorCodeShift) | ModuleId, + InvalidBufferSize = (131 << ErrorCodeShift) | ModuleId, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/AppletFooterUiType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/AppletFooterUiType.cs index c4ff8d7e..1eccd856 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/AppletFooterUiType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/AppletFooterUiType.cs @@ -25,6 +25,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types LarkNesLeft, LarkNesRight, Lucia, - Verification + Verification, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/HidVector.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/HidVector.cs index 18d9fd9c..8d667796 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/HidVector.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/HidVector.cs @@ -6,4 +6,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types public float Y; public float Z; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs index 936ee68c..033eb306 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusHandle.cs @@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid [StructLayout(LayoutKind.Sequential)] struct BusHandle { - public int AbstractedPadId; + public int AbstractedPadId; public byte InternalIndex; public byte PlayerNumber; public byte BusTypeId; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusType.cs index 41852365..25b36ca4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/BusType.cs @@ -2,8 +2,8 @@ { public enum BusType : long { - LeftJoyRail = 0, + LeftJoyRail = 0, RightJoyRail = 1, - InternalBus = 2 + InternalBus = 2, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerKeys.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerKeys.cs index c91636b2..b43381e6 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerKeys.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerKeys.cs @@ -5,41 +5,41 @@ namespace Ryujinx.HLE.HOS.Services.Hid [Flags] public enum ControllerKeys : long { - A = 1 << 0, - B = 1 << 1, - X = 1 << 2, - Y = 1 << 3, - LStick = 1 << 4, - RStick = 1 << 5, - L = 1 << 6, - R = 1 << 7, - Zl = 1 << 8, - Zr = 1 << 9, - Plus = 1 << 10, - Minus = 1 << 11, - DpadLeft = 1 << 12, - DpadUp = 1 << 13, - DpadRight = 1 << 14, - DpadDown = 1 << 15, - LStickLeft = 1 << 16, - LStickUp = 1 << 17, + A = 1 << 0, + B = 1 << 1, + X = 1 << 2, + Y = 1 << 3, + LStick = 1 << 4, + RStick = 1 << 5, + L = 1 << 6, + R = 1 << 7, + Zl = 1 << 8, + Zr = 1 << 9, + Plus = 1 << 10, + Minus = 1 << 11, + DpadLeft = 1 << 12, + DpadUp = 1 << 13, + DpadRight = 1 << 14, + DpadDown = 1 << 15, + LStickLeft = 1 << 16, + LStickUp = 1 << 17, LStickRight = 1 << 18, - LStickDown = 1 << 19, - RStickLeft = 1 << 20, - RStickUp = 1 << 21, + LStickDown = 1 << 19, + RStickLeft = 1 << 20, + RStickUp = 1 << 21, RStickRight = 1 << 22, - RStickDown = 1 << 23, - SlLeft = 1 << 24, - SrLeft = 1 << 25, - SlRight = 1 << 26, - SrRight = 1 << 27, + RStickDown = 1 << 23, + SlLeft = 1 << 24, + SrLeft = 1 << 25, + SlRight = 1 << 26, + SrRight = 1 << 27, // Generic Catch-all - Up = DpadUp | LStickUp | RStickUp, - Down = DpadDown | LStickDown | RStickDown, - Left = DpadLeft | LStickLeft | RStickLeft, + Up = DpadUp | LStickUp | RStickUp, + Down = DpadDown | LStickDown | RStickDown, + Left = DpadLeft | LStickLeft | RStickLeft, Right = DpadRight | LStickRight | RStickRight, - Sl = SlLeft | SlRight, - Sr = SrLeft | SrRight + Sl = SlLeft | SlRight, + Sr = SrLeft | SrRight, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerType.cs index d830f46a..1f5da317 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/ControllerType.cs @@ -6,14 +6,14 @@ namespace Ryujinx.HLE.HOS.Services.Hid public enum ControllerType { None, - ProController = 1 << 0, - Handheld = 1 << 1, - JoyconPair = 1 << 2, - JoyconLeft = 1 << 3, - JoyconRight = 1 << 4, - Invalid = 1 << 5, - Pokeball = 1 << 6, + ProController = 1 << 0, + Handheld = 1 << 1, + JoyconPair = 1 << 2, + JoyconLeft = 1 << 3, + JoyconRight = 1 << 4, + Invalid = 1 << 5, + Pokeball = 1 << 6, SystemExternal = 1 << 29, - System = 1 << 30 + System = 1 << 30, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadColor.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadColor.cs index 3c311e21..010cffbd 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadColor.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadColor.cs @@ -1,37 +1,37 @@ namespace Ryujinx.HLE.HOS.Services.Hid { - public enum NpadColor : uint + public enum NpadColor : uint { - BodyGray = 0x828282, - BodyNeonRed = 0xFF3C28, - BodyNeonBlue = 0x0AB9E6, - BodyNeonYellow = 0xE6FF00, - BodyNeonGreen = 0x1EDC00, - BodyNeonPink = 0xFF3278, - BodyRed = 0xE10F00, - BodyBlue = 0x4655F5, - BodyNeonPurple = 0xB400E6, - BodyNeonOrange = 0xFAA005, - BodyPokemonLetsGoPikachu = 0xFFDC00, - BodyPokemonLetsGoEevee = 0xC88C32, - BodyNintendoLaboCreatorsContestEdition = 0xD7AA73, - BodyAnimalCrossingSpecialEditionLeftJoyCon = 0x82FF96, - BodyAnimalCrossingSpecialEditionRightJoyCon = 0x96F5F5, + BodyGray = 0x828282, + BodyNeonRed = 0xFF3C28, + BodyNeonBlue = 0x0AB9E6, + BodyNeonYellow = 0xE6FF00, + BodyNeonGreen = 0x1EDC00, + BodyNeonPink = 0xFF3278, + BodyRed = 0xE10F00, + BodyBlue = 0x4655F5, + BodyNeonPurple = 0xB400E6, + BodyNeonOrange = 0xFAA005, + BodyPokemonLetsGoPikachu = 0xFFDC00, + BodyPokemonLetsGoEevee = 0xC88C32, + BodyNintendoLaboCreatorsContestEdition = 0xD7AA73, + BodyAnimalCrossingSpecialEditionLeftJoyCon = 0x82FF96, + BodyAnimalCrossingSpecialEditionRightJoyCon = 0x96F5F5, - ButtonGray = 0x0F0F0F, - ButtonNeonRed = 0x1E0A0A, - ButtonNeonBlue = 0x001E1E, - ButtonNeonYellow = 0x142800, - ButtonNeonGreen = 0x002800, - ButtonNeonPink = 0x28001E, - ButtonRed = 0x280A0A, - ButtonBlue = 0x00000A, - ButtonNeonPurple = 0x140014, - ButtonNeonOrange = 0x0F0A00, - ButtonPokemonLetsGoPikachu = 0x322800, - ButtonPokemonLetsGoEevee = 0x281900, - ButtonNintendoLaboCreatorsContestEdition = 0x1E1914, - ButtonAnimalCrossingSpecialEditionLeftJoyCon = 0x0A1E0A, - ButtonAnimalCrossingSpecialEditionRightJoyCon = 0x0A1E28 + ButtonGray = 0x0F0F0F, + ButtonNeonRed = 0x1E0A0A, + ButtonNeonBlue = 0x001E1E, + ButtonNeonYellow = 0x142800, + ButtonNeonGreen = 0x002800, + ButtonNeonPink = 0x28001E, + ButtonRed = 0x280A0A, + ButtonBlue = 0x00000A, + ButtonNeonPurple = 0x140014, + ButtonNeonOrange = 0x0F0A00, + ButtonPokemonLetsGoPikachu = 0x322800, + ButtonPokemonLetsGoEevee = 0x281900, + ButtonNintendoLaboCreatorsContestEdition = 0x1E1914, + ButtonAnimalCrossingSpecialEditionLeftJoyCon = 0x0A1E0A, + ButtonAnimalCrossingSpecialEditionRightJoyCon = 0x0A1E28, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadIdType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadIdType.cs index 4b488cd2..5a9247d9 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadIdType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadIdType.cs @@ -2,15 +2,15 @@ { public enum NpadIdType { - Player1 = 0, - Player2 = 1, - Player3 = 2, - Player4 = 3, - Player5 = 4, - Player6 = 5, - Player7 = 6, - Player8 = 7, - Unknown = 16, - Handheld = 32 + Player1 = 0, + Player2 = 1, + Player3 = 2, + Player4 = 3, + Player5 = 4, + Player6 = 5, + Player7 = 6, + Player8 = 7, + Unknown = 16, + Handheld = 32, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadStyleIndex.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadStyleIndex.cs index ddf5d97f..04550b6f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadStyleIndex.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/NpadStyleIndex.cs @@ -2,12 +2,12 @@ { public enum NpadStyleIndex : byte { - FullKey = 3, - Handheld = 4, - JoyDual = 5, - JoyLeft = 6, - JoyRight = 7, + FullKey = 3, + Handheld = 4, + JoyDual = 5, + JoyLeft = 6, + JoyRight = 7, SystemExt = 32, - System = 33 + System = 33, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/PlayerIndex.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/PlayerIndex.cs index 972d69b4..d68b6d93 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/PlayerIndex.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/Npad/PlayerIndex.cs @@ -2,16 +2,16 @@ namespace Ryujinx.HLE.HOS.Services.Hid { public enum PlayerIndex { - Player1 = 0, - Player2 = 1, - Player3 = 2, - Player4 = 3, - Player5 = 4, - Player6 = 5, - Player7 = 6, - Player8 = 7, + Player1 = 0, + Player2 = 1, + Player3 = 2, + Player4 = 3, + Player5 = 4, + Player6 = 5, + Player7 = 6, + Player8 = 7, Handheld = 8, - Unknown = 9, - Auto = 10 // Shouldn't be used directly + Unknown = 9, + Auto = 10, // Shouldn't be used directly } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/NpadJoyHoldType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/NpadJoyHoldType.cs index d3b51a24..19297de4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/NpadJoyHoldType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/NpadJoyHoldType.cs @@ -3,6 +3,6 @@ enum NpadJoyHoldType { Vertical, - Horizontal + Horizontal, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/AtomicStorage.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/AtomicStorage.cs index da53e421..b6bc288e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/AtomicStorage.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/AtomicStorage.cs @@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common { - struct AtomicStorage<T> where T: unmanaged, ISampledDataStruct + struct AtomicStorage<T> where T : unmanaged, ISampledDataStruct { public ulong SamplingNumber; public T Object; diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs index a382c0c2..ae1997d4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs @@ -11,9 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common /// - use <c>StructLayoutAttribute</c> (and related attributes) to explicity control how the struct is laid out in memory. /// - ensure that the method <c>ISampledDataStruct.GetSamplingNumberFieldOffset()</c> correctly returns the offset, in bytes, /// to the ulong "Sampling Number" field within the struct. Most types have it as the first field, so the default offset is 0. - /// + /// /// Example: - /// + /// /// <c> /// [StructLayout(LayoutKind.Sequential, Pack = 8)] /// struct DebugPadState : ISampledDataStruct @@ -45,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common if (fieldOffset > 0) { - byteSpan = byteSpan.Slice(fieldOffset); + byteSpan = byteSpan[fieldOffset..]; } ulong value = BinaryPrimitives.ReadUInt64LittleEndian(byteSpan); @@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common return sampledDataStruct switch { Npad.SixAxisSensorState _ => sizeof(ulong), - _ => 0 + _ => 0, }; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs index ae654d6f..26ea1cff 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs @@ -5,16 +5,16 @@ using System.Threading; namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common { - struct RingLifo<T> where T: unmanaged, ISampledDataStruct + struct RingLifo<T> where T : unmanaged, ISampledDataStruct { private const ulong MaxEntries = 17; -#pragma warning disable CS0169 - private ulong _unused; -#pragma warning restore CS0169 -#pragma warning disable CS0414 +#pragma warning disable IDE0051, CS0169 // Remove unused private member + private readonly ulong _unused; +#pragma warning restore IDE0051, CS0169 +#pragma warning disable CS0414, IDE0052 // Remove unread private member private ulong _bufferCount; -#pragma warning restore CS0414 +#pragma warning restore CS0414, IDE0052 private ulong _index; private ulong _count; private Array17<AtomicStorage<T>> _storage; @@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong GetNextIndexForWrite(ulong index) + private readonly ulong GetNextIndexForWrite(ulong index) { return (index + 1) % MaxEntries; } @@ -142,7 +142,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common { return new RingLifo<T> { - _bufferCount = MaxEntries + _bufferCount = MaxEntries, }; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadAttribute.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadAttribute.cs index ec5bd3c8..abc6990b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadAttribute.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadAttribute.cs @@ -6,6 +6,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad enum DebugPadAttribute : uint { None = 0, - Connected = 1 << 0 + Connected = 1 << 0, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadButton.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadButton.cs index e8f28317..dc713a03 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadButton.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/DebugPad/DebugPadButton.cs @@ -19,6 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.DebugPad Left = 1 << 10, Up = 1 << 11, Right = 1 << 12, - Down = 1 << 13 + Down = 1 << 13, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKey.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKey.cs index 22df7c79..336037ab 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKey.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKey.cs @@ -26,4 +26,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard } } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKeyShift.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKeyShift.cs index 01c2bb30..46461ad8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKeyShift.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardKeyShift.cs @@ -133,6 +133,6 @@ RightControl = 228, RightShift = 229, RightAlt = 230, - RightGui = 231 + RightGui = 231, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardModifier.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardModifier.cs index 839a4e82..ad94619e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardModifier.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Keyboard/KeyboardModifier.cs @@ -15,6 +15,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Keyboard ScrollLock = 1 << 9, NumLock = 1 << 10, Katakana = 1 << 11, - Hiragana = 1 << 12 + Hiragana = 1 << 12, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseAttribute.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseAttribute.cs index 5ffba0d7..ce3dd946 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseAttribute.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseAttribute.cs @@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse { None = 0, Transferable = 1 << 0, - IsConnected = 1 << 1 + IsConnected = 1 << 1, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseButton.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseButton.cs index 7e35140c..3e025993 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseButton.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Mouse/MouseButton.cs @@ -10,6 +10,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Mouse Right = 1 << 1, Middle = 1 << 2, Forward = 1 << 3, - Back = 1 << 4 + Back = 1 << 4, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/DeviceType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/DeviceType.cs index 95b1cb51..259c712b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/DeviceType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/DeviceType.cs @@ -24,6 +24,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad HandheldLarkNesRight = 1 << 14, Lucia = 1 << 15, - System = 1 << 31 + System = 1 << 31, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadAttribute.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadAttribute.cs index 0960b7bf..6ad2531f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadAttribute.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadAttribute.cs @@ -11,6 +11,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad IsLeftConnected = 1 << 2, IsLeftWired = 1 << 3, IsRightConnected = 1 << 4, - IsRightWired = 1 << 5 + IsRightWired = 1 << 5, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadBatteryLevel.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadBatteryLevel.cs index e10e55cd..a84e0259 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadBatteryLevel.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadBatteryLevel.cs @@ -6,6 +6,6 @@ Percent25, Percent50, Percent75, - Percent100 + Percent100, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadButton.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadButton.cs index 5b3e13a7..442d4089 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadButton.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadButton.cs @@ -39,6 +39,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad // FIXME: Probably a button on Lark. Unknown29 = 1 << 29, - HandheldLeftB = 1 << 30 + HandheldLeftB = 1 << 30, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadColorAttribute.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadColorAttribute.cs index 1e547cc8..1a7846db 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadColorAttribute.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadColorAttribute.cs @@ -4,6 +4,6 @@ { Ok, ReadError, - NoController + NoController, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadCommonState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadCommonState.cs index 64f75ce9..e1d70a8a 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadCommonState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadCommonState.cs @@ -11,6 +11,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public AnalogStickState AnalogStickL; public AnalogStickState AnalogStickR; public NpadAttribute Attributes; - private uint _reserved; + private readonly uint _reserved; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadFullKeyColorState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadFullKeyColorState.cs index 990eafb2..92d4a2ae 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadFullKeyColorState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadFullKeyColorState.cs @@ -6,4 +6,4 @@ public uint FullKeyBody; public uint FullKeyButtons; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs index bddd6212..39453984 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadGcTriggerState.cs @@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NpadGcTriggerState : ISampledDataStruct { -#pragma warning disable CS0649 +#pragma warning disable CS0649 // Field is never assigned to public ulong SamplingNumber; public uint TriggerL; public uint TriggerR; #pragma warning restore CS0649 } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs index b009f95e..60d16fd8 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs @@ -23,7 +23,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public RingLifo<SixAxisSensorState> JoyLeftSixAxisSensor; public RingLifo<SixAxisSensorState> JoyRightSixAxisSensor; public DeviceType DeviceType; - private uint _reserved1; +#pragma warning disable IDE0051 // Remove unused private member + private readonly uint _reserved1; +#pragma warning restore IDE0051 public NpadSystemProperties SystemProperties; public NpadSystemButtonProperties SystemButtonProperties; public NpadBatteryLevel BatteryLevelJoyDual; @@ -31,7 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public NpadBatteryLevel BatteryLevelJoyRight; public uint AppletFooterUiAttributes; public AppletFooterUiType AppletFooterUiType; - private Reserved2Struct _reserved2; +#pragma warning disable IDE0051 // Remove unused private member + private readonly Reserved2Struct _reserved2; +#pragma warning restore IDE0051 public RingLifo<NpadGcTriggerState> GcTrigger; public NpadLarkType LarkTypeLeftAndMain; public NpadLarkType LarkTypeRight; @@ -39,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public uint Unknown43EC; [StructLayout(LayoutKind.Sequential, Size = 123, Pack = 1)] - private struct Reserved2Struct {} + private struct Reserved2Struct { } public static NpadInternalState Create() { @@ -62,4 +66,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad }; } } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyAssignmentMode.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyAssignmentMode.cs index 871c4c5a..c50abe16 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyAssignmentMode.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyAssignmentMode.cs @@ -3,6 +3,6 @@ enum NpadJoyAssignmentMode : uint { Dual, - Single + Single, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyColorState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyColorState.cs index 3986dd5e..6fec613b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyColorState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadJoyColorState.cs @@ -8,4 +8,4 @@ public uint RightBody; public uint RightButtons; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadLuciaType.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadLuciaType.cs index 95148485..e12e84e4 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadLuciaType.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadLuciaType.cs @@ -5,6 +5,6 @@ Invalid, J, E, - U + U, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadState.cs index ed9e7c0d..643234fc 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadState.cs @@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad { return new NpadState { - InternalState = NpadInternalState.Create() + InternalState = NpadInternalState.Create(), }; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadStyleTag.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadStyleTag.cs index f31978e2..d9ecdcd1 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadStyleTag.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadStyleTag.cs @@ -71,6 +71,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad /// <summary> /// Generic controller. /// </summary> - System = 1 << 30 + System = 1 << 30, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemButtonProperties.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemButtonProperties.cs index 68603271..56a4a80f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemButtonProperties.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemButtonProperties.cs @@ -6,6 +6,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad enum NpadSystemButtonProperties : uint { None = 0, - IsUnintendedHomeButtonInputProtectionEnabled = 1 << 0 + IsUnintendedHomeButtonInputProtectionEnabled = 1 << 0, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemProperties.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemProperties.cs index 13444555..817c6c14 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemProperties.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadSystemProperties.cs @@ -19,6 +19,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad IsSlSrButtonOriented = 1 << 12, IsPlusAvailable = 1 << 13, IsMinusAvailable = 1 << 14, - IsDirectionalButtonsAvailable = 1 << 15 + IsDirectionalButtonsAvailable = 1 << 15, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorAttribute.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorAttribute.cs index 7ed46d98..0190f09d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorAttribute.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorAttribute.cs @@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad { None = 0, IsConnected = 1 << 0, - IsInterpolated = 1 << 1 + IsInterpolated = 1 << 1, } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorState.cs index 18be3276..25f65a0e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/SixAxisSensorState.cs @@ -14,6 +14,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public HidVector Angle; public Array9<float> Direction; public SixAxisSensorAttribute Attributes; - private uint _reserved; + private readonly uint _reserved; } -}
\ No newline at end of file +} diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/SharedMemory.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/SharedMemory.cs index 48acfc3f..640076b3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/SharedMemory.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/SharedMemory.cs @@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory public static SharedMemory Create() { - SharedMemory result = new SharedMemory + SharedMemory result = new() { DebugPad = RingLifo<DebugPadState>.Create(), TouchScreen = RingLifo<TouchScreenState>.Create(), diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchAttribute.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchAttribute.cs index d2c5726a..7c43e6cd 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchAttribute.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchAttribute.cs @@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen { None = 0, Start = 1 << 0, - End = 1 << 1 + End = 1 << 1, } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchScreenState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchScreenState.cs index cdd4cc45..5ce51ee3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchScreenState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchScreenState.cs @@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen { public ulong SamplingNumber; public int TouchesCount; - private int _reserved; + private readonly int _reserved; public Array16<TouchState> Touches; } } diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs index ba621a2b..908f9ed5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/TouchScreen/TouchState.cs @@ -3,7 +3,7 @@ struct TouchState { public ulong DeltaTime; -#pragma warning disable CS0649 +#pragma warning disable CS0649 // Field is never assigned to public TouchAttribute Attribute; #pragma warning restore CS0649 public uint FingerId; @@ -12,8 +12,8 @@ public uint DiameterX; public uint DiameterY; public uint RotationAngle; -#pragma warning disable CS0169 - private uint _reserved; -#pragma warning restore CS0169 +#pragma warning disable CS0169, IDE0051 // Remove unused private member + private readonly uint _reserved; +#pragma warning restore CS0169, IDE0051 } } |
