aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-06-26 03:51:16 +0200
committerGitHub <noreply@github.com>2023-06-26 01:51:16 +0000
commitb29ded1d6009dc6a82a0aefd594eda21b5c2d814 (patch)
treef0cbbb7c2a64a457bdd4f96a280033aa43812be1
parent9860bfb2cdb2a3f6093d936d647b1f254a23120d (diff)
[Ryujinx.SDL2.Common] Address dotnet-format issues (#5387)1.1.921
* dotnet format style --severity info Some changes were manually reverted. * Address dotnet format CA1816 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address most dotnet format whitespace warnings * dotnet format whitespace after rebase
-rw-r--r--src/Ryujinx.SDL2.Common/SDL2Driver.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Ryujinx.SDL2.Common/SDL2Driver.cs b/src/Ryujinx.SDL2.Common/SDL2Driver.cs
index 5e2deb26..2642b26f 100644
--- a/src/Ryujinx.SDL2.Common/SDL2Driver.cs
+++ b/src/Ryujinx.SDL2.Common/SDL2Driver.cs
@@ -19,10 +19,7 @@ namespace Ryujinx.SDL2.Common
{
get
{
- if (_instance == null)
- {
- _instance = new SDL2Driver();
- }
+ _instance ??= new SDL2Driver();
return _instance;
}
@@ -43,7 +40,7 @@ namespace Ryujinx.SDL2.Common
private readonly object _lock = new();
- private SDL2Driver() {}
+ private SDL2Driver() { }
private const string SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS = "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS";
@@ -80,8 +77,15 @@ namespace Ryujinx.SDL2.Common
}
// First ensure that we only enable joystick events (for connected/disconnected).
- SDL_GameControllerEventState(SDL_DISABLE);
- SDL_JoystickEventState(SDL_ENABLE);
+ if (SDL_GameControllerEventState(SDL_IGNORE) != SDL_IGNORE)
+ {
+ Logger.Error?.PrintMsg(LogClass.Application, "Couldn't change the state of game controller events.");
+ }
+
+ if (SDL_JoystickEventState(SDL_ENABLE) < 0)
+ {
+ Logger.Error?.PrintMsg(LogClass.Application, $"Failed to enable joystick event polling: {SDL_GetError()}");
+ }
// Disable all joysticks information, we don't need them no need to flood the event queue for that.
SDL_EventState(SDL_EventType.SDL_JOYAXISMOTION, SDL_DISABLE);
@@ -153,7 +157,7 @@ namespace Ryujinx.SDL2.Common
{
const int WaitTimeMs = 10;
- using ManualResetEventSlim waitHandle = new ManualResetEventSlim(false);
+ using ManualResetEventSlim waitHandle = new(false);
while (_isRunning)
{
@@ -199,6 +203,7 @@ namespace Ryujinx.SDL2.Common
public void Dispose()
{
+ GC.SuppressFinalize(this);
Dispose(true);
}
}