From 68a6960617f0703d09971a78445e42bf42b20025 Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Fri, 26 Jun 2020 11:30:16 +0100 Subject: Remember GUI column sort and separate hotkey settings from emulated input settings (#1223) * Separate hotkey settings from emulated input settings * Remember gui column sort * nit * fix schema * nit * Remove unused SaveDataPath to speed up game list loading * Reset the vertical scrollbar to the top when titles finish loading --- .../Configuration/ConfigurationFileFormat.cs | 12 +++- Ryujinx.Common/Configuration/ConfigurationState.cs | 68 +++++++++++++++++++--- Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs | 5 -- Ryujinx.Common/Configuration/Ui/ColumnSort.cs | 8 +++ 4 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 Ryujinx.Common/Configuration/Ui/ColumnSort.cs (limited to 'Ryujinx.Common/Configuration') diff --git a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs index e2431ac6..e00e1eaa 100644 --- a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 8; + public const int CurrentVersion = 9; public int Version { get; set; } @@ -137,6 +137,11 @@ namespace Ryujinx.Configuration /// public GuiColumns GuiColumns { get; set; } + /// + /// Used to configure column sort settings in the GUI + /// + public ColumnSort ColumnSort { get; set; } + /// /// A list of directories containing games to be used to load games into the games list /// @@ -157,6 +162,11 @@ namespace Ryujinx.Configuration /// public bool EnableKeyboard { get; set; } + /// + /// Hotkey Keyboard Bindings + /// + public KeyboardHotkeys Hotkeys { get; set; } + /// /// Keyboard control bindings /// diff --git a/Ryujinx.Common/Configuration/ConfigurationState.cs b/Ryujinx.Common/Configuration/ConfigurationState.cs index 26bbabc7..2a85f7e1 100644 --- a/Ryujinx.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Common/Configuration/ConfigurationState.cs @@ -44,11 +44,28 @@ namespace Ryujinx.Configuration } } + public class ColumnSortSettings + { + public ReactiveObject SortColumnId { get; private set; } + public ReactiveObject SortAscending { get; private set; } + + public ColumnSortSettings() + { + SortColumnId = new ReactiveObject(); + SortAscending = new ReactiveObject(); + } + } + /// /// Used to toggle columns in the GUI /// public Columns GuiColumns { get; private set; } + /// + /// Used to configure column sort settings in the GUI + /// + public ColumnSortSettings ColumnSort { get; private set; } + /// /// A list of directories containing games to be used to load games into the games list /// @@ -67,6 +84,7 @@ namespace Ryujinx.Configuration public UiSection() { GuiColumns = new Columns(); + ColumnSort = new ColumnSortSettings(); GameDirs = new ReactiveObject>(); EnableCustomTheme = new ReactiveObject(); CustomThemePath = new ReactiveObject(); @@ -217,6 +235,11 @@ namespace Ryujinx.Configuration /// public ReactiveObject EnableKeyboard { get; private set; } + /// + /// Hotkey Keyboard Bindings + /// + public ReactiveObject Hotkeys { get; private set; } + /// /// Input device configuration. /// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed. @@ -227,6 +250,7 @@ namespace Ryujinx.Configuration public HidSection() { EnableKeyboard = new ReactiveObject(); + Hotkeys = new ReactiveObject(); InputConfig = new ReactiveObject>(); } } @@ -347,7 +371,7 @@ namespace Ryujinx.Configuration EnableFsIntegrityChecks = System.EnableFsIntegrityChecks, FsGlobalAccessLogMode = System.FsGlobalAccessLogMode, IgnoreMissingServices = System.IgnoreMissingServices, - GuiColumns = new GuiColumns() + GuiColumns = new GuiColumns { FavColumn = Ui.GuiColumns.FavColumn, IconColumn = Ui.GuiColumns.IconColumn, @@ -360,10 +384,16 @@ namespace Ryujinx.Configuration FileSizeColumn = Ui.GuiColumns.FileSizeColumn, PathColumn = Ui.GuiColumns.PathColumn, }, + ColumnSort = new ColumnSort + { + SortColumnId = Ui.ColumnSort.SortColumnId, + SortAscending = Ui.ColumnSort.SortAscending + }, GameDirs = Ui.GameDirs, EnableCustomTheme = Ui.EnableCustomTheme, CustomThemePath = Ui.CustomThemePath, EnableKeyboard = Hid.EnableKeyboard, + Hotkeys = Hid.Hotkeys, KeyboardConfig = keyboardConfigList, ControllerConfig = controllerConfigList }; @@ -406,10 +436,17 @@ namespace Ryujinx.Configuration 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.EnableCustomTheme.Value = false; Ui.CustomThemePath.Value = ""; Hid.EnableKeyboard.Value = false; + + Hid.Hotkeys.Value = new KeyboardHotkeys + { + ToggleVsync = Key.Tab + }; Hid.InputConfig.Value = new List { @@ -451,10 +488,6 @@ namespace Ryujinx.Configuration ButtonZr = Key.O, ButtonSl = Key.PageUp, ButtonSr = Key.PageDown - }, - Hotkeys = new KeyboardHotkeys - { - ToggleVsync = Key.Tab } } }; @@ -553,10 +586,6 @@ namespace Ryujinx.Configuration ButtonZr = Key.O, ButtonSl = Key.Unbound, ButtonSr = Key.Unbound - }, - Hotkeys = new KeyboardHotkeys - { - ToggleVsync = Key.Tab } } }; @@ -587,6 +616,24 @@ namespace Ryujinx.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 9) + { + Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 9."); + + configurationFileFormat.ColumnSort = new ColumnSort + { + SortColumnId = 0, + SortAscending = false + }; + + configurationFileFormat.Hotkeys = new KeyboardHotkeys + { + ToggleVsync = Key.Tab + }; + + configurationFileUpdated = true; + } + List inputConfig = new List(); foreach (ControllerConfig controllerConfig in configurationFileFormat.ControllerConfig) { @@ -631,10 +678,13 @@ namespace Ryujinx.Configuration 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.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme; Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath; Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard; + Hid.Hotkeys.Value = configurationFileFormat.Hotkeys; Hid.InputConfig.Value = inputConfig; if (configurationFileUpdated) diff --git a/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs b/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs index 7dfbcb87..4e217ae5 100644 --- a/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs +++ b/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs @@ -14,10 +14,5 @@ namespace Ryujinx.Common.Configuration.Hid /// Right JoyCon Keyboard Bindings /// public NpadKeyboardRight RightJoycon { get; set; } - - /// - /// Hotkey Keyboard Bindings - /// - public KeyboardHotkeys Hotkeys { get; set; } } } \ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Ui/ColumnSort.cs b/Ryujinx.Common/Configuration/Ui/ColumnSort.cs new file mode 100644 index 00000000..fd8b5da1 --- /dev/null +++ b/Ryujinx.Common/Configuration/Ui/ColumnSort.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.Configuration.Ui +{ + public struct ColumnSort + { + public int SortColumnId { get; set; } + public bool SortAscending { get; set; } + } +} \ No newline at end of file -- cgit v1.2.3