godotengine / godot

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

Godot does not recognize all buttons of a Nintendo Switch Joycon #78805

Open daruku17 opened 1 year ago

daruku17 commented 1 year ago

Godot version

v3.5.2.stable.official[170ba337a], v4.0.3.stable.official [5222a99f5]

System information

Linux Mint 21.1 x86_64

Issue description

Godot does not recognize the ZR and R button of the right joy con when assigning the buttons to an action on the input map in the project settings. The SL, ZL, L, -(minus), arrow up, arrow left of the left joycon also can't be recognized by the engine. I also tried to print the button id in the _input() function but nothing happened for the buttons I mentioned before.

However the Godot version v3.2.3.stable.custom_build from the Linux apt is able to recognize every button pressed on every joycon and everything works fine. This can be installed with sudo apt install godot3

Steps to reproduce

func _input(event): for i in range(0, 20): if Input.is_joy_button_pressed(0, i): print(str(i))

Minimal reproduction project

N/A

KoBeWi commented 1 year ago

Tested, I'm getting the same results in 3.5.2 and 4.1 rc. All buttons are recognized except ZL/ZR and L/R.

Note that your reproduction code gives wrong results. Try

func _input(event):
    if event is InputEventJoypadButton:
        prints(event.device, event.button_index)
stephanbogner commented 7 months ago

Even weirder on my end with Godot v4.2.1.stable - macOS 14.1.2 - Vulkan (Forward+) - integrated Apple M2 Pro - Apple M2 Pro (10 Threads)

Results:

Code I used for testing:

func _ready():
    for joypad_index in Input.get_connected_joypads():
        print("- ", Input.get_joy_name(joypad_index))

func _input(event):
    if not event is InputEventMouse:
        print(event)
leoarmelin commented 6 months ago

I'm getting the same results as @stephanbogner .

Calinou commented 6 months ago

Can you test https://github.com/godotengine/godot/pull/87925 and see if it resolves the issue for you? Note that it only has an impact on Linux.

megalobyte commented 2 months ago

That PR didn't resolve the issue for me. The only difference I observed is that the get_connected_joypads doesn't return anything. Otherwise, the error as stated in the issue is the same for me too (Fedora 40).