Controller hat switch axis not detected
I'm using an 8Bitdo controller:
The left analog stick is axis 0 (-left, +right), axis 1 (-up, +down). With the Solarus default config, I can use this to control the hero successfully. The problem comes when trying to use the d-pad. The d-pad is axis 6 (-left, +right), axis 7 (-up, +down).
Solarus does not detect the d-pad at all. This code has no output when pressing the d-pad:
function sol.main:on_joypad_axis_moved(axis, state)
print(axis, state)
end
The left and right analog sticks do work. Here's what jstest looks like:
It's getting output from the other axis fine.
The d-pad is definitely two axis, not 4 discrete digital inputs, but to sanity check I also used this code and got no output from the d-pad (while ABXY do work):
function sol.main:on_joypad_button_pressed(button)
print(button)
end
My guess is that Solarus won't deal with high-numbered axis for some reason.
EDIT: The order of the axis doesn't matter. I think it's actually because axis 6/7 are considered hat switches: