diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-07-02 00:25:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-02 00:25:07 +0200 |
commit | 0684b00b3c4d000cf627b9c08a49d7469ae50d04 (patch) | |
tree | bfa0ae9c17c99694cff51871b864cfc41e1cd057 /src/Ryujinx/Program.cs | |
parent | 02b5c7ea89bb6aae1c214b78fb1047872382dc43 (diff) |
[Ryujinx] Address dotnet-format issues (#5395)1.1.948
* 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 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 CA1822 warnings
* Make dotnet format succeed in style mode
* Address dotnet format CA2208 warnings properly
* 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
* Format if-blocks correctly
* Another rebase, another dotnet format run
* Run dotnet format whitespace after rebase
* Run dotnet format after rebase and remove unused usings
- analyzers
- style
- whitespace
* Add comments to disabled warnings
* 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
* Fix build issues
* Apply suggestions from code review
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Second dotnet format pass
* Update src/Ryujinx/Modules/Updater/Updater.cs
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Add trailing commas and improve formatting
* Fix formatting and naming issues
* Rename nvStutterWorkaround to nvidiaStutterWorkaround
* Use using declarations and extend resource lifetimes
* Fix GTK issues
* Add formatting for generated files
* Add trailing commas
---------
Co-authored-by: Ac_K <Acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx/Program.cs')
-rw-r--r-- | src/Ryujinx/Program.cs | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index 96024548..50151d73 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -43,10 +43,7 @@ namespace Ryujinx [LibraryImport("libc", SetLastError = true)] private static partial int setenv([MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string value, int overwrite); - [LibraryImport("libc")] - private static partial IntPtr getenv([MarshalAs(UnmanagedType.LPStr)] string name); - - private const uint MB_ICONWARNING = 0x30; + private const uint MbIconWarning = 0x30; static Program() { @@ -78,16 +75,16 @@ namespace Ryujinx if (OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(10, 0, 17134)) { - MessageBoxA(IntPtr.Zero, "You are running an outdated version of Windows.\n\nStarting on June 1st 2022, Ryujinx will only support Windows 10 1803 and newer.\n", $"Ryujinx {Version}", MB_ICONWARNING); + MessageBoxA(IntPtr.Zero, "You are running an outdated version of Windows.\n\nStarting on June 1st 2022, Ryujinx will only support Windows 10 1803 and newer.\n", $"Ryujinx {Version}", MbIconWarning); } // Parse arguments CommandLineState.ParseArguments(args); // Hook unhandled exception and process exit events. - GLib.ExceptionManager.UnhandledException += (GLib.UnhandledExceptionArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating); + GLib.ExceptionManager.UnhandledException += (GLib.UnhandledExceptionArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating); AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating); - AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => Exit(); + AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => Exit(); // Make process DPI aware for proper window sizing on high-res screens. ForceDpiAware.Windows(); @@ -102,7 +99,11 @@ namespace Ryujinx // This ends up causing race condition and abort of XCB when a context is created by SPB (even if SPB do call XInitThreads). if (OperatingSystem.IsLinux()) { - XInitThreads(); + if (XInitThreads() == 0) + { + throw new NotSupportedException("Failed to initialize multi-threading support."); + } + Environment.SetEnvironmentVariable("GDK_BACKEND", "x11"); setenv("GDK_BACKEND", "x11", 1); } @@ -121,7 +122,7 @@ namespace Ryujinx resourcesDataDir = baseDirectory; } - void SetEnvironmentVariableNoCaching(string key, string value) + static void SetEnvironmentVariableNoCaching(string key, string value) { int res = setenv(key, value, 1); Debug.Assert(res != -1); @@ -163,11 +164,11 @@ namespace Ryujinx // Sets ImageSharp Jpeg Encoder Quality. SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.SetEncoder(JpegFormat.Instance, new JpegEncoder() { - Quality = 100 + Quality = 100, }); - string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"); - string appDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, "Config.json"); + string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"); + string appDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, "Config.json"); // Now load the configuration as the other subsystems are now registered ConfigurationPath = File.Exists(localConfigurationPath) @@ -232,7 +233,7 @@ namespace Ryujinx "never" => HideCursorMode.Never, "onidle" => HideCursorMode.OnIdle, "always" => HideCursorMode.Always, - _ => ConfigurationState.Instance.HideCursor.Value + _ => ConfigurationState.Instance.HideCursor.Value, }; } @@ -261,7 +262,7 @@ namespace Ryujinx } // Show the main window UI. - MainWindow mainWindow = new MainWindow(); + MainWindow mainWindow = new(); mainWindow.Show(); if (OperatingSystem.IsLinux()) @@ -278,7 +279,7 @@ namespace Ryujinx { { 0, "Yes, until the next restart" }, { 1, "Yes, permanently" }, - { 2, "No" } + { 2, "No" }, }; ResponseType response = GtkDialog.CreateCustomDialog( @@ -347,7 +348,7 @@ namespace Ryujinx var buttonTexts = new Dictionary<int, string>() { { 0, "Yes (Vulkan)" }, - { 1, "No (OpenGL)" } + { 1, "No (OpenGL)" }, }; ResponseType response = GtkDialog.CreateCustomDialog( @@ -416,4 +417,4 @@ namespace Ryujinx Logger.Shutdown(); } } -}
\ No newline at end of file +} |