-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using SDL_GameController in SDL2 Joypad Driver sometimes returns different event ID #11885
Comments
SDL2 gamecontroller API ignores many buttons on hori fighting commander for nintendo switch. |
https://wiki.libsdl.org/CategoryGameController says
To SDL2 joystick API, SDL2 gamecontroller is what RetroPad is to udev gamepads. This is an issue in SDL2 gamecontroller database. If SDL2 gamecontroller db doesn't have a mapping for a controller, SDL2 gamecontroller API may ignore buttons or return different event IDs. I suggest not using SDL gamecontroller API. Perhaps, an SDL2 autoconfig file can individually opt out of SDL gamecontroller API? The gamecontroller database has many variants of hori fighting commander, but no variant really supports the second mode of hori fighting commander for nintendo switch. One variant supports the first mode. Choosing any variant of hori fighting commander can break the second mode of hori fighting commander for nintendo switch. |
I discovered that if I disabled SDL2 gamecontroller API via a patch, I could just copy udev autoconfig files to sdl2 autoconfig folder and set input_driver to sdl2 and input_device to an appropriate device name reported by sdl2-jstest. |
@twinaphex Do you think it is a good idea to get rid of SDL gamecontroller API in retroarch? |
It seems reasonable to add a setting to allow for SDL gamecontroller api to be skipped. |
I think RetroArch prefers to use the GameController API whenever possible, there might be bugs on RetroArch's side by using GameController in cases where it shouldn't, some buttons are getting ignored or with the wrong IDs. By skipping SDL's GameController API, apparent bugs can be fixed and you can start using SDL2 HIDAPI drivers #14421. |
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.
The text was updated successfully, but these errors were encountered: