From 6e28a4dd13df0ab866e6a178086abe36ca4a2b25 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Thu, 29 Jun 2023 02:39:22 +0200 Subject: [PATCH] [Ryujinx.Ui.Common] Address dotnet-format issues (#5392) * dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Silence dotnet format IDE0060 warnings * Address dotnet format CA1401 warnings * dotnet-format fixes after rebase * 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 * Another rebase, another dotnet format run * Run dotnet format style after rebase * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Small optimizations * Remove alignment * Apply formatting * Fix build issues * Final pass for dotnet format * Add trailing commas Co-authored-by: Ac_K * Add trailing commas --------- Co-authored-by: Ac_K --- src/Ryujinx.Ava/AppHost.cs | 3 +- .../Controls/ApplicationContextMenu.axaml.cs | 2 +- src/Ryujinx.Ava/UI/Models/SaveModel.cs | 3 +- src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs | 24 +- .../App/ApplicationAddedEventArgs.cs | 2 +- .../App/ApplicationCountUpdatedEventArgs.cs | 4 +- src/Ryujinx.Ui.Common/App/ApplicationData.cs | 28 +- .../App/ApplicationJsonSerializerContext.cs | 2 +- .../App/ApplicationLibrary.cs | 68 +- .../App/ApplicationMetadata.cs | 4 +- .../Configuration/AudioBackend.cs | 4 +- .../Configuration/ConfigurationFileFormat.cs | 2 +- .../ConfigurationFileFormatSettings.cs | 2 +- .../ConfigurationJsonSerializerContext.cs | 2 +- .../Configuration/ConfigurationLoadResult.cs | 4 +- .../Configuration/ConfigurationState.cs | 968 +++++++++--------- .../Configuration/LoggerModule.cs | 18 +- .../Configuration/System/Language.cs | 2 +- .../Configuration/System/Region.cs | 2 +- .../Configuration/Ui/ColumnSort.cs | 4 +- .../Configuration/Ui/GuiColumns.cs | 16 +- .../Configuration/Ui/ShownFileTypes.cs | 10 +- .../DiscordIntegrationModule.cs | 46 +- .../Extensions/FileTypeExtensions.cs | 2 +- .../Helper/CommandLineState.cs | 14 +- src/Ryujinx.Ui.Common/Helper/ConsoleHelper.cs | 2 +- .../Helper/FileAssociationHelper.cs | 4 +- src/Ryujinx.Ui.Common/Helper/LinuxHelper.cs | 6 +- src/Ryujinx.Ui.Common/Helper/ObjectiveC.cs | 97 +- src/Ryujinx.Ui.Common/Helper/OpenHelper.cs | 36 +- .../Helper/SetupValidator.cs | 16 +- .../Models/Amiibo/AmiiboApi.cs | 22 +- .../Models/Amiibo/AmiiboApiGamesSwitch.cs | 2 +- .../Models/Amiibo/AmiiboApiUsage.cs | 2 +- .../Models/Amiibo/AmiiboJson.cs | 2 +- .../Amiibo/AmiiboJsonSerializerContext.cs | 2 +- .../Github/GithubReleaseAssetJsonResponse.cs | 2 +- .../Github/GithubReleasesJsonResponse.cs | 2 +- .../GithubReleasesJsonSerializerContext.cs | 2 +- src/Ryujinx.Ui.Common/UserError.cs | 4 +- src/Ryujinx/Ui/MainWindow.cs | 20 +- 41 files changed, 761 insertions(+), 696 deletions(-) diff --git a/src/Ryujinx.Ava/AppHost.cs b/src/Ryujinx.Ava/AppHost.cs index a25713796..c2b1064be 100644 --- a/src/Ryujinx.Ava/AppHost.cs +++ b/src/Ryujinx.Ava/AppHost.cs @@ -32,6 +32,7 @@ using Ryujinx.HLE.HOS.Services.Account.Acc; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.Input; using Ryujinx.Input.HLE; +using Ryujinx.Ui.App.Common; using Ryujinx.Ui.Common; using Ryujinx.Ui.Common.Configuration; using Ryujinx.Ui.Common.Helper; @@ -692,7 +693,7 @@ namespace Ryujinx.Ava DiscordIntegrationModule.SwitchToPlayingState(Device.Processes.ActiveApplication.ProgramIdText, Device.Processes.ActiveApplication.Name); - _viewModel.ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata => + ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText, appMetadata => { appMetadata.LastPlayed = DateTime.UtcNow; }); diff --git a/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs b/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs index fba24d68b..b01c7c5e3 100644 --- a/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs +++ b/src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs @@ -42,7 +42,7 @@ namespace Ryujinx.Ava.UI.Controls { viewModel.SelectedApplication.Favorite = !viewModel.SelectedApplication.Favorite; - viewModel.ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.TitleId, appMetadata => + ApplicationLibrary.LoadAndSaveMetaData(viewModel.SelectedApplication.TitleId, appMetadata => { appMetadata.Favorite = viewModel.SelectedApplication.Favorite; }); diff --git a/src/Ryujinx.Ava/UI/Models/SaveModel.cs b/src/Ryujinx.Ava/UI/Models/SaveModel.cs index e8486459b..cc9b67681 100644 --- a/src/Ryujinx.Ava/UI/Models/SaveModel.cs +++ b/src/Ryujinx.Ava/UI/Models/SaveModel.cs @@ -3,6 +3,7 @@ using LibHac.Ncm; using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Ava.UI.Windows; using Ryujinx.HLE.FileSystem; +using Ryujinx.Ui.App.Common; using System; using System.IO; using System.Linq; @@ -74,7 +75,7 @@ namespace Ryujinx.Ava.UI.Models } else { - var appMetadata = MainWindow.MainWindowViewModel.ApplicationLibrary.LoadAndSaveMetaData(TitleIdString); + var appMetadata = ApplicationLibrary.LoadAndSaveMetaData(TitleIdString); Title = appMetadata.Title ?? TitleIdString; } diff --git a/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs b/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs index 3b2c32e3f..c5dd9332c 100644 --- a/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs +++ b/src/Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs @@ -239,28 +239,28 @@ namespace Ryujinx.Ava.UI.Renderer IPlatformHandle CreateMacOS() { // Create a new CAMetalLayer. - IntPtr layerClass = ObjectiveC.objc_getClass("CAMetalLayer"); - IntPtr metalLayer = ObjectiveC.IntPtr_objc_msgSend(layerClass, "alloc"); - ObjectiveC.objc_msgSend(metalLayer, "init"); + ObjectiveC.Object layerObject = new("CAMetalLayer"); + ObjectiveC.Object metalLayer = layerObject.GetFromMessage("alloc"); + metalLayer.SendMessage("init"); // Create a child NSView to render into. - IntPtr nsViewClass = ObjectiveC.objc_getClass("NSView"); - IntPtr child = ObjectiveC.IntPtr_objc_msgSend(nsViewClass, "alloc"); - ObjectiveC.objc_msgSend(child, "init", new ObjectiveC.NSRect(0, 0, 0, 0)); + ObjectiveC.Object nsViewObject = new("NSView"); + ObjectiveC.Object child = nsViewObject.GetFromMessage("alloc"); + child.SendMessage("init", new ObjectiveC.NSRect(0, 0, 0, 0)); // Make its renderer our metal layer. - ObjectiveC.objc_msgSend(child, "setWantsLayer:", 1); - ObjectiveC.objc_msgSend(child, "setLayer:", metalLayer); - ObjectiveC.objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor); + child.SendMessage("setWantsLayer:", 1); + child.SendMessage("setLayer:", metalLayer); + metalLayer.SendMessage("setContentsScale:", Program.DesktopScaleFactor); // Ensure the scale factor is up to date. _updateBoundsCallback = rect => { - ObjectiveC.objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor); + metalLayer.SendMessage("setContentsScale:", Program.DesktopScaleFactor); }; - IntPtr nsView = child; - MetalLayer = metalLayer; + IntPtr nsView = child.ObjPtr; + MetalLayer = metalLayer.ObjPtr; NsView = nsView; return new PlatformHandle(nsView, "NSView"); diff --git a/src/Ryujinx.Ui.Common/App/ApplicationAddedEventArgs.cs b/src/Ryujinx.Ui.Common/App/ApplicationAddedEventArgs.cs index 6ae7409af..78eed7afd 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationAddedEventArgs.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationAddedEventArgs.cs @@ -6,4 +6,4 @@ namespace Ryujinx.Ui.App.Common { public ApplicationData AppData { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/App/ApplicationCountUpdatedEventArgs.cs b/src/Ryujinx.Ui.Common/App/ApplicationCountUpdatedEventArgs.cs index 981a82d53..6a8e465e0 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationCountUpdatedEventArgs.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationCountUpdatedEventArgs.cs @@ -4,7 +4,7 @@ namespace Ryujinx.Ui.App.Common { public class ApplicationCountUpdatedEventArgs : EventArgs { - public int NumAppsFound { get; set; } + public int NumAppsFound { get; set; } public int NumAppsLoaded { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/App/ApplicationData.cs b/src/Ryujinx.Ui.Common/App/ApplicationData.cs index 1081fcf32..e6130bdac 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationData.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationData.cs @@ -18,19 +18,19 @@ namespace Ryujinx.Ui.App.Common { public class ApplicationData { - public bool Favorite { get; set; } - public byte[] Icon { get; set; } - public string TitleName { get; set; } - public string TitleId { get; set; } - public string Developer { get; set; } - public string Version { get; set; } - public string TimePlayed { get; set; } - public double TimePlayedNum { get; set; } - public DateTime? LastPlayed { get; set; } - public string FileExtension { get; set; } - public string FileSize { get; set; } - public double FileSizeBytes { get; set; } - public string Path { get; set; } + public bool Favorite { get; set; } + public byte[] Icon { get; set; } + public string TitleName { get; set; } + public string TitleId { get; set; } + public string Developer { get; set; } + public string Version { get; set; } + public string TimePlayed { get; set; } + public double TimePlayedNum { get; set; } + public DateTime? LastPlayed { get; set; } + public string FileExtension { get; set; } + public string FileSize { get; set; } + public double FileSizeBytes { get; set; } + public string Path { get; set; } public BlitStruct ControlHolder { get; set; } [JsonIgnore] @@ -159,7 +159,7 @@ namespace Ryujinx.Ui.App.Common codeFs.OpenFile(ref nsoFile.Ref, $"/{MainExeFs}".ToU8Span(), OpenMode.Read).ThrowIfFailure(); - NsoReader reader = new NsoReader(); + NsoReader reader = new(); reader.Initialize(nsoFile.Release().AsStorage().AsFile(OpenMode.Read)).ThrowIfFailure(); return BitConverter.ToString(reader.Header.ModuleId.ItemsRo.ToArray()).Replace("-", "").ToUpper()[..16]; diff --git a/src/Ryujinx.Ui.Common/App/ApplicationJsonSerializerContext.cs b/src/Ryujinx.Ui.Common/App/ApplicationJsonSerializerContext.cs index f81121c28..76eea33ca 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationJsonSerializerContext.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationJsonSerializerContext.cs @@ -7,4 +7,4 @@ namespace Ryujinx.Ui.App.Common internal partial class ApplicationJsonSerializerContext : JsonSerializerContext { } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs b/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs index 28280bd9f..33e6c4aad 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs @@ -26,12 +26,13 @@ using System.Text; using System.Text.Json; using System.Threading; using Path = System.IO.Path; +using TimeSpan = System.TimeSpan; namespace Ryujinx.Ui.App.Common { public class ApplicationLibrary { - public event EventHandler ApplicationAdded; + public event EventHandler ApplicationAdded; public event EventHandler ApplicationCountUpdated; private readonly byte[] _nspIcon; @@ -41,11 +42,11 @@ namespace Ryujinx.Ui.App.Common private readonly byte[] _nsoIcon; private readonly VirtualFileSystem _virtualFileSystem; - private Language _desiredTitleLanguage; - private CancellationTokenSource _cancellationToken; + private Language _desiredTitleLanguage; + private CancellationTokenSource _cancellationToken; - private static readonly ApplicationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions()); - private static readonly TitleUpdateMetadataJsonSerializerContext TitleSerializerContext = new(JsonHelper.GetDefaultSerializerOptions()); + private static readonly ApplicationJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions()); + private static readonly TitleUpdateMetadataJsonSerializerContext _titleSerializerContext = new(JsonHelper.GetDefaultSerializerOptions()); public ApplicationLibrary(VirtualFileSystem virtualFileSystem) { @@ -60,7 +61,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.Read(resourceByteArray); @@ -83,7 +84,7 @@ namespace Ryujinx.Ui.App.Common public void LoadApplications(List appDirs, Language desiredTitleLanguage) { - int numApplicationsFound = 0; + int numApplicationsFound = 0; int numApplicationsLoaded = 0; _desiredTitleLanguage = desiredTitleLanguage; @@ -114,14 +115,14 @@ namespace Ryujinx.Ui.App.Common IEnumerable files = Directory.EnumerateFiles(appDir, "*", SearchOption.AllDirectories).Where(file => { return - (Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value) || + (Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value) || (Path.GetExtension(file).ToLower() is ".pfs0" && ConfigurationState.Instance.Ui.ShownFileTypes.PFS0.Value) || - (Path.GetExtension(file).ToLower() is ".xci" && ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value) || - (Path.GetExtension(file).ToLower() is ".nca" && ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value) || - (Path.GetExtension(file).ToLower() is ".nro" && ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value) || - (Path.GetExtension(file).ToLower() is ".nso" && ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value); + (Path.GetExtension(file).ToLower() is ".xci" && ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value) || + (Path.GetExtension(file).ToLower() is ".nca" && ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value) || + (Path.GetExtension(file).ToLower() is ".nro" && ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value) || + (Path.GetExtension(file).ToLower() is ".nso" && ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value); }); - + foreach (string app in files) { if (_cancellationToken.Token.IsCancellationRequested) @@ -459,27 +460,27 @@ namespace Ryujinx.Ui.App.Common FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + " MiB" : fileSize.ToString("0.##") + " GiB", FileSizeBytes = fileSize, Path = applicationPath, - ControlHolder = controlHolder + ControlHolder = controlHolder, }; numApplicationsLoaded++; - OnApplicationAdded(new ApplicationAddedEventArgs() + OnApplicationAdded(new ApplicationAddedEventArgs { - AppData = data + AppData = data, }); - OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs() + OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs { NumAppsFound = numApplicationsFound, - NumAppsLoaded = numApplicationsLoaded + NumAppsLoaded = numApplicationsLoaded, }); } - OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs() + OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs { NumAppsFound = numApplicationsFound, - NumAppsLoaded = numApplicationsLoaded + NumAppsLoaded = numApplicationsLoaded, }); } finally @@ -505,13 +506,13 @@ namespace Ryujinx.Ui.App.Common // Return the ControlFS controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None); - titleId = controlNca?.Header.TitleId.ToString("x16"); + titleId = controlNca?.Header.TitleId.ToString("x16"); } - public ApplicationMetadata LoadAndSaveMetaData(string titleId, Action modifyFunction = null) + public static ApplicationMetadata LoadAndSaveMetaData(string titleId, Action modifyFunction = null) { string metadataFolder = Path.Combine(AppDataManager.GamesDirPath, titleId, "gui"); - string metadataFile = Path.Combine(metadataFolder, "metadata.json"); + string metadataFile = Path.Combine(metadataFolder, "metadata.json"); ApplicationMetadata appMetadata; @@ -521,12 +522,12 @@ namespace Ryujinx.Ui.App.Common appMetadata = new ApplicationMetadata(); - JsonHelper.SerializeToFile(metadataFile, appMetadata, SerializerContext.ApplicationMetadata); + JsonHelper.SerializeToFile(metadataFile, appMetadata, _serializerContext.ApplicationMetadata); } try { - appMetadata = JsonHelper.DeserializeFromFile(metadataFile, SerializerContext.ApplicationMetadata); + appMetadata = JsonHelper.DeserializeFromFile(metadataFile, _serializerContext.ApplicationMetadata); } catch (JsonException) { @@ -539,7 +540,7 @@ namespace Ryujinx.Ui.App.Common { modifyFunction(appMetadata); - JsonHelper.SerializeToFile(metadataFile, appMetadata, SerializerContext.ApplicationMetadata); + JsonHelper.SerializeToFile(metadataFile, appMetadata, _serializerContext.ApplicationMetadata); } return appMetadata; @@ -703,7 +704,7 @@ namespace Ryujinx.Ui.App.Common } } } - catch(Exception) + catch (Exception) { Logger.Warning?.Print(LogClass.Application, $"Could not retrieve a valid icon for the app. Default icon will be used. Errored File: {applicationPath}"); } @@ -713,7 +714,7 @@ namespace Ryujinx.Ui.App.Common private static string ConvertSecondsToFormattedString(double seconds) { - System.TimeSpan time = System.TimeSpan.FromSeconds(seconds); + TimeSpan time = TimeSpan.FromSeconds(seconds); string timeString; if (time.Days != 0) @@ -840,7 +841,7 @@ namespace Ryujinx.Ui.App.Common pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); - Nca nca = new Nca(fileSystem.KeySet, ncaFile.Release().AsStorage()); + Nca nca = new(fileSystem.KeySet, ncaFile.Release().AsStorage()); int ncaProgramIndex = (int)(nca.Header.TitleId & 0xF); @@ -884,7 +885,7 @@ namespace Ryujinx.Ui.App.Common pfs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); - Nca nca = new Nca(fileSystem.KeySet, ncaFile.Release().AsStorage()); + Nca nca = new(fileSystem.KeySet, ncaFile.Release().AsStorage()); int ncaProgramIndex = (int)(nca.Header.TitleId & 0xF); @@ -925,12 +926,12 @@ namespace Ryujinx.Ui.App.Common if (File.Exists(titleUpdateMetadataPath)) { - updatePath = JsonHelper.DeserializeFromFile(titleUpdateMetadataPath, TitleSerializerContext.TitleUpdateMetadata).Selected; + updatePath = JsonHelper.DeserializeFromFile(titleUpdateMetadataPath, _titleSerializerContext.TitleUpdateMetadata).Selected; if (File.Exists(updatePath)) { - FileStream file = new FileStream(updatePath, FileMode.Open, FileAccess.Read); - PartitionFileSystem nsp = new PartitionFileSystem(file.AsStorage()); + FileStream file = new(updatePath, FileMode.Open, FileAccess.Read); + PartitionFileSystem nsp = new(file.AsStorage()); return GetGameUpdateDataFromPartition(fileSystem, nsp, titleIdBase.ToString("x16"), programIndex); } @@ -941,4 +942,3 @@ namespace Ryujinx.Ui.App.Common } } } - diff --git a/src/Ryujinx.Ui.Common/App/ApplicationMetadata.cs b/src/Ryujinx.Ui.Common/App/ApplicationMetadata.cs index 0abd4680d..01b857a62 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationMetadata.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationMetadata.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Ui.App.Common public class ApplicationMetadata { public string Title { get; set; } - public bool Favorite { get; set; } + public bool Favorite { get; set; } public double TimePlayed { get; set; } [JsonPropertyName("last_played_utc")] @@ -16,4 +16,4 @@ namespace Ryujinx.Ui.App.Common [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string LastPlayedOld { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/AudioBackend.cs b/src/Ryujinx.Ui.Common/Configuration/AudioBackend.cs index 1f9bd0baf..1147a0a6b 100644 --- a/src/Ryujinx.Ui.Common/Configuration/AudioBackend.cs +++ b/src/Ryujinx.Ui.Common/Configuration/AudioBackend.cs @@ -9,6 +9,6 @@ namespace Ryujinx.Ui.Common.Configuration Dummy, OpenAl, SoundIo, - SDL2 + SDL2, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs index f0489915d..434894328 100644 --- a/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs +++ b/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs @@ -395,4 +395,4 @@ namespace Ryujinx.Ui.Common.Configuration JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormatSettings.cs b/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormatSettings.cs index 6ce2ef01a..a1727df51 100644 --- a/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormatSettings.cs +++ b/src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormatSettings.cs @@ -6,4 +6,4 @@ namespace Ryujinx.Ui.Common.Configuration { public static readonly ConfigurationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions()); } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/ConfigurationJsonSerializerContext.cs b/src/Ryujinx.Ui.Common/Configuration/ConfigurationJsonSerializerContext.cs index bb8dfb499..2aa7e5366 100644 --- a/src/Ryujinx.Ui.Common/Configuration/ConfigurationJsonSerializerContext.cs +++ b/src/Ryujinx.Ui.Common/Configuration/ConfigurationJsonSerializerContext.cs @@ -7,4 +7,4 @@ namespace Ryujinx.Ui.Common.Configuration internal partial class ConfigurationJsonSerializerContext : JsonSerializerContext { } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/ConfigurationLoadResult.cs b/src/Ryujinx.Ui.Common/Configuration/ConfigurationLoadResult.cs index 6b08baa65..71366ba7c 100644 --- a/src/Ryujinx.Ui.Common/Configuration/ConfigurationLoadResult.cs +++ b/src/Ryujinx.Ui.Common/Configuration/ConfigurationLoadResult.cs @@ -4,6 +4,6 @@ namespace Ryujinx.Ui.Common.Configuration { Success = 0, NotLoaded = 1, - MigratedFromPreVulkan = 1 << 8 + MigratedFromPreVulkan = 1 << 8, } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs index 146a9b500..7ab20e329 100644 --- a/src/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs @@ -22,40 +22,40 @@ namespace Ryujinx.Ui.Common.Configuration { public class Columns { - public ReactiveObject FavColumn { get; private set; } - public ReactiveObject IconColumn { get; private set; } - public ReactiveObject AppColumn { get; private set; } - public ReactiveObject DevColumn { get; private set; } - public ReactiveObject VersionColumn { get; private set; } + public ReactiveObject FavColumn { get; private set; } + public ReactiveObject IconColumn { get; private set; } + public ReactiveObject AppColumn { get; private set; } + public ReactiveObject DevColumn { get; private set; } + public ReactiveObject VersionColumn { get; private set; } public ReactiveObject TimePlayedColumn { get; private set; } public ReactiveObject LastPlayedColumn { get; private set; } - public ReactiveObject FileExtColumn { get; private set; } - public ReactiveObject FileSizeColumn { get; private set; } - public ReactiveObject PathColumn { get; private set; } + public ReactiveObject FileExtColumn { get; private set; } + public ReactiveObject FileSizeColumn { get; private set; } + public ReactiveObject PathColumn { get; private set; } public Columns() { - FavColumn = new ReactiveObject(); - IconColumn = new ReactiveObject(); - AppColumn = new ReactiveObject(); - DevColumn = new ReactiveObject(); - VersionColumn = new ReactiveObject(); + FavColumn = new ReactiveObject(); + IconColumn = new ReactiveObject(); + AppColumn = new ReactiveObject(); + DevColumn = new ReactiveObject(); + VersionColumn = new ReactiveObject(); TimePlayedColumn = new ReactiveObject(); LastPlayedColumn = new ReactiveObject(); - FileExtColumn = new ReactiveObject(); - FileSizeColumn = new ReactiveObject(); - PathColumn = new ReactiveObject(); + FileExtColumn = new ReactiveObject(); + FileSizeColumn = new ReactiveObject(); + PathColumn = new ReactiveObject(); } } public class ColumnSortSettings { - public ReactiveObject SortColumnId { get; private set; } + public ReactiveObject SortColumnId { get; private set; } public ReactiveObject SortAscending { get; private set; } public ColumnSortSettings() { - SortColumnId = new ReactiveObject(); + SortColumnId = new ReactiveObject(); SortAscending = new ReactiveObject(); } } @@ -74,12 +74,12 @@ namespace Ryujinx.Ui.Common.Configuration public ShownFileTypeSettings() { - NSP = new ReactiveObject(); + NSP = new ReactiveObject(); PFS0 = new ReactiveObject(); - XCI = new ReactiveObject(); - NCA = new ReactiveObject(); - NRO = new ReactiveObject(); - NSO = new ReactiveObject(); + XCI = new ReactiveObject(); + NCA = new ReactiveObject(); + NRO = new ReactiveObject(); + NSO = new ReactiveObject(); } } @@ -186,22 +186,22 @@ namespace Ryujinx.Ui.Common.Configuration public UiSection() { - GuiColumns = new Columns(); - ColumnSort = new ColumnSortSettings(); - GameDirs = new ReactiveObject>(); - ShownFileTypes = new ShownFileTypeSettings(); - WindowStartup = new WindowStartupSettings(); + GuiColumns = new Columns(); + ColumnSort = new ColumnSortSettings(); + GameDirs = new ReactiveObject>(); + ShownFileTypes = new ShownFileTypeSettings(); + WindowStartup = new WindowStartupSettings(); EnableCustomTheme = new ReactiveObject(); - CustomThemePath = new ReactiveObject(); - BaseStyle = new ReactiveObject(); - StartFullscreen = new ReactiveObject(); - GameListViewMode = new ReactiveObject(); - ShowNames = new ReactiveObject(); - GridSize = new ReactiveObject(); - ApplicationSort = new ReactiveObject(); - IsAscendingOrder = new ReactiveObject(); - LanguageCode = new ReactiveObject(); - ShowConsole = new ReactiveObject(); + CustomThemePath = new ReactiveObject(); + BaseStyle = new ReactiveObject(); + StartFullscreen = new ReactiveObject(); + GameListViewMode = new ReactiveObject(); + ShowNames = new ReactiveObject(); + GridSize = new ReactiveObject(); + ApplicationSort = new ReactiveObject(); + IsAscendingOrder = new ReactiveObject(); + LanguageCode = new ReactiveObject(); + ShowConsole = new ReactiveObject(); ShowConsole.Event += static (s, e) => { ConsoleHelper.SetConsoleWindowState(e.NewValue); }; } } @@ -268,18 +268,18 @@ namespace Ryujinx.Ui.Common.Configuration public LoggerSection() { - EnableDebug = new ReactiveObject(); - EnableStub = new ReactiveObject(); - EnableInfo = new ReactiveObject(); - EnableWarn = new ReactiveObject(); - EnableError = new ReactiveObject(); - EnableTrace = new ReactiveObject(); - EnableGuest = new ReactiveObject(); - EnableFsAccessLog = new ReactiveObject(); - FilteredClasses = new ReactiveObject(); - EnableFileLog = new ReactiveObject(); - EnableFileLog.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableFileLog)); - GraphicsDebugLevel = new ReactiveObject(); + EnableDebug = new ReactiveObject(); + EnableStub = new ReactiveObject(); + EnableInfo = new ReactiveObject(); + EnableWarn = new ReactiveObject(); + EnableError = new ReactiveObject(); + EnableTrace = new ReactiveObject(); + EnableGuest = new ReactiveObject(); + EnableFsAccessLog = new ReactiveObject(); + FilteredClasses = new ReactiveObject(); + EnableFileLog = new ReactiveObject(); + EnableFileLog.Event += static (sender, e) => LogValueChange(e, nameof(EnableFileLog)); + GraphicsDebugLevel = new ReactiveObject(); } } @@ -365,32 +365,32 @@ namespace Ryujinx.Ui.Common.Configuration public SystemSection() { - Language = new ReactiveObject(); - Region = new ReactiveObject(); - TimeZone = new ReactiveObject(); - SystemTimeOffset = new ReactiveObject(); - EnableDockedMode = new ReactiveObject(); - EnableDockedMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableDockedMode)); - EnablePtc = new ReactiveObject(); - EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc)); - EnableInternetAccess = new ReactiveObject(); - EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess)); - EnableFsIntegrityChecks = new ReactiveObject(); - EnableFsIntegrityChecks.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableFsIntegrityChecks)); - FsGlobalAccessLogMode = new ReactiveObject(); - FsGlobalAccessLogMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(FsGlobalAccessLogMode)); - AudioBackend = new ReactiveObject(); - AudioBackend.Event += static (sender, e) => LogValueChange(sender, e, nameof(AudioBackend)); - MemoryManagerMode = new ReactiveObject(); - MemoryManagerMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(MemoryManagerMode)); - ExpandRam = new ReactiveObject(); - ExpandRam.Event += static (sender, e) => LogValueChange(sender, e, nameof(ExpandRam)); - IgnoreMissingServices = new ReactiveObject(); - IgnoreMissingServices.Event += static (sender, e) => LogValueChange(sender, e, nameof(IgnoreMissingServices)); - AudioVolume = new ReactiveObject(); - AudioVolume.Event += static (sender, e) => LogValueChange(sender, e, nameof(AudioVolume)); - UseHypervisor = new ReactiveObject(); - UseHypervisor.Event += static (sender, e) => LogValueChange(sender, e, nameof(UseHypervisor)); + Language = new ReactiveObject(); + Region = new ReactiveObject(); + TimeZone = new ReactiveObject(); + SystemTimeOffset = new ReactiveObject(); + EnableDockedMode = new ReactiveObject(); + EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode)); + EnablePtc = new ReactiveObject(); + EnablePtc.Event += static (sender, e) => LogValueChange(e, nameof(EnablePtc)); + EnableInternetAccess = new ReactiveObject(); + EnableInternetAccess.Event += static (sender, e) => LogValueChange(e, nameof(EnableInternetAccess)); + EnableFsIntegrityChecks = new ReactiveObject(); + EnableFsIntegrityChecks.Event += static (sender, e) => LogValueChange(e, nameof(EnableFsIntegrityChecks)); + FsGlobalAccessLogMode = new ReactiveObject(); + FsGlobalAccessLogMode.Event += static (sender, e) => LogValueChange(e, nameof(FsGlobalAccessLogMode)); + AudioBackend = new ReactiveObject(); + AudioBackend.Event += static (sender, e) => LogValueChange(e, nameof(AudioBackend)); + MemoryManagerMode = new ReactiveObject(); + MemoryManagerMode.Event += static (sender, e) => LogValueChange(e, nameof(MemoryManagerMode)); + ExpandRam = new ReactiveObject(); + ExpandRam.Event += static (sender, e) => LogValueChange(e, nameof(ExpandRam)); + IgnoreMissingServices = new ReactiveObject(); + IgnoreMissingServices.Event += static (sender, e) => LogValueChange(e, nameof(IgnoreMissingServices)); + AudioVolume = new ReactiveObject(); + AudioVolume.Event += static (sender, e) => LogValueChange(e, nameof(AudioVolume)); + UseHypervisor = new ReactiveObject(); + UseHypervisor.Event += static (sender, e) => LogValueChange(e, nameof(UseHypervisor)); } } @@ -424,9 +424,9 @@ namespace Ryujinx.Ui.Common.Configuration public HidSection() { EnableKeyboard = new ReactiveObject(); - EnableMouse = new ReactiveObject(); - Hotkeys = new ReactiveObject(); - InputConfig = new ReactiveObject>(); + EnableMouse = new ReactiveObject(); + Hotkeys = new ReactiveObject(); + InputConfig = new ReactiveObject>(); } } @@ -512,35 +512,35 @@ namespace Ryujinx.Ui.Common.Configuration public GraphicsSection() { - BackendThreading = new ReactiveObject(); - BackendThreading.Event += static (sender, e) => LogValueChange(sender, e, nameof(BackendThreading)); - ResScale = new ReactiveObject(); - ResScale.Event += static (sender, e) => LogValueChange(sender, e, nameof(ResScale)); - ResScaleCustom = new ReactiveObject(); - ResScaleCustom.Event += static (sender, e) => LogValueChange(sender, e, nameof(ResScaleCustom)); - MaxAnisotropy = new ReactiveObject(); - MaxAnisotropy.Event += static (sender, e) => LogValueChange(sender, e, nameof(MaxAnisotropy)); - AspectRatio = new ReactiveObject(); - AspectRatio.Event += static (sender, e) => LogValueChange(sender, e, nameof(AspectRatio)); - ShadersDumpPath = new ReactiveObject(); - EnableVsync = new ReactiveObject(); - EnableVsync.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableVsync)); - EnableShaderCache = new ReactiveObject(); - EnableShaderCache.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableShaderCache)); - EnableTextureRecompression = new ReactiveObject(); - EnableTextureRecompression.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableTextureRecompression)); - GraphicsBackend = new ReactiveObject(); - GraphicsBackend.Event += static (sender, e) => LogValueChange(sender, e, nameof(GraphicsBackend)); - PreferredGpu = new ReactiveObject(); - PreferredGpu.Event += static (sender, e) => LogValueChange(sender, e, nameof(PreferredGpu)); - EnableMacroHLE = new ReactiveObject(); - EnableMacroHLE.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableMacroHLE)); - AntiAliasing = new ReactiveObject(); - AntiAliasing.Event += static (sender, e) => LogValueChange(sender, e, nameof(AntiAliasing)); - ScalingFilter = new ReactiveObject(); - ScalingFilter.Event += static (sender, e) => LogValueChange(sender, e, nameof(ScalingFilter)); - ScalingFilterLevel = new ReactiveObject(); - ScalingFilterLevel.Event += static (sender, e) => LogValueChange(sender, e, nameof(ScalingFilterLevel)); + BackendThreading = new ReactiveObject(); + BackendThreading.Event += static (sender, e) => LogValueChange(e, nameof(BackendThreading)); + ResScale = new ReactiveObject(); + ResScale.Event += static (sender, e) => LogValueChange(e, nameof(ResScale)); + ResScaleCustom = new ReactiveObject(); + ResScaleCustom.Event += static (sender, e) => LogValueChange(e, nameof(ResScaleCustom)); + MaxAnisotropy = new ReactiveObject(); + MaxAnisotropy.Event += static (sender, e) => LogValueChange(e, nameof(MaxAnisotropy)); + AspectRatio = new ReactiveObject(); + AspectRatio.Event += static (sender, e) => LogValueChange(e, nameof(AspectRatio)); + ShadersDumpPath = new ReactiveObject(); + EnableVsync = new ReactiveObject(); + EnableVsync.Event += static (sender, e) => LogValueChange(e, nameof(EnableVsync)); + EnableShaderCache = new ReactiveObject(); + EnableShaderCache.Event += static (sender, e) => LogValueChange(e, nameof(EnableShaderCache)); + EnableTextureRecompression = new ReactiveObject(); + EnableTextureRecompression.Event += static (sender, e) => LogValueChange(e, nameof(EnableTextureRecompression)); + GraphicsBackend = new ReactiveObject(); + GraphicsBackend.Event += static (sender, e) => LogValueChange(e, nameof(GraphicsBackend)); + PreferredGpu = new ReactiveObject(); + PreferredGpu.Event += static (sender, e) => LogValueChange(e, nameof(PreferredGpu)); + EnableMacroHLE = new ReactiveObject(); + EnableMacroHLE.Event += static (sender, e) => LogValueChange(e, nameof(EnableMacroHLE)); + AntiAliasing = new ReactiveObject(); + AntiAliasing.Event += static (sender, e) => LogValueChange(e, nameof(AntiAliasing)); + ScalingFilter = new ReactiveObject(); + ScalingFilter.Event += static (sender, e) => LogValueChange(e, nameof(ScalingFilter)); + ScalingFilterLevel = new ReactiveObject(); + ScalingFilterLevel.Event += static (sender, e) => LogValueChange(e, nameof(ScalingFilterLevel)); } } @@ -617,86 +617,86 @@ namespace Ryujinx.Ui.Common.Configuration private ConfigurationState() { - Ui = new UiSection(); - Logger = new LoggerSection(); - System = new SystemSection(); - Graphics = new GraphicsSection(); - Hid = new HidSection(); - Multiplayer = new MultiplayerSection(); + Ui = new UiSection(); + Logger = new LoggerSection(); + System = new SystemSection(); + Graphics = new GraphicsSection(); + Hid = new HidSection(); + Multiplayer = new MultiplayerSection(); EnableDiscordIntegration = new ReactiveObject(); - CheckUpdatesOnStart = new ReactiveObject(); - ShowConfirmExit = new ReactiveObject(); - HideCursor = new ReactiveObject(); + CheckUpdatesOnStart = new ReactiveObject(); + ShowConfirmExit = new ReactiveObject(); + HideCursor = new ReactiveObject(); } public ConfigurationFileFormat ToFileFormat() { - ConfigurationFileFormat configurationFile = new ConfigurationFileFormat + ConfigurationFileFormat configurationFile = new() { - Version = ConfigurationFileFormat.CurrentVersion, - BackendThreading = Graphics.BackendThreading, - EnableFileLog = Logger.EnableFileLog, - ResScale = Graphics.ResScale, - ResScaleCustom = Graphics.ResScaleCustom, - MaxAnisotropy = Graphics.MaxAnisotropy, - AspectRatio = Graphics.AspectRatio, - AntiAliasing = Graphics.AntiAliasing, - ScalingFilter = Graphics.ScalingFilter, - ScalingFilterLevel = Graphics.ScalingFilterLevel, - GraphicsShadersDumpPath = Graphics.ShadersDumpPath, - LoggingEnableDebug = Logger.EnableDebug, - LoggingEnableStub = Logger.EnableStub, - LoggingEnableInfo = Logger.EnableInfo, - LoggingEnableWarn = Logger.EnableWarn, - LoggingEnableError = Logger.EnableError, - LoggingEnableTrace = Logger.EnableTrace, - LoggingEnableGuest = Logger.EnableGuest, - LoggingEnableFsAccessLog = Logger.EnableFsAccessLog, - LoggingFilteredClasses = Logger.FilteredClasses, - LoggingGraphicsDebugLevel = Logger.GraphicsDebugLevel, - SystemLanguage = System.Language, - SystemRegion = System.Region, - SystemTimeZone = System.TimeZone, - SystemTimeOffset = System.SystemTimeOffset, - DockedMode = System.EnableDockedMode, - EnableDiscordIntegration = EnableDiscordIntegration, - CheckUpdatesOnStart = CheckUpdatesOnStart, - ShowConfirmExit = ShowConfirmExit, - HideCursor = HideCursor, - EnableVsync = Graphics.EnableVsync, - EnableShaderCache = Graphics.EnableShaderCache, + Version = ConfigurationFileFormat.CurrentVersion, + BackendThreading = Graphics.BackendThreading, + EnableFileLog = Logger.EnableFileLog, + ResScale = Graphics.ResScale, + ResScaleCustom = Graphics.ResScaleCustom, + MaxAnisotropy = Graphics.MaxAnisotropy, + AspectRatio = Graphics.AspectRatio, + AntiAliasing = Graphics.AntiAliasing, + ScalingFilter = Graphics.ScalingFilter, + ScalingFilterLevel = Graphics.ScalingFilterLevel, + GraphicsShadersDumpPath = Graphics.ShadersDumpPath, + LoggingEnableDebug = Logger.EnableDebug, + LoggingEnableStub = Logger.EnableStub, + LoggingEnableInfo = Logger.EnableInfo, + LoggingEnableWarn = Logger.EnableWarn, + LoggingEnableError = Logger.EnableError, + LoggingEnableTrace = Logger.EnableTrace, + LoggingEnableGuest = Logger.EnableGuest, + LoggingEnableFsAccessLog = Logger.EnableFsAccessLog, + LoggingFilteredClasses = Logger.FilteredClasses, + LoggingGraphicsDebugLevel = Logger.GraphicsDebugLevel, + SystemLanguage = System.Language, + SystemRegion = System.Region, + SystemTimeZone = System.TimeZone, + SystemTimeOffset = System.SystemTimeOffset, + DockedMode = System.EnableDockedMode, + EnableDiscordIntegration = EnableDiscordIntegration, + CheckUpdatesOnStart = CheckUpdatesOnStart, + ShowConfirmExit = ShowConfirmExit, + HideCursor = HideCursor, + EnableVsync = Graphics.EnableVsync, + EnableShaderCache = Graphics.EnableShaderCache, EnableTextureRecompression = Graphics.EnableTextureRecompression, - EnableMacroHLE = Graphics.EnableMacroHLE, - EnablePtc = System.EnablePtc, - EnableInternetAccess = System.EnableInternetAccess, - EnableFsIntegrityChecks = System.EnableFsIntegrityChecks, - FsGlobalAccessLogMode = System.FsGlobalAccessLogMode, - AudioBackend = System.AudioBackend, - AudioVolume = System.AudioVolume, - MemoryManagerMode = System.MemoryManagerMode, - ExpandRam = System.ExpandRam, - IgnoreMissingServices = System.IgnoreMissingServices, - UseHypervisor = System.UseHypervisor, - GuiColumns = new GuiColumns + EnableMacroHLE = Graphics.EnableMacroHLE, + EnablePtc = System.EnablePtc, + EnableInternetAccess = System.EnableInternetAccess, + EnableFsIntegrityChecks = System.EnableFsIntegrityChecks, + FsGlobalAccessLogMode = System.FsGlobalAccessLogMode, + AudioBackend = System.AudioBackend, + AudioVolume = System.AudioVolume, + MemoryManagerMode = System.MemoryManagerMode, + ExpandRam = System.ExpandRam, + IgnoreMissingServices = System.IgnoreMissingServices, + UseHypervisor = System.UseHypervisor, + GuiColumns = new GuiColumns { - FavColumn = Ui.GuiColumns.FavColumn, - IconColumn = Ui.GuiColumns.IconColumn, - AppColumn = Ui.GuiColumns.AppColumn, - DevColumn = Ui.GuiColumns.DevColumn, - VersionColumn = Ui.GuiColumns.VersionColumn, + FavColumn = Ui.GuiColumns.FavColumn, + IconColumn = Ui.GuiColumns.IconColumn, + AppColumn = Ui.GuiColumns.AppColumn, + DevColumn = Ui.GuiColumns.DevColumn, + VersionColumn = Ui.GuiColumns.VersionColumn, TimePlayedColumn = Ui.GuiColumns.TimePlayedColumn, LastPlayedColumn = Ui.GuiColumns.LastPlayedColumn, - FileExtColumn = Ui.GuiColumns.FileExtColumn, - FileSizeColumn = Ui.GuiColumns.FileSizeColumn, - PathColumn = Ui.GuiColumns.PathColumn + FileExtColumn = Ui.GuiColumns.FileExtColumn, + FileSizeColumn = Ui.GuiColumns.FileSizeColumn, + PathColumn = Ui.GuiColumns.PathColumn, }, - ColumnSort = new ColumnSort + ColumnSort = new ColumnSort { - SortColumnId = Ui.ColumnSort.SortColumnId, - SortAscending = Ui.ColumnSort.SortAscending + SortColumnId = Ui.ColumnSort.SortColumnId, + SortAscending = Ui.ColumnSort.SortAscending, }, - GameDirs = Ui.GameDirs, - ShownFileTypes = new ShownFileTypes + GameDirs = Ui.GameDirs, + ShownFileTypes = new ShownFileTypes { NSP = Ui.ShownFileTypes.NSP, PFS0 = Ui.ShownFileTypes.PFS0, @@ -705,7 +705,7 @@ namespace Ryujinx.Ui.Common.Configuration NRO = Ui.ShownFileTypes.NRO, NSO = Ui.ShownFileTypes.NSO, }, - WindowStartup = new WindowStartup + WindowStartup = new WindowStartup { WindowSizeWidth = Ui.WindowStartup.WindowSizeWidth, WindowSizeHeight = Ui.WindowStartup.WindowSizeHeight, @@ -713,26 +713,26 @@ namespace Ryujinx.Ui.Common.Configuration WindowPositionY = Ui.WindowStartup.WindowPositionY, WindowMaximized = Ui.WindowStartup.WindowMaximized, }, - LanguageCode = Ui.LanguageCode, - EnableCustomTheme = Ui.EnableCustomTheme, - CustomThemePath = Ui.CustomThemePath, - BaseStyle = Ui.BaseStyle, - GameListViewMode = Ui.GameListViewMode, - ShowNames = Ui.ShowNames, - GridSize = Ui.GridSize, - ApplicationSort = Ui.ApplicationSort, - IsAscendingOrder = Ui.IsAscendingOrder, - StartFullscreen = Ui.StartFullscreen, - ShowConsole = Ui.ShowConsole, - EnableKeyboard = Hid.EnableKeyboard, - EnableMouse = Hid.EnableMouse, - Hotkeys = Hid.Hotkeys, - KeyboardConfig = new List(), - ControllerConfig = new List(), - InputConfig = Hid.InputConfig, - GraphicsBackend = Graphics.GraphicsBackend, - PreferredGpu = Graphics.PreferredGpu, - MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId + LanguageCode = Ui.LanguageCode, + EnableCustomTheme = Ui.EnableCustomTheme, + CustomThemePath = Ui.CustomThemePath, + BaseStyle = Ui.BaseStyle, + GameListViewMode = Ui.GameListViewMode, + ShowNames = Ui.ShowNames, + GridSize = Ui.GridSize, + ApplicationSort = Ui.ApplicationSort, + IsAscendingOrder = Ui.IsAscendingOrder, + StartFullscreen = Ui.StartFullscreen, + ShowConsole = Ui.ShowConsole, + EnableKeyboard = Hid.EnableKeyboard, + EnableMouse = Hid.EnableMouse, + Hotkeys = Hid.Hotkeys, + KeyboardConfig = new List(), + ControllerConfig = new List(), + InputConfig = Hid.InputConfig, + GraphicsBackend = Graphics.GraphicsBackend, + PreferredGpu = Graphics.PreferredGpu, + MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId, }; return configurationFile; @@ -740,89 +740,89 @@ namespace Ryujinx.Ui.Common.Configuration public void LoadDefault() { - Logger.EnableFileLog.Value = true; - Graphics.BackendThreading.Value = BackendThreading.Auto; - Graphics.ResScale.Value = 1; - Graphics.ResScaleCustom.Value = 1.0f; - Graphics.MaxAnisotropy.Value = -1.0f; - Graphics.AspectRatio.Value = AspectRatio.Fixed16x9; - Graphics.GraphicsBackend.Value = OperatingSystem.IsMacOS() ? GraphicsBackend.Vulkan : GraphicsBackend.OpenGl; - Graphics.PreferredGpu.Value = ""; - Graphics.ShadersDumpPath.Value = ""; - Logger.EnableDebug.Value = false; - Logger.EnableStub.Value = true; - Logger.EnableInfo.Value = true; - Logger.EnableWarn.Value = true; - Logger.EnableError.Value = true; - Logger.EnableTrace.Value = false; - Logger.EnableGuest.Value = true; - Logger.EnableFsAccessLog.Value = false; - Logger.FilteredClasses.Value = Array.Empty(); - Logger.GraphicsDebugLevel.Value = GraphicsDebugLevel.None; - System.Language.Value = Language.AmericanEnglish; - System.Region.Value = Region.USA; - System.TimeZone.Value = "UTC"; - System.SystemTimeOffset.Value = 0; - System.EnableDockedMode.Value = true; - EnableDiscordIntegration.Value = true; - CheckUpdatesOnStart.Value = true; - ShowConfirmExit.Value = true; - HideCursor.Value = Ryujinx.Common.Configuration.HideCursorMode.Never; - Graphics.EnableVsync.Value = true; - Graphics.EnableShaderCache.Value = true; + Logger.EnableFileLog.Value = true; + Graphics.BackendThreading.Value = BackendThreading.Auto; + Graphics.ResScale.Value = 1; + Graphics.ResScaleCustom.Value = 1.0f; + Graphics.MaxAnisotropy.Value = -1.0f; + Graphics.AspectRatio.Value = AspectRatio.Fixed16x9; + Graphics.GraphicsBackend.Value = OperatingSystem.IsMacOS() ? GraphicsBackend.Vulkan : GraphicsBackend.OpenGl; + Graphics.PreferredGpu.Value = ""; + Graphics.ShadersDumpPath.Value = ""; + Logger.EnableDebug.Value = false; + Logger.EnableStub.Value = true; + Logger.EnableInfo.Value = true; + Logger.EnableWarn.Value = true; + Logger.EnableError.Value = true; + Logger.EnableTrace.Value = false; + Logger.EnableGuest.Value = true; + Logger.EnableFsAccessLog.Value = false; + Logger.FilteredClasses.Value = Array.Empty(); + Logger.GraphicsDebugLevel.Value = GraphicsDebugLevel.None; + System.Language.Value = Language.AmericanEnglish; + System.Region.Value = Region.USA; + System.TimeZone.Value = "UTC"; + System.SystemTimeOffset.Value = 0; + System.EnableDockedMode.Value = true; + EnableDiscordIntegration.Value = true; + CheckUpdatesOnStart.Value = true; + ShowConfirmExit.Value = true; + HideCursor.Value = HideCursorMode.Never; + Graphics.EnableVsync.Value = true; + Graphics.EnableShaderCache.Value = true; Graphics.EnableTextureRecompression.Value = false; - Graphics.EnableMacroHLE.Value = true; - Graphics.AntiAliasing.Value = AntiAliasing.None; - Graphics.ScalingFilter.Value = ScalingFilter.Bilinear; - Graphics.ScalingFilterLevel.Value = 80; - System.EnablePtc.Value = true; - System.EnableInternetAccess.Value = false; - System.EnableFsIntegrityChecks.Value = true; - System.FsGlobalAccessLogMode.Value = 0; - System.AudioBackend.Value = AudioBackend.SDL2; - System.AudioVolume.Value = 1; - System.MemoryManagerMode.Value = MemoryManagerMode.HostMappedUnsafe; - System.ExpandRam.Value = false; - System.IgnoreMissingServices.Value = false; - System.UseHypervisor.Value = true; - Multiplayer.LanInterfaceId.Value = "0"; - Ui.GuiColumns.FavColumn.Value = true; - Ui.GuiColumns.IconColumn.Value = true; - Ui.GuiColumns.AppColumn.Value = true; - Ui.GuiColumns.DevColumn.Value = true; - Ui.GuiColumns.VersionColumn.Value = true; - Ui.GuiColumns.TimePlayedColumn.Value = true; - Ui.GuiColumns.LastPlayedColumn.Value = true; - Ui.GuiColumns.FileExtColumn.Value = true; - Ui.GuiColumns.FileSizeColumn.Value = true; - Ui.GuiColumns.PathColumn.Value = true; - Ui.ColumnSort.SortColumnId.Value = 0; - Ui.ColumnSort.SortAscending.Value = false; - Ui.GameDirs.Value = new List(); - Ui.ShownFileTypes.NSP.Value = true; - Ui.ShownFileTypes.PFS0.Value = true; - Ui.ShownFileTypes.XCI.Value = true; - Ui.ShownFileTypes.NCA.Value = true; - Ui.ShownFileTypes.NRO.Value = true; - Ui.ShownFileTypes.NSO.Value = true; - Ui.EnableCustomTheme.Value = true; - Ui.LanguageCode.Value = "en_US"; - Ui.CustomThemePath.Value = ""; - Ui.BaseStyle.Value = "Dark"; - Ui.GameListViewMode.Value = 0; - Ui.ShowNames.Value = true; - Ui.GridSize.Value = 2; - Ui.ApplicationSort.Value = 0; - Ui.IsAscendingOrder.Value = true; - Ui.StartFullscreen.Value = false; - Ui.ShowConsole.Value = true; - Ui.WindowStartup.WindowSizeWidth.Value = 1280; - Ui.WindowStartup.WindowSizeHeight.Value = 760; - Ui.WindowStartup.WindowPositionX.Value = 0; - Ui.WindowStartup.WindowPositionY.Value = 0; - Ui.WindowStartup.WindowMaximized.Value = false; - Hid.EnableKeyboard.Value = false; - Hid.EnableMouse.Value = false; + Graphics.EnableMacroHLE.Value = true; + Graphics.AntiAliasing.Value = AntiAliasing.None; + Graphics.ScalingFilter.Value = ScalingFilter.Bilinear; + Graphics.ScalingFilterLevel.Value = 80; + System.EnablePtc.Value = true; + System.EnableInternetAccess.Value = false; + System.EnableFsIntegrityChecks.Value = true; + System.FsGlobalAccessLogMode.Value = 0; + System.AudioBackend.Value = AudioBackend.SDL2; + System.AudioVolume.Value = 1; + System.MemoryManagerMode.Value = MemoryManagerMode.HostMappedUnsafe; + System.ExpandRam.Value = false; + System.IgnoreMissingServices.Value = false; + System.UseHypervisor.Value = true; + Multiplayer.LanInterfaceId.Value = "0"; + Ui.GuiColumns.FavColumn.Value = true; + Ui.GuiColumns.IconColumn.Value = true; + Ui.GuiColumns.AppColumn.Value = true; + Ui.GuiColumns.DevColumn.Value = true; + Ui.GuiColumns.VersionColumn.Value = true; + Ui.GuiColumns.TimePlayedColumn.Value = true; + Ui.GuiColumns.LastPlayedColumn.Value = true; + Ui.GuiColumns.FileExtColumn.Value = true; + Ui.GuiColumns.FileSizeColumn.Value = true; + Ui.GuiColumns.PathColumn.Value = true; + Ui.ColumnSort.SortColumnId.Value = 0; + Ui.ColumnSort.SortAscending.Value = false; + Ui.GameDirs.Value = new List(); + Ui.ShownFileTypes.NSP.Value = true; + Ui.ShownFileTypes.PFS0.Value = true; + Ui.ShownFileTypes.XCI.Value = true; + Ui.ShownFileTypes.NCA.Value = true; + Ui.ShownFileTypes.NRO.Value = true; + Ui.ShownFileTypes.NSO.Value = true; + Ui.EnableCustomTheme.Value = true; + Ui.LanguageCode.Value = "en_US"; + Ui.CustomThemePath.Value = ""; + Ui.BaseStyle.Value = "Dark"; + Ui.GameListViewMode.Value = 0; + Ui.ShowNames.Value = true; + Ui.GridSize.Value = 2; + Ui.ApplicationSort.Value = 0; + Ui.IsAscendingOrder.Value = true; + Ui.StartFullscreen.Value = false; + Ui.ShowConsole.Value = true; + Ui.WindowStartup.WindowSizeWidth.Value = 1280; + Ui.WindowStartup.WindowSizeHeight.Value = 760; + Ui.WindowStartup.WindowPositionX.Value = 0; + Ui.WindowStartup.WindowPositionY.Value = 0; + Ui.WindowStartup.WindowMaximized.Value = false; + Hid.EnableKeyboard.Value = false; + Hid.EnableMouse.Value = false; Hid.Hotkeys.Value = new KeyboardHotkeys { ToggleVsync = Key.F1, @@ -833,61 +833,58 @@ namespace Ryujinx.Ui.Common.Configuration ResScaleUp = Key.Unbound, ResScaleDown = Key.Unbound, VolumeUp = Key.Unbound, - VolumeDown = Key.Unbound + VolumeDown = Key.Unbound, }; Hid.InputConfig.Value = new List { - new StandardKeyboardInputConfig - { - Version = InputConfig.CurrentVersion, - Backend = InputBackendType.WindowKeyboard, - Id = "0", - PlayerIndex = PlayerIndex.Player1, - ControllerType = ControllerType.JoyconPair, - LeftJoycon = new LeftJoyconCommonConfig - { - DpadUp = Key.Up, - DpadDown = Key.Down, - DpadLeft = Key.Left, - DpadRight = Key.Right, - ButtonMinus = Key.Minus, - ButtonL = Key.E, - ButtonZl = Key.Q, - ButtonSl = Key.Unbound, - ButtonSr = Key.Unbound - }, - - LeftJoyconStick = new JoyconConfigKeyboardStick - { - StickUp = Key.W, - StickDown = Key.S, - StickLeft = Key.A, - StickRight = Key.D, - StickButton = Key.F, - }, - - RightJoycon = new RightJoyconCommonConfig - { - ButtonA = Key.Z, - ButtonB = Key.X, - ButtonX = Key.C, - ButtonY = Key.V, - ButtonPlus = Key.Plus, - ButtonR = Key.U, - ButtonZr = Key.O, - ButtonSl = Key.Unbound, - ButtonSr = Key.Unbound - }, - - RightJoyconStick = new JoyconConfigKeyboardStick - { - StickUp = Key.I, - StickDown = Key.K, - StickLeft = Key.J, - StickRight = Key.L, - StickButton = Key.H, - } - } + new StandardKeyboardInputConfig + { + Version = InputConfig.CurrentVersion, + Backend = InputBackendType.WindowKeyboard, + Id = "0", + PlayerIndex = PlayerIndex.Player1, + ControllerType = ControllerType.JoyconPair, + LeftJoycon = new LeftJoyconCommonConfig + { + DpadUp = Key.Up, + DpadDown = Key.Down, + DpadLeft = Key.Left, + DpadRight = Key.Right, + ButtonMinus = Key.Minus, + ButtonL = Key.E, + ButtonZl = Key.Q, + ButtonSl = Key.Unbound, + ButtonSr = Key.Unbound, + }, + LeftJoyconStick = new JoyconConfigKeyboardStick + { + StickUp = Key.W, + StickDown = Key.S, + StickLeft = Key.A, + StickRight = Key.D, + StickButton = Key.F, + }, + RightJoycon = new RightJoyconCommonConfig + { + ButtonA = Key.Z, + ButtonB = Key.X, + ButtonX = Key.C, + ButtonY = Key.V, + ButtonPlus = Key.Plus, + ButtonR = Key.U, + ButtonZr = Key.O, + ButtonSl = Key.Unbound, + ButtonSr = Key.Unbound, + }, + RightJoyconStick = new JoyconConfigKeyboardStick + { + StickUp = Key.I, + StickDown = Key.K, + StickLeft = Key.J, + StickRight = Key.L, + StickButton = Key.H, + }, + }, }; } @@ -957,13 +954,13 @@ namespace Ryujinx.Ui.Common.Configuration configurationFileFormat.ColumnSort = new ColumnSort { - SortColumnId = 0, - SortAscending = false + SortColumnId = 0, + SortAscending = false, }; configurationFileFormat.Hotkeys = new KeyboardHotkeys { - ToggleVsync = Key.F1 + ToggleVsync = Key.F1, }; configurationFileUpdated = true; @@ -1057,57 +1054,54 @@ namespace Ryujinx.Ui.Common.Configuration configurationFileFormat.InputConfig = new List { - new StandardKeyboardInputConfig - { - Version = InputConfig.CurrentVersion, - Backend = InputBackendType.WindowKeyboard, - Id = "0", - PlayerIndex = PlayerIndex.Player1, - ControllerType = ControllerType.JoyconPair, - LeftJoycon = new LeftJoyconCommonConfig - { - DpadUp = Key.Up, - DpadDown = Key.Down, - DpadLeft = Key.Left, - DpadRight = Key.Right, - ButtonMinus = Key.Minus, - ButtonL = Key.E, - ButtonZl = Key.Q, - ButtonSl = Key.Unbound, - ButtonSr = Key.Unbound - }, - - LeftJoyconStick = new JoyconConfigKeyboardStick - { - StickUp = Key.W, - StickDown = Key.S, - StickLeft = Key.A, - StickRight = Key.D, - StickButton = Key.F, - }, - - RightJoycon = new RightJoyconCommonConfig - { - ButtonA = Key.Z, - ButtonB = Key.X, - ButtonX = Key.C, - ButtonY = Key.V, - ButtonPlus = Key.Plus, - ButtonR = Key.U, - ButtonZr = Key.O, - ButtonSl = Key.Unbound, - ButtonSr = Key.Unbound - }, - - RightJoyconStick = new JoyconConfigKeyboardStick - { - StickUp = Key.I, - StickDown = Key.K, - StickLeft = Key.J, - StickRight = Key.L, - StickButton = Key.H, - } - } + new StandardKeyboardInputConfig + { + Version = InputConfig.CurrentVersion, + Backend = InputBackendType.WindowKeyboard, + Id = "0", + PlayerIndex = PlayerIndex.Player1, + ControllerType = ControllerType.JoyconPair, + LeftJoycon = new LeftJoyconCommonConfig + { + DpadUp = Key.Up, + DpadDown = Key.Down, + DpadLeft = Key.Left, + DpadRight = Key.Right, + ButtonMinus = Key.Minus, + ButtonL = Key.E, + ButtonZl = Key.Q, + ButtonSl = Key.Unbound, + ButtonSr = Key.Unbound, + }, + LeftJoyconStick = new JoyconConfigKeyboardStick + { + StickUp = Key.W, + StickDown = Key.S, + StickLeft = Key.A, + StickRight = Key.D, + StickButton = Key.F, + }, + RightJoycon = new RightJoyconCommonConfig + { + ButtonA = Key.Z, + ButtonB = Key.X, + ButtonX = Key.C, + ButtonY = Key.V, + ButtonPlus = Key.Plus, + ButtonR = Key.U, + ButtonZr = Key.O, + ButtonSl = Key.Unbound, + ButtonSr = Key.Unbound, + }, + RightJoyconStick = new JoyconConfigKeyboardStick + { + StickUp = Key.I, + StickDown = Key.K, + StickLeft = Key.J, + StickRight = Key.L, + StickButton = Key.H, + }, + }, }; configurationFileUpdated = true; @@ -1145,7 +1139,7 @@ namespace Ryujinx.Ui.Common.Configuration configurationFileFormat.Hotkeys = new KeyboardHotkeys { ToggleVsync = Key.F1, - Screenshot = Key.F8 + Screenshot = Key.F8, }; configurationFileUpdated = true; @@ -1159,7 +1153,7 @@ namespace Ryujinx.Ui.Common.Configuration { ToggleVsync = Key.F1, Screenshot = Key.F8, - ShowUi = Key.F4 + ShowUi = Key.F4, }; configurationFileUpdated = true; @@ -1169,7 +1163,7 @@ namespace Ryujinx.Ui.Common.Configuration { Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 30."); - foreach(InputConfig config in configurationFileFormat.InputConfig) + foreach (InputConfig config in configurationFileFormat.InputConfig) { if (config is StandardControllerInputConfig controllerConfig) { @@ -1177,7 +1171,7 @@ namespace Ryujinx.Ui.Common.Configuration { EnableRumble = false, StrongRumble = 1f, - WeakRumble = 1f + WeakRumble = 1f, }; } } @@ -1203,7 +1197,7 @@ namespace Ryujinx.Ui.Common.Configuration ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync, Screenshot = configurationFileFormat.Hotkeys.Screenshot, ShowUi = configurationFileFormat.Hotkeys.ShowUi, - Pause = Key.F5 + Pause = Key.F5, }; configurationFileUpdated = true; @@ -1219,7 +1213,7 @@ namespace Ryujinx.Ui.Common.Configuration Screenshot = configurationFileFormat.Hotkeys.Screenshot, ShowUi = configurationFileFormat.Hotkeys.ShowUi, Pause = configurationFileFormat.Hotkeys.Pause, - ToggleMute = Key.F2 + ToggleMute = Key.F2, }; configurationFileFormat.AudioVolume = 1; @@ -1244,7 +1238,7 @@ namespace Ryujinx.Ui.Common.Configuration { if (config is StandardControllerInputConfig controllerConfig) { - controllerConfig.RangeLeft = 1.0f; + controllerConfig.RangeLeft = 1.0f; controllerConfig.RangeRight = 1.0f; } } @@ -1274,11 +1268,11 @@ namespace Ryujinx.Ui.Common.Configuration { Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 38."); - configurationFileFormat.BaseStyle = "Dark"; + configurationFileFormat.BaseStyle = "Dark"; configurationFileFormat.GameListViewMode = 0; - configurationFileFormat.ShowNames = true; - configurationFileFormat.GridSize = 2; - configurationFileFormat.LanguageCode = "en_US"; + configurationFileFormat.ShowNames = true; + configurationFileFormat.GridSize = 2; + configurationFileFormat.LanguageCode = "en_US"; configurationFileUpdated = true; } @@ -1295,7 +1289,7 @@ namespace Ryujinx.Ui.Common.Configuration Pause = configurationFileFormat.Hotkeys.Pause, ToggleMute = configurationFileFormat.Hotkeys.ToggleMute, ResScaleUp = Key.Unbound, - ResScaleDown = Key.Unbound + ResScaleDown = Key.Unbound, }; configurationFileUpdated = true; @@ -1326,7 +1320,7 @@ namespace Ryujinx.Ui.Common.Configuration ResScaleUp = configurationFileFormat.Hotkeys.ResScaleUp, ResScaleDown = configurationFileFormat.Hotkeys.ResScaleDown, VolumeUp = Key.Unbound, - VolumeDown = Key.Unbound + VolumeDown = Key.Unbound, }; } @@ -1361,12 +1355,12 @@ namespace Ryujinx.Ui.Common.Configuration configurationFileFormat.ShownFileTypes = new ShownFileTypes { - NSP = true, + NSP = true, PFS0 = true, - XCI = true, - NCA = true, - NRO = true, - NSO = true + XCI = true, + NCA = true, + NRO = true, + NSO = true, }; configurationFileUpdated = true; @@ -1393,94 +1387,94 @@ namespace Ryujinx.Ui.Common.Configuration WindowSizeWidth = 1280, WindowMaximized = false, }; - + configurationFileUpdated = true; } - Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; - Graphics.ResScale.Value = configurationFileFormat.ResScale; - Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; - Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy; - Graphics.AspectRatio.Value = configurationFileFormat.AspectRatio; - Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath; - Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading; - Graphics.GraphicsBackend.Value = configurationFileFormat.GraphicsBackend; - Graphics.PreferredGpu.Value = configurationFileFormat.PreferredGpu; - Graphics.AntiAliasing.Value = configurationFileFormat.AntiAliasing; - Graphics.ScalingFilter.Value = configurationFileFormat.ScalingFilter; - Graphics.ScalingFilterLevel.Value = configurationFileFormat.ScalingFilterLevel; - Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug; - Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub; - Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo; - Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn; - Logger.EnableError.Value = configurationFileFormat.LoggingEnableError; - Logger.EnableTrace.Value = configurationFileFormat.LoggingEnableTrace; - Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest; - Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog; - Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses; - Logger.GraphicsDebugLevel.Value = configurationFileFormat.LoggingGraphicsDebugLevel; - System.Language.Value = configurationFileFormat.SystemLanguage; - System.Region.Value = configurationFileFormat.SystemRegion; - System.TimeZone.Value = configurationFileFormat.SystemTimeZone; - System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset; - System.EnableDockedMode.Value = configurationFileFormat.DockedMode; - EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; - CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; - ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit; - HideCursor.Value = configurationFileFormat.HideCursor; - Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; - Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache; + Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; + Graphics.ResScale.Value = configurationFileFormat.ResScale; + Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; + Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy; + Graphics.AspectRatio.Value = configurationFileFormat.AspectRatio; + Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath; + Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading; + Graphics.GraphicsBackend.Value = configurationFileFormat.GraphicsBackend; + Graphics.PreferredGpu.Value = configurationFileFormat.PreferredGpu; + Graphics.AntiAliasing.Value = configurationFileFormat.AntiAliasing; + Graphics.ScalingFilter.Value = configurationFileFormat.ScalingFilter; + Graphics.ScalingFilterLevel.Value = configurationFileFormat.ScalingFilterLevel; + Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug; + Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub; + Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo; + Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn; + Logger.EnableError.Value = configurationFileFormat.LoggingEnableError; + Logger.EnableTrace.Value = configurationFileFormat.LoggingEnableTrace; + Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest; + Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog; + Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses; + Logger.GraphicsDebugLevel.Value = configurationFileFormat.LoggingGraphicsDebugLevel; + System.Language.Value = configurationFileFormat.SystemLanguage; + System.Region.Value = configurationFileFormat.SystemRegion; + System.TimeZone.Value = configurationFileFormat.SystemTimeZone; + System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset; + System.EnableDockedMode.Value = configurationFileFormat.DockedMode; + EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; + CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; + ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit; + HideCursor.Value = configurationFileFormat.HideCursor; + Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; + Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache; Graphics.EnableTextureRecompression.Value = configurationFileFormat.EnableTextureRecompression; - Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE; - System.EnablePtc.Value = configurationFileFormat.EnablePtc; - System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess; - System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks; - System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode; - System.AudioBackend.Value = configurationFileFormat.AudioBackend; - System.AudioVolume.Value = configurationFileFormat.AudioVolume; - System.MemoryManagerMode.Value = configurationFileFormat.MemoryManagerMode; - System.ExpandRam.Value = configurationFileFormat.ExpandRam; - System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices; - System.UseHypervisor.Value = configurationFileFormat.UseHypervisor; - Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn; - Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn; - Ui.GuiColumns.AppColumn.Value = configurationFileFormat.GuiColumns.AppColumn; - Ui.GuiColumns.DevColumn.Value = configurationFileFormat.GuiColumns.DevColumn; - Ui.GuiColumns.VersionColumn.Value = configurationFileFormat.GuiColumns.VersionColumn; - Ui.GuiColumns.TimePlayedColumn.Value = configurationFileFormat.GuiColumns.TimePlayedColumn; - Ui.GuiColumns.LastPlayedColumn.Value = configurationFileFormat.GuiColumns.LastPlayedColumn; - Ui.GuiColumns.FileExtColumn.Value = configurationFileFormat.GuiColumns.FileExtColumn; - Ui.GuiColumns.FileSizeColumn.Value = configurationFileFormat.GuiColumns.FileSizeColumn; - Ui.GuiColumns.PathColumn.Value = configurationFileFormat.GuiColumns.PathColumn; - Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId; - Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending; - Ui.GameDirs.Value = configurationFileFormat.GameDirs; - Ui.ShownFileTypes.NSP.Value = configurationFileFormat.ShownFileTypes.NSP; - Ui.ShownFileTypes.PFS0.Value = configurationFileFormat.ShownFileTypes.PFS0; - Ui.ShownFileTypes.XCI.Value = configurationFileFormat.ShownFileTypes.XCI; - Ui.ShownFileTypes.NCA.Value = configurationFileFormat.ShownFileTypes.NCA; - Ui.ShownFileTypes.NRO.Value = configurationFileFormat.ShownFileTypes.NRO; - Ui.ShownFileTypes.NSO.Value = configurationFileFormat.ShownFileTypes.NSO; - Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme; - Ui.LanguageCode.Value = configurationFileFormat.LanguageCode; - Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath; - Ui.BaseStyle.Value = configurationFileFormat.BaseStyle; - Ui.GameListViewMode.Value = configurationFileFormat.GameListViewMode; - Ui.ShowNames.Value = configurationFileFormat.ShowNames; - Ui.IsAscendingOrder.Value = configurationFileFormat.IsAscendingOrder; - Ui.GridSize.Value = configurationFileFormat.GridSize; - Ui.ApplicationSort.Value = configurationFileFormat.ApplicationSort; - Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen; - Ui.ShowConsole.Value = configurationFileFormat.ShowConsole; - Ui.WindowStartup.WindowSizeWidth.Value = configurationFileFormat.WindowStartup.WindowSizeWidth; - Ui.WindowStartup.WindowSizeHeight.Value = configurationFileFormat.WindowStartup.WindowSizeHeight; - Ui.WindowStartup.WindowPositionX.Value = configurationFileFormat.WindowStartup.WindowPositionX; - Ui.WindowStartup.WindowPositionY.Value = configurationFileFormat.WindowStartup.WindowPositionY; - Ui.WindowStartup.WindowMaximized.Value = configurationFileFormat.WindowStartup.WindowMaximized; - Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard; - Hid.EnableMouse.Value = configurationFileFormat.EnableMouse; - Hid.Hotkeys.Value = configurationFileFormat.Hotkeys; - Hid.InputConfig.Value = configurationFileFormat.InputConfig; + Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE; + System.EnablePtc.Value = configurationFileFormat.EnablePtc; + System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess; + System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks; + System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode; + System.AudioBackend.Value = configurationFileFormat.AudioBackend; + System.AudioVolume.Value = configurationFileFormat.AudioVolume; + System.MemoryManagerMode.Value = configurationFileFormat.MemoryManagerMode; + System.ExpandRam.Value = configurationFileFormat.ExpandRam; + System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices; + System.UseHypervisor.Value = configurationFileFormat.UseHypervisor; + Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn; + Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn; + Ui.GuiColumns.AppColumn.Value = configurationFileFormat.GuiColumns.AppColumn; + Ui.GuiColumns.DevColumn.Value = configurationFileFormat.GuiColumns.DevColumn; + Ui.GuiColumns.VersionColumn.Value = configurationFileFormat.GuiColumns.VersionColumn; + Ui.GuiColumns.TimePlayedColumn.Value = configurationFileFormat.GuiColumns.TimePlayedColumn; + Ui.GuiColumns.LastPlayedColumn.Value = configurationFileFormat.GuiColumns.LastPlayedColumn; + Ui.GuiColumns.FileExtColumn.Value = configurationFileFormat.GuiColumns.FileExtColumn; + Ui.GuiColumns.FileSizeColumn.Value = configurationFileFormat.GuiColumns.FileSizeColumn; + Ui.GuiColumns.PathColumn.Value = configurationFileFormat.GuiColumns.PathColumn; + Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId; + Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending; + Ui.GameDirs.Value = configurationFileFormat.GameDirs; + Ui.ShownFileTypes.NSP.Value = configurationFileFormat.ShownFileTypes.NSP; + Ui.ShownFileTypes.PFS0.Value = configurationFileFormat.ShownFileTypes.PFS0; + Ui.ShownFileTypes.XCI.Value = configurationFileFormat.ShownFileTypes.XCI; + Ui.ShownFileTypes.NCA.Value = configurationFileFormat.ShownFileTypes.NCA; + Ui.ShownFileTypes.NRO.Value = configurationFileFormat.ShownFileTypes.NRO; + Ui.ShownFileTypes.NSO.Value = configurationFileFormat.ShownFileTypes.NSO; + Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme; + Ui.LanguageCode.Value = configurationFileFormat.LanguageCode; + Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath; + Ui.BaseStyle.Value = configurationFileFormat.BaseStyle; + Ui.GameListViewMode.Value = configurationFileFormat.GameListViewMode; + Ui.ShowNames.Value = configurationFileFormat.ShowNames; + Ui.IsAscendingOrder.Value = configurationFileFormat.IsAscendingOrder; + Ui.GridSize.Value = configurationFileFormat.GridSize; + Ui.ApplicationSort.Value = configurationFileFormat.ApplicationSort; + Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen; + Ui.ShowConsole.Value = configurationFileFormat.ShowConsole; + Ui.WindowStartup.WindowSizeWidth.Value = configurationFileFormat.WindowStartup.WindowSizeWidth; + Ui.WindowStartup.WindowSizeHeight.Value = configurationFileFormat.WindowStartup.WindowSizeHeight; + Ui.WindowStartup.WindowPositionX.Value = configurationFileFormat.WindowStartup.WindowPositionX; + Ui.WindowStartup.WindowPositionY.Value = configurationFileFormat.WindowStartup.WindowPositionY; + Ui.WindowStartup.WindowMaximized.Value = configurationFileFormat.WindowStartup.WindowMaximized; + Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard; + Hid.EnableMouse.Value = configurationFileFormat.EnableMouse; + Hid.Hotkeys.Value = configurationFileFormat.Hotkeys; + Hid.InputConfig.Value = configurationFileFormat.InputConfig; if (Hid.InputConfig.Value == null) { @@ -1499,7 +1493,7 @@ namespace Ryujinx.Ui.Common.Configuration return result; } - private static void LogValueChange(object sender, ReactiveEventArgs eventArgs, string valueName) + private static void LogValueChange(ReactiveEventArgs eventArgs, string valueName) { Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}"); } diff --git a/src/Ryujinx.Ui.Common/Configuration/LoggerModule.cs b/src/Ryujinx.Ui.Common/Configuration/LoggerModule.cs index 85b50e763..e18b2bfa3 100644 --- a/src/Ryujinx.Ui.Common/Configuration/LoggerModule.cs +++ b/src/Ryujinx.Ui.Common/Configuration/LoggerModule.cs @@ -9,16 +9,16 @@ namespace Ryujinx.Ui.Common.Configuration { public static void Initialize() { - ConfigurationState.Instance.Logger.EnableDebug.Event += ReloadEnableDebug; - ConfigurationState.Instance.Logger.EnableStub.Event += ReloadEnableStub; - ConfigurationState.Instance.Logger.EnableInfo.Event += ReloadEnableInfo; - ConfigurationState.Instance.Logger.EnableWarn.Event += ReloadEnableWarning; - ConfigurationState.Instance.Logger.EnableError.Event += ReloadEnableError; - ConfigurationState.Instance.Logger.EnableTrace.Event += ReloadEnableTrace; - ConfigurationState.Instance.Logger.EnableGuest.Event += ReloadEnableGuest; + ConfigurationState.Instance.Logger.EnableDebug.Event += ReloadEnableDebug; + ConfigurationState.Instance.Logger.EnableStub.Event += ReloadEnableStub; + ConfigurationState.Instance.Logger.EnableInfo.Event += ReloadEnableInfo; + ConfigurationState.Instance.Logger.EnableWarn.Event += ReloadEnableWarning; + ConfigurationState.Instance.Logger.EnableError.Event += ReloadEnableError; + ConfigurationState.Instance.Logger.EnableTrace.Event += ReloadEnableTrace; + ConfigurationState.Instance.Logger.EnableGuest.Event += ReloadEnableGuest; ConfigurationState.Instance.Logger.EnableFsAccessLog.Event += ReloadEnableFsAccessLog; - ConfigurationState.Instance.Logger.FilteredClasses.Event += ReloadFilteredClasses; - ConfigurationState.Instance.Logger.EnableFileLog.Event += ReloadFileLogger; + ConfigurationState.Instance.Logger.FilteredClasses.Event += ReloadFilteredClasses; + ConfigurationState.Instance.Logger.EnableFileLog.Event += ReloadFileLogger; } private static void ReloadEnableDebug(object sender, ReactiveEventArgs e) diff --git a/src/Ryujinx.Ui.Common/Configuration/System/Language.cs b/src/Ryujinx.Ui.Common/Configuration/System/Language.cs index 404f8063d..2eb9ef5c1 100644 --- a/src/Ryujinx.Ui.Common/Configuration/System/Language.cs +++ b/src/Ryujinx.Ui.Common/Configuration/System/Language.cs @@ -23,6 +23,6 @@ namespace Ryujinx.Ui.Common.Configuration.System LatinAmericanSpanish, SimplifiedChinese, TraditionalChinese, - BrazilianPortuguese + BrazilianPortuguese, } } diff --git a/src/Ryujinx.Ui.Common/Configuration/System/Region.cs b/src/Ryujinx.Ui.Common/Configuration/System/Region.cs index 7dfac6388..03aed7d50 100644 --- a/src/Ryujinx.Ui.Common/Configuration/System/Region.cs +++ b/src/Ryujinx.Ui.Common/Configuration/System/Region.cs @@ -12,6 +12,6 @@ namespace Ryujinx.Ui.Common.Configuration.System Australia, China, Korea, - Taiwan + Taiwan, } } diff --git a/src/Ryujinx.Ui.Common/Configuration/Ui/ColumnSort.cs b/src/Ryujinx.Ui.Common/Configuration/Ui/ColumnSort.cs index 95bb43f82..cbc13b857 100644 --- a/src/Ryujinx.Ui.Common/Configuration/Ui/ColumnSort.cs +++ b/src/Ryujinx.Ui.Common/Configuration/Ui/ColumnSort.cs @@ -2,7 +2,7 @@ { public struct ColumnSort { - public int SortColumnId { get; set; } + public int SortColumnId { get; set; } public bool SortAscending { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Configuration/Ui/GuiColumns.cs b/src/Ryujinx.Ui.Common/Configuration/Ui/GuiColumns.cs index 89264cff2..aff654599 100644 --- a/src/Ryujinx.Ui.Common/Configuration/Ui/GuiColumns.cs +++ b/src/Ryujinx.Ui.Common/Configuration/Ui/GuiColumns.cs @@ -2,15 +2,15 @@ { public struct GuiColumns { - public bool FavColumn { get; set; } - public bool IconColumn { get; set; } - public bool AppColumn { get; set; } - public bool DevColumn { get; set; } - public bool VersionColumn { get; set; } + public bool FavColumn { get; set; } + public bool IconColumn { get; set; } + public bool AppColumn { get; set; } + public bool DevColumn { get; set; } + public bool VersionColumn { get; set; } public bool TimePlayedColumn { get; set; } public bool LastPlayedColumn { get; set; } - public bool FileExtColumn { get; set; } - public bool FileSizeColumn { get; set; } - public bool PathColumn { get; set; } + public bool FileExtColumn { get; set; } + public bool FileSizeColumn { get; set; } + public bool PathColumn { get; set; } } } diff --git a/src/Ryujinx.Ui.Common/Configuration/Ui/ShownFileTypes.cs b/src/Ryujinx.Ui.Common/Configuration/Ui/ShownFileTypes.cs index c0b76e85c..1b14fd467 100644 --- a/src/Ryujinx.Ui.Common/Configuration/Ui/ShownFileTypes.cs +++ b/src/Ryujinx.Ui.Common/Configuration/Ui/ShownFileTypes.cs @@ -2,11 +2,11 @@ namespace Ryujinx.Ui.Common.Configuration.Ui { public struct ShownFileTypes { - public bool NSP { get; set; } + public bool NSP { get; set; } public bool PFS0 { get; set; } - public bool XCI { get; set; } - public bool NCA { get; set; } - public bool NRO { get; set; } - public bool NSO { get; set; } + public bool XCI { get; set; } + public bool NCA { get; set; } + public bool NRO { get; set; } + public bool NSO { get; set; } } } diff --git a/src/Ryujinx.Ui.Common/DiscordIntegrationModule.cs b/src/Ryujinx.Ui.Common/DiscordIntegrationModule.cs index 5ae886aca..69d725967 100644 --- a/src/Ryujinx.Ui.Common/DiscordIntegrationModule.cs +++ b/src/Ryujinx.Ui.Common/DiscordIntegrationModule.cs @@ -7,10 +7,10 @@ namespace Ryujinx.Ui.Common public static class DiscordIntegrationModule { private const string Description = "A simple, experimental Nintendo Switch emulator."; - private const string CliendId = "568815339807309834"; + private const string CliendId = "568815339807309834"; private static DiscordRpcClient _discordClient; - private static RichPresence _discordPresenceMain; + private static RichPresence _discordPresenceMain; public static void Initialize() { @@ -18,20 +18,20 @@ namespace Ryujinx.Ui.Common { Assets = new Assets { - LargeImageKey = "ryujinx", - LargeImageText = Description + LargeImageKey = "ryujinx", + LargeImageText = Description, }, - Details = "Main Menu", - State = "Idling", + Details = "Main Menu", + State = "Idling", Timestamps = Timestamps.Now, - Buttons = new Button[] + Buttons = new[] { - new Button() - { - Label = "Website", - Url = "https://ryujinx.org/" - } - } + new Button + { + Label = "Website", + Url = "https://ryujinx.org/", + }, + }, }; ConfigurationState.Instance.EnableDiscordIntegration.Event += Update; @@ -66,22 +66,22 @@ namespace Ryujinx.Ui.Common { Assets = new Assets { - LargeImageKey = "game", + LargeImageKey = "game", LargeImageText = titleName, - SmallImageKey = "ryujinx", + SmallImageKey = "ryujinx", SmallImageText = Description, }, - Details = $"Playing {titleName}", - State = (titleId == "0000000000000000") ? "Homebrew" : titleId.ToUpper(), + Details = $"Playing {titleName}", + State = (titleId == "0000000000000000") ? "Homebrew" : titleId.ToUpper(), Timestamps = Timestamps.Now, - Buttons = new Button[] + Buttons = new[] { - new Button() + new Button { Label = "Website", - Url = "https://ryujinx.org/" - } - } + Url = "https://ryujinx.org/", + }, + }, }); } @@ -95,4 +95,4 @@ namespace Ryujinx.Ui.Common _discordClient?.Dispose(); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Extensions/FileTypeExtensions.cs b/src/Ryujinx.Ui.Common/Extensions/FileTypeExtensions.cs index e2ac49504..e60fa78cd 100644 --- a/src/Ryujinx.Ui.Common/Extensions/FileTypeExtensions.cs +++ b/src/Ryujinx.Ui.Common/Extensions/FileTypeExtensions.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Ui.Common FileTypes.NCA => config.NCA.Value, FileTypes.NRO => config.NRO.Value, FileTypes.NSO => config.NSO.Value, - _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) + _ => throw new ArgumentOutOfRangeException(nameof(type), type, null), }; } } diff --git a/src/Ryujinx.Ui.Common/Helper/CommandLineState.cs b/src/Ryujinx.Ui.Common/Helper/CommandLineState.cs index 660a4ce92..714cf2f0a 100644 --- a/src/Ryujinx.Ui.Common/Helper/CommandLineState.cs +++ b/src/Ryujinx.Ui.Common/Helper/CommandLineState.cs @@ -7,13 +7,13 @@ namespace Ryujinx.Ui.Common.Helper { public static string[] Arguments { get; private set; } - public static bool? OverrideDockedMode { get; private set; } + public static bool? OverrideDockedMode { get; private set; } public static string OverrideGraphicsBackend { get; private set; } - public static string OverrideHideCursor { get; private set; } - public static string BaseDirPathArg { get; private set; } - public static string Profile { get; private set; } - public static string LaunchPathArg { get; private set; } - public static bool StartFullscreenArg { get; private set; } + public static string OverrideHideCursor { get; private set; } + public static string BaseDirPathArg { get; private set; } + public static string Profile { get; private set; } + public static string LaunchPathArg { get; private set; } + public static bool StartFullscreenArg { get; private set; } public static void ParseArguments(string[] args) { @@ -96,4 +96,4 @@ namespace Ryujinx.Ui.Common.Helper Arguments = arguments.ToArray(); } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Helper/ConsoleHelper.cs b/src/Ryujinx.Ui.Common/Helper/ConsoleHelper.cs index 4eb3b79c1..160c6390f 100644 --- a/src/Ryujinx.Ui.Common/Helper/ConsoleHelper.cs +++ b/src/Ryujinx.Ui.Common/Helper/ConsoleHelper.cs @@ -47,4 +47,4 @@ namespace Ryujinx.Ui.Common.Helper [return: MarshalAs(UnmanagedType.Bool)] private static partial bool ShowWindow(IntPtr hWnd, int nCmdShow); } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Helper/FileAssociationHelper.cs b/src/Ryujinx.Ui.Common/Helper/FileAssociationHelper.cs index 542db9a7e..570fb91e2 100644 --- a/src/Ryujinx.Ui.Common/Helper/FileAssociationHelper.cs +++ b/src/Ryujinx.Ui.Common/Helper/FileAssociationHelper.cs @@ -17,7 +17,7 @@ namespace Ryujinx.Ui.Common.Helper private static readonly string _mimeDbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "mime"); private const int SHCNE_ASSOCCHANGED = 0x8000000; - private const int SHCNF_FLUSH = 0x1000; + private const int SHCNF_FLUSH = 0x1000; [LibraryImport("shell32.dll", SetLastError = true)] public static partial void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2); @@ -199,4 +199,4 @@ namespace Ryujinx.Ui.Common.Helper return false; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Helper/LinuxHelper.cs b/src/Ryujinx.Ui.Common/Helper/LinuxHelper.cs index cfbf4b57d..bf647719a 100644 --- a/src/Ryujinx.Ui.Common/Helper/LinuxHelper.cs +++ b/src/Ryujinx.Ui.Common/Helper/LinuxHelper.cs @@ -49,8 +49,8 @@ namespace Ryujinx.Ui.Common.Helper StartInfo = { FileName = PkExecPath, - ArgumentList = { "sh", "-c", command } - } + ArgumentList = { "sh", "-c", command }, + }, }; process.Start(); @@ -59,4 +59,4 @@ namespace Ryujinx.Ui.Common.Helper return process.ExitCode; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Helper/ObjectiveC.cs b/src/Ryujinx.Ui.Common/Helper/ObjectiveC.cs index 234f7597a..af8723e2f 100644 --- a/src/Ryujinx.Ui.Common/Helper/ObjectiveC.cs +++ b/src/Ryujinx.Ui.Common/Helper/ObjectiveC.cs @@ -1,8 +1,6 @@ using System; -using System.IO; using System.Runtime.InteropServices; using System.Runtime.Versioning; -using System.Text; namespace Ryujinx.Ui.Common.Helper { @@ -12,44 +10,109 @@ namespace Ryujinx.Ui.Common.Helper private const string ObjCRuntime = "/usr/lib/libobjc.A.dylib"; [LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)] - private static unsafe partial IntPtr sel_getUid(string name); + private static partial IntPtr sel_getUid(string name); [LibraryImport(ObjCRuntime, StringMarshalling = StringMarshalling.Utf8)] - public static partial IntPtr objc_getClass(string name); + private static partial IntPtr objc_getClass(string name); [LibraryImport(ObjCRuntime)] - public static partial void objc_msgSend(IntPtr receiver, Selector selector); + private static partial void objc_msgSend(IntPtr receiver, Selector selector); [LibraryImport(ObjCRuntime)] - public static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value); + private static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value); [LibraryImport(ObjCRuntime)] - public static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value); + private static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value); [LibraryImport(ObjCRuntime)] - public static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point); + private static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point); [LibraryImport(ObjCRuntime)] - public static partial void objc_msgSend(IntPtr receiver, Selector selector, double value); + private static partial void objc_msgSend(IntPtr receiver, Selector selector, double value); [LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")] - public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector); + private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector); [LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")] - public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param); + private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param); [LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend", StringMarshalling = StringMarshalling.Utf8)] - public static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, string param); + private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector, string param); [LibraryImport(ObjCRuntime, EntryPoint = "objc_msgSend")] [return: MarshalAs(UnmanagedType.Bool)] - public static partial bool bool_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param); + private static partial bool bool_objc_msgSend(IntPtr receiver, Selector selector, IntPtr param); - public struct Selector + public readonly struct Object + { + public readonly IntPtr ObjPtr; + + private Object(IntPtr pointer) + { + ObjPtr = pointer; + } + + public Object(string name) + { + ObjPtr = objc_getClass(name); + } + + public void SendMessage(Selector selector) + { + objc_msgSend(ObjPtr, selector); + } + + public void SendMessage(Selector selector, byte value) + { + objc_msgSend(ObjPtr, selector, value); + } + + public void SendMessage(Selector selector, Object obj) + { + objc_msgSend(ObjPtr, selector, obj.ObjPtr); + } + + public void SendMessage(Selector selector, NSRect point) + { + objc_msgSend(ObjPtr, selector, point); + } + + public void SendMessage(Selector selector, double value) + { + objc_msgSend(ObjPtr, selector, value); + } + + public Object GetFromMessage(Selector selector) + { + return new Object(IntPtr_objc_msgSend(ObjPtr, selector)); + } + + public Object GetFromMessage(Selector selector, Object obj) + { + return new Object(IntPtr_objc_msgSend(ObjPtr, selector, obj.ObjPtr)); + } + + public Object GetFromMessage(Selector selector, NSString nsString) + { + return new Object(IntPtr_objc_msgSend(ObjPtr, selector, nsString.StrPtr)); + } + + public Object GetFromMessage(Selector selector, string param) + { + return new Object(IntPtr_objc_msgSend(ObjPtr, selector, param)); + } + + public bool GetBoolFromMessage(Selector selector, Object obj) + { + return bool_objc_msgSend(ObjPtr, selector, obj.ObjPtr); + } + } + + public readonly struct Selector { public readonly IntPtr SelPtr; - public unsafe Selector(string name) + private Selector(string name) { SelPtr = sel_getUid(name); } @@ -57,7 +120,7 @@ namespace Ryujinx.Ui.Common.Helper public static implicit operator Selector(string value) => new(value); } - public struct NSString + public readonly struct NSString { public readonly IntPtr StrPtr; @@ -94,4 +157,4 @@ namespace Ryujinx.Ui.Common.Helper } } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Helper/OpenHelper.cs b/src/Ryujinx.Ui.Common/Helper/OpenHelper.cs index 5b2e86635..49a53ae48 100644 --- a/src/Ryujinx.Ui.Common/Helper/OpenHelper.cs +++ b/src/Ryujinx.Ui.Common/Helper/OpenHelper.cs @@ -9,13 +9,13 @@ namespace Ryujinx.Ui.Common.Helper public static partial class OpenHelper { [LibraryImport("shell32.dll", SetLastError = true)] - public static partial int SHOpenFolderAndSelectItems(IntPtr pidlFolder, uint cidl, IntPtr apidl, uint dwFlags); + private static partial int SHOpenFolderAndSelectItems(IntPtr pidlFolder, uint cidl, IntPtr apidl, uint dwFlags); [LibraryImport("shell32.dll", SetLastError = true)] - public static partial void ILFree(IntPtr pidlList); + private static partial void ILFree(IntPtr pidlList); [LibraryImport("shell32.dll", SetLastError = true)] - public static partial IntPtr ILCreateFromPathW([MarshalAs(UnmanagedType.LPWStr)] string pszPath); + private static partial IntPtr ILCreateFromPathW([MarshalAs(UnmanagedType.LPWStr)] string pszPath); public static void OpenFolder(string path) { @@ -23,9 +23,9 @@ namespace Ryujinx.Ui.Common.Helper { Process.Start(new ProcessStartInfo { - FileName = path, + FileName = path, UseShellExecute = true, - Verb = "open" + Verb = "open", }); } else @@ -56,16 +56,16 @@ namespace Ryujinx.Ui.Common.Helper else if (OperatingSystem.IsMacOS()) { ObjectiveC.NSString nsStringPath = new(path); - IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL"); - var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "fileURLWithPath:", nsStringPath); + ObjectiveC.Object nsUrl = new("NSURL"); + var urlPtr = nsUrl.GetFromMessage("fileURLWithPath:", nsStringPath); - IntPtr nsArray = ObjectiveC.objc_getClass("NSArray"); - IntPtr urlArray = ObjectiveC.IntPtr_objc_msgSend(nsArray, "arrayWithObject:", urlPtr); + ObjectiveC.Object nsArray = new("NSArray"); + ObjectiveC.Object urlArray = nsArray.GetFromMessage("arrayWithObject:", urlPtr); - IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace"); - IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace"); + ObjectiveC.Object nsWorkspace = new("NSWorkspace"); + ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace"); - ObjectiveC.objc_msgSend(sharedWorkspace, "activateFileViewerSelectingURLs:", urlArray); + sharedWorkspace.SendMessage("activateFileViewerSelectingURLs:", urlArray); } else if (OperatingSystem.IsLinux()) { @@ -95,13 +95,13 @@ namespace Ryujinx.Ui.Common.Helper else if (OperatingSystem.IsMacOS()) { ObjectiveC.NSString nsStringPath = new(url); - IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL"); - var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "URLWithString:", nsStringPath); + ObjectiveC.Object nsUrl = new("NSURL"); + var urlPtr = nsUrl.GetFromMessage("URLWithString:", nsStringPath); - IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace"); - IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace"); + ObjectiveC.Object nsWorkspace = new("NSWorkspace"); + ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace"); - ObjectiveC.bool_objc_msgSend(sharedWorkspace, "openURL:", urlPtr); + sharedWorkspace.GetBoolFromMessage("openURL:", urlPtr); } else { @@ -109,4 +109,4 @@ namespace Ryujinx.Ui.Common.Helper } } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Helper/SetupValidator.cs b/src/Ryujinx.Ui.Common/Helper/SetupValidator.cs index 3d779fdf2..4a7dac474 100644 --- a/src/Ryujinx.Ui.Common/Helper/SetupValidator.cs +++ b/src/Ryujinx.Ui.Common/Helper/SetupValidator.cs @@ -20,12 +20,10 @@ namespace Ryujinx.Ui.Common.Helper return true; } - else - { - error = UserError.NoFirmware; - return false; - } + error = UserError.NoFirmware; + + return false; } public static bool CanFixStartApplication(ContentManager contentManager, string baseApplicationPath, UserError error, out SystemVersion firmwareVersion) @@ -107,12 +105,10 @@ namespace Ryujinx.Ui.Common.Helper return IsFirmwareValid(contentManager, out error); } - else - { - error = UserError.ApplicationNotFound; - return false; - } + error = UserError.ApplicationNotFound; + + return false; } } } diff --git a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApi.cs b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApi.cs index f412b9504..e8eba6d38 100644 --- a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApi.cs +++ b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApi.cs @@ -29,29 +29,39 @@ namespace Ryujinx.Ui.Common.Models.Amiibo [JsonPropertyName("gamesSwitch")] public List GamesSwitch { get; set; } - public override string ToString() + public readonly override string ToString() { return Name; } - public string GetId() + public readonly string GetId() { return Head + Tail; } - public bool Equals(AmiiboApi other) + public readonly bool Equals(AmiiboApi other) { return Head + Tail == other.Head + other.Tail; } - public override bool Equals(object obj) + public readonly override bool Equals(object obj) { return obj is AmiiboApi other && Equals(other); } - public override int GetHashCode() + public readonly override int GetHashCode() { return HashCode.Combine(Head, Tail); } + + public static bool operator ==(AmiiboApi left, AmiiboApi right) + { + return left.Equals(right); + } + + public static bool operator !=(AmiiboApi left, AmiiboApi right) + { + return !(left == right); + } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiGamesSwitch.cs b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiGamesSwitch.cs index def7d1bcc..6a0442f08 100644 --- a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiGamesSwitch.cs +++ b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiGamesSwitch.cs @@ -12,4 +12,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo [JsonPropertyName("gameName")] public string GameName { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiUsage.cs b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiUsage.cs index 814573c22..d9d3a18f6 100644 --- a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiUsage.cs +++ b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboApiUsage.cs @@ -9,4 +9,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo [JsonPropertyName("write")] public bool Write { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJson.cs b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJson.cs index feb7993c1..bcfe230dd 100644 --- a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJson.cs +++ b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJson.cs @@ -11,4 +11,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo [JsonPropertyName("lastUpdated")] public DateTime LastUpdated { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJsonSerializerContext.cs b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJsonSerializerContext.cs index 4cbb5a7b4..09888d37b 100644 --- a/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJsonSerializerContext.cs +++ b/src/Ryujinx.Ui.Common/Models/Amiibo/AmiiboJsonSerializerContext.cs @@ -6,4 +6,4 @@ namespace Ryujinx.Ui.Common.Models.Amiibo public partial class AmiiboJsonSerializerContext : JsonSerializerContext { } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Github/GithubReleaseAssetJsonResponse.cs b/src/Ryujinx.Ui.Common/Models/Github/GithubReleaseAssetJsonResponse.cs index 10d014783..ed0a49f6c 100644 --- a/src/Ryujinx.Ui.Common/Models/Github/GithubReleaseAssetJsonResponse.cs +++ b/src/Ryujinx.Ui.Common/Models/Github/GithubReleaseAssetJsonResponse.cs @@ -6,4 +6,4 @@ public string State { get; set; } public string BrowserDownloadUrl { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonResponse.cs b/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonResponse.cs index 954d03e31..3fa7cf817 100644 --- a/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonResponse.cs +++ b/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonResponse.cs @@ -7,4 +7,4 @@ namespace Ryujinx.Ui.Common.Models.Github public string Name { get; set; } public List Assets { get; set; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonSerializerContext.cs b/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonSerializerContext.cs index e5fd9d094..c6dd88755 100644 --- a/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonSerializerContext.cs +++ b/src/Ryujinx.Ui.Common/Models/Github/GithubReleasesJsonSerializerContext.cs @@ -6,4 +6,4 @@ namespace Ryujinx.Ui.Common.Models.Github public partial class GithubReleasesJsonSerializerContext : JsonSerializerContext { } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Ui.Common/UserError.cs b/src/Ryujinx.Ui.Common/UserError.cs index f4cfa26dc..63be1e264 100644 --- a/src/Ryujinx.Ui.Common/UserError.cs +++ b/src/Ryujinx.Ui.Common/UserError.cs @@ -34,6 +34,6 @@ /// /// An unknown error. /// - Unknown = 0xDEAD + Unknown = 0xDEAD, } -} \ No newline at end of file +} diff --git a/src/Ryujinx/Ui/MainWindow.cs b/src/Ryujinx/Ui/MainWindow.cs index 1918594ce..628bcff4f 100644 --- a/src/Ryujinx/Ui/MainWindow.cs +++ b/src/Ryujinx/Ui/MainWindow.cs @@ -874,7 +874,7 @@ namespace Ryujinx.Ui DiscordIntegrationModule.SwitchToPlayingState(_emulationContext.Processes.ActiveApplication.ProgramIdText, _emulationContext.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString()); - _applicationLibrary.LoadAndSaveMetaData(_emulationContext.Processes.ActiveApplication.ProgramIdText, appMetadata => + ApplicationLibrary.LoadAndSaveMetaData(_emulationContext.Processes.ActiveApplication.ProgramIdText, appMetadata => { appMetadata.LastPlayed = DateTime.UtcNow; }); @@ -1017,7 +1017,7 @@ namespace Ryujinx.Ui { if (_gameLoaded) { - _applicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => + ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => { if (appMetadata.LastPlayed.HasValue) { @@ -1156,7 +1156,7 @@ namespace Ryujinx.Ui _tableStore.SetValue(treeIter, 0, newToggleValue); - _applicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => + ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => { appMetadata.Favorite = newToggleValue; }); @@ -1321,7 +1321,7 @@ namespace Ryujinx.Ui { if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog()) { - SaveWindowSizePosition(); + SaveWindowSizePosition(); End(); } else @@ -1337,9 +1337,9 @@ namespace Ryujinx.Ui Move(ConfigurationState.Instance.Ui.WindowStartup.WindowPositionX, ConfigurationState.Instance.Ui.WindowStartup.WindowPositionY); - if (ConfigurationState.Instance.Ui.WindowStartup.WindowMaximized) - { - Maximize(); + if (ConfigurationState.Instance.Ui.WindowStartup.WindowMaximized) + { + Maximize(); } } @@ -1354,7 +1354,7 @@ namespace Ryujinx.Ui ConfigurationState.Instance.Ui.WindowStartup.WindowPositionX.Value = windowXPos; ConfigurationState.Instance.Ui.WindowStartup.WindowPositionY.Value = windowYPos; - SaveConfig(); + SaveConfig(); } private void StopEmulation_Pressed(object sender, EventArgs args) @@ -1633,7 +1633,7 @@ namespace Ryujinx.Ui _virtualFileSystem, _emulationContext.Processes.ActiveApplication.ProgramId, _emulationContext.Processes.ActiveApplication.ApplicationControlProperties - .Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString(), + .Title[(int)_emulationContext.System.State.DesiredTitleLanguage].NameString.ToString(), _currentEmulatedGamePath); window.Destroyed += CheatWindow_Destroyed; @@ -1861,4 +1861,4 @@ namespace Ryujinx.Ui UpdateGameTable(); } } -} +} \ No newline at end of file