diff --git a/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs b/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs index 53e0d560d..fc7a5fd11 100644 --- a/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs +++ b/src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs @@ -474,69 +474,71 @@ namespace Ryujinx.Ava.UI.Models.Input ControllerType = config.ControllerType; PlayerIndex = config.PlayerIndex; - if (config is StandardControllerInputConfig controllerInput) + if (config is not StandardControllerInputConfig controllerInput) { - LeftJoystick = controllerInput.LeftJoyconStick.Joystick; - LeftInvertStickX = controllerInput.LeftJoyconStick.InvertStickX; - LeftInvertStickY = controllerInput.LeftJoyconStick.InvertStickY; - LeftRotate90 = controllerInput.LeftJoyconStick.Rotate90CW; - LeftControllerStickButton = controllerInput.LeftJoyconStick.StickButton; + return; + } - RightJoystick = controllerInput.RightJoyconStick.Joystick; - RightInvertStickX = controllerInput.RightJoyconStick.InvertStickX; - RightInvertStickY = controllerInput.RightJoyconStick.InvertStickY; - RightRotate90 = controllerInput.RightJoyconStick.Rotate90CW; - RightControllerStickButton = controllerInput.RightJoyconStick.StickButton; + LeftJoystick = controllerInput.LeftJoyconStick.Joystick; + LeftInvertStickX = controllerInput.LeftJoyconStick.InvertStickX; + LeftInvertStickY = controllerInput.LeftJoyconStick.InvertStickY; + LeftRotate90 = controllerInput.LeftJoyconStick.Rotate90CW; + LeftControllerStickButton = controllerInput.LeftJoyconStick.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; + RightJoystick = controllerInput.RightJoyconStick.Joystick; + RightInvertStickX = controllerInput.RightJoyconStick.InvertStickX; + RightInvertStickY = controllerInput.RightJoyconStick.InvertStickY; + RightRotate90 = controllerInput.RightJoyconStick.Rotate90CW; + RightControllerStickButton = controllerInput.RightJoyconStick.StickButton; - 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; + 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; - DeadzoneLeft = controllerInput.DeadzoneLeft; - DeadzoneRight = controllerInput.DeadzoneRight; - RangeLeft = controllerInput.RangeLeft; - RangeRight = controllerInput.RangeRight; - TriggerThreshold = controllerInput.TriggerThreshold; + 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; - if (controllerInput.Motion != null) + DeadzoneLeft = controllerInput.DeadzoneLeft; + DeadzoneRight = controllerInput.DeadzoneRight; + RangeLeft = controllerInput.RangeLeft; + RangeRight = controllerInput.RangeRight; + TriggerThreshold = controllerInput.TriggerThreshold; + + if (controllerInput.Motion != null) + { + EnableMotion = controllerInput.Motion.EnableMotion; + MotionBackend = controllerInput.Motion.MotionBackend; + GyroDeadzone = controllerInput.Motion.GyroDeadzone; + Sensitivity = controllerInput.Motion.Sensitivity; + + if (controllerInput.Motion is CemuHookMotionConfigController cemuHook) { - EnableMotion = controllerInput.Motion.EnableMotion; - MotionBackend = controllerInput.Motion.MotionBackend; - GyroDeadzone = controllerInput.Motion.GyroDeadzone; - Sensitivity = controllerInput.Motion.Sensitivity; + EnableCemuHookMotion = true; + DsuServerHost = cemuHook.DsuServerHost; + DsuServerPort = cemuHook.DsuServerPort; + Slot = cemuHook.Slot; + AltSlot = cemuHook.AltSlot; + MirrorInput = cemuHook.MirrorInput; + } - if (controllerInput.Motion is CemuHookMotionConfigController cemuHook) - { - EnableCemuHookMotion = true; - DsuServerHost = cemuHook.DsuServerHost; - DsuServerPort = cemuHook.DsuServerPort; - Slot = cemuHook.Slot; - AltSlot = cemuHook.AltSlot; - MirrorInput = cemuHook.MirrorInput; - } - - if (controllerInput.Rumble != null) - { - EnableRumble = controllerInput.Rumble.EnableRumble; - WeakRumble = controllerInput.Rumble.WeakRumble; - StrongRumble = controllerInput.Rumble.StrongRumble; - } + if (controllerInput.Rumble != null) + { + EnableRumble = controllerInput.Rumble.EnableRumble; + WeakRumble = controllerInput.Rumble.WeakRumble; + StrongRumble = controllerInput.Rumble.StrongRumble; } } } diff --git a/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs index 9b43ab7ec..f35413283 100644 --- a/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx.Ava/UI/Models/Input/KeyboardInputConfig.cs @@ -322,38 +322,44 @@ namespace Ryujinx.Ava.UI.Models.Input { if (config != null) { - if (config is StandardKeyboardInputConfig keyboardConfig) + Id = config.Id; + ControllerType = config.ControllerType; + PlayerIndex = config.PlayerIndex; + + if (config is not StandardKeyboardInputConfig keyboardConfig) { - LeftStickUp = keyboardConfig.LeftJoyconStick.StickUp; - LeftStickDown = keyboardConfig.LeftJoyconStick.StickDown; - LeftStickLeft = keyboardConfig.LeftJoyconStick.StickLeft; - LeftStickRight = keyboardConfig.LeftJoyconStick.StickRight; - - RightStickUp = keyboardConfig.RightJoyconStick.StickUp; - RightStickDown = keyboardConfig.RightJoyconStick.StickDown; - RightStickLeft = keyboardConfig.RightJoyconStick.StickLeft; - RightStickRight = keyboardConfig.RightJoyconStick.StickRight; - - 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; - RightButtonSl = keyboardConfig.RightJoycon.ButtonSl; - RightButtonSr = keyboardConfig.RightJoycon.ButtonSr; - ButtonZr = keyboardConfig.RightJoycon.ButtonZr; + return; } + + LeftStickUp = keyboardConfig.LeftJoyconStick.StickUp; + LeftStickDown = keyboardConfig.LeftJoyconStick.StickDown; + LeftStickLeft = keyboardConfig.LeftJoyconStick.StickLeft; + LeftStickRight = keyboardConfig.LeftJoyconStick.StickRight; + + RightStickUp = keyboardConfig.RightJoyconStick.StickUp; + RightStickDown = keyboardConfig.RightJoyconStick.StickDown; + RightStickLeft = keyboardConfig.RightJoyconStick.StickLeft; + RightStickRight = keyboardConfig.RightJoyconStick.StickRight; + + 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; + RightButtonSl = keyboardConfig.RightJoycon.ButtonSl; + RightButtonSr = keyboardConfig.RightJoycon.ButtonSr; + ButtonZr = keyboardConfig.RightJoycon.ButtonZr; } }