Fixed bug 4436 - [OpenBSD] fix D-pad

daniel.c.sinclair

Hi, this patch breaks dpad/hat input on my PS4 controller.  The attached patch restores functionality.  Calling SDL_PrivateJoystickHat() at the end of BSD_JoystickUpdate was setting the hat state to zero on every kind of input, instead of just the HUG_DPAD events.
This commit is contained in:
Sam Lantinga 2019-06-30 22:48:13 -07:00
parent 22a2decf64
commit 797d2c5957

View file

@ -623,14 +623,22 @@ BSD_JoystickUpdate(SDL_Joystick * joy)
hitem.logical_minimum);
}
#ifdef __OpenBSD__
else if (usage == HUG_DPAD_UP)
else if (usage == HUG_DPAD_UP) {
dpad[0] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
else if (usage == HUG_DPAD_DOWN)
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
}
else if (usage == HUG_DPAD_DOWN) {
dpad[1] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
else if (usage == HUG_DPAD_RIGHT)
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
}
else if (usage == HUG_DPAD_RIGHT) {
dpad[2] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
else if (usage == HUG_DPAD_LEFT)
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
}
else if (usage == HUG_DPAD_LEFT) {
dpad[3] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
}
#endif
break;
}
@ -647,9 +655,6 @@ BSD_JoystickUpdate(SDL_Joystick * joy)
break;
}
}
#ifdef __OpenBSD__
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
#endif
hid_end_parse(hdata);
}
}