Fixes Rumble Strength for XInput

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4933 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2010-01-23 13:34:18 +00:00
parent 6b2466c869
commit 135b1a33cc
6 changed files with 18 additions and 19 deletions

View File

@ -218,7 +218,7 @@ void Config::Load()
file.Get(SectionName.c_str(), "Diagonal", &GCMapping[i].Diagonal, 100);
file.Get(SectionName.c_str(), "Square2Circle", &GCMapping[i].bSquare2Circle, false);
file.Get(SectionName.c_str(), "Rumble", &GCMapping[i].Rumble, false);
file.Get(SectionName.c_str(), "RumbleStrength", &GCMapping[i].RumbleStrength, 8); // x10
file.Get(SectionName.c_str(), "RumbleStrength", &GCMapping[i].RumbleStrength, 80);
file.Get(SectionName.c_str(), "TriggerType", &GCMapping[i].TriggerType, 0);
file.Get(SectionName.c_str(), "Source_Stick", &GCMapping[i].Stick.Main, 0);

View File

@ -295,7 +295,7 @@ void GCPadConfigDialog::ChangeSettings(wxCommandEvent& event)
GCMapping[m_Page].Rumble = m_CheckRumble[m_Page]->IsChecked();
break;
case IDC_RUMBLE_STRENGTH:
GCMapping[m_Page].RumbleStrength = m_RumbleStrength[m_Page]->GetSelection();
GCMapping[m_Page].RumbleStrength = m_RumbleStrength[m_Page]->GetSelection() * 10;
break;
case IDC_TRIGGER_TYPE:
GCMapping[m_Page].TriggerType = m_TriggerType[m_Page]->GetSelection();
@ -341,7 +341,7 @@ void GCPadConfigDialog::UpdateGUI()
m_ComboDiagonal[m_Page]->SetSelection((100 - GCMapping[m_Page].Diagonal) / 5);
m_CheckS2C[m_Page]->SetValue(GCMapping[m_Page].bSquare2Circle);
m_CheckRumble[m_Page]->SetValue(GCMapping[m_Page].Rumble);
m_RumbleStrength[m_Page]->SetSelection(GCMapping[m_Page].RumbleStrength);
m_RumbleStrength[m_Page]->SetSelection(GCMapping[m_Page].RumbleStrength / 10);
m_TriggerType[m_Page]->SetSelection(GCMapping[m_Page].TriggerType);
m_Combo_StickSrc[m_Page]->SetSelection(GCMapping[m_Page].Stick.Main);

View File

@ -55,8 +55,8 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
unsigned int Strength = 0;
if (_uType == 1 && _uStrength > 2)
{
Strength = 1000 * GCMapping[_numPAD].RumbleStrength;
Strength = Strength > 10000 ? 10000 : Strength;
Strength = GCMapping[_numPAD].RumbleStrength;
Strength = Strength > 100 ? 100 : Strength;
}
if (GCMapping[_numPAD].TriggerType == InputCommon::CTL_TRIGGER_XINPUT)
@ -71,8 +71,8 @@ void Rumble_XInput(int _ID, unsigned int _Strength)
{
#ifdef _WIN32
XINPUT_VIBRATION vib;
vib.wLeftMotorSpeed = _Strength;
vib.wRightMotorSpeed = _Strength;
vib.wLeftMotorSpeed = 0xFFFF / 100 * _Strength;
vib.wRightMotorSpeed = 0xFFFF / 100 * _Strength;
XInputSetState(_ID, &vib);
#endif
}
@ -94,7 +94,7 @@ void Rumble_DInput(int _ID, unsigned int _Strength)
pRumble[_ID].g_pDevice->Acquire();
}
SetDeviceForcesXY(_ID, _Strength);
SetDeviceForcesXY(_ID, _Strength * 100);
}
HRESULT InitRumble(HWND hWnd)

View File

