Merge pull request #43461 from ccl2of4/fix-linux-joypad-dpad-zeroing

Fix for linux joypad D-pad zeroing
This commit is contained in:
Rémi Verschelde 2020-11-16 14:46:43 +01:00 committed by GitHub
commit 7610945b4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -459,9 +459,9 @@ void JoypadLinux::process_joypads() {
case ABS_HAT0X:
if (ev.value != 0) {
if (ev.value < 0) {
joy->dpad |= Input::HAT_MASK_LEFT;
joy->dpad = (joy->dpad | Input::HAT_MASK_LEFT) & ~Input::HAT_MASK_RIGHT;
} else {
joy->dpad |= Input::HAT_MASK_RIGHT;
joy->dpad = (joy->dpad | Input::HAT_MASK_RIGHT) & ~Input::HAT_MASK_LEFT;
}
} else {
joy->dpad &= ~(Input::HAT_MASK_LEFT | Input::HAT_MASK_RIGHT);
@ -473,9 +473,9 @@ void JoypadLinux::process_joypads() {
case ABS_HAT0Y:
if (ev.value != 0) {
if (ev.value < 0) {
joy->dpad |= Input::HAT_MASK_UP;
joy->dpad = (joy->dpad | Input::HAT_MASK_UP) & ~Input::HAT_MASK_DOWN;
} else {
joy->dpad |= Input::HAT_MASK_DOWN;
joy->dpad = (joy->dpad | Input::HAT_MASK_DOWN) & ~Input::HAT_MASK_UP;
}
} else {
joy->dpad &= ~(Input::HAT_MASK_UP | Input::HAT_MASK_DOWN);