Expose joypad vendor_id
and product_id
in Windows
#91539
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
vendor_id
andproduct_id
can already be extracted but only in Linux. It was implemented back in #78539 throughInput.get_joy_info(device_id)
and this PR implements the same functionality but for Windows.I should add that through the XInput API the
vendor_id
andproduct_id
extraction happens through an undocumented function in XInput1_4.dll which is the same way SDL does it.This PR is inspired by the following proposal:
Input.get_joy_type()
to get controller type godot-proposals#8519I was looking for a way to map a joypad to its type in order to correctly show button prompts and by reading through the proposal one can find the following databases which allow users to do so:
The reason I didn't implement
Input.get_joy_type()
is because I don't think the function nor those databases should be compiled into the engine. The joypad type database needs could differ greatly between users, and once thevendor_id
andproduct_id
can be extracted with ease, the mapping of a joypad to its type seems straightforward through an addon.