libgdx/gdx-controllers

No controller support on MacOS?

mlesniak opened this issue · 8 comments

Hi,

I've cloned the repository and build the desktop test application. A connected Nintendo Switch Pro Controller is connected and works according to https://html5gamepad.com/:

image

Unfortunately, neither in my program nor the test application any controller is found:

❯ pwd
/Users/m/Documents/gdx-controllers
❯ java -jar test/desktop/build/libs/test-1.0.0.jar
AL lib: (EE) ca_open_playback: AudioUnitInitialize failed
[Controllers] added manager for application, 1 managers active
[Controllers] 0 controllers connected.

image

I've looked for other having this problem and asked in the libgdx discord channel, but to no avail.

I'd really appreciate any help here.

Thanks,
Michael

Best is to check if the controller is available in the db file that ships with the lib. If not, check if it is in the latest.

There were some changes to SDL (the underlying lib) concerning Nintendo controllers, it might be needed that we update to the latest version.

Which browser did you use to test the support, Chrome or Safari?

Hello @MrStahlfelge,

thanks for the swift reply.

Best is to check if the controller is available in the db file that ships with the lib. If not, check if it is in the latest.

The controller seems to be available, i.e. in com.badlogicgames.gdx-controllers:gdx-controllers-desktop:2.2.1/gamecontrollerdb.txt I've found a couple of entries for a Nintendo Switch Controller, e.g.

030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,

How could I update the entry to test it, that is, determine more current values?

Which browser did you use to test the support, Chrome or Safari?

Chrome

Best,
Michael

The line you outlined is for Windows, is there any for MacOS?

I found the following two lines

030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
030000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,

Okay, if they were missing, that would be it! Unfortunately I can't test with the controller on MacOS, but next steps should be to check if it really is the correct id of your device. In 99% of the cases when a controller does not appear on Jamepad/SDL, it is because the mapping is not set in the db file.

Sorry for that question, but how can I check the id by controller is sending? 🤔

Information on the db file repo on how to create the mappings: https://github.com/gabomdq/SDL_GameControllerDB#mapping-tools

@MrStahlfelge

I tried to use various tools to create mappings. None of them based on SDL2 worked, there are different problems when a Switch Pro Controller is connected. For now, I'll work with other controllers.

Hence, I'll close the issue.