Added a Windows Gaming Input joystick driver

This driver supports the Razer Atrox Arcade Stick

Some of the quirks of this driver, inherent in Windows Gaming Input:
* There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers.
* You can't read the state of the guide button
* You can't get controller events in the background
This commit is contained in:
Sam Lantinga 2020-04-18 21:41:37 -07:00
parent b90b59279e
commit aba2792896
13 changed files with 1043 additions and 418 deletions

View file

@ -58,6 +58,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
#ifdef SDL_JOYSTICK_HIDAPI /* Before WINDOWS_ driver, as WINDOWS wants to check if this driver is handling things */
&SDL_HIDAPI_JoystickDriver,
#endif
#if defined(SDL_JOYSTICK_WGI)
&SDL_WGI_JoystickDriver,
#endif
#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
&SDL_WINDOWS_JoystickDriver,
#endif
@ -1731,6 +1734,12 @@ SDL_IsJoystickXInput(SDL_JoystickGUID guid)
return (guid.data[14] == 'x') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool
SDL_IsJoystickWGI(SDL_JoystickGUID guid)
{
return (guid.data[14] == 'w') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool
SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid)
{
@ -1840,6 +1849,10 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid)
}
}
if (SDL_IsJoystickWGI(guid)) {
return (SDL_JoystickType)guid.data[15];
}
if (SDL_IsJoystickVirtual(guid)) {
return (SDL_JoystickType)guid.data[15];
}