Using SDL_GameController in SDL2 Joypad Driver sometimes returns different event ID
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 14.1k
- Forks
- 2.2k
- Avg merge
- 7h 35m
- Merged PRs (30d)
- 51
Description
Retroarch currently tries to use SDL_GameController for gamepad button event detection, and uses SDL_Joystick as a backup mechanism. While this usually works fine, unfortunately not always. I've recently identified that 8bitdo controllers (in some cases, not always, and for some unknown reason), return different event IDs when the event is returned from SDL_GameController vs SDL_Joystick. I am testing with SDL 2.0.12 on ARMv8.
My workaround is to remove this conditional:
https://github.com/libretro/RetroArch/blob/master/input/drivers_joypad/sdl_joypad.c#L105
Which then does not assign a value to pad->controller and the rest of the code correctly falls back to using SDL_Joystick.
This might be a glitch within SDL itself, but twinaphex asked that I document my findings in an issue so that others can have visibility.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in input/drivers_joypad/sdl_joypad.c at line 105 and reproduce the differing event IDs with an 8bitdo controller on SDL 2.0.12 and ARMv8. Compare the SDL_GameController and SDL_Joystick paths, using the reported workaround as a reference; done means the driver handles the event consistently without breaking its fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100