mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 13:20:57 -06:00
Fix triggers being recognized as negative analog stick values when assigning an input if the axis is moved too slowly.
This commit is contained in:
@ -245,19 +245,21 @@ protected:
|
|||||||
Sint16 axisval = SDL_JoystickGetAxis(joy, i);
|
Sint16 axisval = SDL_JoystickGetAxis(joy, i);
|
||||||
int diff = abs(axisval - axesRest[i]);
|
int diff = abs(axisval - axesRest[i]);
|
||||||
|
|
||||||
if (axesRest[i] < -16384 && axisval >= 0)
|
if (diff >= 16384)
|
||||||
{
|
{
|
||||||
*mapping = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);
|
if (axesRest[i] < -16384) // Trigger
|
||||||
click();
|
{
|
||||||
return;
|
*mapping = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);
|
||||||
}
|
}
|
||||||
else if (diff > 16384)
|
else // Analog stick
|
||||||
{
|
{
|
||||||
int axistype;
|
int axistype;
|
||||||
if (axisval > 0) axistype = 0;
|
if (axisval > 0) axistype = 0;
|
||||||
else axistype = 1;
|
else axistype = 1;
|
||||||
|
|
||||||
|
*mapping = (oldmap & 0xFFFF) | 0x10000 | (axistype << 20) | (i << 24);
|
||||||
|
}
|
||||||
|
|
||||||
*mapping = (oldmap & 0xFFFF) | 0x10000 | (axistype << 20) | (i << 24);
|
|
||||||
click();
|
click();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user