The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Game Controller Map app
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
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:
Quote:
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.

_______________________________________________
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


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
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
Quote:
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:
Quote:
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.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
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. Smile And remove it once 2.0.2 makes it into the
SLR.

Leszek

2013/12/4 Gabriel Jacobo:
Quote:
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
Quote:

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:
Quote:
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.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Gabriel.

_______________________________________________
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
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. Smile

2013/12/4 Jorgen Tjerno:
Quote:
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.

_______________________________________________
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
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. Smile

2013/12/4 Jorgen Tjerno:
Quote:
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.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
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


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
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
Quote:
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. Smile

2013/12/4 Jorgen Tjerno:
Quote:
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.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Gabriel.
Game Controller Map app
Jared Maddox
Guest

Quote:
Date: Wed, 4 Dec 2013 15:17:06 +0100
From: Leszek Godlewski
To: SDL Development List
Subject: Re: [SDL] Game Controller Map app
Message-ID:

Content-Type: text/plain; charset=ISO-8859-1

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. Smile And remove it once 2.0.2 makes it into the
SLR.

Leszek

2013/12/4 Gabriel Jacobo:
Quote:
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
Quote:

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:
Quote:
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!).


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


Joined: 20 Sep 2013
Posts: 279
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:
Quote:
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

Quote:
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:
Quote:
Any chance the ids will conflict on different OSes, since they use
different
Quote:
methods for determining the id? If so, should the file format include
some
Quote:
kind of platform field?

- Jørgen.

________________________________
From: [] on
behalf
Quote:
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"
Quote:
that should let you create mappings for your controllers without having
to
Quote:
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
Quote:

Feel free to fork, send pull requests there, or just file an issue with
new
Quote:
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.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Gabriel.

Quote:
_______________________________________________
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


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
2013/12/5 T. Joseph Carter
Quote:
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.



Platform filtering is only applied when loading mappings from a file. 
SDL_GameControllerAddMapping ignores this field, so as far as I can tell it's perfectly backwards compatible (or at least as long as the platform name does not have a comma in it Razz ). 
Definitions embedded in SDL_gamecontrollerdb.h also don't require this field because #ifdefs take care of that.


Sorry if I'm misunderstanding you but I don't think I spot where the problem is.
Game Controller Map app
Ryan C. Gordon
Guest

Quote:
I haven't got commit access to the tree, so I haven't been able to
make incremental changes on this stuff.

Is your work somewhere public at the moment?

--ryan.



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
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


Joined: 21 Feb 2014
Posts: 7
Location: New Hampshire
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


Joined: 29 Aug 2014
Posts: 32
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


Joined: 06 Feb 2015
Posts: 13
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


Joined: 29 Aug 2014
Posts: 32
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.