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

@ -196,6 +196,8 @@ namespace Ryujinx.Headless.SDL2
ControllerType = ControllerType.JoyconPair,
DeadzoneLeft = 0.1f,
DeadzoneRight = 0.1f,
RangeLeft = 1.0f,
RangeRight = 1.0f,
TriggerThreshold = 0.5f,
LeftJoycon = new LeftJoyconCommonConfig<ConfigGamepadInputId>
{
@ -299,6 +301,18 @@ namespace Ryujinx.Headless.SDL2
Logger.Info?.Print(LogClass.Application, $"{config.PlayerIndex} configured with {inputTypeName} \"{config.Id}\"");
// If both stick ranges are 0 (usually indicative of an outdated profile load) then both sticks will be set to 1.0.
if (config is StandardControllerInputConfig controllerConfig)
{
if (controllerConfig.RangeLeft <= 0.0f && controllerConfig.RangeRight <= 0.0f)
{
controllerConfig.RangeLeft = 1.0f;
controllerConfig.RangeRight = 1.0f;
Logger.Info?.Print(LogClass.Application, $"{config.PlayerIndex} stick range reset. Save the profile now to update your configuration");
}
}
return config;
}