SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL3 Request: adjust Controller button names

Open Lokathor opened this issue 3 years ago • 5 comments

Currently the Controller API gives ABXY button presses according to the XBox360 layout. However, many people are also using playstation controllers (shape buttons) and switch controllers (flipped layout relative to the 360 layout) hooked to the PC or phone.

The problem is that then the in-game button prompts will often show the wrong button icon compared to the button that the game wants you to push on the physical device. This is particularly bad with the Switch Pro Controller. A huge number of games will only show the 360 button prompt, or if they show the button layouts of other controller styles they'll still read the wrong inputs. Persona 5 Royal on Steam, for example, will detect the controller type and show the right icons to match that controller, but then just keep reading the Xbox button orientation on a Switch controller and all the player's inputs are wrong.

I definitely don't think that SDL can solve this entire issue on its own, but I think that if the controller buttons were given other names, such as naming the buttons after the four compass directions (north/south/east/west), and then an API was added to turn a direction button into the name of the button as it is on the controller (eg: "west" is Y on switch, Square on PlayStation, and X on 360), then that might help developers to be more correct about controller input more often.

Lokathor avatar Nov 26 '22 20:11 Lokathor

SDL2 also has SDL_GameControllerGetType and the SDL_GameControllerType enum to help figure out what to display to users. But I suppose that doesn't necessarily address your point about button enum names.

slime73 avatar Nov 26 '22 20:11 slime73

Yeah, currently the goal of the controller api is to abstract over controllers, but that doesn't end up happening in practice. For example, a particular USB SNES controller has the mapping set up so that the top face button reads as SDL_CONTROLLER_BUTTON_Y despite the button physically being marked as X. Meanwhile the Switch Pro Controller reads the top face button as SDL_CONTROLLER_BUTTON_X because that's is what the button is marked as, but programs created with an Xbox 360 layout in mind won't think of X as being the top face button.

I think the API is improved if the face buttons are re-named so that the layout/orientation of the buttons is what's kept most consistent between controllers, and then the program can look up what to call a particular button position for a given controller when necessary.

Lokathor avatar Nov 27 '22 00:11 Lokathor

They should be named by layout, but I think this battle got lost on the Switch controllers because Switch games not only have the letters backwards from an xbox controller, they also inverted the intention of the buttons...they want ok and cancel backwards from what an xbox controller would use for it, for example.

I still argue this is an SDL bug when the layout isn't correct.

I also think it would be really nice if there was a library that could say "ah, I see this controller's GUID, here are SDL_Surfaces of all the button faces that you can show in-game," but I don't think we want to add that to SDL itself. (right...?)

icculus avatar Nov 27 '22 02:11 icculus

Well, some would argue that since ABXY was first done on the SNES then it's the 360 that's got the wrong layout. I'm "some".

As for confirm/cancel, yeah that's a whole separate pain in the butt. Nintendo and Xbox generally agree that "A is confirm" (despite different orientations of where A goes), while tons of PlayStation games can't even decide if it's Circle or X to confirm. Some games even swap the confirm button based on region. At least more and more games are moving to having more customizable controls, so that's not as much of an issue as it once was.

For button icons... I think shipping button art within the DLL isn't great, it adds a lot of space that might never get used. But having an art asset in the source that people can copy into their project and use when they do need button art would be entirely fine.

Lokathor avatar Nov 27 '22 02:11 Lokathor

SDL has alternate bindings for controllers based on a hint, I think that's just missing for your SNES controller here. See hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1 in src/joystick/SDL_gamecontrollerdb.h.

The intent is for games to show A/B/X/Y or circle/square/cross/triangle for actions, using SDL_GameControllerType to figure out what set of glyphs to use, and then the user can set the hint to swap whether A means the button labeled 'A', or the south button, and the application can use the hint value to swap the label if they want.

This is what Steam implements on Steam Deck as well.

slouken avatar Nov 27 '22 16:11 slouken

I oppose the idea of north/east/south/west as well. Despite different button positions, button A is _accept _ and B is back accross nintendo and xbox controllers. On play station it is a mess, since originally circle means accept and cross means back, but localization thought the meaning should be flipped when localizing to western audience, which was of course only done sometimes. Not to mention that sega, some PC controllers and arcade sticks have 6 (or even more) face buttons instead of just 4 (A,B,C,X,Y,Z). For compatibility many arcade sticks emulate a 360 controller and pretend that C/Z are L1 and R1, But I don't think that is a good solution. Last but not least (but a tiny bit unrelated), Steam deck also has L4, L5, R4, R5, please make them buttons in SDL3 controller as well.

krux02 avatar Feb 05 '23 14:02 krux02

Alright, it seems the majority is against the idea, so i'll close it.

Lokathor avatar Mar 08 '23 06:03 Lokathor