Skip to content
Browse files

InputCommon/DInputJoystick: Correct force-feedback flag testing

Introduced in a995e2f

We need to be performing a bitwise AND on the flags and not a logical
AND, otherwise we could end up counting device objects that don't
support forced feedback.
  • Loading branch information...
lioncash committed Aug 2, 2019
1 parent c70da39 commit 37d643c7d3055c40ebaca920f7efa34a6337379b
Showing with 2 additions and 3 deletions.
  1. +2 −3 Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
@@ -164,9 +164,8 @@ Joystick::Joystick(/*const LPCDIDEVICEINSTANCE lpddi, */ const LPDIRECTINPUTDEVI
if (SUCCEEDED(m_device->EnumObjects(DIEnumDeviceObjectsCallback, (LPVOID)&objects, DIDFT_AXIS)))
const int num_ff_axes =
std::count_if(std::begin(objects), std::end(objects), [](DIDEVICEOBJECTINSTANCE& pdidoi) {
return pdidoi.dwFlags && DIDOI_FFACTUATOR;
std::count_if(std::begin(objects), std::end(objects),
[](const auto& pdidoi) { return (pdidoi.dwFlags & DIDOI_FFACTUATOR) != 0; });
InitForceFeedback(m_device, num_ff_axes);

0 comments on commit 37d643c

Please sign in to comment.
You can’t perform that action at this time.