diff --git a/src/xenia/hid/xinput/xinput_input_driver.cc b/src/xenia/hid/xinput/xinput_input_driver.cc index 02c35ad14..830daa0e4 100644 --- a/src/xenia/hid/xinput/xinput_input_driver.cc +++ b/src/xenia/hid/xinput/xinput_input_driver.cc @@ -149,12 +149,16 @@ X_RESULT XInputInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags, // https://stackoverflow.com/questions/23669238/xinputgetkeystroke-returning-error-success-while-controller-is-unplugged // // So we first check if the device is connected via XInputGetCapabilities, so - // we are not passing back an uninitialized X_INPUT_KEYSTROKE structure: - XINPUT_CAPABILITIES caps; - auto xigc = (decltype(&XInputGetCapabilities))XInputGetCapabilities_; - result = xigc(user_index, 0, &caps); - if (result) { - return result; + // we are not passing back an uninitialized X_INPUT_KEYSTROKE structure. + // If any user (0xFF) is polled this bug does not occur but GetCapabilities + // would fail so we need to skip it. + if (user_index != 0xFF) { + XINPUT_CAPABILITIES caps; + auto xigc = (decltype(&XInputGetCapabilities))XInputGetCapabilities_; + result = xigc(user_index, 0, &caps); + if (result) { + return result; + } } XINPUT_KEYSTROKE native_keystroke;