From 17e4bd9575281052f9aa27678c41e2e94e6c06e9 Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Wed, 10 Aug 2016 23:30:36 +0000 Subject: 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. --- .../Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp') 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 xinput_guids; - GetXInputGUIDS(&xinput_guids); - + std::unordered_set 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; } -- cgit v1.2.3