MemoryCard: Save FLAG to state

This commit is contained in:
Connor McLaughlin 2020-04-25 14:58:19 +10:00
parent 92255c8ddd
commit 25af5ef9d9
3 changed files with 4 additions and 3 deletions

View File

@ -26,6 +26,7 @@ void MemoryCard::Reset()
{ {
ResetTransferState(); ResetTransferState();
SaveIfChanged(true); SaveIfChanged(true);
m_FLAG.no_write_yet = true;
} }
bool MemoryCard::DoState(StateWrapper& sw) bool MemoryCard::DoState(StateWrapper& sw)
@ -34,6 +35,7 @@ bool MemoryCard::DoState(StateWrapper& sw)
SaveIfChanged(true); SaveIfChanged(true);
sw.Do(&m_state); sw.Do(&m_state);
sw.Do(&m_FLAG.bits);
sw.Do(&m_address); sw.Do(&m_address);
sw.Do(&m_sector_offset); sw.Do(&m_sector_offset);
sw.Do(&m_checksum); sw.Do(&m_checksum);

View File

@ -49,8 +49,6 @@ private:
BitField<u8, bool, 2, 1> write_error; BitField<u8, bool, 2, 1> write_error;
}; };
FLAG m_FLAG = {};
enum class State : u8 enum class State : u8
{ {
Idle, Idle,
@ -91,6 +89,7 @@ private:
std::unique_ptr<TimingEvent> m_save_event; std::unique_ptr<TimingEvent> m_save_event;
State m_state = State::Idle; State m_state = State::Idle;
FLAG m_FLAG = {};
u16 m_address = 0; u16 m_address = 0;
u8 m_sector_offset = 0; u8 m_sector_offset = 0;
u8 m_checksum = 0; u8 m_checksum = 0;

View File

@ -2,7 +2,7 @@
#include "types.h" #include "types.h"
static constexpr u32 SAVE_STATE_MAGIC = 0x43435544; static constexpr u32 SAVE_STATE_MAGIC = 0x43435544;
static constexpr u32 SAVE_STATE_VERSION = 25; static constexpr u32 SAVE_STATE_VERSION = 26;
#pragma pack(push, 4) #pragma pack(push, 4)
struct SAVE_STATE_HEADER struct SAVE_STATE_HEADER