mdqinc / SDL_GameControllerDB

A community sourced database of game controller mappings to be used with SDL2 Game Controller functionality
http://libsdl.org
zlib License
1.38k stars 520 forks source link

add Linux/Windows mapping for Alfadata USB Gameport Adaptor #783

Closed bomb2777 closed 2 months ago

bomb2777 commented 2 months ago

What is it?

Why do I need it?

offalynne commented 2 months ago

Have you confirmed that LibGdx does recognize the device after this change? It is not usual in SDL, the intended consumer of the db, for a generic device to be unavailable simply because a db mapping is not present. If that is the case with LibGdx, you should consider that a bug.

2 axes and 2 buttons are not suitable criteria for a mapping. The goal of mapping is to disambiguate layout; with less than 3 buttons or axes a mapping is redundant and unnecessary.

bomb2777 commented 2 months ago

2 axes and 2 buttons are not suitable criteria for a mapping. The goal of mapping is to disambiguate layout; with less than 3 buttons or axes a mapping is redundant and unnecessary.

thx for your explanation, I will try something else then :+1:

bomb2777 commented 2 months ago

Have you confirmed that LibGdx does recognize the device after this change? It is not usual in SDL, the intended consumer of the db, for a generic device to be unavailable simply because a db mapping is not present. If that is the case with LibGdx, you should consider that a bug.

@offalynne JFYI: I got it working with a modified gamecontrollerdb.txt which overrides the orginal one in my game.jar.

I created a mapping with SDL Gamepad Tool before, but it does only recognize 2 directions, not 4. Mapping string: 030000009d0700000102000000000000,USB ADAPTOR,a:b1,x:b0,dpup:a1,dpleft:a0,platform:Windows

I tried to create the mapping with Steam's Big Picture Mode, which produces a more usable output: Mapping string: 030000009d0700000102000000000000,USB ADAPTOR,a:b1,x:b0,dpleft:-a0,dpright:+a0,dpup:-a1,dpdown:+a1,platform:Windows

I copied the dpad (dpleft. dpright etc.) values to the Linux string, now the USB Adaptor is recognized on both platforms. Looks not like a bug on libgdx's side for me, but probably the adaptor + controller I use is just too old.

Have a nice day.

offalynne commented 2 months ago

Yes the mapping tool is not always the friendliest, glad you worked out the final correct mapping that works for you

Looks not like a bug on libgdx's side for me

Just to clarify, SDL should not require a mapping db entry for the device to be registered and accessed as a joystick. Given gameport is a generic interface for devices including joysticks, it should "just work" without the mapping you added. Since Steam and the mapping tool both recognize the device correctly before you add the mapping db entry (a necessary step to author the map in the first place), it seems the issue is with Libgdx. In any case, glad you found your solution!

bomb2777 commented 2 months ago

Thx again for explanation. I ignored the fact that Steam already uses SDL under the hood. You are right, must be something with the implementation on https://github.com/libgdx/gdx-controllers 's side. Will open an issue there.