How do I get my DirectInput controller working?
So you have a DirectInput controller that's not working in Slap City. I feel your pain. To demonstrate how to remedy this, I will use an already implemented controller, the DualShock 4 connected via USB cable.
Step 1: Locate the name of your controller. This can be done in the controllers menu (Picture 1, red circles). The DualShock 4 makes itself known to Windows as "Wireless Controller". What a detailed description that is.
Step 2: Make a new text file in your profile folder (Picture 1, green circles), give it a unique name and change the filetype to ".json". (Picture 2)
Step 3: Open the file in your favorite text editor and add this boilerplate assignment data:
{ "controllers":[ { "exactControllerName":"DirectInput Controller", "descriptiveControllerName":"Some Controller I Want To Use", "comments":"Controller probably released by a cornflakes corporation", }, { "exactControllerName":"OTHER DirectInput Controller", "descriptiveControllerName":"Some OTHER Controller I Want To Use", "comments":"Controller probably released by ANOTHER cornflakes corporation", } ], "mappings":[ ["button0", "button0", 0, 1, 0, 1], ["button1", "button1", 0, 1, 0, 1], ["button2", "button2", 0, 1, 0, 1], ["button3", "button3", 0, 1, 0, 1], ["button4", "button4", 0, 1, 0, 1], ["button5", "button5", 0, 1, 0, 1], ["button6", "button6", 0, 1, 0, 1], ["button7", "button7", 0, 1, 0, 1], ["button8", "button8", 0, 1, 0, 1], ["button9", "button9", 0, 1, 0, 1], ["button10", "button10", 0, 1, 0, 1], ["button11", "button11", 0, 1, 0, 1], ["button12", "button12", 0, 1, 0, 1], ["button13", "button13", 0, 1, 0, 1], ["button14", "button14", 0, 1, 0, 1], ["button15", "button15", 0, 1, 0, 1], ["axis1", "axis1", -1, 1, -1, 1], ["axis2", "axis2", -1, 1, -1, 1], ["axis3", "axis3", -1, 1, -1, 1], ["axis4", "axis4", -1, 1, -1, 1], ["axis5", "axis5", -1, 1, -1, 1], ["axis6", "axis6", -1, 1, -1, 1], ["axis7", "axis7", -1, 1, -1, 1], ["axis8", "axis8", -1, 1, -1, 1], ["axis9", "axis9", -1, 1, -1, 1], ["axis10", "axis10", -1, 1, -1, 1], ] }
Step 3.1: A profile can apply to more than one controller. If you look inside the default DualShock4.json you'll see that it applies to several fightsticks (that I got to test at a local tournament; thanks everyone!) as well as the regular DualShock 4. They behave the same, so they are mapped the same. If you have a controller that you know works on the PS4, try adding it to the DualShock4.json file first.
Step 3.2: Assignment format goes like this
["windows", "game", windows minimum, windows maximum, game minimum, game maximum, deadzone(optional)]
Buttons 0 and 1 are "menu yes" and "menu no", respectively. Buttons 2, 3, 4, 5 are menu options. Buttons 8 and 9 are "start/pause". Axis 1 and 2 are "left stick" X and Y, respectively. Axis 3 and 4 are "right stick" X and Y. Axis 5 and 6 are "dpad" X and Y.
Axis 7, 8, 9 and 10 are assignable (defend as default).
Buttons can be mapped to axes, and vice versa.
Step 4: Enable the profile and allow the controller in the controllers menu ingame.
Step 5: Figure out the mappings for your controller. You can view how the mappings are working on the "detailed metrics" screen (Picture 3), which you can toggle with F1 (Picture 1, blue circles) This can take some trial and error, but you only need to save the file and reload the controllers menu or the character select to see changes.
Step 5.1: The finished mappings for a wired DualShock 4 look like the below. Note how some buttons and axes are left out, most significantly buttons 6 and 7, as they are the "buttons" of the analog triggers which we don't need because they are mapped to axis7 and axis8.
{ "controllers":[ { "exactControllerName":"Wireless Controller", "descriptiveControllerName":"Sony DualShock 4", "comments":"Controller for the PlayStation 4 gaming console", } ] "mappings":[ ["button1", "button0", 0, 1, 0, 1], ["button2", "button1", 0, 1, 0, 1], ["button0", "button2", 0, 1, 0, 1], ["button3", "button3", 0, 1, 0, 1], ["button4", "button4", 0, 1, 0, 1], ["button5", "button5", 0, 1, 0, 1], ["button8", "button8", 0, 1, 0, 1], ["button9", "button9", 0, 1, 0, 1], ["button10", "button10", 0, 1, 0, 1], ["button11", "button11", 0, 1, 0, 1], ["axis1", "axis1", -1, 1, -1, 1], ["axis2", "axis2", -1, 1, -1, 1], ["axis7", "axis5", -1, 1, -1, 1], ["axis8", "axis6", -1, 1, -1, 1], ["axis3", "axis3", -1, 1, -1, 1], ["axis6", "axis4", -1, 1, -1, 1], ["axis4", "axis7", -1, 1, 0, 1], ["axis5", "axis8", -1, 1, 0, 1], ] }
Step 6: Having conquered this task, play some Slap City.