mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 22:25:38 +00:00
filterTrigger: filter negative trigger axis event after positive axis detection
If filterTrigger detects a positive axis event on a common trigger axis while also configuring a trigger, the next input event will be a negative axis press (as the trigger needs to transition from >0 to rest at -32767). Filter this negative event or else the next item in the configuration dialog (typically "left thumb") will erroneously detect this as a separate event.
This commit is contained in:
parent
5edecef9c8
commit
7ac6ffcdbe
|
@ -352,16 +352,28 @@ bool GuiInputConfig::filterTrigger(Input input, InputConfig* config, int inputId
|
||||||
) && InputManager::getInstance()->getAxisCountByDevice(config->getDeviceId()) == 6)
|
) && InputManager::getInstance()->getAxisCountByDevice(config->getDeviceId()) == 6)
|
||||||
{
|
{
|
||||||
// digital triggers are unwanted
|
// digital triggers are unwanted
|
||||||
if (input.type == TYPE_BUTTON && (input.id == 6 || input.id == 7))
|
if(input.type == TYPE_BUTTON && (input.id == 6 || input.id == 7))
|
||||||
|
{
|
||||||
|
mHoldingInput = false;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore negative pole for axes 2/5 only when triggers are being configured
|
// ignore negative pole for axes 2/5 only when triggers are being configured
|
||||||
if((mSkipAxis || strstr(GUI_INPUT_CONFIG_LIST[inputId].name, "Trigger") != NULL) \
|
if(input.type == TYPE_AXIS && (input.id == 2 || input.id == 5))
|
||||||
&& input.type == TYPE_AXIS && (input.id == 2 || input.id == 5) && input.value < 0)
|
|
||||||
{
|
{
|
||||||
mSkipAxis = true;
|
if(strstr(GUI_INPUT_CONFIG_LIST[inputId].name, "Trigger") != NULL)
|
||||||
return true;
|
{
|
||||||
|
if(input.value == 1)
|
||||||
|
mSkipAxis = true;
|
||||||
|
else if(input.value == -1)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(mSkipAxis)
|
||||||
|
{
|
||||||
|
mSkipAxis = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
(void)input;
|
(void)input;
|
||||||
|
|
Loading…
Reference in a new issue