-
Notifications
You must be signed in to change notification settings - Fork 120
Description
Hi folks - I have an issue with GameInput on Windows and can't seem to find anywhere better to post this, so here I am.
I have an Xbox One Elite controller. If I call RegisterDeviceCallback(nullptr, GameInputKindGamepad, GameInputDeviceConnected, ...) with the gamepad already connected (via wire), the callback immediately fires twice: once for "Xbox One Game Controller", and one for "Xbox One Elite Controller".
What I want to do is support multiple connected gamepads, spawning an in-game player per connected gamepad. So I need a way to know that these devices are the same physical gamepad so I don't spawn two players for one gamepad.
However this doesn't appear to be possible. If I get GameInputDeviceInfo for each device representing the same physical device, virtually all the details are different: the deviceId, deviceRootId, hardwareVersion, firmwareVersion, containerId, displayName and pnpPath are all different. My only option seems to be to deduplicate based on vendorId, productId, and revisionNumber. But what if someone connects two of the same gamepad models? This approach will presumably fail to detect the second physical gamepad if it happens to have the same values for vendorId, productId and revisionNumber.
I thought maybe only one of these devices will send readings. But calling GetCurrentReading() with a null device returns input for both devices! Worse, if you call it once per poll with a null device, the returned device seems to randomly change as buttons are depressed and released.
So it seems my only options are:
- Give up on multiple gamepad support and only support a single physical gamepad
- Give up on GameInput and go back to something like XInput (which I tested and does not have this problem)
Is it really not possible to reliably support multiple physical gamepads with GameInput? Ideally there would be a new device info property like physicalDeviceId that would allow reliably deduplicating gamepads.