Switch Pro Controller layout "wrong"

Hi! This is my first post here. I’m experimenting with SDL 2.0.14, and my understanding is that when mappings are set up correctly, a given input should match buttons by position rather than name. However, Switch controllers aren’t working this way.

I’m using the standard mapping file from here: https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt

And my understanding is that this:

bool northPressed = SDL_GameControllerGetButton(g, SDL_CONTROLLER_BUTTON_Y);

should give me the North face button, regardless of controller (since Y is in the North position on Xbox controllers). This works correctly with my DualShock 4 and my DualSense (responding to Triangle in both cases), but on my Nintendo Switch Pro Controller, this responds to the West face button (which is named ‘Y’ on Switch controllers).

The same appears to be true with my PowerA controller (a Switch controller), so my best guess is that this is standard across all Switch controllers.

What’s the best practice for developers if we want mappings to work by position? I imagine this must be a common issue, but I haven’t been able to find it by searching. But there’s no way anyone wants their Xbox’s A and their Switch’s A to be mapped to the same action by default.


There is SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS hint that doing exactly what you want.
Try it.

Thanks! That should be exactly what I’m looking for.

However, having just tried it, nothing changes with the Switch Pro Controller, and the PowerA Controller has its East and West buttons fixed, but its North and South buttons are wrong.

This looks like bug.
Please fill bugreport at https://bugzilla.libsdl.org/

Done, thanks!