diff --git a/src/joystick/windows/SDL_dxjoystick.c b/src/joystick/windows/SDL_dxjoystick.c index 2c1fdbe2e..7a61947f2 100644 --- a/src/joystick/windows/SDL_dxjoystick.c +++ b/src/joystick/windows/SDL_dxjoystick.c @@ -396,11 +396,11 @@ SetDIerror(const char *function, HRESULT code) } \ } - DEFINE_GUID(CLSID_WbemLocator, 0x4590f811,0x1d3a,0x11d0,0x89,0x1F,0x00,0xaa,0x00,0x4b,0x2e,0x24); -/* The Windows SDK doesn't define this GUID */ DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x00,0x4b,0x2e,0x24); +DEFINE_GUID(IID_ValveStreamingGamepad, MAKELONG( 0x28DE, 0x11FF ),0x0000,0x0000,0x00,0x00,0x50,0x49,0x44,0x56,0x49,0x44); + /*----------------------------------------------------------------------------- * * code from MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx @@ -411,6 +411,9 @@ DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x *-----------------------------------------------------------------------------*/ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput ) { + static const GUID *s_XInputProductGUID[] = { + &IID_ValveStreamingGamepad + }; IWbemLocator* pIWbemLocator = NULL; IEnumWbemClassObject* pEnumDevices = NULL; IWbemClassObject* pDevices[20]; @@ -430,6 +433,14 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput ) return SDL_FALSE; } + // Check for well known XInput device GUIDs + // We need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list. + for ( iDevice = 0; iDevice < SDL_arraysize(s_XInputProductGUID); ++iDevice ) { + if (SDL_memcmp(pGuidProductFromDirectInput, s_XInputProductGUID[iDevice], sizeof(GUID)) == 0) { + return SDL_TRUE; + } + } + SDL_memset( pDevices, 0x0, sizeof(pDevices) ); /* CoInit if needed */