mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 05:39:18 +01:00
Fix inverted axis polarity
In the case of axis value being zero, polarity would favor one side of the stick resulting in invalid values. Fix that by taking into account axis history when calculating polarity.
This commit is contained in:
parent
675e8dbb2e
commit
f1ec771944
@ -138,7 +138,7 @@ class InputHandler(private val inputManager : InputManager, private val preferen
|
||||
var value = event.getAxisValue(axis)
|
||||
|
||||
if ((event.historySize != 0 && value != event.getHistoricalAxisValue(axis, 0)) || (axesHistory[axisItem.index]?.let { it == value } == false)) {
|
||||
var polarity = value >= 0
|
||||
var polarity = value > 0 || (value == 0f && axesHistory[axisItem.index]?.let { it >= 0 } == true)
|
||||
|
||||
val guestEvent = MotionHostEvent(event.device.descriptor, axis, polarity).let { hostEvent ->
|
||||
inputManager.eventMap[hostEvent] ?: if (value == 0f) {
|
||||
|
Loading…
Reference in New Issue
Block a user