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: [PATCH] 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
---
Ryujinx.Ava/Assets/Locales/en_US.json | 1 +
.../UI/ViewModels/MainWindowViewModel.cs | 17 +++++
.../UI/Views/Main/MainMenuBarView.axaml | 1 +
.../UI/Views/Main/MainMenuBarView.axaml.cs | 28 +++++++-
Ryujinx.Ui.Common/App/ApplicationLibrary.cs | 15 +++-
.../Configuration/ConfigurationFileFormat.cs | 7 +-
.../Configuration/ConfigurationState.cs | 71 ++++++++++++++++++-
Ryujinx.Ui.Common/Configuration/FileTypes.cs | 12 ++++
.../Configuration/Ui/ShownFileTypes.cs | 12 ++++
.../Extensions/FileTypeExtensions.cs | 25 +++++++
Ryujinx/Ui/MainWindow.cs | 68 ++++++++++++++++++
Ryujinx/Ui/MainWindow.glade | 69 ++++++++++++++++++
12 files changed, 321 insertions(+), 5 deletions(-)
create mode 100644 Ryujinx.Ui.Common/Configuration/FileTypes.cs
create mode 100644 Ryujinx.Ui.Common/Configuration/Ui/ShownFileTypes.cs
create mode 100644 Ryujinx.Ui.Common/Extensions/FileTypeExtensions.cs
diff --git a/Ryujinx.Ava/Assets/Locales/en_US.json b/Ryujinx.Ava/Assets/Locales/en_US.json
index fb8f800c0..b2d6b43d7 100644
--- a/Ryujinx.Ava/Assets/Locales/en_US.json
+++ b/Ryujinx.Ava/Assets/Locales/en_US.json
@@ -429,6 +429,7 @@
"DlcManagerEnableAllButton": "Enable All",
"DlcManagerDisableAllButton": "Disable All",
"MenuBarOptionsChangeLanguage": "Change Language",
+ "MenuBarShowFileTypes": "Show File Types",
"CommonSort": "Sort",
"CommonShowNames": "Show Names",
"CommonFavorite": "Favorite",
diff --git a/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs b/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs
index d5ff78545..da2115265 100644
--- a/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs
+++ b/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs
@@ -1336,6 +1336,23 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
+ public void ToggleFileType(string fileType)
+ {
+ _ = fileType switch
+ {
+ "NSP" => ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value = !ConfigurationState.Instance.Ui.ShownFileTypes.NSP,
+ "PFS0" => ConfigurationState.Instance.Ui.ShownFileTypes.PFS0.Value = !ConfigurationState.Instance.Ui.ShownFileTypes.PFS0,
+ "XCI" => ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value = !ConfigurationState.Instance.Ui.ShownFileTypes.XCI,
+ "NCA" => ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value = !ConfigurationState.Instance.Ui.ShownFileTypes.NCA,
+ "NRO" => ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value = !ConfigurationState.Instance.Ui.ShownFileTypes.NRO,
+ "NSO" => ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value = !ConfigurationState.Instance.Ui.ShownFileTypes.NSO,
+ _ => throw new ArgumentOutOfRangeException(fileType),
+ };
+
+ ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
+ LoadApplications();
+ }
+
public async void ManageProfiles()
{
await NavigationDialogHost.Show(AccountManager, ContentManager, VirtualFileSystem, LibHacHorizonManager.RyujinxClient);
diff --git a/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml b/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml
index b1d768ead..d5b5efcdd 100644
--- a/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml
+++ b/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml
@@ -78,6 +78,7 @@
+