diff options
| author | Mike <7153163+hackbar@users.noreply.github.com> | 2017-11-01 18:29:33 -0700 |
|---|---|---|
| committer | Mike <7153163+hackbar@users.noreply.github.com> | 2017-11-07 17:39:56 -0800 |
| commit | 1f81e13d81f0e405e887cddd06d7e1f8bf49c9d3 (patch) | |
| tree | 6e04e469f4471be4db2c041f2332656966c1e136 /Source/Android/app/src/main/java | |
| parent | 6787fcb71277e69f43fc32f4b232af916a043c7f (diff) | |
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.
Diffstat (limited to 'Source/Android/app/src/main/java')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 4688cbce05..7fede2a7d4 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -735,7 +735,16 @@ public final class EmulationActivity extends AppCompatActivity int axis = range.getAxis(); float origValue = event.getAxisValue(axis); 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; |
