I've seen @dulsi's topic on the new forum (I still can't post there, sorry).
No, they are using different mappings. Even worse, the same controller has different mappings depending on the OS.dulsi {l Wrote}:Does anyone know if SDL2 uses equivalent mappings of axis/buttons on Xbox or other controllers?
FYI, this isn't mentioned on the linked discourse page, neither in the SDL_GameControllerAddMapping documentation, but you don't have to mess around and generate the mapping string yourself.dulsi {l Wrote}:Obviously I want to make a configuration screen but if I don't have time I'd like to know if it is usable by others.
First, there's a ready-to-use tool in SDL, called controllermap.c.
Second, there's a community maintained database of game controller mapping strings here (with links to some 3rd party string generator tools as well). Just download gamecontrollerdb.txt and pass that to SDL_GameControllerAddMappingsFromFile as-is. It is well-tested and gives support for many many game controllers out-of-the-box to your game.
If you don't want an additional file, then you can embed that db string into your game using the "FromRW" variant in conjunction with "SDL_RWFromMem".
- {l Code}: {l Select All Code}
char gamecontrollerdb[] = " /* paste the contents of gamecontrollerdb.txt here */ ";
SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem(gamecontrollerdb, sizeof(gamecontrollerdb)-1), 0);
Cheers,
bzt