From 3b60e8f590f3399cbf83349e61d41f90afa74ebb Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sat, 20 Apr 2024 12:32:57 -0400 Subject: [PATCH] Dirty on input map bindings change --- .../UI/ViewModels/Settings/SettingsInputViewModel.cs | 12 ++++++++++++ .../UI/Views/Input/ControllerInputView.axaml.cs | 2 +- .../UI/Views/Input/KeyboardInputView.axaml.cs | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/Settings/SettingsInputViewModel.cs b/src/Ryujinx/UI/ViewModels/Settings/SettingsInputViewModel.cs index 32a6c749a..f7a6cbdae 100644 --- a/src/Ryujinx/UI/ViewModels/Settings/SettingsInputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Settings/SettingsInputViewModel.cs @@ -57,6 +57,17 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions()); + private bool _isModified; + public bool IsModified + { + get => _isModified; + set + { + _isModified = value; + DirtyEvent?.Invoke(); + } + } + public IGamepadDriver AvaloniaKeyboardDriver { get; } public IGamepad SelectedGamepad { get; private set; } @@ -836,6 +847,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings { bool isDirty = false; + isDirty |= IsModified; isDirty |= config.System.EnableDockedMode.Value != EnableDockedMode; isDirty |= config.Hid.EnableKeyboard.Value != EnableKeyboard; isDirty |= config.Hid.EnableMouse.Value != EnableMouse; diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs index d4012c23f..b76648da7 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs @@ -71,7 +71,7 @@ namespace Ryujinx.Ava.UI.Views.Input if (e.ButtonValue.HasValue) { var buttonValue = e.ButtonValue.Value; - //viewModel.ParentModel.SettingsViewModel.CheckIfModified(); + viewModel.ParentModel.IsModified = true; switch (button.Name) { diff --git a/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs index ff83d487e..f17c7496c 100644 --- a/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/KeyboardInputView.axaml.cs @@ -68,7 +68,7 @@ namespace Ryujinx.Ava.UI.Views.Input if (e.ButtonValue.HasValue) { var buttonValue = e.ButtonValue.Value; - // viewModel.ParentModel.SettingsViewModel.CheckIfModified(); + viewModel.ParentModel.IsModified = true; switch (button.Name) {