What's required for unofficial game controller support?

With the 1.24.0 release, Cemu added SDL 2 support, obviating the necessity for software like Steam, DS4Windows, and BetterJoy.

However, this appears only to work for official or licensed controllers. As far as I can tell, the likes of Steam, DS4Windows, and BetterJoy have the same limitation…except for a single test build of BetterJoy with a config modification: Sticks both point to top right constantly. · Issue #588 · Davidobot/BetterJoy · GitHub

It’s the only thing that worked for me to get a generic Nintendo Switch Pro style controller working with Cemu. It appears to have worked for others, too. Clearly it can be done, but this is far outside of my wheelhouse and so I’m wondering what’s required to get these unofficial controllers to be supported by SDL.

I don’t mean to come here as a beggar or some ungrateful lout unappreciative of the work you all do. It’s only wondering what the difference is between the official and unofficial Switch Pro controllers (which seem to work just fine with the Switch itself), and if there’s any sort of data or testing I could provide to improve the chances that support for these generic controllers will be included in the future.

SDL authors doesn’t have all possible controllers in their hands and it’s impossible to add support for controllers that they don’t have…

Nintendo Switch controller support code is lying here: SDL/SDL_hidapi_switch.c at main · libsdl-org/SDL · GitHub
You can start hacking by adding your controller vid/pid here: SDL/controller_type.h at main · libsdl-org/SDL · GitHub
and then debugging switch controller code.
After you’re done - just create pull request to include your changes to SDL repo.

Thank you for the links and direction! I hope I didn’t come across as expecting the SDL devs to just “know” the answer. Nor do I expect them to support every generic controller. I’m assuming that there are only so many variants out there, and if I can get mine working it will take care of a bunch of others, too.

I’m not even sure where to start, but there’s no time like the present to learn something new! I’ll familiarize myself with all of this (I’m not dumb, but I have exactly zero experience here) and try to contribute something useful.

I’ve also reached out to the BetterJoy dev to see if they have any insight, code, or suggestions that will speed up the process since they did something to make so many generic controllers work and so clearly understand all of this better than I do.

If a controller is recognized by SDL’s Joystick API but isn’t a recognized Game Controller and you’d like it to be, you can add a mapping for it via SDL_GameControllerAddMapping or SDL_GameControllerAddMappingsFromRW or SDL_GameControllerAddMappingsFromFile.

There’s a pretty large list of game controller mappings you can use the latter function with, here: GitHub - gabomdq/SDL_GameControllerDB: A community sourced database of game controller mappings to be used with SDL2 Game Controller functionality