Ack Suggestions

Remaining ack suggestions

Update src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>

Update src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
Isaac Marovitz 2023-05-28 17:44:13 -04:00
parent 71fa81017b
commit 5e8eedae37
6 changed files with 72 additions and 77 deletions

View file

@ -275,8 +275,8 @@
"KeyAltRight": "Alt Right", "KeyAltRight": "Alt Right",
"KeyOptLeft": "⌥ Left", "KeyOptLeft": "⌥ Left",
"KeyOptRight": "⌥ Right", "KeyOptRight": "⌥ Right",
"KeyWinLeft": "Windows Left", "KeyWinLeft": " Left",
"KeyWinRight": "Windows Right", "KeyWinRight": " Right",
"KeyCmdLeft": "⌘ Left", "KeyCmdLeft": "⌘ Left",
"KeyCmdRight": "⌘ Right", "KeyCmdRight": "⌘ Right",
"KeyMenu": "Menu", "KeyMenu": "Menu",

View file

@ -14,11 +14,11 @@ namespace Ryujinx.Ava.UI.Models.Input
public int Slot { get; set; } public int Slot { get; set; }
public int AltSlot { get; set; } public int AltSlot { get; set; }
public bool MirrorInput { get; set; } public bool MirrorInput { get; set; }
public int Sensitivity { get; set; } public int Sensitivity { get; set; }
public double GyroDeadzone { get; set; } public double GyroDeadzone { get; set; }
public float WeakRumble { get; set; } public float WeakRumble { get; set; }
public float StrongRumble { get; set; } public float StrongRumble { get; set; }
public string Id { get; set; } public string Id { get; set; }
public ControllerType ControllerType { get; set; } public ControllerType ControllerType { get; set; }
@ -339,7 +339,6 @@ namespace Ryujinx.Ava.UI.Models.Input
set set
{ {
_deadzoneLeft = MathF.Round(value, 3); _deadzoneLeft = MathF.Round(value, 3);
OnPropertyChanged(); OnPropertyChanged();
} }
} }
@ -351,7 +350,6 @@ namespace Ryujinx.Ava.UI.Models.Input
set set
{ {
_deadzoneRight = MathF.Round(value, 3); _deadzoneRight = MathF.Round(value, 3);
OnPropertyChanged(); OnPropertyChanged();
} }
} }
@ -363,7 +361,6 @@ namespace Ryujinx.Ava.UI.Models.Input
set set
{ {
_rangeLeft = MathF.Round(value, 3); _rangeLeft = MathF.Round(value, 3);
OnPropertyChanged(); OnPropertyChanged();
} }
} }
@ -375,7 +372,6 @@ namespace Ryujinx.Ava.UI.Models.Input
set set
{ {
_rangeRight = MathF.Round(value, 3); _rangeRight = MathF.Round(value, 3);
OnPropertyChanged(); OnPropertyChanged();
} }
} }
@ -387,7 +383,6 @@ namespace Ryujinx.Ava.UI.Models.Input
set set
{ {
_triggerThreshold = MathF.Round(value, 3); _triggerThreshold = MathF.Round(value, 3);
OnPropertyChanged(); OnPropertyChanged();
} }
} }
@ -427,37 +422,37 @@ namespace Ryujinx.Ava.UI.Models.Input
return; return;
} }
LeftJoystick = controllerInput.LeftJoyconStick.Joystick; LeftJoystick = controllerInput.LeftJoyconStick.Joystick;
LeftInvertStickX = controllerInput.LeftJoyconStick.InvertStickX; LeftInvertStickX = controllerInput.LeftJoyconStick.InvertStickX;
LeftInvertStickY = controllerInput.LeftJoyconStick.InvertStickY; LeftInvertStickY = controllerInput.LeftJoyconStick.InvertStickY;
LeftRotate90 = controllerInput.LeftJoyconStick.Rotate90CW; LeftRotate90 = controllerInput.LeftJoyconStick.Rotate90CW;
LeftStickButton = controllerInput.LeftJoyconStick.StickButton; LeftStickButton = controllerInput.LeftJoyconStick.StickButton;
RightJoystick = controllerInput.RightJoyconStick.Joystick; RightJoystick = controllerInput.RightJoyconStick.Joystick;
RightInvertStickX = controllerInput.RightJoyconStick.InvertStickX; RightInvertStickX = controllerInput.RightJoyconStick.InvertStickX;
RightInvertStickY = controllerInput.RightJoyconStick.InvertStickY; RightInvertStickY = controllerInput.RightJoyconStick.InvertStickY;
RightRotate90 = controllerInput.RightJoyconStick.Rotate90CW; RightRotate90 = controllerInput.RightJoyconStick.Rotate90CW;
RightStickButton = controllerInput.RightJoyconStick.StickButton; RightStickButton = controllerInput.RightJoyconStick.StickButton;
DpadUp = controllerInput.LeftJoycon.DpadUp; DpadUp = controllerInput.LeftJoycon.DpadUp;
DpadDown = controllerInput.LeftJoycon.DpadDown; DpadDown = controllerInput.LeftJoycon.DpadDown;
DpadLeft = controllerInput.LeftJoycon.DpadLeft; DpadLeft = controllerInput.LeftJoycon.DpadLeft;
DpadRight = controllerInput.LeftJoycon.DpadRight; DpadRight = controllerInput.LeftJoycon.DpadRight;
ButtonL = controllerInput.LeftJoycon.ButtonL; ButtonL = controllerInput.LeftJoycon.ButtonL;
ButtonMinus = controllerInput.LeftJoycon.ButtonMinus; ButtonMinus = controllerInput.LeftJoycon.ButtonMinus;
LeftButtonSl = controllerInput.LeftJoycon.ButtonSl; LeftButtonSl = controllerInput.LeftJoycon.ButtonSl;
LeftButtonSr = controllerInput.LeftJoycon.ButtonSr; LeftButtonSr = controllerInput.LeftJoycon.ButtonSr;
ButtonZl = controllerInput.LeftJoycon.ButtonZl; ButtonZl = controllerInput.LeftJoycon.ButtonZl;
ButtonA = controllerInput.RightJoycon.ButtonA; ButtonA = controllerInput.RightJoycon.ButtonA;
ButtonB = controllerInput.RightJoycon.ButtonB; ButtonB = controllerInput.RightJoycon.ButtonB;
ButtonX = controllerInput.RightJoycon.ButtonX; ButtonX = controllerInput.RightJoycon.ButtonX;
ButtonY = controllerInput.RightJoycon.ButtonY; ButtonY = controllerInput.RightJoycon.ButtonY;
ButtonR = controllerInput.RightJoycon.ButtonR; ButtonR = controllerInput.RightJoycon.ButtonR;
ButtonPlus = controllerInput.RightJoycon.ButtonPlus; ButtonPlus = controllerInput.RightJoycon.ButtonPlus;
RightButtonSl = controllerInput.RightJoycon.ButtonSl; RightButtonSl = controllerInput.RightJoycon.ButtonSl;
RightButtonSr = controllerInput.RightJoycon.ButtonSr; RightButtonSr = controllerInput.RightJoycon.ButtonSr;
ButtonZr = controllerInput.RightJoycon.ButtonZr; ButtonZr = controllerInput.RightJoycon.ButtonZr;
DeadzoneLeft = controllerInput.DeadzoneLeft; DeadzoneLeft = controllerInput.DeadzoneLeft;
DeadzoneRight = controllerInput.DeadzoneRight; DeadzoneRight = controllerInput.DeadzoneRight;
@ -521,7 +516,7 @@ namespace Ryujinx.Ava.UI.Models.Input
ButtonSl = RightButtonSl, ButtonSl = RightButtonSl,
ButtonSr = RightButtonSr, ButtonSr = RightButtonSr,
ButtonR = ButtonR, ButtonR = ButtonR,
ButtonZr = ButtonZr, ButtonZr = ButtonZr
}, },
LeftJoyconStick = new JoyconConfigControllerStick<GamepadInputId, StickInputId> LeftJoyconStick = new JoyconConfigControllerStick<GamepadInputId, StickInputId>
{ {
@ -529,7 +524,7 @@ namespace Ryujinx.Ava.UI.Models.Input
InvertStickX = LeftInvertStickX, InvertStickX = LeftInvertStickX,
InvertStickY = LeftInvertStickY, InvertStickY = LeftInvertStickY,
Rotate90CW = LeftRotate90, Rotate90CW = LeftRotate90,
StickButton = LeftStickButton, StickButton = LeftStickButton
}, },
RightJoyconStick = new JoyconConfigControllerStick<GamepadInputId, StickInputId> RightJoyconStick = new JoyconConfigControllerStick<GamepadInputId, StickInputId>
{ {
@ -537,7 +532,7 @@ namespace Ryujinx.Ava.UI.Models.Input
InvertStickX = RightInvertStickX, InvertStickX = RightInvertStickX,
InvertStickY = RightInvertStickY, InvertStickY = RightInvertStickY,
Rotate90CW = RightRotate90, Rotate90CW = RightRotate90,
StickButton = RightStickButton, StickButton = RightStickButton
}, },
Rumble = new RumbleConfigController Rumble = new RumbleConfigController
{ {
@ -550,7 +545,7 @@ namespace Ryujinx.Ava.UI.Models.Input
DeadzoneRight = DeadzoneRight, DeadzoneRight = DeadzoneRight,
RangeLeft = RangeLeft, RangeLeft = RangeLeft,
RangeRight = RangeRight, RangeRight = RangeRight,
TriggerThreshold = TriggerThreshold, TriggerThreshold = TriggerThreshold
}; };
if (EnableCemuHookMotion) if (EnableCemuHookMotion)

View file

@ -331,37 +331,37 @@ namespace Ryujinx.Ava.UI.Models.Input
return; return;
} }
LeftStickUp = keyboardConfig.LeftJoyconStick.StickUp; LeftStickUp = keyboardConfig.LeftJoyconStick.StickUp;
LeftStickDown = keyboardConfig.LeftJoyconStick.StickDown; LeftStickDown = keyboardConfig.LeftJoyconStick.StickDown;
LeftStickLeft = keyboardConfig.LeftJoyconStick.StickLeft; LeftStickLeft = keyboardConfig.LeftJoyconStick.StickLeft;
LeftStickRight = keyboardConfig.LeftJoyconStick.StickRight; LeftStickRight = keyboardConfig.LeftJoyconStick.StickRight;
LeftStickButton = keyboardConfig.LeftJoyconStick.StickButton; LeftStickButton = keyboardConfig.LeftJoyconStick.StickButton;
RightStickUp = keyboardConfig.RightJoyconStick.StickUp; RightStickUp = keyboardConfig.RightJoyconStick.StickUp;
RightStickDown = keyboardConfig.RightJoyconStick.StickDown; RightStickDown = keyboardConfig.RightJoyconStick.StickDown;
RightStickLeft = keyboardConfig.RightJoyconStick.StickLeft; RightStickLeft = keyboardConfig.RightJoyconStick.StickLeft;
RightStickRight = keyboardConfig.RightJoyconStick.StickRight; RightStickRight = keyboardConfig.RightJoyconStick.StickRight;
RightStickButton = keyboardConfig.RightJoyconStick.StickButton; RightStickButton = keyboardConfig.RightJoyconStick.StickButton;
DpadUp = keyboardConfig.LeftJoycon.DpadUp; DpadUp = keyboardConfig.LeftJoycon.DpadUp;
DpadDown = keyboardConfig.LeftJoycon.DpadDown; DpadDown = keyboardConfig.LeftJoycon.DpadDown;
DpadLeft = keyboardConfig.LeftJoycon.DpadLeft; DpadLeft = keyboardConfig.LeftJoycon.DpadLeft;
DpadRight = keyboardConfig.LeftJoycon.DpadRight; DpadRight = keyboardConfig.LeftJoycon.DpadRight;
ButtonL = keyboardConfig.LeftJoycon.ButtonL; ButtonL = keyboardConfig.LeftJoycon.ButtonL;
ButtonMinus = keyboardConfig.LeftJoycon.ButtonMinus; ButtonMinus = keyboardConfig.LeftJoycon.ButtonMinus;
LeftButtonSl = keyboardConfig.LeftJoycon.ButtonSl; LeftButtonSl = keyboardConfig.LeftJoycon.ButtonSl;
LeftButtonSr = keyboardConfig.LeftJoycon.ButtonSr; LeftButtonSr = keyboardConfig.LeftJoycon.ButtonSr;
ButtonZl = keyboardConfig.LeftJoycon.ButtonZl; ButtonZl = keyboardConfig.LeftJoycon.ButtonZl;
ButtonA = keyboardConfig.RightJoycon.ButtonA; ButtonA = keyboardConfig.RightJoycon.ButtonA;
ButtonB = keyboardConfig.RightJoycon.ButtonB; ButtonB = keyboardConfig.RightJoycon.ButtonB;
ButtonX = keyboardConfig.RightJoycon.ButtonX; ButtonX = keyboardConfig.RightJoycon.ButtonX;
ButtonY = keyboardConfig.RightJoycon.ButtonY; ButtonY = keyboardConfig.RightJoycon.ButtonY;
ButtonR = keyboardConfig.RightJoycon.ButtonR; ButtonR = keyboardConfig.RightJoycon.ButtonR;
ButtonPlus = keyboardConfig.RightJoycon.ButtonPlus; ButtonPlus = keyboardConfig.RightJoycon.ButtonPlus;
RightButtonSl = keyboardConfig.RightJoycon.ButtonSl; RightButtonSl = keyboardConfig.RightJoycon.ButtonSl;
RightButtonSr = keyboardConfig.RightJoycon.ButtonSr; RightButtonSr = keyboardConfig.RightJoycon.ButtonSr;
ButtonZr = keyboardConfig.RightJoycon.ButtonZr; ButtonZr = keyboardConfig.RightJoycon.ButtonZr;
} }
} }
@ -383,7 +383,7 @@ namespace Ryujinx.Ava.UI.Models.Input
ButtonMinus = ButtonMinus, ButtonMinus = ButtonMinus,
ButtonZl = ButtonZl, ButtonZl = ButtonZl,
ButtonSl = LeftButtonSl, ButtonSl = LeftButtonSl,
ButtonSr = LeftButtonSr, ButtonSr = LeftButtonSr
}, },
RightJoycon = new RightJoyconCommonConfig<Key> RightJoycon = new RightJoyconCommonConfig<Key>
{ {

View file

@ -56,6 +56,14 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public InputViewModel parentModel; public InputViewModel parentModel;
public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config)
{
parentModel = model;
model.NotifyChangesEvent += OnParentModelChanged;
OnParentModelChanged();
Config = config;
}
public async void ShowMotionConfig() public async void ShowMotionConfig()
{ {
await MotionInputView.Show(this); await MotionInputView.Show(this);
@ -66,15 +74,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
await RumbleInputView.Show(this); await RumbleInputView.Show(this);
} }
public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config) public void OnParentModelChanged()
{
parentModel = model;
model.NotifyChangesEvent += UpdateParentModelValues;
UpdateParentModelValues();
Config = config;
}
public void UpdateParentModelValues()
{ {
IsLeft = parentModel.IsLeft; IsLeft = parentModel.IsLeft;
IsRight = parentModel.IsRight; IsRight = parentModel.IsRight;

View file

@ -58,12 +58,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config) public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config)
{ {
parentModel = model; parentModel = model;
model.NotifyChangesEvent += UpdateParentModelValues; model.NotifyChangesEvent += OnParentModelChanged;
UpdateParentModelValues(); OnParentModelChanged();
Config = config; Config = config;
} }
public void UpdateParentModelValues() public void OnParentModelChanged()
{ {
IsLeft = parentModel.IsLeft; IsLeft = parentModel.IsLeft;
IsRight = parentModel.IsRight; IsRight = parentModel.IsRight;

View file

@ -893,7 +893,7 @@ namespace Ryujinx.UI.Windows
} }
} }
object pressedButton = assigner.GetPressedButton(); string pressedButton = assigner.GetPressedButton().ToString();
Application.Invoke(delegate Application.Invoke(delegate
{ {
@ -903,7 +903,7 @@ namespace Ryujinx.UI.Windows
} }
else if (pressedButton != "") else if (pressedButton != "")
{ {
button.Label = pressedButton.ToString(); button.Label = pressedButton;
} }
_middleMousePressed = false; _middleMousePressed = false;