mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Android: Ignore joystick axis movements in the flat area.
Now that all inputs are corrected to zero-centered, we can use getFlat() to ignore movements that are just noise. This eliminates a lot of drift when the controller is at rest, notably on the character select screen in Melee.
This commit is contained in:
@ -735,7 +735,16 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
int axis = range.getAxis();
|
int axis = range.getAxis();
|
||||||
float origValue = event.getAxisValue(axis);
|
float origValue = event.getAxisValue(axis);
|
||||||
float value = mControllerMappingHelper.scaleAxis(input, axis, origValue);
|
float value = mControllerMappingHelper.scaleAxis(input, axis, origValue);
|
||||||
NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, value);
|
// If the input is still in the "flat" area, that means it's really zero.
|
||||||
|
// This is used to compensate for imprecision in joysticks.
|
||||||
|
if (Math.abs(value) > range.getFlat())
|
||||||
|
{
|
||||||
|
NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NativeLibrary.onGamePadMoveEvent(input.getDescriptor(), axis, 0.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user