Closed stephanbogner closed 1 year ago
This is beyond the scope of this DB. You should take this up with Godot. This DB is for SDL2 2.0.16 and forward. That Godot and other projects use it is incidental.
SDL has it's own list of types here: https://github.com/libsdl-org/SDL/blob/main/src/joystick/controller_list.h
I maintain a DB of types for those not upstreamed to SDL for an unrelated project here: https://github.com/JujuAdams/Input/blob/community-data/community_gamepad_type.txt
If you propose this downstream to Godot and it receives an adequate response, I am willing to break that out into it's own repo and/or help contribute to what you're proposing, but this repo is not the place for this issue.
Thank you very much for the quick response, the clarifications and the offer to help out :heart:
The two resources you mentioned look very handy indeed! I am gonna have a closer look and think about what a good proposal regarding Godot would be.
Goal:
In my game I want to show the appropriate image for a controller with its button mapping.
If it's a PS5 controller show the image of a PS5 controller, if it's an Xbox Series controller, show an image for an Xbox Series controller.
Problem:
There are many controllers that share the same layout but have different names or IDs.
Solution
Add another value to the entries that describes their basic layout, e.g.
xbox-series-controller
orwii-remote
. This is not the same as the controller platform, as explained below.Complications (only one example each):
Different brand but same layout: The "8Bit Do Zero"-controller looks different from a regular "SNES controller", but fundamentally they are the same → Both should be
snes-controller
Added features: An "Xbox Elite Controller" is the same as an "Xbox Series Controller", but has additional buttons like paddles → Tricky, but
xbox-series-controller
for both would likely be fineAdjusted layout: Hori Fighting Commander Xbox 360 is an Xbox 360 controller but has a different layout → Tricky, could be considered
xbox-360-controller
but also not (I'd argue it is for the sake of simplicity)Same platform different controllers: The Nintendo Switch has a "Switch Pro Controller" and "Joycons" → Value would be
switch-pro-controller
andjoycon-pair
, despite having the same buttons because their appearance is very differentMultipurpose-controller: The Nintendo Switch's "Joycons" can be used as pair or individually → Values would be
joycon-pair
,joycon-right
andjoycon-left
(this case might not be coverable by the DB because likely Joycons are connected individually to a computer)Controller and computer are one device:
steam-deck
would be a value because it's a controller in itself (unlikesteam-controller
which is just a controller)Totally unique controllers: "Microsoft dual strike" or the "DK Bongos" deviate a lot from the normal controller → Don't share a layout with other controllers, likely blank
layout value
A possible (and incomplete list) of values could be:
ps-controller
,ps2-controller
,ps3-controller
,ps4-controller
,ps5-controller
,xbox-controller
,xbox-360-controller
,xbox-series-controller
,xbox-one-controller
,joycon-right
,joycon-left
,joycon-pair
,steam-deck
,steam-controller
,wii-remote
,gamecube-controller
,ouya-controller
,luna-controller
and so on.Personal note:
This can get quite complex. For my game I am planning on only covering the most common controllers, but I wanted to bring this up, because likely more people have the same issue and I would not have a problem contributing.
Early Godot code I am thinking of using
```Python match (device_name): # --- Xbox --- "Xbox 360 Controller", "Hori Fighting Commander Xbox 360", "GameStop Xbox 360 Controller": return "xbox-360-controller" "Xbox One Controller", "Xbox One S Controller", "Xbox One Elite", "Xbox One Elite 2 Controller", "Xbox Elite Controller Series 2", "Xbox One PowerA Controller": return "xbox-one-controller" "Xbox Series Controller": return "xbox-series-controller" # --- Playstation --- "PS3 Controller": return "ps3-controller" "PS4 Controller": return "ps4-controller" "PS5 Controller": return "ps5-controller" # --- Other --- "Steam Controller": return "steam-controller" "Steam Deck": return "steam-deck" # If unknown we use a generic gamepad return "generic-controller" ```