diff --git a/.travis.yml b/.travis.yml index 179980f..a488289 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python -python: 3.5 -script: ./check.py gamecontrollerdb.txt +python: 2.7 +script: ./check.py gamecontrollerdb_204.txt && ./check.py gamecontrollerdb_205.txt notifications: email: on_success: never - on_failure: always \ No newline at end of file + on_failure: always diff --git a/README.md b/README.md index 648f09a..85e2b79 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ A community source database of game controller mappings to be used with SDL2 Game Controller functionality. ## SDL Variants -gamecontrollerdb_205.txt: For games or engines using the SDL 2.0.5 format. There are no range or inversion modifiers (+,-,~). It contains 282 controller entries, with duplicates removed. +gamecontrollerdb_205.txt: For games or engines using the SDL >= 2.0.5 format. There are no range or inversion modifiers (+,-,~). gamecontrollerdb_204.txt -For games or engines using the SDL 2.0.4 format. GUIDs are different depending on the platform. It contains 237 controller entries, with duplicates removed. +For games or engines using the SDL 2.0.4 format. GUIDs are different depending on the platform. Note that SDL > 2.0.4 can still read this format. ## Create New Mappings A mapping looks like this : @@ -17,14 +17,10 @@ A mapping looks like this : ``` It is comprised of a controller GUID (`030000004c050000c405000000010000`), a name (`PS4 Controller`), button / axis mappings (`leftshoulder:b4`) and a platform (`platform:Mac OS X`). -There are a few different ways to create mappings. Here are some options. If you know of other tools, I would be happy to add them to the list. +There are a few different tools that let you create mappings. -### [SDL2 Gamepad Tool](http://www.generalarcade.com/gamepadtool/) -This seems to be the easiest and most reliable way to configure your gamepad. It is cross-platform (Windows, macOS and Linux). - - - -Setup your controller and copy the ouput entry. The tool currently doesn't output SDL 2.0.5 GUIDs, but that is fine as SDL still supports these GUIDs. I will convert older GUIDs in pull requests as well. +### [SDL2 ControllerMap](https://www.libsdl.org/download-2.0.php) +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). ### [Steam](http://store.steampowered.com) 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. @@ -35,22 +31,26 @@ In Steam's Big Picture mode, configure your joystick. Then look in `[steam_insta Unfortunately, **Steam does not ouput the platform field**, so you will need to add it manually. At the end of the generated entry, add `platform:Windows,` or `platform:Mac OS X,` or `platform:Linux,`. -### [SDL2 ControllerMap](https://www.libsdl.org/download-2.0.php) -You can also use the controllermap utility provided with SDL2. + +### [SDL2 Gamepad Tool](http://www.generalarcade.com/gamepadtool/) +Third party cross-platform tool (Windows, macOS and Linux). + +Setup your controller and copy the ouput entry. The tool currently doesn't output SDL 2.0.5 GUIDs, but that is fine as SDL still supports these GUIDs. I will convert older GUIDs in pull requests as well. ## Usage Download gamecontrollerdb.txt, place it in your app's directory and load it. For example : ``` -SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt"); +SDL_GameControllerAddMappingsFromFile("gamecontrollerdb_205.txt"); ``` # For Contributors ## Check Your Mappings -Before submitting a new Pull Request, please run the `check.py` tool to make sure everything is in order. It requires python3 installed. Run it with: +Before submitting a new Pull Request, please run the `check.py` tool to make sure everything is in order. Run it with: ``` -python3 check.py gamecontrollerdb.txt +python check.py gamecontrollerdb_204.txt +python check.py gamecontrollerdb_205.txt ``` If no errors were generated you can (please) send a Pull Request! Tests are automatically run on Pull Requests, so you'll easily see if there is an issue. diff --git a/check.py b/check.py index 024e26a..c2fc111 100755 --- a/check.py +++ b/check.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python #import fileinput import string diff --git a/gamecontrollerdb_204.txt b/gamecontrollerdb_204.txt index 954a53c..37ef387 100644 --- a/gamecontrollerdb_204.txt +++ b/gamecontrollerdb_204.txt @@ -1,4 +1,4 @@ -# Game Controller DB for SDL <= 2.0.4 +# Game Controller DB for SDL in legacy (pre 2.0.5) format # Source: https://github.com/gabomdq/SDL_GameControllerDB # Windows 02200090000000000000504944564944,8Bitdo NES30 PRO USB,platform:Windows,a:b0,b:b1,x:b3,y:b4,leftshoulder:b6,rightshoulder:b7,lefttrigger:b8,righttrigger:b9,back:b10,start:b11,leftstick:b13,rightstick:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8, diff --git a/gamecontrollerdb_205.txt b/gamecontrollerdb_205.txt index 2b31458..dcaa5de 100644 --- a/gamecontrollerdb_205.txt +++ b/gamecontrollerdb_205.txt @@ -1,4 +1,4 @@ -# Game Controller DB for SDL >= 2.0.5 +# Game Controller DB for SDL in post 2.0.5 format # Source: https://github.com/gabomdq/SDL_GameControllerDB # Windows 03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,