Commit 0252235e820fb9af6112529e219ba5f2d5c4c1f6

Sam Lantinga 2020-11-27T10:44:53

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index 8dd47c0..0f505a4 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/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 ) {