godot: Incorrect ButtonIndex in Xbox controller and MacOS
Godot version
v4.0.beta5.mono.official.89a33d28f
System information
Macos Monterey 12.6
Issue description
InputEventJoypadButton.ButtonIndex return incorrect values for buttons.
- If X is pressed, it returns Y
- If Y is pressed, it returns Back
All the buttons return wrong codes, except A(0) and B(1), where it returns the right ButtonIndex.
https://user-images.githubusercontent.com/194074/203168530-6b209573-7332-41a6-8ce5-d21362c48173.mov
Steps to reproduce
This snippet is enough to see the buttons and check if they are correct or wrong:
public override void _Input(InputEvent e) {
if (e is InputEventJoypadButton b && b.IsPressed() && !b.IsEcho()) {
GD.Print($"Button {(int)b.ButtonIndex} {b.ButtonIndex}");
}
}
Minimal reproduction project
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (15 by maintainers)
Sorry @offalynne and thanks for your time. I have two different controllers:
I can confirm that #80709 fixes the issue for me
Apologies: I’m new here. Not sure if I should revive a closed thread or make a new one, but I’m definitely still getting this incorrect mapping behavior with an Xbox One controller on MacOS 14 with Godot 4.3dev3.
For example: I create a new empty project, go to Project Settings > Input Map, and create an Action. Then when I press what should be the Start button (Xbox Menu) on my controller, it reads as D-pad Up, as shown in the image. If I press the left bumper, that reads as the Start button.
So if I understand correctly this issue is fixed? We might just need to update our copy of SDL_GameControllerDB?
The controller worked before in Godot 3.5. I tried with a Xbox One controller and Xbox Series S, both failed. Even the mouse wheel up returns MaskMiddle in MacOS too, so I guess it’s a general configuration issue in Godot 4 only.
It’s likely a wrong mapping. Check this for steps on creating a controller mapping. It it fixes the issue, you should contribute it to the SDL_GameControllerDB
Yes, it’s a Godot problem. I’ve changed the code to GDScript like the screenshot and, after pressing A B X Y, it prints 0,1,3,4 instead of 0,1,2,3