summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2011-03-15 04:04:27 +0000
committerJordan Woyak <jordan.woyak@gmail.com>2011-03-15 04:04:27 +0000
commit3454ade05e5da8ff3b182e35ca9ff4fecd441ca8 (patch)
treec6e744cf6f761af09ee58a5e2fa181b9f1ef6393 /Source/Core/InputCommon
parentc83e5ee35bf18156d36150969efb28edd3236e35 (diff)
Fix DInput rumble.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7347 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp17
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h8
2 files changed, 13 insertions, 12 deletions
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<EffectState>::iterator
+ std::list<EffectState>::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<EffectState>::iterator
+ std::list<EffectState>::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 <Windows.h>
#include <dinput.h>
+#include <list>
+
#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<EffectState> m_state_out;
+ DIJOYSTATE m_state_in;
+ std::list<EffectState> m_state_out;
- bool m_buffered;
+ bool m_buffered;
};
}