summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
diff options
context:
space:
mode:
authorEmptyChaos <EmptyChaos@users.noreply.github.com>2016-08-10 23:30:36 +0000
committerEmptyChaos <EmptyChaos@users.noreply.github.com>2016-08-11 09:30:36 +1000
commit17e4bd9575281052f9aa27678c41e2e94e6c06e9 (patch)
tree85910cedc9599fb55838ad61219486020fe4e66b /Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
parent8552ff5789a2498a4ede1e811710dc1d3cba3d6b (diff)
InputCommon: Fix slow startup on some Windows systems
Rewrite GetXInputGUIDS to use SetupAPI instead of WMI Queries. When using a language pack where the system language and user/program language differ, Windows starts taking a VERY long time (10+ seconds) to complete Queries for Win32_PNPEntity objects (it's probably translating every single string since it transfers every single one from the WMI server into memory in the program). Fixes Issue 9744.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
index 92798a055c..9968bc798f 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
@@ -23,14 +23,11 @@ void InitJoystick(IDirectInput8* const idi8, HWND hwnd)
idi8->EnumDevices(DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks,
DIEDFL_ATTACHEDONLY);
- std::vector<DWORD> xinput_guids;
- GetXInputGUIDS(&xinput_guids);
-
+ std::unordered_set<DWORD> xinput_guids = GetXInputGUIDS();
for (DIDEVICEINSTANCE& joystick : joysticks)
{
// skip XInput Devices
- if (std::find(xinput_guids.begin(), xinput_guids.end(), joystick.guidProduct.Data1) !=
- xinput_guids.end())
+ if (xinput_guids.count(joystick.guidProduct.Data1))
{
continue;
}