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

Closed
wants to merge 1 commit into 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.

@Rubonnek Rubonnek added this to the 4.3 milestone May 3, 2024
@Rubonnek Rubonnek requested a review from a team as a code owner May 3, 2024 21:35
@Rubonnek Rubonnek force-pushed the joypad-info-windows branch from f741400 to 644ee91 Compare May 3, 2024 22:10
@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.

@jss2a98aj
Copy link
Contributor

jss2a98aj commented Jan 18, 2025

The recently merged PR #98861 did some related stuff, but used the winmm dll to get joypad information.

@Rubonnek
Copy link
Member Author

Rubonnek commented Feb 1, 2025

Closing since #98861 superseded this PR and the exposed data for the hardware I have available are the same in both PRs.

@Rubonnek Rubonnek closed this Feb 1, 2025
@Rubonnek Rubonnek deleted the joypad-info-windows branch February 1, 2025 03:44
@AThousandShips AThousandShips removed this from the 4.4 milestone Feb 1, 2025
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.

5 participants