virtualx-engine/platform
Connor Lirot 1e01963d29
Fix for linux joypad D-pad zeroing
Some controllers (notably those made by 8bitdo) do not always emit an event to zero out a D-pad axis before flipping direction. For example, when rolling around aggressively the D-pad of an 8bitdo SN30 Pro/Pro+, the following may be observed:

```
ABS_HAT0X : -1
ABS_HAT0Y : -1
ABS_HAT0Y : 0
ABS_HAT0Y : 1
ABS_HAT0X : 1
```

Notable here is that no event for `ABS_HAT0X: 0` is emitted between the events for `ABS_HAT0X: -1` and `ABS_HAT0X: 1`. Consequently, the game engine believes that both the negative _and_ positive x-axis directions of the D-pad are activated simultaneously (i.e `is_joy_button_pressed()` returns `true` for both `JOY_BUTTON_DPAD_LEFT` and `JOY_BUTTON_DPAD_RIGHT`), which should be impossible.

This issue is _not_ reproducible on all controllers. The Xbox One controller in particular will not exhibit this problem (it always emits zeroing out events for an axis before flipping direction).

The fix is to always zero out the opposite direction on the D-pad axis in question when processing an event with a nonzero value. This unfortunately wastes a small number of CPU cycles on controllers that behave nicely.

**I have verified this issue is also reproducible in the stable 3.2 branch**

(cherry picked from commit dd021099ff)
2020-11-17 12:07:01 +01:00
..
android Change android orientations from sensor to user 2020-11-17 12:01:59 +01:00
iphone [3.2] Disable iOS SDK version check on osxcross. 2020-10-21 07:56:05 +03:00
javascript [HTML5] AudioWorkletAPI implementation. 2020-11-10 11:05:15 +01:00
osx Remove debug_symbols=full in favor of debug_symbols=yes 2020-11-11 15:12:01 +01:00
server Remove debug_symbols=full in favor of debug_symbols=yes 2020-11-11 15:12:01 +01:00
uwp Fixed an issue in UWP export caused by duplicate entry for extensions in content types file. 2020-10-19 16:09:59 +02:00
windows Use LONG instead of DWORD (unsigned int) when interacting with DIJOFS constants. 2020-11-11 15:30:57 +01:00
x11 Fix for linux joypad D-pad zeroing 2020-11-17 12:07:01 +01:00
register_platform_apis.h Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
SCsub SCons: Format buildsystem files with psf/black 2020-06-10 15:30:52 +02:00