forked from Mirror/Ryujinx
[Ryujinx.SDL2.Common] Address dotnet-format issues (#5387)
* 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
This commit is contained in:
parent
9860bfb2cd
commit
b29ded1d60
1 changed files with 13 additions and 8 deletions
|
@ -19,10 +19,7 @@ namespace Ryujinx.SDL2.Common
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
_instance ??= new SDL2Driver();
|
||||||
{
|
|
||||||
_instance = new SDL2Driver();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +40,7 @@ namespace Ryujinx.SDL2.Common
|
||||||
|
|
||||||
private readonly object _lock = new();
|
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";
|
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).
|
// First ensure that we only enable joystick events (for connected/disconnected).
|
||||||
SDL_GameControllerEventState(SDL_DISABLE);
|
if (SDL_GameControllerEventState(SDL_IGNORE) != SDL_IGNORE)
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
{
|
||||||
|
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.
|
// 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);
|
SDL_EventState(SDL_EventType.SDL_JOYAXISMOTION, SDL_DISABLE);
|
||||||
|
@ -153,7 +157,7 @@ namespace Ryujinx.SDL2.Common
|
||||||
{
|
{
|
||||||
const int WaitTimeMs = 10;
|
const int WaitTimeMs = 10;
|
||||||
|
|
||||||
using ManualResetEventSlim waitHandle = new ManualResetEventSlim(false);
|
using ManualResetEventSlim waitHandle = new(false);
|
||||||
|
|
||||||
while (_isRunning)
|
while (_isRunning)
|
||||||
{
|
{
|
||||||
|
@ -199,6 +203,7 @@ namespace Ryujinx.SDL2.Common
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue