diff options
author | Xpl0itR <xpl0itr@outlook.com> | 2020-06-26 11:30:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-26 12:30:16 +0200 |
commit | 68a6960617f0703d09971a78445e42bf42b20025 (patch) | |
tree | b513024397b554efbb1e780c61b58b560bc0355f /Ryujinx.Common/Configuration/ConfigurationState.cs | |
parent | 9a49f8aec92f7707037f5d1e677078451d07036b (diff) |
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
Diffstat (limited to 'Ryujinx.Common/Configuration/ConfigurationState.cs')
-rw-r--r-- | Ryujinx.Common/Configuration/ConfigurationState.cs | 68 |
1 files changed, 59 insertions, 9 deletions
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,12 +44,29 @@ namespace Ryujinx.Configuration } } + public class ColumnSortSettings + { + public ReactiveObject<int> SortColumnId { get; private set; } + public ReactiveObject<bool> SortAscending { get; private set; } + + public ColumnSortSettings() + { + SortColumnId = new ReactiveObject<int>(); + SortAscending = new ReactiveObject<bool>(); + } + } + /// <summary> /// Used to toggle columns in the GUI /// </summary> public Columns GuiColumns { get; private set; } /// <summary> + /// Used to configure column sort settings in the GUI + /// </summary> + public ColumnSortSettings ColumnSort { get; private set; } + + /// <summary> /// A list of directories containing games to be used to load games into the games list /// </summary> public ReactiveObject<List<string>> GameDirs { get; private set; } @@ -67,6 +84,7 @@ namespace Ryujinx.Configuration public UiSection() { GuiColumns = new Columns(); + ColumnSort = new ColumnSortSettings(); GameDirs = new ReactiveObject<List<string>>(); EnableCustomTheme = new ReactiveObject<bool>(); CustomThemePath = new ReactiveObject<string>(); @@ -218,6 +236,11 @@ namespace Ryujinx.Configuration public ReactiveObject<bool> EnableKeyboard { get; private set; } /// <summary> + /// Hotkey Keyboard Bindings + /// </summary> + public ReactiveObject<KeyboardHotkeys> Hotkeys { get; private set; } + + /// <summary> /// Input device configuration. /// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed. /// TODO: Implement a ReactiveList class. @@ -227,6 +250,7 @@ namespace Ryujinx.Configuration public HidSection() { EnableKeyboard = new ReactiveObject<bool>(); + Hotkeys = new ReactiveObject<KeyboardHotkeys>(); InputConfig = new ReactiveObject<List<InputConfig>>(); } } @@ -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<string>(); Ui.EnableCustomTheme.Value = false; Ui.CustomThemePath.Value = ""; Hid.EnableKeyboard.Value = false; + + Hid.Hotkeys.Value = new KeyboardHotkeys + { + ToggleVsync = Key.Tab + }; Hid.InputConfig.Value = new List<InputConfig> { @@ -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> inputConfig = new List<InputConfig>(); 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) |