Implement analog stick range modifier (#2783)

* adjust position vector + GUI

* remove brackets

* Update configuration

* Update ConfigurationFileFormat.cs

* rebase + review changes

* spacing

* revert deletion

* fix profile loading

* spacing

* comment spacing
This commit is contained in:
MutantAura 2022-01-03 11:49:29 +00:00 committed by GitHub
parent 16c649934f
commit 686757105c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 160 additions and 5 deletions

View file

@ -38,6 +38,8 @@ namespace Ryujinx.Ui.Windows
[GUI] Adjustment _controllerWeakRumble;
[GUI] Adjustment _controllerDeadzoneLeft;
[GUI] Adjustment _controllerDeadzoneRight;
[GUI] Adjustment _controllerRangeLeft;
[GUI] Adjustment _controllerRangeRight;
[GUI] Adjustment _controllerTriggerThreshold;
[GUI] Adjustment _slotNumber;
[GUI] Adjustment _altSlotNumber;
@ -59,9 +61,11 @@ namespace Ryujinx.Ui.Windows
[GUI] Grid _leftStickKeyboard;
[GUI] Grid _leftStickController;
[GUI] Box _deadZoneLeftBox;
[GUI] Box _rangeLeftBox;
[GUI] Grid _rightStickKeyboard;
[GUI] Grid _rightStickController;
[GUI] Box _deadZoneRightBox;
[GUI] Box _rangeRightBox;
[GUI] Grid _leftSideTriggerBox;
[GUI] Grid _rightSideTriggerBox;
[GUI] Box _triggerThresholdBox;
@ -316,6 +320,8 @@ namespace Ryujinx.Ui.Windows
_rightStickController.Hide();
_deadZoneLeftBox.Hide();
_deadZoneRightBox.Hide();
_rangeLeftBox.Hide();
_rangeRightBox.Hide();
_triggerThresholdBox.Hide();
_motionBox.Hide();
_rumbleBox.Hide();
@ -416,6 +422,8 @@ namespace Ryujinx.Ui.Windows
_controllerWeakRumble.Value = 1;
_controllerDeadzoneLeft.Value = 0;
_controllerDeadzoneRight.Value = 0;
_controllerRangeLeft.Value = 1;
_controllerRangeRight.Value = 1;
_controllerTriggerThreshold.Value = 0;
_mirrorInput.Active = false;
_enableMotion.Active = false;
@ -510,12 +518,23 @@ namespace Ryujinx.Ui.Windows
_enableRumble.Active = controllerConfig.Rumble.EnableRumble;
_controllerDeadzoneLeft.Value = controllerConfig.DeadzoneLeft;
_controllerDeadzoneRight.Value = controllerConfig.DeadzoneRight;
_controllerRangeLeft.Value = controllerConfig.RangeLeft;
_controllerRangeRight.Value = controllerConfig.RangeRight;
_controllerTriggerThreshold.Value = controllerConfig.TriggerThreshold;
_sensitivity.Value = controllerConfig.Motion.Sensitivity;
_gyroDeadzone.Value = controllerConfig.Motion.GyroDeadzone;
_enableMotion.Active = controllerConfig.Motion.EnableMotion;
_enableCemuHook.Active = controllerConfig.Motion.MotionBackend == MotionInputBackendType.CemuHook;
// If both stick ranges are 0 (usually indicative of an outdated profile load) then both sticks will be set to 1.0.
if (_controllerRangeLeft.Value <= 0.0 && _controllerRangeRight.Value <= 0.0)
{
_controllerRangeLeft.Value = 1.0;
_controllerRangeRight.Value = 1.0;
Logger.Info?.Print(LogClass.Application, $"{config.PlayerIndex} stick range reset. Save the profile now to update your configuration");
}
if (controllerConfig.Motion is CemuHookMotionConfigController cemuHookMotionConfig)
{
_slotNumber.Value = cemuHookMotionConfig.Slot;
@ -678,6 +697,8 @@ namespace Ryujinx.Ui.Windows
PlayerIndex = _playerIndex,
DeadzoneLeft = (float)_controllerDeadzoneLeft.Value,
DeadzoneRight = (float)_controllerDeadzoneRight.Value,
RangeLeft = (float)_controllerRangeLeft.Value,
RangeRight = (float)_controllerRangeRight.Value,
TriggerThreshold = (float)_controllerTriggerThreshold.Value,
LeftJoycon = new LeftJoyconCommonConfig<ConfigGamepadInputId>
{
@ -1013,6 +1034,8 @@ namespace Ryujinx.Ui.Windows
ControllerType = ControllerType.JoyconPair,
DeadzoneLeft = 0.1f,
DeadzoneRight = 0.1f,
RangeLeft = 1.0f,
RangeRight = 1.0f,
TriggerThreshold = 0.5f,
LeftJoycon = new LeftJoyconCommonConfig<ConfigGamepadInputId>
{