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

Update gamepads_windows to use a newer API #31

Open
markvideon opened this issue May 21, 2024 · 5 comments
Open

Update gamepads_windows to use a newer API #31

markvideon opened this issue May 21, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request windows Relates to gamepads_windows

Comments

@markvideon
Copy link
Collaborator

markvideon commented May 21, 2024

gamepads_windows currently appears to use the Joysticks API. As per its documentation, it has now been superseded by Windows.Gaming.Input, which provides some functionality comparable to the Game Controller Library provided by Apple.

There is a larger project to make Windows APIs accessible as Dart packages via FFI. One such package is windows_gaming. https://github.com/halildurmus/dartwinrt/tree/main/packages/windows_gaming

It may be worth exploring making use of this package.

EDIT: I've come to understand that migrating to this API may affect compatibility with controllers that don't support XInput.

@markvideon
Copy link
Collaborator Author

markvideon commented May 31, 2024

After some experimentation, I have some comments about this.

Windows.Gaming.Input manages input devices and events. It seems like we would need to look at other Windows APIs for other features.

The two 'core' classes representing devices of concern are:

A particular device may be recognised as a RawGameController and it may also be recognised as a Gamepad. For instance, I found the Switch Pro Controller was recognised as a Gamepad and a RawGameController when connected via Bluetooth, and only as a RawGameController when connected via USB.

RawGameController has a number of properties such as device name and hardware device ID that can also vary depending on the connection type. E.g. I observed RawGameController.DisplayName with a value of "HID-compliant game controller" for most controller and connection type combinations, but notably when an Xbox Series S/X controller was connected via USB it was reported as "Xbox One Game Controller".

@chengwei88888

This comment was marked as off-topic.

@markvideon
Copy link
Collaborator Author

markvideon commented Jun 7, 2024

Win10 has been unable to operate in the past two weeks, is this the reason?

This GitHub issue describes rewriting the Windows plugin to use a new API, it is not directly related to any problems people may be facing with the current implementation of gamepads_windows.

@markvideon markvideon self-assigned this Jun 8, 2024
@markvideon markvideon changed the title [Improvement] Update gamepads_windows to use Windows.Gaming.Input [Improvement] Update gamepads_windows to use a newer API Jun 9, 2024
@markvideon
Copy link
Collaborator Author

This sounds promising:

GameInput is a functional superset of all legacy input APIs—XInput, DirectInput, Raw Input, Human Interface Device (HID), and WinRT APIs—in addition to adding new features of its own.

However it is distributed via NuGet, which does not play well with CMake according to this issue.

@chengwei88888

This comment was marked as off-topic.

@markvideon markvideon changed the title [Improvement] Update gamepads_windows to use a newer API Update gamepads_windows to use a newer API Jun 16, 2024
@markvideon markvideon added enhancement New feature or request windows Relates to gamepads_windows labels Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request windows Relates to gamepads_windows
Projects
None yet
Development

No branches or pull requests

2 participants