diff --git a/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs index eb4e485ac..7a64f8206 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs @@ -39,17 +39,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input } } - private bool _showSettings; - public bool ShowSettings - { - get => _showSettings; - set - { - _showSettings = value; - OnPropertyChanged(); - } - } - private SvgImage _image; public SvgImage Image { @@ -70,5 +59,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input { await RumbleInputView.Show(this); } + + public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config) + { + IsLeft = model.IsLeft; + IsRight = model.IsRight; + Image = model.Image; + Config = config; + } } } \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/Input/InputViewModel.cs index ec8682e19..4b9dddae4 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/Input/InputViewModel.cs @@ -47,7 +47,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input private int _controllerNumber = 0; private string _controllerImage; private int _device; - private object _configuration; + private object _configViewModel; private string _profileName; private bool _isLoaded; private readonly UserControl _owner; @@ -72,12 +72,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public bool IsModified { get; set; } - public object Configuration + public object ConfigViewModel { - get => _configuration; + get => _configViewModel; set { - _configuration = value; + _configViewModel = value; OnPropertyChanged(); } @@ -286,12 +286,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (Config is StandardKeyboardInputConfig keyboardInputConfig) { - Configuration = new KeyboardInputConfig(keyboardInputConfig); + ConfigViewModel = new KeyboardInputViewModel(this, new KeyboardInputConfig(keyboardInputConfig)); } if (Config is StandardControllerInputConfig controllerInputConfig) { - Configuration = new ControllerInputConfig(controllerInputConfig); + ConfigViewModel = new ControllerInputViewModel(this, new ControllerInputConfig(controllerInputConfig)); } } @@ -733,7 +733,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input return; } - if (Configuration == null) + if (ConfigViewModel == null) { return; } @@ -756,11 +756,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (IsKeyboard) { - config = (Configuration as KeyboardInputConfig).GetConfig(); + config = (ConfigViewModel as KeyboardInputViewModel).Config.GetConfig(); } else if (IsController) { - config = (Configuration as ControllerInputConfig).GetConfig(); + config = (ConfigViewModel as ControllerInputViewModel).Config.GetConfig(); } config.ControllerType = Controllers[_controller].Type; @@ -825,18 +825,18 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (device.Type == DeviceType.Keyboard) { - var inputConfig = Configuration as KeyboardInputConfig; + var inputConfig = (ConfigViewModel as KeyboardInputViewModel).Config; inputConfig.Id = device.Id; } else { - var inputConfig = Configuration as ControllerInputConfig; + var inputConfig = (ConfigViewModel as ControllerInputViewModel).Config; inputConfig.Id = device.Id.Split(" ")[0]; } var config = !IsController - ? (Configuration as KeyboardInputConfig).GetConfig() - : (Configuration as ControllerInputConfig).GetConfig(); + ? (ConfigViewModel as KeyboardInputViewModel).Config.GetConfig() + : (ConfigViewModel as ControllerInputViewModel).Config.GetConfig(); config.ControllerType = Controllers[_controller].Type; config.PlayerIndex = _playerId; @@ -867,7 +867,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public void NotifyChanges() { - OnPropertyChanged(nameof(Configuration)); + OnPropertyChanged(nameof(ConfigViewModel)); OnPropertyChanged(nameof(IsController)); OnPropertyChanged(nameof(ShowSettings)); OnPropertyChanged(nameof(IsKeyboard)); diff --git a/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs index 97b3aae0e..4025e4a3c 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs @@ -38,17 +38,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input } } - private bool _showSettings; - public bool ShowSettings - { - get => _showSettings; - set - { - _showSettings = value; - OnPropertyChanged(); - } - } - private SvgImage _image; public SvgImage Image { @@ -59,5 +48,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input OnPropertyChanged(); } } + + public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config) + { + IsLeft = model.IsLeft; + IsRight = model.IsRight; + Image = model.Image; + Config = config; + } } } \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml index a75b84dd3..9f4974b5e 100644 --- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml +++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml @@ -35,8 +35,7 @@ + MinHeight="450"> @@ -451,7 +450,7 @@ @@ -477,7 +476,7 @@ diff --git a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml index b56bbcb3a..a4cc7d8ce 100644 --- a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml +++ b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml @@ -211,7 +211,15 @@ - - + + + + + + + + + + \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs index 045f000c9..dbca2b581 100644 --- a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs +++ b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs @@ -27,14 +27,15 @@ namespace Ryujinx.Ava.UI.Views.Input InitializeComponent(); - foreach (ILogical visual in SettingButtons.GetLogicalDescendants()) + // TODO: Move this stuff to Controller/KeyboardInputView + /*foreach (ILogical visual in SettingButtons.GetLogicalDescendants()) { if (visual is ToggleButton button && !(visual is CheckBox)) { button.Checked += Button_Checked; button.Unchecked += Button_Unchecked; } - } + }*/ } protected override void OnPointerReleased(PointerReleasedEventArgs e) diff --git a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml index 9d09af81f..10ae809c9 100644 --- a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml +++ b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml @@ -35,8 +35,7 @@ + MinHeight="450">