Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Jul 1, 2019
1 parent 22a2dec commit 797d2c5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/joystick/bsd/SDL_sysjoystick.c
Expand Up @@ -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;
}
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 797d2c5

Please sign in to comment.