Skip to content

A community sourced database of game controller mappings to be used with SDL2 Game Controller functionality

License

Notifications You must be signed in to change notification settings

PSebs/SDL_GameControllerDB

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDL_GameControllerDB

A community sourced database of game controller mappings to be used with SDL2 Game Controller functionality.

Usage

Download gamecontrollerdb.txt, place it in your app's directory and load it.

For example :

SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");

The database is compatible with SDL v2.0.10 and newer. Older SDL versions are no longer supported.

Create New Mappings

A mapping looks like this :

030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,

It is comprised of a controller GUID (030000004c050000c405000000010000), a name (PS4 Controller), button / axis mappings (leftshoulder:b4) and a platform (platform:Mac OS X).

Please make sure to check that the name is a good description of the controller. If relevant, include the controller's name and model number.

Mapping Tools

There are a few different tools that let you create mappings.

Third party cross-platform tool with GUI (Windows, macOS and Linux). Likely the easiest tool to use.

The controllermap utility provided with SDL2 is the official tool to create these mappings, it runs on all the platforms SDL runs (Windows, Mac, Linux, iOS, Android, etc).

In Steam's Big Picture mode, configure your joystick. Then look in [steam_installation_directory]/config/config.vdf in your Steam installation directory for the SDL_GamepadBind entry. It is one of the last entries, it will look something like this.

"SDL_GamepadBind"		"030000004c050000c405000000010000,PS4 Controller,platform:Windows,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,"

Unfortunately, Steam outputs the platform field at the beginning, so you will need to move it to the end manually. Move platform:Windows, or platform:Mac OS X, or platform:Linux, to the end of the mapping (with the trailing comma).

GNOME Games allows users to configure their own gamepads. The gamepad file the user generates is located at ~/.var/app/org.gnome.Games/config/libmanette/gamecontrollerdb when installed from the flatpak. (GNU/Linux)

Resources

About

A community sourced database of game controller mappings to be used with SDL2 Game Controller functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%