Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose joypad vendor_id and product_id in Windows #91539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Rubonnek
Copy link
Member

@Rubonnek Rubonnek commented May 3, 2024

The vendor_id and product_id can already be extracted but only in Linux. It was implemented back in #78539 through Input.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 and product_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:

I 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 the vendor_id and product_id can be extracted with ease, the mapping of a joypad to its type seems straightforward through an addon.

@Riteo
Copy link
Contributor

Riteo commented May 4, 2024

If there's already the API and it's implemented only on Linux, I guess it makes sense to add it for Windows too, yeah.

FTR, there's also #89193 which tries to move the parsing to the engine, which should address the above usecase in a more solid way hopefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants