From 3454ade05e5da8ff3b182e35ca9ff4fecd441ca8 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 15 Mar 2011 04:04:27 +0000 Subject: Fix DInput rumble. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7347 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/ControllerInterface/DInput/DInputJoystick.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp') 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) -- cgit v1.2.3