diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp index 796f948534..d37d1eb2ba 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -306,7 +306,7 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI //ZeroMemory(&env, sizeof(env)); //env.dwSize = sizeof(env); - for (unsigned int f = 0, i = 0; f < sizeof(force_type_names)/sizeof(*force_type_names); ++f) + for (unsigned int f = 0; f < sizeof(force_type_names)/sizeof(*force_type_names); ++f) { // ugly if ladder if (0 == f) @@ -319,16 +319,15 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI LPDIRECTINPUTEFFECT pEffect; if (SUCCEEDED(m_device->CreateEffect(force_type_names[f].guid, &eff, &pEffect, NULL))) { + m_state_out.push_back(EffectState(pEffect)); + // ugly if ladder again :/ if (0 == f) - AddOutput(new ForceConstant(f, m_state_out[i])); + AddOutput(new ForceConstant(f, m_state_out.back())); else if (1 == f) - AddOutput(new ForceRamp(f, m_state_out[i])); + AddOutput(new ForceRamp(f, m_state_out.back())); else - AddOutput(new ForcePeriodic(f, m_state_out[i])); - - ++i; - m_state_out.push_back(EffectState(pEffect)); + AddOutput(new ForcePeriodic(f, m_state_out.back())); } } } @@ -351,7 +350,7 @@ Joystick::Joystick( /*const LPCDIDEVICEINSTANCE lpddi, */const LPDIRECTINPUTDEVI Joystick::~Joystick() { // release the ff effect iface's - std::vector::iterator + std::list::iterator i = m_state_out.begin(), e = m_state_out.end(); for (; i!=e; ++i) @@ -439,7 +438,7 @@ bool Joystick::UpdateOutput() eff.dwSize = sizeof(DIEFFECT); eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; - std::vector::iterator + std::list::iterator i = m_state_out.begin(), e = m_state_out.end(); for (; i!=e; ++i) diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h index 76fa8d2617..a783381154 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h @@ -9,6 +9,8 @@ #include #include +#include + #ifdef CIFACE_USE_XINPUT // this takes so long, idk if it should be enabled :( #define NO_DUPLICATE_DINPUT_XINPUT @@ -102,10 +104,10 @@ private: const LPDIRECTINPUTDEVICE8 m_device; const unsigned int m_index; - DIJOYSTATE m_state_in; - std::vector m_state_out; + DIJOYSTATE m_state_in; + std::list m_state_out; - bool m_buffered; + bool m_buffered; }; }