Skip to content

kcms/gamecontroller: Fix getting the status of all the buttons

SDL maps each controller button to an id in the SDL_GameControllerButton enum, which are not necessarily in consecutive order.

We need to store which buttons are present for the current device and then check the status based on the enum id.

For instance, on my Wiimote, SDL reports a total of 11 buttons, but the arrow keys are mapped to SDL_CONTROLLER_BUTTON_DPAD_* (with values of 11 to 14) while the button values 7 to 10 are unsed.

Merge request reports

Loading