Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (855)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  GLFW Controller Database  (Read 9986 times)
0 Members and 1 Guest are viewing this topic.
Offline SHC
« Posted 2016-09-17 17:11:34 »

GLFW Controller Database


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

How to Map controllers


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.

What details do we need?


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.

Offline SHC
« Reply #1 - Posted 2016-09-18 10:16:14 »

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.

Offline Spasi
« Reply #2 - Posted 2016-09-18 12:17:22 »

NVIDIA SHIELD Controller

Identified as: Xbox 360 Controller
Platform: Windows 10 x64

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
{
    "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" }
    ]
}
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SHC
« Reply #3 - Posted 2016-09-18 12:51:58 »

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

Offline SHC
« Reply #4 - Posted 2016-09-19 15:54:44 »

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.

Offline SHC
« Reply #5 - Posted 2016-09-19 19:46:00 »

I got an error.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
Exception in thread "main" com.shc.silenceengine.graphics.opengl.GLException: Unable to compile shader:
Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors.  No code generated


        at com.shc.silenceengine.graphics.opengl.Shader.compile(Shader.java:91)
        at com.shc.silenceengine.graphics.programs.FontProgram.lambda$1(FontProgram.java:56)
        at com.shc.silenceengine.backend.lwjgl.LwjglFileReader.lambda$3(LwjglFileReader.java:100)
        at com.shc.silenceengine.utils.TaskManager.forceUpdateTasks(TaskManager.java:61)
        at com.shc.silenceengine.core.EventManager.raiseUpdateEvent(EventManager.java:172)
        at com.shc.silenceengine.core.gameloops.FixedTimeSteppedLoop.performLoopFrame(FixedTimeSteppedLoop.java:75)
        at com.shc.silenceengine.backend.lwjgl.LwjglRuntime.start(LwjglRuntime.java:96)
        at com.shc.silenceengine.tests.lwjgl.ControllerTestRun.main(ControllerTestRun.java:38)
AL lib: (EE) alc_cleanup: 1 device not closed


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?

Offline wessles
« Reply #6 - Posted 2016-09-19 22:36:45 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
{
    "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?
Offline MinusKelvin

Senior Devvie


Medals: 20
Projects: 1
Exp: 4 years


Quantum WAT


« Reply #7 - Posted 2016-09-20 03:36:19 »

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
{
    "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" }
    ]
}

You can click my images to look at a larger version most of the time.
Offline SHC
« Reply #8 - Posted 2016-09-20 04:36:30 »

@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.

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.

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.

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

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.

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

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.

Offline SHC
« Reply #9 - Posted 2016-09-20 04:44:39 »

1  
2  
3  
4  
5  
6  
7  
        { "index": "9", "name": "LS" },
       { "index": "10", "name": "RS" },
 
       { "index": "10", "name": "DPAD_UP" },
        { "index": "11", "name": "DPAD_RIGHT" },
        { "index": "12", "name": "DPAD_DOWN" },
        { "index": "13", "name": "DPAD_LEFT" }

@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?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SHC
« Reply #10 - Posted 2016-09-20 05:49:53 »

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.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
{
    "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.

Offline SHC
« Reply #11 - Posted 2016-09-21 06:32:26 »

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.

Offline SHC
« Reply #12 - Posted 2016-09-21 14:49:03 »

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.

Offline SilverTiger

JGO Coder


Medals: 41
Exp: 3 years


がんばってください!


« Reply #13 - Posted 2016-10-17 10:18:44 »

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
{
    "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" }
    ]
}

Offline chrisevergreengamesorg

Innocent Bystander





« Reply #14 - Posted 2017-01-09 21:43:53 »

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.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
{
    "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" }
    ]
}

Offline SHC
« Reply #15 - Posted 2017-01-10 14:34:46 »

@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.


Offline SHC
« Reply #16 - Posted 2017-01-17 14:13:11 »

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.

Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1572 views)
2018-06-10 19:43:48

EgonOlsen (1640 views)
2018-06-10 19:43:44

EgonOlsen (1144 views)
2018-06-10 19:43:20

DesertCoockie (1572 views)
2018-05-13 18:23:11

nelsongames (1173 views)
2018-04-24 18:15:36

nelsongames (1647 views)
2018-04-24 18:14:32

ivj94 (2404 views)
2018-03-24 14:47:39

ivj94 (1614 views)
2018-03-24 14:46:31

ivj94 (2699 views)
2018-03-24 14:43:53

Solater (883 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!