diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 89cc6496d..a02bf42bd 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -51,6 +51,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input private object _configViewModel; private string _profileName; private bool _isLoaded; + private bool _enableDockedMode; private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions()); @@ -70,6 +71,17 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public bool IsRight { get; set; } public bool IsLeft { get; set; } + public bool EnableDockedMode + { + get => _enableDockedMode; + set + { + _enableDockedMode = value; + } + } + public bool EnableKeyboard { get; set; } + public bool EnableMouse { get; set; } + public bool IsModified { get; set; } public event Action NotifyChangesEvent; @@ -288,6 +300,10 @@ namespace Ryujinx.Ava.UI.ViewModels.Input { ConfigViewModel = new ControllerInputViewModel(this, new GamepadInputConfig(controllerInputConfig)); } + + EnableDockedMode = ConfigurationState.Instance.System.EnableDockedMode; + EnableKeyboard = ConfigurationState.Instance.Hid.EnableKeyboard; + EnableMouse = ConfigurationState.Instance.Hid.EnableMouse; } public void LoadDevice() @@ -853,6 +869,10 @@ namespace Ryujinx.Ava.UI.ViewModels.Input // NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event. ConfigurationState.Instance.Hid.InputConfig.Value = newConfig; + ConfigurationState.Instance.System.EnableDockedMode.Value = EnableDockedMode; + ConfigurationState.Instance.Hid.EnableKeyboard.Value = EnableKeyboard; + ConfigurationState.Instance.Hid.EnableMouse.Value = EnableMouse; + ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath); } diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 3fda90a64..34c3af354 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -146,9 +146,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool ShowConfirmExit { get; set; } public bool RememberWindowState { get; set; } public int HideCursor { get; set; } - public bool EnableDockedMode { get; set; } - public bool EnableKeyboard { get; set; } - public bool EnableMouse { get; set; } public bool EnableVsync { get; set; } public bool EnablePptc { get; set; } public bool EnableInternetAccess { get; set; } @@ -418,11 +415,6 @@ namespace Ryujinx.Ava.UI.ViewModels _ => 0 }; - // Input - EnableDockedMode = config.System.EnableDockedMode; - EnableKeyboard = config.Hid.EnableKeyboard; - EnableMouse = config.Hid.EnableMouse; - // Keyboard Hotkeys KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value); @@ -513,11 +505,6 @@ namespace Ryujinx.Ava.UI.ViewModels _ => "Auto" }; - // Input - config.System.EnableDockedMode.Value = EnableDockedMode; - config.Hid.EnableKeyboard.Value = EnableKeyboard; - config.Hid.EnableMouse.Value = EnableMouse; - // Keyboard Hotkeys config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig(); diff --git a/src/Ryujinx/UI/Views/Input/InputView.axaml b/src/Ryujinx/UI/Views/Input/InputView.axaml index b4940941c..bd36fc581 100644 --- a/src/Ryujinx/UI/Views/Input/InputView.axaml +++ b/src/Ryujinx/UI/Views/Input/InputView.axaml @@ -27,199 +27,237 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + IsChecked="{Binding EnableDockedMode}"> + + + + + + + + + + + diff --git a/src/Ryujinx/UI/Views/Settings/SettingsInputView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsInputView.axaml index 55c2ed6e3..f474771f9 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsInputView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsInputView.axaml @@ -4,7 +4,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" xmlns:views="clr-namespace:Ryujinx.Ava.UI.Views.Input" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" mc:Ignorable="d" @@ -21,47 +20,8 @@ - - - - - - - - - - - - - - - - - - - - - - + - \ No newline at end of file +