mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-28 11:26:24 +02:00
[Ryujinx.Headless.SDL2] Address dotnet-format issues (#5379)
* 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 * Address or silence dotnet format CA1806 and a few CA1854 warnings * 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 * Simplify properties and array initialization, Use const when possible, Remove trailing commas * 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 * Add trailing commas * Fix naming and formatting issues
This commit is contained in:
parent
981e0c082d
commit
40daca5684
9 changed files with 218 additions and 208 deletions
|
@ -4,6 +4,8 @@ using Ryujinx.Common.Configuration.Hid;
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.GAL.Multithreading;
|
||||
using Ryujinx.Graphics.Gpu;
|
||||
using Ryujinx.Graphics.OpenGL;
|
||||
using Ryujinx.HLE.HOS.Applets;
|
||||
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types;
|
||||
using Ryujinx.HLE.Ui;
|
||||
|
@ -30,7 +32,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
private const SDL_WindowFlags DefaultFlags = SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI | SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | SDL_WindowFlags.SDL_WINDOW_SHOWN;
|
||||
private const int TargetFps = 60;
|
||||
|
||||
private static ConcurrentQueue<Action> MainThreadActions = new ConcurrentQueue<Action>();
|
||||
private static readonly ConcurrentQueue<Action> _mainThreadActions = new();
|
||||
|
||||
[LibraryImport("SDL2")]
|
||||
// TODO: Remove this as soon as SDL2-CS was updated to expose this method publicly
|
||||
|
@ -38,7 +40,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
public static void QueueMainThreadAction(Action action)
|
||||
{
|
||||
MainThreadActions.Enqueue(action);
|
||||
_mainThreadActions.Enqueue(action);
|
||||
}
|
||||
|
||||
public NpadManager NpadManager { get; }
|
||||
|
@ -55,9 +57,9 @@ namespace Ryujinx.Headless.SDL2
|
|||
public int Height { get; private set; }
|
||||
|
||||
protected SDL2MouseDriver MouseDriver;
|
||||
private InputManager _inputManager;
|
||||
private IKeyboard _keyboardInterface;
|
||||
private GraphicsDebugLevel _glLogLevel;
|
||||
private readonly InputManager _inputManager;
|
||||
private readonly IKeyboard _keyboardInterface;
|
||||
private readonly GraphicsDebugLevel _glLogLevel;
|
||||
private readonly Stopwatch _chrono;
|
||||
private readonly long _ticksPerFrame;
|
||||
private readonly CancellationTokenSource _gpuCancellationTokenSource;
|
||||
|
@ -71,8 +73,8 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
private string _gpuVendorName;
|
||||
|
||||
private AspectRatio _aspectRatio;
|
||||
private bool _enableMouse;
|
||||
private readonly AspectRatio _aspectRatio;
|
||||
private readonly bool _enableMouse;
|
||||
|
||||
public WindowBase(
|
||||
InputManager inputManager,
|
||||
|
@ -192,9 +194,6 @@ namespace Ryujinx.Headless.SDL2
|
|||
case SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE:
|
||||
Exit();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -260,7 +259,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
if (_ticks >= _ticksPerFrame)
|
||||
{
|
||||
string dockedMode = Device.System.State.DockedMode ? "Docked" : "Handheld";
|
||||
float scale = Graphics.Gpu.GraphicsConfig.ResScale;
|
||||
float scale = GraphicsConfig.ResScale;
|
||||
if (scale != 1)
|
||||
{
|
||||
dockedMode += $" ({scale}x)";
|
||||
|
@ -309,9 +308,9 @@ namespace Ryujinx.Headless.SDL2
|
|||
_exitEvent.Dispose();
|
||||
}
|
||||
|
||||
public void ProcessMainThreadQueue()
|
||||
public static void ProcessMainThreadQueue()
|
||||
{
|
||||
while (MainThreadActions.TryDequeue(out Action action))
|
||||
while (_mainThreadActions.TryDequeue(out Action action))
|
||||
{
|
||||
action();
|
||||
}
|
||||
|
@ -334,7 +333,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
_exitEvent.Set();
|
||||
}
|
||||
|
||||
private void NVStutterWorkaround()
|
||||
private void NvidiaStutterWorkaround()
|
||||
{
|
||||
while (_isActive)
|
||||
{
|
||||
|
@ -348,7 +347,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
// TODO: This should be removed when the issue with the GateThread is resolved.
|
||||
|
||||
ThreadPool.QueueUserWorkItem((state) => { });
|
||||
ThreadPool.QueueUserWorkItem(state => { });
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
}
|
||||
|
@ -396,20 +395,20 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
InitializeWindow();
|
||||
|
||||
Thread renderLoopThread = new Thread(Render)
|
||||
Thread renderLoopThread = new(Render)
|
||||
{
|
||||
Name = "GUI.RenderLoop"
|
||||
Name = "GUI.RenderLoop",
|
||||
};
|
||||
renderLoopThread.Start();
|
||||
|
||||
Thread nvStutterWorkaround = null;
|
||||
if (Renderer is Graphics.OpenGL.OpenGLRenderer)
|
||||
Thread nvidiaStutterWorkaround = null;
|
||||
if (Renderer is OpenGLRenderer)
|
||||
{
|
||||
nvStutterWorkaround = new Thread(NVStutterWorkaround)
|
||||
nvidiaStutterWorkaround = new Thread(NvidiaStutterWorkaround)
|
||||
{
|
||||
Name = "GUI.NVStutterWorkaround"
|
||||
Name = "GUI.NvidiaStutterWorkaround",
|
||||
};
|
||||
nvStutterWorkaround.Start();
|
||||
nvidiaStutterWorkaround.Start();
|
||||
}
|
||||
|
||||
MainLoop();
|
||||
|
@ -418,7 +417,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
// We only need to wait for all commands submitted during the main gpu loop to be processed.
|
||||
_gpuDoneEvent.WaitOne();
|
||||
_gpuDoneEvent.Dispose();
|
||||
nvStutterWorkaround?.Join();
|
||||
nvidiaStutterWorkaround?.Join();
|
||||
|
||||
Exit();
|
||||
}
|
||||
|
@ -465,13 +464,13 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
public bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText)
|
||||
{
|
||||
SDL_MessageBoxData data = new SDL_MessageBoxData
|
||||
SDL_MessageBoxData data = new()
|
||||
{
|
||||
title = title,
|
||||
message = message,
|
||||
buttons = new SDL_MessageBoxButtonData[buttonsText.Length],
|
||||
numbuttons = buttonsText.Length,
|
||||
window = WindowHandle
|
||||
window = WindowHandle,
|
||||
};
|
||||
|
||||
for (int i = 0; i < buttonsText.Length; i++)
|
||||
|
@ -479,7 +478,7 @@ namespace Ryujinx.Headless.SDL2
|
|||
data.buttons[i] = new SDL_MessageBoxButtonData
|
||||
{
|
||||
buttonid = i,
|
||||
text = buttonsText[i]
|
||||
text = buttonsText[i],
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -509,4 +508,4 @@ namespace Ryujinx.Headless.SDL2
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue