diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp index 383740f9f1..b37ec5ae51 100644 --- a/Windows/DinputDevice.cpp +++ b/Windows/DinputDevice.cpp @@ -94,7 +94,7 @@ int DinputDevice::UpdateState(InputState &input_state) } if(FAILED(pJoystick->GetDeviceState(sizeof(DIJOYSTATE2), &js))) - return -1; + return -1; switch (js.rgdwPOV[0]) { diff --git a/Windows/InputDevice.cpp b/Windows/InputDevice.cpp index 8c1aa7eabd..b4ed5d8c76 100644 --- a/Windows/InputDevice.cpp +++ b/Windows/InputDevice.cpp @@ -8,8 +8,8 @@ #define PUSH_BACK(Cls) do { list.push_back(std::shared_ptr(new Cls())); } while (0) std::list> getInputDevices() { std::list> list; + PUSH_BACK(KeyboardDevice); PUSH_BACK(XinputDevice); PUSH_BACK(DinputDevice); - PUSH_BACK(KeyboardDevice); return list; } diff --git a/Windows/InputDevice.h b/Windows/InputDevice.h index 372d16a8c8..597f2e0395 100644 --- a/Windows/InputDevice.h +++ b/Windows/InputDevice.h @@ -10,6 +10,7 @@ struct InputState; class InputDevice { public: + enum { UPDATESTATE_SKIP_NEXT = 0x1234}; virtual int UpdateState(InputState &input_state) = 0; }; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 908a14d4fe..3005bd8137 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -132,7 +132,8 @@ void WindowsHost::SetDebugMode(bool mode) void WindowsHost::PollControllers(InputState &input_state) { for (auto iter = this->input.begin(); iter != this->input.end(); iter++) - (*iter)->UpdateState(input_state); + if ((*iter)->UpdateState(input_state) == InputDevice::UPDATESTATE_SKIP_NEXT) + break; } void WindowsHost::BootDone() diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp index 1095919f77..e27970381e 100644 --- a/Windows/XinputDevice.cpp +++ b/Windows/XinputDevice.cpp @@ -52,7 +52,10 @@ int XinputDevice::UpdateState(InputState &input_state) { this->prevState = state; this->check_delay = 0; - return 0; + + // If there's an XInput pad, skip following pads. This prevents DInput and XInput + // from colliding. + return UPDATESTATE_SKIP_NEXT; } else { // wait check_delay frames before polling the controller again this->gamepad_idx = -1;