godotengine / godot

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

HOTAS Problem (some axes and buttons not recognized) and godot closing on remove joy mapping (Thrustmaster TWCS Trottle) #65330

Open Roman-laufenderWahnsinn opened 2 years ago

Roman-laufenderWahnsinn commented 2 years ago

Godot version

3.5 Stable & 4.0 alpha 15

System information

Windows 10, GLES3, Intel i7-8700K, NVIDIA GTX 1080

Issue description

I have a HOTAS setup (Thrustmaster T.16000M and TWCS Throttle) witch get mapped through generic SDL mapping, but therefore I have a lot of non accessible axes and buttons, and some are double mapped. I tried every option to get "raw like" input, but somehow those buttons and axes get not recognized bu godot (even tried 4.0 alpha 15). What I have tested and what was the result: _unhandled_input(event) and _input(event): (same results)

TWCS Trottle:

  • only 3 axes recognized (of 8 axes), and one is even split up in 2 (into shoulder pads) and therefore jumps in value as only half in "present"
  • buttons are double mapped (7-10 are combined with "d-pad") and a lot are missing: 1-5, 11 - 14 T.16000M:
  • only 2 of 4 axes work, z rotation and slider missing (interesting, as on the TWCS the z-rot is split into axes 6+7, the weird one)
  • buttons are very weird: some are mapped to axes (physical 8 and 10 to axis 4 and 5) and missing 6, 9 and 14 - 16

Then I got the idea to remove the "generic" mapping to maybe get the buttons and axes to work with: Input.remove_joy_mapping(Input.get_joy_guid(1)) # TWCS Throttle Input.remove_joy_mapping(Input.get_joy_guid(4)) # T.16000M In that case the godot debug closes silently (and goes back to the editor like I would have closed the debug with the x on the window or like get_tree().quit() function).

I created for exklusive testing a new project in 3.5 and 4.0 alpha with only a node_3D and the script attached (see below).

If a video would help to show the issue I can create one. And is there somewhere a file I can attach? As the debug-instance just closes without error report... (only warning: "The parameter 'delta' is never used in the function '_process'....")

Steps to reproduce

extends Node

# Called when the node enters the scene tree for the first time.
func _ready():
    #Input.remove_joy_mapping(Input.get_joy_guid(1))
    #Input.remove_joy_mapping(Input.get_joy_guid(4))
    print(Input.get_joy_guid(1))
    print(Input.get_joy_guid(4))

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    pass

func _unhandled_input(event):
    if event.device != 0: # to get only joy inputs
        print(event.as_text())
        print(event.device)

Minimal reproduction project

No response

Calinou commented 2 years ago

Related to https://github.com/godotengine/godot/issues/60862.

The game controller database used by Godot does not feature mappings for HOTASes and steering wheels, so buttons are expected to be incorrect.

PS: Code blocks should use triple backticks like this (with an optional language name for syntax highlighting):

```gdscript code here ```

I edited your post accordingly, but remember to do this in the future :slightly_smiling_face:

Roman-laufenderWahnsinn commented 2 years ago

Okay, I see the relevance to #60862, just one question: is it normal that on removal of the mapping the instance closes? That seems very odd for me.

Calinou commented 2 years ago

just one question: is it normal that on removal of the mapping the instance closes? That seems very odd for me.

No, the crash should be fixed.

Roman-laufenderWahnsinn commented 2 years ago

Okay, I tryed to dig in in the code of godot myself, but I have to admit I can't find where godotcontrollerdb.txt gets loaded in. Because the "default" map is my problem. And stopping godot from loading a "default" map may help. I found where the map gets "deleted" but as I didn't find the "_input" & "_unhandled_input" methods I can't suspect what creates the silent crash. I would like to read the functions, so that I at least try to find the cause, maybe (like missing entry in list leads to stop of program). Cheers