Skip to content
Permalink
Browse files

XInputCheck: add XInputCheck_ClearDeviceCache().

  • Loading branch information...
mkrautz committed Mar 3, 2016
1 parent e174f8d commit 0f8053351bdf870962e1b7cbb9072806935b84bf
@@ -111,3 +111,9 @@ SDL_IsXInputDevice(const GUID* pGuidProductFromDirectInput)
bool XInputCheck_IsGuidProductXInputDevice(const GUID *pGuidProductFromDirectInput) {
return SDL_IsXInputDevice(pGuidProductFromDirectInput);
}

void XInputCheck_ClearDeviceCache() {
SDL_free(SDL_RawDevList);
SDL_RawDevList = NULL;
SDL_RawDevListCount = 0;
}
@@ -26,4 +26,9 @@

bool XInputCheck_IsGuidProductXInputDevice(const GUID *pGuidProductFromDirectInput);

/// XInputCheck_ClearDeviceCache clears XInputCheck's internal device cache.
/// Calling this function causes the next call to
/// XInputCheck_IsGuidProductXInputDevice to query the system's device tree.
void XInputCheck_ClearDeviceCache();

#endif
@@ -568,6 +568,8 @@ void GlobalShortcutWin::timeTicked() {
if (g.mw->uiNewHardware != uiHardwareDevices) {
uiHardwareDevices = g.mw->uiNewHardware;

XInputCheck_ClearDeviceCache();

pDI->EnumDevices(DI8DEVCLASS_ALL, EnumDevicesCB, static_cast<void *>(this), DIEDFL_ATTACHEDONLY);
}

0 comments on commit 0f80533

Please sign in to comment.
You can’t perform that action at this time.