@ -321,7 +321,7 @@ void Config::Load()
iniFile.Get(SectionName, "Diagonal", &WiiMoteEmu::WiiMapping[i].Diagonal, 100);
iniFile.Get(SectionName, "Circle2Square", &WiiMoteEmu::WiiMapping[i].bCircle2Square, false);
iniFile.Get(SectionName, "Rumble", &WiiMoteEmu::WiiMapping[i].Rumble, false);
iniFile.Get(SectionName, "RumbleStrength", &WiiMoteEmu::WiiMapping[i].RumbleStrength, 8); // x10
iniFile.Get(SectionName, "RumbleStrength", &WiiMoteEmu::WiiMapping[i].RumbleStrength, 80);
iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0);
}
@ -418,7 +418,7 @@ void Config::Save()
iniFile.Set(SectionName, "Diagonal", WiiMoteEmu::WiiMapping[i].Diagonal);
iniFile.Set(SectionName, "Circle2Square", WiiMoteEmu::WiiMapping[i].bCircle2Square);
iniFile.Set(SectionName, "Rumble", WiiMoteEmu::WiiMapping[i].Rumble);
iniFile.Set(SectionName, "RumbleStrength", WiiMoteEmu::WiiMapping[i].RumbleStrength); // x10
iniFile.Set(SectionName, "RumbleStrength", WiiMoteEmu::WiiMapping[i].RumbleStrength);
iniFile.Set(SectionName, "TriggerType", WiiMoteEmu::WiiMapping[i].TriggerType);
}

View File

@ -978,7 +978,7 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
WiiMoteEmu::WiiMapping[m_Page].Rumble = m_CheckRumble[m_Page]->IsChecked();
break;
case IDC_RUMBLE_STRENGTH:
WiiMoteEmu::WiiMapping[m_Page].RumbleStrength = m_RumbleStrength[m_Page]->GetSelection();
WiiMoteEmu::WiiMapping[m_Page].RumbleStrength = m_RumbleStrength[m_Page]->GetSelection() * 10;
break;
case IDC_TILT_TYPE_WM:
WiiMoteEmu::WiiMapping[m_Page].Tilt.InputWM = m_TiltTypeWM[m_Page]->GetSelection();
@ -1055,7 +1055,7 @@ void WiimotePadConfigDialog::UpdateGUI()
m_ComboDiagonal[m_Page]->SetSelection((100 - WiiMoteEmu::WiiMapping[m_Page].Diagonal) / 5);
m_CheckC2S[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bCircle2Square);
m_CheckRumble[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].Rumble);
m_RumbleStrength[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].RumbleStrength);
m_RumbleStrength[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].RumbleStrength / 10);
m_TriggerType[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].TriggerType);
m_TiltTypeWM[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].Tilt.InputWM);
m_TiltTypeNC[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].Tilt.InputNC);

View File

@ -80,8 +80,8 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType)
unsigned int Strength = 0;
if (_uType == 1)
{
Strength = 1000 * (WiiMapping[_numPAD].RumbleStrength);
Strength = Strength > 10000 ? 10000 : Strength;
Strength = WiiMapping[_numPAD].RumbleStrength;
Strength = Strength > 100 ? 100 : Strength;
}
if (WiiMapping[_numPAD].TriggerType == InputCommon::CTL_TRIGGER_XINPUT)
@ -96,8 +96,8 @@ void Rumble_XInput(int _ID, unsigned int _Strength)
{
#ifdef _WIN32
XINPUT_VIBRATION vib;
vib.wLeftMotorSpeed = _Strength;
vib.wRightMotorSpeed = _Strength;
vib.wLeftMotorSpeed = 0xFFFF / 100 * _Strength;
vib.wRightMotorSpeed = 0xFFFF / 100 * _Strength;
XInputSetState(_ID, &vib);
#endif
}
@ -119,7 +119,7 @@ void Rumble_DInput(int _ID, unsigned int _Strength)
pRumble[_ID].g_pDevice->Acquire();
}
SetDeviceForcesXY(_ID, _Strength);
SetDeviceForcesXY(_ID, _Strength * 100);
}
HRESULT InitRumble(HWND hWnd)
@ -273,8 +273,7 @@ BOOL CALLBACK EnumFFDevicesCallback(const DIDEVICEINSTANCE* pInst, VOID* pContex
{
// a DInput device is created even if rumble is disabled on startup
// this way, you can toggle the rumble setting while in game
//if (WiiMapping[i].enabled) // && WiiMapping[i].Rumble
pRumble[i].g_pDevice = pDevice; // everything looks good, save the DInput device
pRumble[i].g_pDevice = pDevice; // everything looks good, save the DInput device
}
}