diff --git a/Directory.Packages.props b/Directory.Packages.props
index c474184b4..5c21c5f85 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -15,6 +15,7 @@
+
@@ -46,4 +47,4 @@
-
+
\ No newline at end of file
diff --git a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
index 0827266a1..0e1265fb6 100644
--- a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
+++ b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
@@ -629,8 +629,8 @@ namespace Ryujinx.HLE.FileSystem
}
private static readonly ExtraDataFixInfo[] _systemExtraDataFixInfo =
- {
- new ExtraDataFixInfo()
+ [
+ new()
{
StaticSaveDataId = 0x8000000000000030,
OwnerId = 0x010000000000001F,
@@ -638,15 +638,15 @@ namespace Ryujinx.HLE.FileSystem
DataSize = 0x10000,
JournalSize = 0x10000,
},
- new ExtraDataFixInfo()
+ new()
{
StaticSaveDataId = 0x8000000000001040,
OwnerId = 0x0100000000001009,
Flags = SaveDataFlags.None,
DataSize = 0xC000,
JournalSize = 0xC000,
- },
- };
+ }
+ ];
public void Dispose()
{
diff --git a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs
index 187ca48dd..c8834fdea 100644
--- a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs
+++ b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs
@@ -320,23 +320,7 @@ namespace Ryujinx.Input.SDL2
return (0.0f, 0.0f);
}
- short stickX;
- short stickY;
-
- if (inputId == StickInputId.Left)
- {
- stickX = SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTX);
- stickY = SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTY);
- }
- else if (inputId == StickInputId.Right)
- {
- stickX = SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_RIGHTX);
- stickY = SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_RIGHTY);
- }
- else
- {
- throw new NotSupportedException($"Unsupported stick {inputId}");
- }
+ (short stickX, short stickY) = GetStickXY(inputId);
float resultX = ConvertRawStickValue(stickX);
float resultY = -ConvertRawStickValue(stickY);
@@ -367,6 +351,18 @@ namespace Ryujinx.Input.SDL2
return (resultX, resultY);
}
+ private (short, short) GetStickXY(StickInputId inputId) =>
+ inputId switch
+ {
+ StickInputId.Left => (
+ SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTX),
+ SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_LEFTY)),
+ StickInputId.Right => (
+ SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_RIGHTX),
+ SDL_GameControllerGetAxis(_gamepadHandle, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_RIGHTY)),
+ _ => throw new NotSupportedException($"Unsupported stick {inputId}")
+ };
+
public bool IsPressed(GamepadButtonInputId inputId)
{
if (inputId == GamepadButtonInputId.LeftTrigger)
diff --git a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
index c741493c1..012d72d7c 100644
--- a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
+++ b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
@@ -9,7 +9,7 @@ namespace Ryujinx.Input.SDL2
{
private readonly Dictionary _gamepadsInstanceIdsMapping;
private readonly List _gamepadsIds;
- private readonly object _lock = new object();
+ private readonly object _lock = new();
public ReadOnlySpan GamepadsIds
{
@@ -82,17 +82,15 @@ namespace Ryujinx.Input.SDL2
private void HandleJoyStickDisconnected(int joystickInstanceId)
{
- if (_gamepadsInstanceIdsMapping.TryGetValue(joystickInstanceId, out string id))
+ if (!_gamepadsInstanceIdsMapping.Remove(joystickInstanceId, out string id))
+ return;
+
+ lock (_lock)
{
- _gamepadsInstanceIdsMapping.Remove(joystickInstanceId);
-
- lock (_lock)
- {
- _gamepadsIds.Remove(id);
- }
-
- OnGamepadDisconnected?.Invoke(id);
+ _gamepadsIds.Remove(id);
}
+
+ OnGamepadDisconnected?.Invoke(id);
}
private void HandleJoyStickConnected(int joystickDeviceId, int joystickInstanceId)
diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
index c464cb0a5..ca94f086b 100644
--- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
+++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
@@ -80,7 +80,7 @@ namespace Ryujinx.UI.App.Common
private static byte[] GetResourceBytes(string resourceName)
{
- Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName);
+ Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName)!;
byte[] resourceByteArray = new byte[resourceStream.Length];
resourceStream.ReadExactly(resourceByteArray);
@@ -1081,7 +1081,7 @@ namespace Ryujinx.UI.App.Common
using FileStream file = new(applicationPath, FileMode.Open, FileAccess.Read);
- if (extension == ".nsp" || extension == ".pfs0" || extension == ".xci")
+ if (extension is ".nsp" or ".pfs0" or ".xci")
{
try
{
diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
index 2cb814afa..ceb9728d5 100644
--- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
+++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
@@ -527,36 +527,36 @@ namespace Ryujinx.UI.Common.Configuration
public GraphicsSection()
{
BackendThreading = new ReactiveObject();
- BackendThreading.Event += static (sender, e) => LogValueChange(e, nameof(BackendThreading));
+ BackendThreading.Event += static (_, e) => LogValueChange(e, nameof(BackendThreading));
ResScale = new ReactiveObject();
- ResScale.Event += static (sender, e) => LogValueChange(e, nameof(ResScale));
+ ResScale.Event += static (_, e) => LogValueChange(e, nameof(ResScale));
ResScaleCustom = new ReactiveObject();
- ResScaleCustom.Event += static (sender, e) => LogValueChange(e, nameof(ResScaleCustom));
+ ResScaleCustom.Event += static (_, e) => LogValueChange(e, nameof(ResScaleCustom));
MaxAnisotropy = new ReactiveObject();
- MaxAnisotropy.Event += static (sender, e) => LogValueChange(e, nameof(MaxAnisotropy));
+ MaxAnisotropy.Event += static (_, e) => LogValueChange(e, nameof(MaxAnisotropy));
AspectRatio = new ReactiveObject();
- AspectRatio.Event += static (sender, e) => LogValueChange(e, nameof(AspectRatio));
+ AspectRatio.Event += static (_, e) => LogValueChange(e, nameof(AspectRatio));
ShadersDumpPath = new ReactiveObject();
EnableVsync = new ReactiveObject();
- EnableVsync.Event += static (sender, e) => LogValueChange(e, nameof(EnableVsync));
+ EnableVsync.Event += static (_, e) => LogValueChange(e, nameof(EnableVsync));
EnableShaderCache = new ReactiveObject();
- EnableShaderCache.Event += static (sender, e) => LogValueChange(e, nameof(EnableShaderCache));
+ EnableShaderCache.Event += static (_, e) => LogValueChange(e, nameof(EnableShaderCache));
EnableTextureRecompression = new ReactiveObject();
- EnableTextureRecompression.Event += static (sender, e) => LogValueChange(e, nameof(EnableTextureRecompression));
+ EnableTextureRecompression.Event += static (_, e) => LogValueChange(e, nameof(EnableTextureRecompression));
GraphicsBackend = new ReactiveObject();
- GraphicsBackend.Event += static (sender, e) => LogValueChange(e, nameof(GraphicsBackend));
+ GraphicsBackend.Event += static (_, e) => LogValueChange(e, nameof(GraphicsBackend));
PreferredGpu = new ReactiveObject();
- PreferredGpu.Event += static (sender, e) => LogValueChange(e, nameof(PreferredGpu));
+ PreferredGpu.Event += static (_, e) => LogValueChange(e, nameof(PreferredGpu));
EnableMacroHLE = new ReactiveObject();
- EnableMacroHLE.Event += static (sender, e) => LogValueChange(e, nameof(EnableMacroHLE));
+ EnableMacroHLE.Event += static (_, e) => LogValueChange(e, nameof(EnableMacroHLE));
EnableColorSpacePassthrough = new ReactiveObject();
- EnableColorSpacePassthrough.Event += static (sender, e) => LogValueChange(e, nameof(EnableColorSpacePassthrough));
+ EnableColorSpacePassthrough.Event += static (_, e) => LogValueChange(e, nameof(EnableColorSpacePassthrough));
AntiAliasing = new ReactiveObject();
- AntiAliasing.Event += static (sender, e) => LogValueChange(e, nameof(AntiAliasing));
+ AntiAliasing.Event += static (_, e) => LogValueChange(e, nameof(AntiAliasing));
ScalingFilter = new ReactiveObject();
- ScalingFilter.Event += static (sender, e) => LogValueChange(e, nameof(ScalingFilter));
+ ScalingFilter.Event += static (_, e) => LogValueChange(e, nameof(ScalingFilter));
ScalingFilterLevel = new ReactiveObject();
- ScalingFilterLevel.Event += static (sender, e) => LogValueChange(e, nameof(ScalingFilterLevel));
+ ScalingFilterLevel.Event += static (_, e) => LogValueChange(e, nameof(ScalingFilterLevel));
}
}
@@ -766,8 +766,8 @@ namespace Ryujinx.UI.Common.Configuration
EnableKeyboard = Hid.EnableKeyboard,
EnableMouse = Hid.EnableMouse,
Hotkeys = Hid.Hotkeys,
- KeyboardConfig = new List(),
- ControllerConfig = new List(),
+ KeyboardConfig = [],
+ ControllerConfig = [],
InputConfig = Hid.InputConfig,
GraphicsBackend = Graphics.GraphicsBackend,
PreferredGpu = Graphics.PreferredGpu,
@@ -880,8 +880,8 @@ namespace Ryujinx.UI.Common.Configuration
VolumeUp = Key.Unbound,
VolumeDown = Key.Unbound,
};
- Hid.InputConfig.Value = new List
- {
+ Hid.InputConfig.Value =
+ [
new StandardKeyboardInputConfig
{
Version = InputConfig.CurrentVersion,
@@ -929,15 +929,16 @@ namespace Ryujinx.UI.Common.Configuration
StickRight = Key.L,
StickButton = Key.H,
},
- },
- };
+ }
+
+ ];
}
public void Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
{
bool configurationFileUpdated = false;
- if (configurationFileFormat.Version < 0 || configurationFileFormat.Version > ConfigurationFileFormat.CurrentVersion)
+ if (configurationFileFormat.Version is < 0 or > ConfigurationFileFormat.CurrentVersion)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default.");
diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs
index 1388c94f3..8e8abf1af 100644
--- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs
+++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs
@@ -115,9 +115,6 @@ namespace Ryujinx.Ava.UI.Windows
base.OnClosed(e);
if (PlatformSettings != null)
{
- ///
- /// Unsubscribe to the ColorValuesChanged event
- ///
PlatformSettings.ColorValuesChanged -= OnPlatformColorValuesChanged;
}
}