From 3c0227445cb75f2798d8bcf1d284566c16f6f940 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 31 Aug 2014 22:41:33 -0700 Subject: Revert changes to how DInput filters out XInput devices. This is to remain compatible with XBCD devices. --- .../ControllerInterface/DInput/DInputJoystick.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 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 7d1db57427..1ff48877db 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -8,6 +8,7 @@ #include "InputCommon/ControllerInterface/DInput/DInput.h" #include "InputCommon/ControllerInterface/DInput/DInputJoystick.h" +#include "InputCommon/ControllerInterface/DInput/XInputFilter.h" namespace ciface { @@ -16,29 +17,22 @@ namespace DInput #define DATA_BUFFER_SIZE 32 -static const GUID s_known_xinput_guids[] = { - // ValveStreamingGamepad - { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }, - // IID_X360WiredGamepad - { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }, - // IID_X360WirelessGamepad - { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }, -}; - void InitJoystick(IDirectInput8* const idi8, std::vector& devices, HWND hwnd) { std::list joysticks; - idi8->EnumDevices( DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, DIEDFL_ATTACHEDONLY ); + idi8->EnumDevices(DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, DIEDFL_ATTACHEDONLY); // this is used to number the joysticks // multiple joysticks with the same name shall get unique ids starting at 0 std::map< std::basic_string, int> name_counts; + std::vector xinput_guids; + GetXInputGUIDS(&xinput_guids); + for (DIDEVICEINSTANCE& joystick : joysticks) { // skip XInput Devices - if (std::find(std::begin(s_known_xinput_guids), std::end(s_known_xinput_guids), - joystick.guidProduct) != std::end(s_known_xinput_guids)) + if (std::find(xinput_guids.begin(), xinput_guids.end(), joystick.guidProduct.Data1) != xinput_guids.end()) { continue; } -- cgit v1.2.3