[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>
This commit is contained in:
TSRBerry
2023-07-16 19:31:14 +02:00
committed by GitHub
parent fec8291c17
commit 326749498b
1015 changed files with 8173 additions and 7615 deletions

View File

@@ -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;
}
}
}
}