mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-18 04:16:39 +00:00
Fix issues with Invert X / Y and Rotate when mapping different physical stick to JoyCon logical stick
This commit is contained in:
parent
268c9aecf8
commit
89c2c6c76b
1 changed files with 37 additions and 15 deletions
|
@ -313,6 +313,33 @@ namespace Ryujinx.Input.SDL2
|
||||||
return value * ConvertRate;
|
return value * ConvertRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JoyconConfigControllerStick<GamepadInputId, Common.Configuration.Hid.Controller.StickInputId> GetLogicalJoyStickConfig(StickInputId inputId)
|
||||||
|
{
|
||||||
|
switch(inputId)
|
||||||
|
{
|
||||||
|
case StickInputId.Left:
|
||||||
|
if (_configuration.RightJoyconStick.Joystick == Common.Configuration.Hid.Controller.StickInputId.Left)
|
||||||
|
{
|
||||||
|
return _configuration.RightJoyconStick;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _configuration.LeftJoyconStick;
|
||||||
|
}
|
||||||
|
case StickInputId.Right:
|
||||||
|
if (_configuration.LeftJoyconStick.Joystick == Common.Configuration.Hid.Controller.StickInputId.Right)
|
||||||
|
{
|
||||||
|
return _configuration.LeftJoyconStick;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _configuration.RightJoyconStick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public (float, float) GetStick(StickInputId inputId)
|
public (float, float) GetStick(StickInputId inputId)
|
||||||
{
|
{
|
||||||
if (inputId == StickInputId.Unbound)
|
if (inputId == StickInputId.Unbound)
|
||||||
|
@ -343,26 +370,21 @@ namespace Ryujinx.Input.SDL2
|
||||||
|
|
||||||
if (HasConfiguration)
|
if (HasConfiguration)
|
||||||
{
|
{
|
||||||
if ((inputId == StickInputId.Left && _configuration.LeftJoyconStick.InvertStickX) ||
|
var joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
||||||
(inputId == StickInputId.Right && _configuration.RightJoyconStick.InvertStickX))
|
|
||||||
{
|
|
||||||
resultX = -resultX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((inputId == StickInputId.Left && _configuration.LeftJoyconStick.InvertStickY) ||
|
if (joyconStickConfig != null)
|
||||||
(inputId == StickInputId.Right && _configuration.RightJoyconStick.InvertStickY))
|
|
||||||
{
|
{
|
||||||
resultY = -resultY;
|
if (joyconStickConfig.InvertStickX) resultX = -resultX;
|
||||||
}
|
if (joyconStickConfig.InvertStickY) resultY = -resultY;
|
||||||
|
|
||||||
if ((inputId == StickInputId.Left && _configuration.LeftJoyconStick.Rotate90CW) ||
|
if (joyconStickConfig.Rotate90CW)
|
||||||
(inputId == StickInputId.Right && _configuration.RightJoyconStick.Rotate90CW))
|
|
||||||
{
|
{
|
||||||
float temp = resultX;
|
float temp = resultX;
|
||||||
resultX = resultY;
|
resultX = resultY;
|
||||||
resultY = -temp;
|
resultY = -temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (resultX, resultY);
|
return (resultX, resultY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue