Open arganoid opened 4 years ago
Iirc, under XInput the names of the buttons are purely synthetic, because XInput has no api to fetch the button names.
Names and indices of buttons and axis on USB joysticks and joy pads are a big mess, since the USB standard failed to properly define those. The only 2 options are to keep a huge database of all known devices, or to just make everything configurable.
I think you meant DirectInput when you said XInput. IDirectInputDevice8_EnumObjects gets the button names, but I don't know whether they come from the device or whether Windows just provides "Button 0" etc regardless of the device.
No I really meant XInput. I failed to notice you have a DirectX joystick.
We already use IDirectInputDevice8_EnumObjects for DirectX joysticks that are not XInput capable. But it seems in your case directinput8 doesn't give very good names for some reason.
Only thing we could do against that is try to scan the low level usb device, but that also often doesn't yield very useful results.
On every 3rd party DirectInput controller I own, the buttons are labelled with numbers starting from 1. al_get_joystick_button_name returns the buttons numbered from 0. So if the game asks the player to press "Button 1" for example, they have to press the button labelled 2.
I could modify the returned button numbers in my own code but it might be better to address this in the library.
However, stepping through the Allegro code, it appears that it is DirectInput itself which is returning "Button 0" etc - in fact if it doesn't get a name from DirectInput it defaults to "B1", "B2" and so on. Is it up to the device itself to return a name, or do the button names come purely from DirectInput? In the latter case it might make sense to use the Allegro defaults instead.
In the case of the three DirectInput-only controllers I own, all of the button names are just "Button 0" and so on. I also have two controllers which work with both XInput and DirectInput – because these are detected as XInput controllers by default, it is harder to test what their button names would be under DirectInput.