Game Controller Map app |
gabomdq
|
Hey everyone, I've added a utility in the test folder called "controllermap" that should let you create mappings for your controllers without having to use Steam Big Picture.
This also ties to the new function I've added SDL_GameControllerAddMappingsFromFile which lets you load a database of controllers from a file. I'm keeping such a db here: https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt Feel free to fork, send pull requests there, or just file an issue with new mappings. The policy for acceptance is going to be very lax, so if the mapping has the proper format and it is not a duplicate of an already existing entry, it'll be accepted (something to consider if you decide to use this DB and ship it with your games!). -- Gabriel. |
|||||||||||
|
Game Controller Map app |
Leszek Godlewski
Guest
|
Cool, any estimate as to how long it will take for this new API to
appear in the Steam Linux Runtime? Regards, Leszek 2013/12/3 Gabriel Jacobo:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Game Controller Map app |
gabomdq
|
I suppose there has to be a new SDL release first (2.0.2), I'm not sure when that will happen though (probably when there's a big enough number of improvements/fixes to merit a release).
2013/12/3 Leszek Godlewski
-- Gabriel. |
|||||||||||||||
|
Game Controller Map app |
Leszek Godlewski
Guest
|
Well, I figured since it doesn't use any private SDL APIs internally,
I might just as well just copy its implementation into my codebase as an interim solution. And remove it once 2.0.2 makes it into the SLR. Leszek 2013/12/4 Gabriel Jacobo:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||
|
Game Controller Map app |
Jorgen Tjerno
Guest
|
Any chance the ids will conflict on different OSes, since they use different methods for determining the id? If so, should the file format include some kind of platform field?
- Jørgen. From: [] on behalf of Gabriel Jacobo [] Sent: Tuesday, December 03, 2013 7:23 AM To: SDL Development List Subject: [SDL] Game Controller Map app Hey everyone, I've added a utility in the test folder called "controllermap" that should let you create mappings for your controllers without having to use Steam Big Picture. This also ties to the new function I've added SDL_GameControllerAddMappingsFromFile which lets you load a database of controllers from a file. I'm keeping such a db here: https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt Feel free to fork, send pull requests there, or just file an issue with new mappings. The policy for acceptance is going to be very lax, so if the mapping has the proper format and it is not a duplicate of an already existing entry, it'll be accepted (something to consider if you decide to use this DB and ship it with your games!). -- Gabriel. |
|||||||||||
|
Game Controller Map app |
Leszek Godlewski
Guest
|
They do include a platform field.
2013/12/4 Jorgen Tjerno:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Game Controller Map app |
Jorgen Tjerno
Guest
|
Hah, I'm evidently blind!
- Jørgen. ________________________________________ From: [] on behalf of Leszek Godlewski [] Sent: Wednesday, December 04, 2013 1:08 PM To: SDL Development List Subject: Re: [SDL] Game Controller Map app They do include a platform field. 2013/12/4 Jorgen Tjerno:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Game Controller Map app |
gabomdq
|
Yep, right now we use SDL_GetPlatform() to filter entries, which may not be the best option in the long run...Android and Linux could probably share GUIDs, and "Mac OS X" is not the most parser friendly string, having spaces and all, but it gets the job done for now.
2013/12/4 Jorgen Tjerno
-- Gabriel. |
|||||||||||||||
|
Game Controller Map app |
Jared Maddox
Guest
|
Instead of removing it once it makes it into an official release, I'd suggest adding code that uses SDL_GetVersion() to dynamically disable it. That way it'll work even if some configuration snafu or a user who misunderstands updating procedures winds up giving the program an old version of SDL2 (unless that results in a crash, in which case never mind; this is an area that I haven't often poked into). _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||
|
Game Controller Map app |
Joseph Carter
|
That does step on my toes a bit. We talked about including platform
after the GUID and controller name for backward-compatibility. SDL's parser at least should handle spaces okay (it does so for controller name after all), but we intended to put the platform in the string in such a way that old parsers would ignore it and new ones would use it. More like… GUID,Name Of Controller,platform:darwin,a:b1,b:b3,x:b0,y:b2,… The use of Mac OS X" vs. "darwin" there works, though the latter is technically more accurate and fits with the current style of the mapping string. I haven't got commit access to the tree, so I haven't been able to make incremental changes on this stuff. Caveats on platforms: - Mappings added with no platform are assumed to apply to the current one. (Backward compatibility.) - SDL can be asked to produce a string containing the mapping for a given GUID it knows. If that mapping has an unspecified (current) platform, the resulting string should not contain a platform directive at all. - Mappings for platform "current" should always be searched by SDL when looking for a mapping for a new controller. Those for an unknown platform should be skipped. I'd planned an enum for this with a pointer to a string unused except for unknown (as opposed to unspecified) platforms. Joseph On Wed, Dec 04, 2013 at 08:38:35PM -0200, Gabriel Jacobo wrote:
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||||||||||||||||||||
|
Game Controller Map app |
Game Controller Map app |
Ryan C. Gordon
Guest
|
Is your work somewhere public at the moment? --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
gabomdq
|
A quick update on this topic. Ryan just committed changes to testgamecontroller.c which use the same mechanism as controllermap.c and that are quite useful to test the mappings you generate before submitting them.
The way to test your newly created mapping string is to paste it into a file called "gamecontrollerdb.txt" which gets loaded automatically by testgamecontroller, and then verify that all the buttons and axis match what you intended for (some controllers fire up somewhat unpredictably and can make the mapping process somewhat unpredictable). |
|||||||||||
|
DaveB1980
|
Hmm, weird... I was trying this function (SDL_GameControllerAddMappingsFromFile) for the first time today, and oddly, it only returns "2" for the number of mappings added when I feed in the gamecontrollerdb.txt. This is being tested in SDL 2.0.2 on a Windows 7 PC.
|
|||||||||||
|
GameCodingNinja
|
I picked up a Mad Catz GameSmart C.T.R.L controller for my Android phone (Samsung Galaxy S7 Edge) and noticed it didn't work in my SDL game. The gamecontrollerdb.txt doesn't have entries for Android entries and my game only responds to the Game Controller messages. I built the controllermap.c with the androidbuild.sh but when it runs, it only displays a white screen.
I'm surprised the gamecontrollerdb.txt doesn't have any Android entries. Not sure what to do at this point. |
|||||||||||
|
Game Controller Map app |
SiPlus
|
The Android code for gamepads in SDL needs to be rewritten from scratch, it simply ignores the fact that the system already provides a unified mapping for gamepads and just assigns consecutive numbers to whatever axes/buttons are physically available instead, and SDL doesn't need a mapping table at all (apart from one global mapping similar to the XInput one on Windows - any deviations only optionally for specific controllers). Also LTRIGGER/RTRIGGER and BRAKE/GAS duality is not taken into account by SDL.
As a quick workaround, you could write some glue code to access the gamepad events natively, bypassing SDL (or by generating custom SDL events). In the future, it needs to be fixed in the upstream. -------- Original message -------- From: GameCodingNinja Date: 10/21/16 19:17 (GMT+03:00) To: Subject: Re: [SDL] Game Controller Map app I picked up a Mad Catz GameSmart C.T.R.L controller for my Android phone (Samsung Galaxy S7 Edge) and noticed it didn't work in my SDL game. The gamecontrollerdb.txt doesn't have entries for Android entries and my game only responds to the Game Controller messages. I built the controllermap.c with the androidbuild.sh but when it runs, it only displays a white screen. I'm surprised the gamecontrollerdb.txt doesn't have any Android entries. Not sure what to do at this point. |
|||||||||||
|
GameCodingNinja
|
So as of now, my game is reporting that there is no controllers connected even though it is and working with other apps.
What I'm confused about is some posts here report that controller support is working in their apps. Are they using a different controller? Version 2.0.4 has Android specific fixes/additions related to the joystick. gamecontrollerdb.txt doesn't have any Android entries but SDL_GameControllerAddMappingsFromFile returns back with 8 new mappings and SDL_NumJoysticks() returns zero. |
|||||||||||
|