diff options
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 +} |
