DigitalController: Store button state/transfer state in save states
This commit is contained in:
parent
2ffcad3d37
commit
fccc2dd295
|
@ -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)
|
||||
|
|
|
@ -42,6 +42,9 @@ public:
|
|||
std::optional<s32> GetAxisCodeByName(std::string_view axis_name) const override;
|
||||
std::optional<s32> GetButtonCodeByName(std::string_view button_name) const override;
|
||||
|
||||
void Reset() override;
|
||||
bool DoState(StateWrapper& sw) override;
|
||||
|
||||
void SetAxisState(s32 axis_code, float value) override;
|
||||
void SetButtonState(s32 button_code, bool pressed) override;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "types.h"
|
||||
|
||||
static constexpr u32 SAVE_STATE_MAGIC = 0x43435544;
|
||||
static constexpr u32 SAVE_STATE_VERSION = 26;
|
||||
static constexpr u32 SAVE_STATE_VERSION = 27;
|
||||
|
||||
#pragma pack(push, 4)
|
||||
struct SAVE_STATE_HEADER
|
||||
|
|
Loading…
Reference in New Issue