The gamepad works fine on Linux, but doesn’t work on Android, the gamepad on Android generates the keys AKEYCODE_BUTTON_1 to AKEYCODE_BUTTON_16, i tried to print the action_id but the return is “hash:[1725367350475554478 (unknown)]”, the numbers in the hash change for each button pressed.
Printing hashes always gives that in release mode bundles. I don’t know why it’s generating those keys instead of something like AKEYCODE_BUTTON_A or AKEYCODE_DPAD_LEFT, but running a debug mode bundle should correctly print out action_id and give some clues.
Seems like a bug if only certain hashes can be reversed. Also, your gamepad should be outputting these keycodes instead of the generic AKEYCODE_BUTTON_##. My guess is that your controller is weird and Defold doesn’t know what to do about it. Maybe someone more experienced with controllers and Android has more ideas?
I almost sure the gamepad isn’t working because the defold doesn’t supports theses AKEYCODE_BUTTON_##, i think if put theses AKEYCODE_BUTTON_## here could work.
Each gamepad needs an entry in the gamepad file per platform. Just because you have an entry for Linux for instance doesn’t mean you have one for Android. The mapping from Android keycode to Defold gamepad mapping can be seen here: Gamepad input in Defold
Interesting. It’s AKEYCODE_BUTTON_1 through AKEYCODE_BUTTON_16:
As you can see neither of those keycodes are covered in the current implementation of the Android gamepad support in Defold. It is quite surprising that you’re not getting the standardised keycodes for gamepads as documented here:
How do those 1-16 buttons translate to the standard gamepad configuration? Which button is 1, which is 2 and so on?
The gamepad return the keys 188 to 199(previously i said 188 to 203, i was wrong, sorry) but i have an interface from an arcade machine that returns the keys 188 to 203, the keys doesn’t have a name, so can you add this too? because the gamepad only have 12 buttons and the arcade’s interface uses 16 buttons. The names of the buttons could be like: generic button 1 … generic button 16.