AnalogController: Output zeros for 0x43 when already in config mode

This commit is contained in:
Albert Liu 2020-11-25 06:20:12 -08:00
parent 3f709d97b6
commit 31b41b9ec0

View file

@ -350,10 +350,12 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
case State::ConfigModeSetMode: case State::ConfigModeSetMode:
{ {
// If 0x43 "enter/leave config mode" is called from within config mode, return all zeros
Log_DebugPrintf("0x%02x(%s) config mode", data_in, data_in == 1 ? "enter" : "leave"); Log_DebugPrintf("0x%02x(%s) config mode", data_in, data_in == 1 ? "enter" : "leave");
bool prev_configuration_mode = m_configuration_mode;
m_configuration_mode = (data_in == 1); m_configuration_mode = (data_in == 1);
*data_out = Truncate8(m_button_state); *data_out = prev_configuration_mode ? 0x00 : Truncate8(m_button_state);
m_state = State::GetStateButtonsMSB; m_state = prev_configuration_mode ? State::Pad5Bytes : State::GetStateButtonsMSB;
ack = true; ack = true;
} }
break; break;