GLFW Controller Database

[h1]GLFW Controller Database[/h1]
There are a lot of different controller layouts, and even controllers with similar layouts give out different button and axis codes depending on the platform. This is an attempt to create a collection of controller mappings which work with the latest GLFW 3.3 which is used in LWJGL 3.0.1 SNAPSHOT.

All the submitted mappings will be added to this repository at https://github.com/sriharshachilakapati/GLFW-Controller-Database

[h1]How to Map controllers[/h1]
GLFW returns the data as arrays (ByteBuffer and FloatBuffer) in LWJGL, and the button information is found in those arrays. Instead of manually finding the index of the input, I wrote a visual tool which allows to find the indices easily.

Get it at http://silenceengine.goharsha.com/downloads/ControllerTest.jar

Though the tool is made with SilenceEngine, it uses GLFW for input. SilenceEngine is only used to render the info to the screen. The controls are as follows. You can type 0 to 9 to switch between the first 10 connected controllers. You can press + and - keys to look for more.

If your controller is detected as ideal, then it means that there is a mapping already provided by a contributor and is present in the database repo. If not please map it yourself and contribute the details.

[h1]What details do we need?[/h1]
The tool doesn’t send any information automatically, it is just for convenience. You have to provide the following details so we can add it to the database.

[]The Operating System that you are using
[
]Architecture of your Operating system
[]The real name, make and model of your controller
[
]What is it identified as by the tool
[]The number of buttons
[
]The number of axes
[]Which button is at which index
[
]Which axis is at which index
[*]Any other additional information you wish to provide

Thanks in advance for being part of the database construction. All the mappings will be changed to a JSON format, and stored as JSON files in the repository.

Note: This requires Java 8, and mac users need to run it on the first thread. java -XstartOnFirstThread -jar ControllerTest.jar. On other platforms, you can run it with java -jar ControllerTest.jar. All the natives are packed into the JAR.

I just uploaded a new version of the ControllerTest, now it can sense controller connect and disconnect events. I also added mappings for my locally found non standard controller with a PS style layout and XBOX style button naming, with 16 buttons and 4 axes for Windows.

GenericWinLiveTechLTPad.json

It looks exactly like the ideal controller that I drawn a few days earlier.

Please post mappings of your controllers guys, it might help someone.

NVIDIA SHIELD Controller

Identified as: Xbox 360 Controller
Platform: Windows 10 x64

{
    "layout": {
        "buttons": "14",
        "axes": "6"
    },

    "buttons": [
        { "index": "0", "name": "A" },
        { "index": "1", "name": "B" },
        { "index": "2", "name": "X" },
        { "index": "3", "name": "Y" },

        { "index": "4", "name": "LB" },
        { "index": "5", "name": "RB" },
        { "index": "6", "name": "BACK" },
        { "index": "7", "name": "START" },

        { "index": "8", "name": "LS" },
        { "index": "9", "name": "RS" },

        { "index": "10", "name": "DPAD_UP" },
        { "index": "11", "name": "DPAD_RIGHT" },
        { "index": "12", "name": "DPAD_DOWN" },
        { "index": "13", "name": "DPAD_LEFT" }
    ],

    "axes": [
        { "index": "0", "name": "LS_X" },
        { "index": "1", "name": "LS_Y" },
        { "index": "2", "name": "RS_X" },
        { "index": "3", "name": "RS_Y" },
        { "index": "4", "name": "LTRIGGER" },
        { "index": "5", "name": "RTRIGGER" }
    ]
}

Thanks a lot @Spasi. Added your mappings to the database as XInputNVShieldController.json

I just purchased a second hand game pad SPEEDLINK STRIKE here for ₹250/- ($3.74) which is very cheap. It is a PS3 style controller, and identifies itself as SPEEDLINK STRIKE Gamepad in Windows after the drivers. Also added its mappings.

P.S: I’m surprised that its driver also detects my LiveTech joystick also as a SPEEDLINK controller, but both have same mappings. Maybe because both are local made.

I have fixed that issue. Now using GLSL 330 core for the shaders, thanks for the find. Maybe NVIDIA and Intel are ignoring this. I just uploaded a new download, could you please test it again?

{
    "name": "Afterglow Gamepad for Xbox 360",
    "os": "Ubuntu 16.04",

    "layout": {
        "buttons": "11",
        "axes": "8"
    },

    "buttons": [
        { "index": "3", "name": "Y" },
        { "index": "1", "name": "B" },
        { "index": "0", "name": "A" },
        { "index": "2", "name": "X" },

        { "index": "4", "name": "L1" },
        { "index": "5", "name": "R1" },

        { "index": "6", "name": "SELECT" },
        { "index": "7", "name": "START" },

        { "index": "9", "name": "LS" },
        { "index": "10", "name": "RS" }
    ],

    "axes": [
        { "index": "0", "name": "LS_X" },
        { "index": "1", "name": "LS_Y" },
        { "index": "3", "name": "RS_X" },
        { "index": "4", "name": "RS_Y" },

        { "index": "6", "name": "DPAD_X" },
        { "index": "7", "name": "DPAD_Y" },

        { "index": "2", "name": "L2" },
        { "index": "5", "name": "R2" }
    ]
}

