Browse Source

SDL_IsXInputDevice() shouldn't return true if XInput isn't enabled

Sam Lantinga 3 years ago
parent
commit
0ad8d9d292
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/joystick/windows/SDL_dinputjoystick.c

+ 2 - 0
src/joystick/windows/SDL_dinputjoystick.c

@@ -238,6 +238,7 @@ SetDIerror(const char *function, HRESULT code)
 static SDL_bool
 static SDL_bool
 SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath)
 SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath)
 {
 {
+#ifdef SDL_JOYSTICK_XINPUT
     SDL_GameControllerType type;
     SDL_GameControllerType type;
 
 
     /* XInput and RawInput backends will pick up XInput-compatible devices */
     /* XInput and RawInput backends will pick up XInput-compatible devices */
@@ -261,6 +262,7 @@ SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath)
         (vendor_id == USB_VENDOR_VALVE && product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) {
         (vendor_id == USB_VENDOR_VALVE && product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) {
         return SDL_TRUE;
         return SDL_TRUE;
     }
     }
+#endif /* SDL_JOYSTICK_XINPUT */
 
 
     return SDL_FALSE;
     return SDL_FALSE;
 }
 }