Browse Source

Recheck devices if another API queries raw input for a new device

Sam Lantinga 4 years ago
parent
commit
0252235e82
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/joystick/windows/SDL_rawinputjoystick.c

+ 8 - 0
src/joystick/windows/SDL_rawinputjoystick.c

@@ -933,6 +933,14 @@ RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, co
     /* Make sure the device list is completely up to date when we check for device presence */
     RAWINPUT_GetPendingDeviceChanges();
 
+    /* If we're being asked about a device, that means another API just detected one, so rescan */
+#ifdef SDL_JOYSTICK_RAWINPUT_XINPUT
+    xinput_device_change = SDL_TRUE;
+#endif
+#ifdef SDL_JOYSTICK_RAWINPUT_WGI
+    wgi_state.need_device_list_update = SDL_TRUE;
+#endif
+
     device = SDL_RAWINPUT_devices;
     while (device) {
         if (vendor_id == device->vendor_id && product_id == device->product_id ) {