Adding A New Game Controller Mapping under AntiMicro

Jeff Backus edited this page Jun 4, 2016 · 3 revisions

Since AntiMicro version 2.0, the program takes advantage of the SDL Game Controller API that is bundled into SDL 2. The SDL Game Controller API is an XInput-like API that game developers can use to allow sensible default gamepad controls to be implemented in a game without having to worry about how the buttons are mapped on the controller itself. This allows for a more plug and play experience for the end user. AntiMicro uses the API to allow one profile (universal profile) to be usable using many different kinds of controllers.

There are a number of controllers that are natively supported by the API. The most common controllers that are supported are the Xbox 360, PS3, Logitech F710, and the Logitech F310. The controllers that are supported will vary depending on the platform that SDL is running on but those controllers have mappings that will work on any major supported platform. For more technical details, you can check out the header file that contains the mappings for supported controllers.

http://hg.libsdl.org/SDL/file/tip/src/joystick/SDL_gamecontrollerdb.h

In order to use a controller that is not supported directly by SDL 2, you will have to map your controller in AntiMicro so that you will be able to use and create universal Game Controller profiles. Firstly, open the tab for the controller that you would like to map. After that, open the Options menu in the main menubar and then click on Game Controller Mapping.

AntiMicro Option Mapping

The Game Controller Mapping window will then open for that controller. In this window, you will create the appropriate mapping for the controller.

AntiMicro Game Controller Mapping Window

You will highlight a cell in the table to start the process. Highlight the cell in the A row. You will then press the button on your controller that corresponds to the placement of the A button on the example controller; for people using a version older than 2.1.1, please refer to a picture of the Xbox 360 controller. After that, the cell will be updated with the assignment and the next cell will get highlighted automatically. The next button will also be highlighted on the example controller. Go through that process for each button and axis until you reach the end of the list. When you have finished making the assignments for your controller, press the Save button in order to have AntiMicro save the controller mapping that you just created. You will then have to either select the Update Joysticks option under Options or you will have to unplug the controller and plug it back in so that the mapping will be active.

As you add more assignments, you will see the SDL 2 Game Controller Mapping String text box gets updated with the actual string that will later be passed to SDL. This is only shown for reference since it is a read-only field. Besides people who might be curious about how the program is mapping the controller, this string can be used with any game that uses SDL 2 in order to add a mapping for an unsupported controller. The most common way would be to set the SDL_GAMECONTROLLERCONFIG environmental variable before launching the game so that the game will be able to use the mapping string; it is the approach that Steam uses for passing the controller mapping that was created in Big Picture Mode.

export SDL_GAMECONTROLLERCONFIG="060000004c0500006802000000010000,sixad,a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,"

Besides AntiMicro, Steam Big Picture Mode and the Game Controller Map test program bundled in the SDL source code (test/controllermap.c) are the only GUI applications for creating the raw mapping string. Of those two, Steam Big Picture Mode is the more friendly option to use for creating a mapping string; the Game Controller Map test program can take a bit of fidling to build. You can check the config.vdf file (config/config.vdf) and look for the value of SDL_GamepadBind.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.