AnalogController: Implement legacy rumble method

Fixes missing vibration in Tobal 2, Bushido Blade, etc.
This commit is contained in:
Albert Liu 2020-11-04 22:45:58 -08:00
parent a17e15f176
commit 6d4b812b7c
2 changed files with 10 additions and 0 deletions

View File

@ -302,6 +302,10 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
{
if (m_rumble_unlocked)
SetMotorState(1, ((data_in & 0x01) != 0) ? 255 : 0);
else if (data_in >= 0x40 && data_in <= 0x7F)
m_legacy_rumble_unlocked = true;
else
SetMotorState(1, 0);
*data_out = Truncate8(m_button_state) & GetExtraButtonMaskLSB();
m_state = State::GetStateButtonsMSB;
@ -313,6 +317,11 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
{
if (m_rumble_unlocked)
SetMotorState(0, data_in);
else if (m_legacy_rumble_unlocked)
{
SetMotorState(1, ((data_in & 0x01) != 0) ? 255 : 0);
m_legacy_rumble_unlocked = false;
}
*data_out = Truncate8(m_button_state >> 8);
m_state = m_analog_mode ? State::GetStateRightAxisX : State::Idle;

View File

@ -142,6 +142,7 @@ private:
bool m_analog_mode = false;
bool m_analog_locked = false;
bool m_rumble_unlocked = false;
bool m_legacy_rumble_unlocked = false;
bool m_configuration_mode = false;
u8 m_command_param = 0;