godotengine / godot

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

Controller names no longer contain brand / type #98008

Open AdriaandeJongh opened 1 month ago

AdriaandeJongh commented 1 month ago

Tested versions

Tested in 4.3.stable

System information

Godot v4.3.stable - macOS 15.0.1 - Vulkan (Mobile) - integrated Apple M3 Max - Apple M3 Max (14 Threads)

Issue description

I don't know when this started happening – perhaps with a new macOS version – but somehow print(Input.get_joy_name(device_id)) only returns names like Controller and Wireless Controller making it impossible for me to determine the type of controller and subsequently show the right icons in my game.

Showing the right icons is an important feature for compliance with stores and platforms. There should be a solid way to at the very least differentiate between controllers from Microsoft, Sony, Nintendo, and generic controllers.

If there is a workaround, please let me know.

Steps to reproduce

On macOS, connect any controller and print its name using Input.get_joy_name(device_id).

Minimal reproduction project (MRP)

n/a

AdriaandeJongh commented 1 month ago

To add insult to injury, it seems that removing the name is a change by Apple? Here's a screenshot of my settings:

Screenshot 2024-10-09 at 09 27 03

I did not change any names. I can't even change the names. The icons indicate that the Apple settings knows the brands, but has taken them out of the name? I don't get it.

AdriaandeJongh commented 1 month ago

It seems that at least on macOS, Godot should be able to determine the type of controller by checking the type of object inside the extendedGamepad property. In Godot source, that is done here: https://github.com/godotengine/godot/blob/4c4e67334412f73c9deba5e5d29afa8651418af2/platform/macos/joypad_macos.mm#L433

More info about this property: https://developer.apple.com/documentation/gamecontroller/gccontroller/1458883-extendedgamepad

Is there perhaps an easy way I could do this check myself, through a plugin or whatever? I'm gonna need this functionality pretty soon :/

AThousandShips commented 1 month ago

Related: