godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.28k stars 21.05k forks source link

x52 pro HOTAS has duplicated button bindings #60862

Open DAMO238 opened 2 years ago

DAMO238 commented 2 years ago

Godot version

3.3.stable and 3.4.4.stable

System information

Arch Linux, Saitek X52 Pro Flight Control System

Issue description

The silver hat on the right hand stick conflict with the buttons in the table and correspond to the following indices:

Silver Hat Direction Index Conflicting Button
Up 12 T5
Down 13 T6
Left 14 Fire 1 (fully engaged)
Right 15 Cursor clicking button

Steps to reproduce

This can be seen easily (if you have said HOTAS) by using the following snippet of code:

func _unhandled_input(event):
    if event is InputEventJoypadButton:
        print(event.button_index)

Then just launch the scene and press the buttons in the table and observe the conflicting buttons.

Minimal reproduction project

No response

Calinou commented 2 years ago

Controller mappings are handled by the third-party https://github.com/gabomdq/SDL_GameControllerDB, so issues related to incorrect mappings should be reported there instead.

PartlyAtomic commented 2 years ago

I have a similar issue with a G27 steering wheel, the D-Pad and some gears on the shifter share bindings. This apparently won't be resolved upstream in the SDL_GameControllerDB repo. A previous PR with support for a different HOTAS was closed because flightsticks and other non-controller devices are out of the scope of the db.

https://github.com/gabomdq/SDL_GameControllerDB/pull/508 https://github.com/godotengine/godot/issues/53334#issuecomment-962524812

Calinou commented 2 years ago

I'm not sure how this can be resolved, other than starting our own database of mappings for steering wheels and HOTASes (then combining it with the main controller DB). Such a database would take a lot of time to populate, as Godot users with those input devices are uncommon.

PartlyAtomic commented 2 years ago

I'm not even sure an extended controller DB would be a good solution for these use cases. On the G27 alone I count 4 axes, 23 buttons, and a hat switch (which problematically got mapped into the buttons). From what I can see in input/input.cpp there are only 21 button mappings available using a controller map. The workaround I've been considering for my project is using a module to expose SDL_Joystick so it doesn't get remapped in the first place.

Edit: I see now that Godot isn't directly using SDL, rather the controller DB format. I think allowing for an extended format of the SDL controller db would be sufficient for me (such as allowing godot_button1, ..., godot_buttonN, godot_axis1, ...,godot_axisN). I'm still digging into the input system though, so I might be misunderstanding things.