This is an XBOX 360 controller with blue LED lighting.

L2 and R2 are not buttons on this controller, but axes from -1 (not pulled at all) to 1 (fully pulled). No buttons are pressed when I pull the trigger.

The DPAD is also counted as 2 axes, being either 0, 1, or -1 on each axis.

Maybe you should have a notes section on the database to track these irregularities?

My controller is an official USB Xbox 360 controller. Mapping appears be the same as wessles’ controller’s mapping.


{
    "name": "Microsoft X-Box 360 pad",
    "os": "Linux Mint 18 Cinnamon",

    "layout": {
        "buttons": "11",
        "axes": "8"
    },

    "buttons": [
 
        { "index": "0", "name": "A" },
        { "index": "1", "name": "B" },
        { "index": "2", "name": "X" },
        { "index": "3", "name": "Y" },

        { "index": "4", "name": "LB" },
        { "index": "5", "name": "RB" },

        { "index": "6", "name": "BACK" },
        { "index": "7", "name": "START" },
        { "index": "8", "name": "GUIDE" },

        { "index": "9", "name": "LS" },
        { "index": "10", "name": "RS" },
    ],

    "axes": [
        { "index": "0", "name": "LS_X" },
        { "index": "1", "name": "LS_Y" },
        { "index": "2", "name": "LT" },
        { "index": "3", "name": "RS_X" },
        { "index": "4", "name": "RS_Y" },

        { "index": "5", "name": "RT" },
        { "index": "6", "name": "DPAD_X" }
        { "index": "7", "name": "DPAD_Y" }
    ]
}

@wessles

In your mappings, button index 8 is missing. I suppose it is the guide button? I’ll add the mapping to the database if you confirm.

That’s expected for XBOX style gamepads, as triggers are analog buttons, and by design, GLFW represents analog buttons as axes since they have values and not just ON and OFF.

This is really strange, I didn’t expect this, because they are buttons. Maybe XBOX is having analog DPAD or what I don’t know, but this is indeed a variation.

Yes! I’m working on that. There will be a section explaining the mappings in the README soon. I’ll also try to provide some code on creating a class which can load these mappings from files and auto-detect the controller.

@Brynn There is index 8 missing in your mapping as well, and you have added same index for RS and DPAD_UP. I suppose that the sticks are in 8 and 9 indices, and DPAD_UP is in 10. Can you confirm this again please?

So according to GLFW, the joystick name is not guaranteed to be unique per device, and it may report differently on different OS, even the name. This leaves us with only the number of axes and buttons to identify. Additionally, we can keep keywords per mapping, and select the mapping which matches the maximum keywords. This should be the way to globally identify the controllers.

The goal of GLFW Controller Database is not to map every controller to an ideal controller, but to document the input locations on a wide range of controllers. We want to generalize the controllers between XBOX layout and PS layout controllers.

And in XBOX controllers posted, and also third party XBOX style controllers, I’ve identified two layouts, one with 14 buttons and 6 axes and another with 11 buttons and 8 axes. There might be the same happening in PS style controllers too, we just need to test more.

The new layout in the database (I’ll push to the repository soon) is to have files with the naming scheme Style-Buttons-Axes-Platform-Type.json. For examples of valid names, Xbox-14-6-Linux-1.json and Xbox-11-8-Linux-2.json are good examples. The type is a number, which only changes when a controller is of an existing style, have the same number of axes and buttons, but the indices are different.

The internal file format is also going to change a small bit, it accepts names as an array of strings which are known variations that give the same indices for the names, and they are also going to include a new keywords section, which is an array of strings as well.


{
    "names": [
        "name1", "name2", ...
    ],

    "keywords": [
        "keywords", "to", "identify", "uniquely"
    ],

    "buttons": [
        { "index": 0, "name": "NAME" }, ...
    ]

    "axes": [
        { "index": 0, "name": "NAME" }, ...
    ]
}

The layout section is now gone, because that information is present in the file name, and is already provided by the GLFW, there is no need for redundant data. Also the indices are now JSON number fields and not strings anymore.

We also make it strict for names within the mappings for axes and buttons, so that they are consistent across the mappings. The names for the XBOX style controllers are as follows.

X, Y, A, B, BACK, START, GUIDE, LB, RB, DPAD_UP, DPAD_RIGHT, DPAD_LEFT, DPAD_DOWN, LS, RS for the buttons and
LS_X, LS_Y, RS_X, RS_Y, LTRIGGER, RTRIGGER, DPAD_X, DPAD_Y for the axes.

Similarly the names for PS style controllers are as follows.

TRIANGLE, CIRCLE, CROSS, SQUARE, SELECT, START, PS, L1, R1, L2, R2, DPAD_UP, DPAD_RIGHT, DPAD_LEFT, DPAD_DOWN, LS, RS for the buttons and
LS_X, LS_Y, RS_X, RS_Y, DPAD_X, DPAD_Y for the axes.

Every mapping should have the names only from the above selected list. Any other names will render it invalid. Coming to the styles PS and XBOX, there is a need for the differences between them, apart from physical layouts (which only change the location of the left stick), triggers are buttons in PS controllers where they are axes in XBOX style.

With this, I think I have covered abnormalities in controllers enough. There are more layouts and different controllers in the wild, but let’s start with these.

The database is now modified to the new layout I said before. Anyone using a controller with a Mac? We need bindings on Mac OS as well.

Another thing I have observed, Microsoft’s XBOX driver is not exposing the guide button on windows, but it is exposed on Linux because of custom non microsoft drivers. It is advised not to use it in the games.

I just purchased a Microsoft Xbox 360 Wireless Receiver for Windows for ₹1500/- ($22.35), and it is perfectly working with my original Xbox 360 Wireless receiver that came with the console. It had the same mappings as reported already, and verified itself as “Wireless Xbox 360 Controller”. Added it to the database as well.

Tested it with a Logitech F510 on Linux Mint 18 Sarah 64-bit.


{
    "names": [
        "Logitech Gamepad F510"
    ],

    "keywords": [
        "Logitech"
    ],

"buttons": [
        { "index": "0", "name": "A" },
        { "index": "1", "name": "B" },
        { "index": "2", "name": "X" },
        { "index": "3", "name": "Y" },

        { "index": "4", "name": "L1" },
        { "index": "5", "name": "R1" },

        { "index": "6", "name": "BACK" },
        { "index": "7", "name": "START" },

        { "index": "8", "name": "LOGITECH" },

        { "index": "9", "name": "LS" },
        { "index": "10", "name": "RS" }
    ],

    "axes": [
        { "index": "0", "name": "LS_X" },
        { "index": "1", "name": "LS_Y" },

        { "index": "2", "name": "L2" },

        { "index": "3", "name": "RS_X" },
        { "index": "4", "name": "RS_Y" },

        { "index": "5", "name": "R2" },

        { "index": "6", "name": "DPAD_X" },
        { "index": "7", "name": "DPAD_Y" }
    ]
}

Operating System Used:Windows 7 OS
Architecture: x64
Real Name of Controller: Fujitel Gamepad (Single Axis, DPad Only. Configured as LS_X, LS_y)
Identified Name: USB Joystick
Number of Buttons: 13 (only B0-B9 are Configurable by the tool, it has Turbo, Clear and Auto near Start/Select, which would likely be B10, B11, B12, B13)
Number of axes: 2

This is a controller I bought in Chile while studying abroad. Great for games that don’t need two joysticks. A bit dated but I imagine others have it.

{
    "names": [
        "Fujitel SingleAxis Gamepad", "Fujitel Gamepad Chile", "Fujitel Gamepad"
    ],

    "keywords": [
        "Fujitel Gamepad", "Fujitel", "Fujitel Game", "SingleAxis"
    ],

"buttons": [
        { "index": "0", "name": "TRIANGLE" },
        { "index": "1", "name": "CIRCLE" },
        { "index": "2", "name": "CROSS" },
        { "index": "3", "name": "SQUARE" },

        { "index": "4", "name": "L1" },
        { "index": "5", "name": "R1" },

        { "index": "6", "name": "L2" },
        { "index": "7", "name": "R2" },

        { "index": "8", "name": "SELECT" },

        { "index": "9", "name": "START" }
    ],

    "axes": [
        { "index": "0", "name": "LS_X" },
        { "index": "1", "name": "LS_Y" }
    ]
}

@chrisevergreengamesorg

If the game pad is identified as USB Joystick on Windows, that means that windows is using the generic driver for Joysticks. Don’t you have a driver that came along with it?

And by Single Axis, DPad Only, do you mean there is only one analog stick, or there are no analog sticks, and DPAD is reported as axes also? And is this your gamepad? I had a hard time searching for this one, it seems there is very less information on this.

I just purchased Redgear Pro Wireless Game Pad with XBOX 360 layout, and this one is so cool! It’s just ₹1600/- ($23.54) and is the best one for the price. Got the following mappings in Windows.

This one identifies as Xbox 360 Controller on XInput mode, and as Redgear on DirectInput mode, and both works out of the box without any custom drivers.

The commit 5685a23 adds the support.