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 --- Ryujinx.Common/Configuration/ConfigurationState.cs | 68 +++++++++++++++++++--- 1 file changed, 59 insertions(+), 9 deletions(-) (limited to 'Ryujinx.Common/Configuration/ConfigurationState.cs') 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) -- cgit v1.2.3