mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-16 18:46:36 +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
@ -313,6 +313,33 @@ namespace Ryujinx.Input.SDL2
|
||||
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)
|
||||
{
|
||||
if (inputId == StickInputId.Unbound)
|
||||
@ -343,24 +370,19 @@ namespace Ryujinx.Input.SDL2
|
||||
|
||||
if (HasConfiguration)
|
||||
{
|
||||
if ((inputId == StickInputId.Left && _configuration.LeftJoyconStick.InvertStickX) ||
|
||||
(inputId == StickInputId.Right && _configuration.RightJoyconStick.InvertStickX))
|
||||
{
|
||||
resultX = -resultX;
|
||||
}
|
||||
var joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
||||
|
||||
if ((inputId == StickInputId.Left && _configuration.LeftJoyconStick.InvertStickY) ||
|
||||
(inputId == StickInputId.Right && _configuration.RightJoyconStick.InvertStickY))
|
||||
if (joyconStickConfig != null)
|
||||
{
|
||||
resultY = -resultY;
|
||||
}
|
||||
if (joyconStickConfig.InvertStickX) resultX = -resultX;
|
||||
if (joyconStickConfig.InvertStickY) resultY = -resultY;
|
||||
|
||||
if ((inputId == StickInputId.Left && _configuration.LeftJoyconStick.Rotate90CW) ||
|
||||
(inputId == StickInputId.Right && _configuration.RightJoyconStick.Rotate90CW))
|
||||
{
|
||||
float temp = resultX;
|
||||
resultX = resultY;
|
||||
resultY = -temp;
|
||||
if (joyconStickConfig.Rotate90CW)
|
||||
{
|
||||
float temp = resultX;
|
||||
resultX = resultY;
|
||||
resultY = -temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user