Fix DInput rumble.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7347 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2011-03-15 04:04:27 +00:00
parent c83e5ee35b
commit 3454ade05e
2 changed files with 13 additions and 12 deletions

View File

@ -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)

View File

@ -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;
};
}