Hello Everyone
I’m currently using GitHub - 0xcafed00d/joystick: Go Joystick API to get joystick state - which (in basic form) works on Windows with XBox360 (compatible) controller, DualShock 4 and also Legion Go joystick/s.
However, the button mappings between DS4 and Xbox for the face buttons (and I am sure the axes) don’t map the same, i.e. I would like to have the same button (mask) for these:
Ⓐ/✕
Ⓑ/◯
Ⓧ/☐
Ⓨ/🛆
There doesn’t appear to be any way to identify the controller type (using the underlying Windows Multi Media (legacy) dll/api).
Does anyone know of a package that manages this better - without adopting a whole framework - note that this isn’t for game development - but for a background (OS level) utility that can respond to gamepad inputs.
Things I have looked at so far include:
I can guess which the controllers are, since the DS4 returns a different number of buttons and axes to an XBox360 - but I can’t find anywhere this is documented so it is just guessing based on 2/3 controllers…
Roll my own Windows calls - but this seems over the top (and OS specific) plus I don’t have any experience of this - and likely reinventing the wheel…
Windows Gaming Input - but I don’t see any examples of Golang accessing the api and it looks like you might have to buy in to the whole SDK.
SDL - but this looks too over the top for my purposes and it looks unlikely to solve the issue either
Note that I would prefer a cross platform solution but the prime target is windows…
I have tried some different options which may help anyone with a similar issue:
I directly accessed the windows xinput dll. This worked for XBox 360 compatible joysticks (only). Unfortunately the joystick numbers do not match the Multi Media numbers so can’t be used to identify Xbox joysticks.
I tried accessing the (new) GameInput and managed to get the dll and also access the first api call. But my Windows C++ is non existent so I gave up when I encountered pointers of pointers - too much learning required to convert between C++ and Go.
I’m now ‘rolling my own’ using XInput with XInputGetState from xinput1_3.dll.