DigitalController: Store button state/transfer state in save states

This commit is contained in:
Connor McLaughlin
2020-04-26 01:18:15 +10:00
parent 2ffcad3d37
commit fccc2dd295
3 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#include "digital_controller.h"
#include "common/assert.h"
#include "common/state_wrapper.h"
DigitalController::DigitalController() = default;
@ -20,6 +21,21 @@ std::optional<s32> DigitalController::GetButtonCodeByName(std::string_view butto
return StaticGetButtonCodeByName(button_name);
}
void DigitalController::Reset()
{
m_transfer_state = TransferState::Idle;
}
bool DigitalController::DoState(StateWrapper& sw)
{
if (!Controller::DoState(sw))
return false;
sw.Do(&m_button_state);
sw.Do(&m_transfer_state);
return true;
}
void DigitalController::SetAxisState(s32 axis_code, float value) {}
void DigitalController::SetButtonState(Button button, bool pressed)