mirror of https://github.com/stella-emu/stella.git
prevent menu navigation with analog input
This commit is contained in:
parent
628baef1d2
commit
c30cd906a6
|
@ -610,12 +610,13 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
|||
if(j)
|
||||
{
|
||||
int button = j->buttonLast[stick];
|
||||
bool isAnalog = abs(j->axisLastValue[axis] - value) < 30000;
|
||||
|
||||
if(myHandler.state() == EventHandlerState::EMULATION)
|
||||
{
|
||||
// Check for analog events, which are handled differently
|
||||
// A value change lower than ~90% indicates analog input
|
||||
if(abs(j->axisLastValue[axis] - value) < 30000)
|
||||
if(isAnalog)
|
||||
{
|
||||
Event::Type eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG);
|
||||
|
||||
|
@ -648,9 +649,11 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
|||
}
|
||||
}
|
||||
}
|
||||
j->axisLastValue[axis] = value;
|
||||
}
|
||||
else if(myHandler.hasOverlay())
|
||||
{
|
||||
// prevent menu navigation by analog input
|
||||
if(!isAnalog)
|
||||
{
|
||||
// First, clamp the values to simulate digital input
|
||||
// (the only thing that the underlying code understands)
|
||||
|
@ -668,10 +671,11 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
|||
#ifdef GUI_SUPPORT
|
||||
myHandler.overlay().handleJoyAxisEvent(stick, JoyAxis(axis), convertAxisValue(value), button);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
j->axisLastValue[axis] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue