[Native] - Implement IsXInputDevice method in C# by Jklawreszuk · Pull Request #1926 · stride3d/stride (original) (raw)

The problem is that the GPL code doesnt work with sharpdx

Sharpdx takes the HID path from a device and somehow builds an product ID ( GUID ) from it
what the GPL code does is just splitting the HID and takes the values and compares them which will never fit to the sharpdx guid

$devices = Get-WmiObject -Query 'SELECT * FROM Win32_PNPEntity WHERE DeviceID LIKE "%VID_%&PID_%&IG_%"'
this is how you can select the xinput devices
accordign to microsoft if it has IG_ in it then its an xinput device
https://learn.microsoft.com/en-us/windows/win32/xinput/xinput-and-directinput

to convert a sharpdx guid to a hid i only found that
https://stackoverflow.com/questions/67059441/how-to-map-directinput-sharpdx-device-to-its-corresponding-hid-c
but that mentioned class is internal

one option would be to accurately query with wql to get all xdevices and comparing the device path instead of the guid

the gpl code is just doing alot of fancy things but in the end it just converts this example hid path
HID\VID_045E&PID_028E&IG_00\3&8968588&0&0000
to that
045E028E
( not sure anymore aobut the leading zeros )
and this number is far away from a sharpdx guid

this shouldnt sound negative about the gpl code, i just couldnt find an alignment between sharpdx and the guid part of the code

if you need testing i can use my playstation controllers as xinput and help with testing