From c5258cf082b10f335f81487f22b7eeb86075e09e Mon Sep 17 00:00:00 2001 From: NitroTears <73270647+NitroTears@users.noreply.github.com> Date: Sun, 16 Apr 2023 11:03:35 +1000 Subject: Ability to hide file types in Game List (#4555) * Added HiddenFileTypes to config state, and check to file enumeration * Added hiddenfiletypes checkboxes to the UI * Added Ava version of HiddenFileTypes * Inverted Hide to Show with file types, minor formatting * all variables with a reference to 'hidden' is now 'shown' * one more variable name changed * review feedback * added FileTypes extension methof to get the correlating config value * moved extension method to new folder and file in Ryujinx.Ui.Common * added default case for ToggleFileType * changed exception type to OutOfRangeException --- .../Configuration/ConfigurationState.cs | 71 +++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) (limited to 'Ryujinx.Ui.Common/Configuration/ConfigurationState.cs') diff --git a/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs b/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs index 82a331c1..12cc1b8f 100644 --- a/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs @@ -60,6 +60,29 @@ namespace Ryujinx.Ui.Common.Configuration } } + /// + /// Used to toggle which file types are shown in the UI + /// + public class ShownFileTypeSettings + { + public ReactiveObject NSP { get; private set; } + public ReactiveObject PFS0 { get; private set; } + public ReactiveObject XCI { get; private set; } + public ReactiveObject NCA { get; private set; } + public ReactiveObject NRO { get; private set; } + public ReactiveObject NSO { get; private set; } + + public ShownFileTypeSettings() + { + NSP = new ReactiveObject(); + PFS0 = new ReactiveObject(); + XCI = new ReactiveObject(); + NCA = new ReactiveObject(); + NRO = new ReactiveObject(); + NSO = new ReactiveObject(); + } + } + /// /// Used to toggle columns in the GUI /// @@ -75,6 +98,11 @@ namespace Ryujinx.Ui.Common.Configuration /// public ReactiveObject> GameDirs { get; private set; } + /// + /// A list of file types to be hidden in the games List + /// + public ShownFileTypeSettings ShownFileTypes { get; private set; } + /// /// Language Code for the UI /// @@ -135,6 +163,7 @@ namespace Ryujinx.Ui.Common.Configuration GuiColumns = new Columns(); ColumnSort = new ColumnSortSettings(); GameDirs = new ReactiveObject>(); + ShownFileTypes = new ShownFileTypeSettings(); EnableCustomTheme = new ReactiveObject(); CustomThemePath = new ReactiveObject(); BaseStyle = new ReactiveObject(); @@ -618,6 +647,15 @@ namespace Ryujinx.Ui.Common.Configuration SortAscending = Ui.ColumnSort.SortAscending }, GameDirs = Ui.GameDirs, + ShownFileTypes = new ShownFileTypes + { + NSP = Ui.ShownFileTypes.NSP, + PFS0 = Ui.ShownFileTypes.PFS0, + XCI = Ui.ShownFileTypes.XCI, + NCA = Ui.ShownFileTypes.NCA, + NRO = Ui.ShownFileTypes.NRO, + NSO = Ui.ShownFileTypes.NSO, + }, LanguageCode = Ui.LanguageCode, EnableCustomTheme = Ui.EnableCustomTheme, CustomThemePath = Ui.CustomThemePath, @@ -702,7 +740,13 @@ namespace Ryujinx.Ui.Common.Configuration Ui.ColumnSort.SortColumnId.Value = 0; Ui.ColumnSort.SortAscending.Value = false; Ui.GameDirs.Value = new List(); - Ui.EnableCustomTheme.Value = false; + 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"; @@ -1238,7 +1282,7 @@ namespace Ryujinx.Ui.Common.Configuration if (configurationFileFormat.Version < 44) { - Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 42."); + Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 44."); configurationFileFormat.AntiAliasing = AntiAliasing.None; configurationFileFormat.ScalingFilter = ScalingFilter.Bilinear; @@ -1247,6 +1291,23 @@ namespace Ryujinx.Ui.Common.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 45) + { + Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 45."); + + configurationFileFormat.ShownFileTypes = new ShownFileTypes + { + NSP = true, + PFS0 = true, + XCI = true, + NCA = true, + NRO = true, + NSO = true + }; + + configurationFileUpdated = true; + } + Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; Graphics.ResScale.Value = configurationFileFormat.ResScale; Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; @@ -1305,6 +1366,12 @@ namespace Ryujinx.Ui.Common.Configuration 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; -- cgit v1.2.3