godotengine / godot

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

Godot does not detect rear analog triggers on the stadia controller. #94585

Open Torguen opened 3 months ago

Torguen commented 3 months ago

Tested versions

v4.4.dev2.official [97ef3c837] v4.3.beta3.official [82cedc83c] v3.6.rc1.official [cfc4a0eff]

System information

w10 64

Issue description

From the SDL forum, they confirm that the Stadia controller's analog triggers work correctly. It is understood that the problem lies in Godot. A video is provided showing that the analog triggers work correctly in SDL. Link to the post: https://discourse.libsdl.org/t/sdl-supports-stadia-pad/55314/2

Captura5

Godot only reads 0 or 1, there are no intermediate values ​​using "get_action_strength". Initially this error also occurred on Windows. For windows I solved it using this method:

Captura5

This generated two new fields in the windows application:

Captura4

But godot doesn't read those fields, it seems, and only returns two fixed values: 0 or 1.

This utility reads stadia triggers correctly: https://gamepad-tester.com/

https://github.com/user-attachments/assets/b30d6746-2994-405d-b2d5-4466fb7ba39c

Steps to reproduce

Press the right trigger and see the values in output, 0 or 1.

Minimal reproduction project (MRP)

Test.zip

Torguen commented 2 months ago

This problem is caused by godot or by SDL_GameControllerDB?

Should I report this issue here or in SDL_GameControllerDB?

AThousandShips commented 2 months ago

Would be good to do a check upstream and see if the problem occurs in other cases as well, I don't have this controller so can't test myself

Torguen commented 2 months ago

What other cases are you referring to?

In the gamecontrollerdb.txt file the stadia controller seems to be misassigned, someone thought that those triggers are not analog and set them as digital. The different analog controls on the xbox controller, for example, are set as a0, a1, a2 etc... (a for analog I guess). However, the stadia controller triggers do not have the letter a but its analog sticks do. Someone must have thought that the stadia controller triggers are not analog.

AThousandShips commented 2 months ago

What other cases are you referring to?

Outside Godot

Torguen commented 2 months ago

I have no idea, how should I test outside of godot?

AThousandShips commented 2 months ago

That's why I'd suggest looking upstream, what I meant in my comment above

Torguen commented 2 months ago

I don't understand what you mean in your previous comment. If you want to explain it to me, I can try it.

AThousandShips commented 2 months ago

It would be good to see if other projects have this problem to see if it's a Godot problem or an sdl problem

I'm sorry if the language barrier makes it hard to understand what I'm saying 😕

What I'm saying is: Check with the SDL library to see if this is known, and if others have this issue, if it's our code, or our configuration, or a problem with their configurations

If it's that their configurations are wrong then it should be fixed by them and then we can update ours to match

Torguen commented 1 month ago

Maybe it's related: https://github.com/godotengine/godot/issues/36370

In the end I couldn't look at what you suggested because I don't know exactly how to do it.

Torguen commented 2 weeks ago

There is an answer and it is mentioned that SDL accepts stadia controllers. https://discourse.libsdl.org/t/sdl-supports-stadia-pad/55314

Torguen commented 1 week ago

Well, someone answered, and they say that SDL is compatible with the Stadia controller. I have a Stadia controller, if someone tells me what I should change in the Godot source code, I could fix it.

Torguen commented 4 hours ago

In Godot, the Stadia controller is using DirectInput The information I have so far is that the analog trigger press only returns 1 and 0 because in this line, 1 is assigned when the trigger is pressed, and there is no intermediate value; the trigger is not being detected as analog.

In input.cpp Just investigating. If it's an axis type, why are integer values assigned to it?

captura2

Also, from joypad_windows.cpp, the trigger is already detected as a button because these lines are executed when pressing and releasing it. Perhaps joy_axis should be executed instead of joy_button?

captura3

Torguen commented 2 hours ago

When the analog left trigger is pressed, the value 13 is sent, which corresponds to DPAD_LEFT in the JoyButton class.

captura

captura

The correct way should be:

captura