From 5e8eedae37b8386956d5408bccf093ca2a20c0ef Mon Sep 17 00:00:00 2001 From: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> Date: Sun, 28 May 2023 17:44:13 -0400 Subject: [PATCH] Ack Suggestions Remaining ack suggestions Update src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs Co-authored-by: Ac_K Update src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs Co-authored-by: Ac_K --- src/Ryujinx.Ava/Assets/Locales/en_US.json | 4 +- .../UI/Models/Input/ControllerInputConfig.cs | 65 +++++++++---------- .../UI/Models/Input/KeyboardInputConfig.cs | 52 +++++++-------- .../Input/ControllerInputViewModel.cs | 18 ++--- .../Input/KeyboardInputViewModel.cs | 6 +- src/Ryujinx/UI/Windows/ControllerWindow.cs | 4 +- 6 files changed, 72 insertions(+), 77 deletions(-) diff --git a/src/Ryujinx.Ava/Assets/Locales/en_US.json b/src/Ryujinx.Ava/Assets/Locales/en_US.json index d5c2d8cfc..621a51ad7 100644 --- a/src/Ryujinx.Ava/Assets/Locales/en_US.json +++ b/src/Ryujinx.Ava/Assets/Locales/en_US.json @@ -275,8 +275,8 @@ "KeyAltRight": "Alt Right", "KeyOptLeft": "⌥ Left", "KeyOptRight": "⌥ Right", - "KeyWinLeft": "Windows Left", - "KeyWinRight": "Windows Right", + "KeyWinLeft": "⊞ Left", + "KeyWinRight": "⊞ Right", "KeyCmdLeft": "⌘ Left", "KeyCmdRight": "⌘ Right", "KeyMenu": "Menu", diff --git a/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs b/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs index ff81daf0b..cb3e171fa 100644 --- a/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs +++ b/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs @@ -14,11 +14,11 @@ namespace Ryujinx.Ava.UI.Models.Input public int Slot { get; set; } public int AltSlot { get; set; } public bool MirrorInput { get; set; } - public int Sensitivity { get; set; } + public int Sensitivity { get; set; } public double GyroDeadzone { get; set; } public float WeakRumble { get; set; } - public float StrongRumble { get; set; } + public float StrongRumble { get; set; } public string Id { get; set; } public ControllerType ControllerType { get; set; } @@ -339,7 +339,6 @@ namespace Ryujinx.Ava.UI.Models.Input set { _deadzoneLeft = MathF.Round(value, 3); - OnPropertyChanged(); } } @@ -351,7 +350,6 @@ namespace Ryujinx.Ava.UI.Models.Input set { _deadzoneRight = MathF.Round(value, 3); - OnPropertyChanged(); } } @@ -363,7 +361,6 @@ namespace Ryujinx.Ava.UI.Models.Input set { _rangeLeft = MathF.Round(value, 3); - OnPropertyChanged(); } } @@ -375,7 +372,6 @@ namespace Ryujinx.Ava.UI.Models.Input set { _rangeRight = MathF.Round(value, 3); - OnPropertyChanged(); } } @@ -387,7 +383,6 @@ namespace Ryujinx.Ava.UI.Models.Input set { _triggerThreshold = MathF.Round(value, 3); - OnPropertyChanged(); } } @@ -427,37 +422,37 @@ namespace Ryujinx.Ava.UI.Models.Input return; } - LeftJoystick = controllerInput.LeftJoyconStick.Joystick; - LeftInvertStickX = controllerInput.LeftJoyconStick.InvertStickX; - LeftInvertStickY = controllerInput.LeftJoyconStick.InvertStickY; - LeftRotate90 = controllerInput.LeftJoyconStick.Rotate90CW; - LeftStickButton = controllerInput.LeftJoyconStick.StickButton; + LeftJoystick = controllerInput.LeftJoyconStick.Joystick; + LeftInvertStickX = controllerInput.LeftJoyconStick.InvertStickX; + LeftInvertStickY = controllerInput.LeftJoyconStick.InvertStickY; + LeftRotate90 = controllerInput.LeftJoyconStick.Rotate90CW; + LeftStickButton = controllerInput.LeftJoyconStick.StickButton; - RightJoystick = controllerInput.RightJoyconStick.Joystick; + RightJoystick = controllerInput.RightJoyconStick.Joystick; RightInvertStickX = controllerInput.RightJoyconStick.InvertStickX; RightInvertStickY = controllerInput.RightJoyconStick.InvertStickY; - RightRotate90 = controllerInput.RightJoyconStick.Rotate90CW; - RightStickButton = controllerInput.RightJoyconStick.StickButton; + RightRotate90 = controllerInput.RightJoyconStick.Rotate90CW; + RightStickButton = controllerInput.RightJoyconStick.StickButton; - DpadUp = controllerInput.LeftJoycon.DpadUp; - DpadDown = controllerInput.LeftJoycon.DpadDown; - DpadLeft = controllerInput.LeftJoycon.DpadLeft; - DpadRight = controllerInput.LeftJoycon.DpadRight; - ButtonL = controllerInput.LeftJoycon.ButtonL; - ButtonMinus = controllerInput.LeftJoycon.ButtonMinus; - LeftButtonSl = controllerInput.LeftJoycon.ButtonSl; - LeftButtonSr = controllerInput.LeftJoycon.ButtonSr; - ButtonZl = controllerInput.LeftJoycon.ButtonZl; + DpadUp = controllerInput.LeftJoycon.DpadUp; + DpadDown = controllerInput.LeftJoycon.DpadDown; + DpadLeft = controllerInput.LeftJoycon.DpadLeft; + DpadRight = controllerInput.LeftJoycon.DpadRight; + ButtonL = controllerInput.LeftJoycon.ButtonL; + ButtonMinus = controllerInput.LeftJoycon.ButtonMinus; + LeftButtonSl = controllerInput.LeftJoycon.ButtonSl; + LeftButtonSr = controllerInput.LeftJoycon.ButtonSr; + ButtonZl = controllerInput.LeftJoycon.ButtonZl; - ButtonA = controllerInput.RightJoycon.ButtonA; - ButtonB = controllerInput.RightJoycon.ButtonB; - ButtonX = controllerInput.RightJoycon.ButtonX; - ButtonY = controllerInput.RightJoycon.ButtonY; - ButtonR = controllerInput.RightJoycon.ButtonR; - ButtonPlus = controllerInput.RightJoycon.ButtonPlus; + ButtonA = controllerInput.RightJoycon.ButtonA; + ButtonB = controllerInput.RightJoycon.ButtonB; + ButtonX = controllerInput.RightJoycon.ButtonX; + ButtonY = controllerInput.RightJoycon.ButtonY; + ButtonR = controllerInput.RightJoycon.ButtonR; + ButtonPlus = controllerInput.RightJoycon.ButtonPlus; RightButtonSl = controllerInput.RightJoycon.ButtonSl; RightButtonSr = controllerInput.RightJoycon.ButtonSr; - ButtonZr = controllerInput.RightJoycon.ButtonZr; + ButtonZr = controllerInput.RightJoycon.ButtonZr; DeadzoneLeft = controllerInput.DeadzoneLeft; DeadzoneRight = controllerInput.DeadzoneRight; @@ -521,7 +516,7 @@ namespace Ryujinx.Ava.UI.Models.Input ButtonSl = RightButtonSl, ButtonSr = RightButtonSr, ButtonR = ButtonR, - ButtonZr = ButtonZr, + ButtonZr = ButtonZr }, LeftJoyconStick = new JoyconConfigControllerStick { @@ -529,7 +524,7 @@ namespace Ryujinx.Ava.UI.Models.Input InvertStickX = LeftInvertStickX, InvertStickY = LeftInvertStickY, Rotate90CW = LeftRotate90, - StickButton = LeftStickButton, + StickButton = LeftStickButton }, RightJoyconStick = new JoyconConfigControllerStick { @@ -537,7 +532,7 @@ namespace Ryujinx.Ava.UI.Models.Input InvertStickX = RightInvertStickX, InvertStickY = RightInvertStickY, Rotate90CW = RightRotate90, - StickButton = RightStickButton, + StickButton = RightStickButton }, Rumble = new RumbleConfigController { @@ -550,7 +545,7 @@ namespace Ryujinx.Ava.UI.Models.Input DeadzoneRight = DeadzoneRight, RangeLeft = RangeLeft, RangeRight = RangeRight, - TriggerThreshold = TriggerThreshold, + TriggerThreshold = TriggerThreshold }; if (EnableCemuHookMotion) diff --git a/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs index 33ef38186..8355f26fb 100644 --- a/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs @@ -331,37 +331,37 @@ namespace Ryujinx.Ava.UI.Models.Input return; } - LeftStickUp = keyboardConfig.LeftJoyconStick.StickUp; - LeftStickDown = keyboardConfig.LeftJoyconStick.StickDown; - LeftStickLeft = keyboardConfig.LeftJoyconStick.StickLeft; - LeftStickRight = keyboardConfig.LeftJoyconStick.StickRight; - LeftStickButton = keyboardConfig.LeftJoyconStick.StickButton; + LeftStickUp = keyboardConfig.LeftJoyconStick.StickUp; + LeftStickDown = keyboardConfig.LeftJoyconStick.StickDown; + LeftStickLeft = keyboardConfig.LeftJoyconStick.StickLeft; + LeftStickRight = keyboardConfig.LeftJoyconStick.StickRight; + LeftStickButton = keyboardConfig.LeftJoyconStick.StickButton; - RightStickUp = keyboardConfig.RightJoyconStick.StickUp; - RightStickDown = keyboardConfig.RightJoyconStick.StickDown; - RightStickLeft = keyboardConfig.RightJoyconStick.StickLeft; - RightStickRight = keyboardConfig.RightJoyconStick.StickRight; + RightStickUp = keyboardConfig.RightJoyconStick.StickUp; + RightStickDown = keyboardConfig.RightJoyconStick.StickDown; + RightStickLeft = keyboardConfig.RightJoyconStick.StickLeft; + RightStickRight = keyboardConfig.RightJoyconStick.StickRight; RightStickButton = keyboardConfig.RightJoyconStick.StickButton; - DpadUp = keyboardConfig.LeftJoycon.DpadUp; - DpadDown = keyboardConfig.LeftJoycon.DpadDown; - DpadLeft = keyboardConfig.LeftJoycon.DpadLeft; - DpadRight = keyboardConfig.LeftJoycon.DpadRight; - ButtonL = keyboardConfig.LeftJoycon.ButtonL; - ButtonMinus = keyboardConfig.LeftJoycon.ButtonMinus; - LeftButtonSl = keyboardConfig.LeftJoycon.ButtonSl; - LeftButtonSr = keyboardConfig.LeftJoycon.ButtonSr; - ButtonZl = keyboardConfig.LeftJoycon.ButtonZl; + DpadUp = keyboardConfig.LeftJoycon.DpadUp; + DpadDown = keyboardConfig.LeftJoycon.DpadDown; + DpadLeft = keyboardConfig.LeftJoycon.DpadLeft; + DpadRight = keyboardConfig.LeftJoycon.DpadRight; + ButtonL = keyboardConfig.LeftJoycon.ButtonL; + ButtonMinus = keyboardConfig.LeftJoycon.ButtonMinus; + LeftButtonSl = keyboardConfig.LeftJoycon.ButtonSl; + LeftButtonSr = keyboardConfig.LeftJoycon.ButtonSr; + ButtonZl = keyboardConfig.LeftJoycon.ButtonZl; - ButtonA = keyboardConfig.RightJoycon.ButtonA; - ButtonB = keyboardConfig.RightJoycon.ButtonB; - ButtonX = keyboardConfig.RightJoycon.ButtonX; - ButtonY = keyboardConfig.RightJoycon.ButtonY; - ButtonR = keyboardConfig.RightJoycon.ButtonR; - ButtonPlus = keyboardConfig.RightJoycon.ButtonPlus; + ButtonA = keyboardConfig.RightJoycon.ButtonA; + ButtonB = keyboardConfig.RightJoycon.ButtonB; + ButtonX = keyboardConfig.RightJoycon.ButtonX; + ButtonY = keyboardConfig.RightJoycon.ButtonY; + ButtonR = keyboardConfig.RightJoycon.ButtonR; + ButtonPlus = keyboardConfig.RightJoycon.ButtonPlus; RightButtonSl = keyboardConfig.RightJoycon.ButtonSl; RightButtonSr = keyboardConfig.RightJoycon.ButtonSr; - ButtonZr = keyboardConfig.RightJoycon.ButtonZr; + ButtonZr = keyboardConfig.RightJoycon.ButtonZr; } } @@ -383,7 +383,7 @@ namespace Ryujinx.Ava.UI.Models.Input ButtonMinus = ButtonMinus, ButtonZl = ButtonZl, ButtonSl = LeftButtonSl, - ButtonSr = LeftButtonSr, + ButtonSr = LeftButtonSr }, RightJoycon = new RightJoyconCommonConfig { diff --git a/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs index 52e2d2c53..bf94101d4 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/Input/ControllerInputViewModel.cs @@ -56,6 +56,14 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public InputViewModel parentModel; + public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config) + { + parentModel = model; + model.NotifyChangesEvent += OnParentModelChanged; + OnParentModelChanged(); + Config = config; + } + public async void ShowMotionConfig() { await MotionInputView.Show(this); @@ -66,15 +74,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input await RumbleInputView.Show(this); } - public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config) - { - parentModel = model; - model.NotifyChangesEvent += UpdateParentModelValues; - UpdateParentModelValues(); - Config = config; - } - - public void UpdateParentModelValues() + public void OnParentModelChanged() { IsLeft = parentModel.IsLeft; IsRight = parentModel.IsRight; diff --git a/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs index b9f4c8602..7b7e9bbe7 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/Input/KeyboardInputViewModel.cs @@ -58,12 +58,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config) { parentModel = model; - model.NotifyChangesEvent += UpdateParentModelValues; - UpdateParentModelValues(); + model.NotifyChangesEvent += OnParentModelChanged; + OnParentModelChanged(); Config = config; } - public void UpdateParentModelValues() + public void OnParentModelChanged() { IsLeft = parentModel.IsLeft; IsRight = parentModel.IsRight; diff --git a/src/Ryujinx/UI/Windows/ControllerWindow.cs b/src/Ryujinx/UI/Windows/ControllerWindow.cs index 46fd4224c..60cb56776 100644 --- a/src/Ryujinx/UI/Windows/ControllerWindow.cs +++ b/src/Ryujinx/UI/Windows/ControllerWindow.cs @@ -893,7 +893,7 @@ namespace Ryujinx.UI.Windows } } - object pressedButton = assigner.GetPressedButton(); + string pressedButton = assigner.GetPressedButton().ToString(); Application.Invoke(delegate { @@ -903,7 +903,7 @@ namespace Ryujinx.UI.Windows } else if (pressedButton != "") { - button.Label = pressedButton.ToString(); + button.Label = pressedButton; } _middleMousePressed = false;