Enable GameCube controller adapter support on Linux - #118147
Conversation
8097e7f to
736f0b0
Compare
736f0b0 to
16953cc
Compare
|
@bakana808 Hello, may I ask if you can test this PR, please? See https://contributing.godotengine.org/en/latest/pull_requests/testing.html on how to download a build of this PR, you'll want to download the |
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install libwayland-bin # TODO: Figure out somehow how to embed this one. | ||
| sudo apt-get install libusb-1.0-0-dev |
There was a problem hiding this comment.
| sudo apt-get install libusb-1.0-0-dev | |
| sudo apt-get install libusb-1.0-0-dev # Used by SDL's GameCube HIDAPI driver. |
Thanks for your work on this! I did try it out briefly, and my Gamecube controller seems to be detected in the editor now (I can add input maps and such now), however when testing the game it doesn't seem to be working in the game, at least for me. From my experience using this GCC adapter, when one app is already "using" the adapter, other apps cannot see or use it at the same time. I'm guessing that's what's happening here (the editor is already using the adapter so the game can't see it) but I'll play around with it more when I have more time. I suspect it probably works if I export the game first and run it on its own without the editor. |
|
Thank you for testing! SDL described that the official adapter can be used exclusively by libusb, which detaches drivers and makes it unusable by the rest of the OS at the moment: godot/thirdparty/sdl/hidapi/SDL_hidapi.c Lines 880 to 893 in 3911e09 That's what might be happening here, one process (the editor) has acquired the device, so other processes (the debugger with the game) can't see it, but I think running the exported game alone should work! EDIT: Now that I think about it, maybe we can make the Godot editor disconnect the controller so the game can then detect it, I will need to try it. |
|
I checked the SDL GameCube HIDAPI driver source code and realized that it calls |
|
Just commenting to confirm that I had the same experience with the mono build on Arch Linux; one can add input maps in the editor but no input is read (at all) when the scene is run. I can help you or others test this with my controller and adapter since I'm pretty desperate for this feature, but I'm not a libusb expert either. |
|
Did not test this PR but if anyone wants to work on the libusb fix, I can help with testing, too. |
This PR enables GameCube controllers support on Linux by enabling libusb and
HAVE_ENABLE_GAMECUBE_ADAPTORSthat does proper GameCube controller initialization via libusb.Not tested by me since I don't have GameCube controllers and GameCube adapters.
CC @Repiteo since you mention GameCube controller adapters in several of your Godot proposals:
InputHandlerabstract/virtual class to allow for multiple input drivers godot-proposals#9064FileAccessequivalent for devices (USB, HID, etc) godot-proposals#7247Note: SDL described that the official adapter can be used exclusively by libusb, which detaches drivers and makes it unusable by the rest of the OS at the moment:
godot/thirdparty/sdl/hidapi/SDL_hidapi.c
Lines 880 to 893 in 3911e09
This means that while one process (the editor) has acquired the device, other processes (the debugger with the game) can't see it, but I think running the exported game alone should work!
TODO: