Controller: Always preserve internal state when loading/resuming

Fixes analog mode getting disabled when loading state.
This commit is contained in:
Connor McLaughlin
2020-12-17 00:09:32 +10:00
parent b78a6045fc
commit 47f0720b93
15 changed files with 99 additions and 39 deletions

View File

@ -27,12 +27,16 @@ void DigitalController::Reset()
m_transfer_state = TransferState::Idle;
}
bool DigitalController::DoState(StateWrapper& sw)
bool DigitalController::DoState(StateWrapper& sw, bool apply_input_state)
{
if (!Controller::DoState(sw))
if (!Controller::DoState(sw, apply_input_state))
return false;
sw.Do(&m_button_state);
u16 button_state = m_button_state;
sw.Do(&button_state);
if (apply_input_state)
m_button_state = apply_input_state;
sw.Do(&m_transfer_state);
return true;
}