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/HidDevices | |
| 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/HidDevices')
12 files changed, 64 insertions, 61 deletions
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 +} |
