godotengine / godot

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

Xbox controller L2 and R2 inputs swapped on Android #56181

Open Oliver-makes-code opened 2 years ago

Oliver-makes-code commented 2 years ago

Godot version

3.4.2

System information

Android 11, Samsung Galaxy A02S

Issue description

When exporting my project for android, I noticed that my L2 and R2 inputs were swapped. I expected the inputs to not be swapped, and to work as it does on windows, but that wasn't the case.

Steps to reproduce

Minimal reproduction project

minimal-reproduction.zip

akien-mga commented 2 years ago

What controller model are you using, and how is it connected? Can you retrieve its GUID with https://github.com/godotengine/godot/blob/b4d7d8766670e2e6380d7d76798f81f840ffe168/doc/classes/Input.xml#L144?

Oliver-makes-code commented 2 years ago

What controller model are you using, and how is it connected?

It's a standard Xbox One controller (marked as __XINPUT_DEVICE__), connected via Bluetooth

madmiraal commented 2 years ago

@Oliver-makes-code __XINPUT_DEVICE__" is a Windows entry for controllers using the XInput system on Winodws. You need to run get_joy_guid() from within Android to get the GUID that Android sees. I'd suggest creating another label in your MRP and displaying it there. Also, if you enable information logging in the logcat, you should be able to see which Android axis is mapped to which Godot axis. Look for "=== New Input Device: " and then the following " - Mapping Android axis " entries.

ICatRegister commented 2 years ago

On Android and Linux, Godot does not use an SDL compatible GUID, instead, GUID is created from the controller name and it will never match the SDL base, so expect the default mappig even for branded controllers

Ryhon0 commented 1 week ago

I'm getting the same issue with the Stadia controller connected via BT and USB. The GUID for BT is 5374616469615a5656352d64373261 and 476f6f676c65204c4c43205374616469 for USB. When using Bluetooth, every controller has it's own display name, which can be re-rolled when the controller is reset, so this might result in random GUIDs.
The "Gamepad Tester" app by elron on the Play Store seems to detect the triggers as BREAK and GAS correctly in both cases