GBA Serialize: Serialize POSTFLG

This commit is contained in:
Vicki Pfau 2018-09-08 11:24:46 -07:00
parent 45a5101099
commit 0d7cdb9ed8
2 changed files with 4 additions and 0 deletions

View File

@ -195,6 +195,7 @@ mLOG_DECLARE_CATEGORY(GBA_STATE);
* 0x00318 - 0x0031B: Last prefetched program counter
* 0x0031C - 0x0031F: Miscellaneous flags
* | bit 0: Is CPU halted?
* | bit 1: POSTFLG
* 0x00320 - 0x003FF: Reserved (leave zero)
* 0x00400 - 0x007FF: I/O memory
* 0x00800 - 0x00BFF: Palette
@ -225,6 +226,7 @@ DECL_BIT(GBASerializedSavedataFlags, DustSettling, 5);
DECL_BITFIELD(GBASerializedMiscFlags, uint32_t);
DECL_BIT(GBASerializedMiscFlags, Halted, 0);
DECL_BIT(GBASerializedMiscFlags, POSTFLG, 1);
struct GBASerializedState {
uint32_t versionMagic;

View File

@ -61,6 +61,7 @@ void GBASerialize(struct GBA* gba, struct GBASerializedState* state) {
GBASerializedMiscFlags miscFlags = 0;
miscFlags = GBASerializedMiscFlagsSetHalted(miscFlags, gba->cpu->halted);
miscFlags = GBASerializedMiscFlagsSetPOSTFLG(miscFlags, gba->memory.io[REG_POSTFLG >> 1] & 1);
STORE_32(miscFlags, 0, &state->miscFlags);
GBAMemorySerialize(&gba->memory, state);
@ -177,6 +178,7 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
GBASerializedMiscFlags miscFlags = 0;
LOAD_32(miscFlags, 0, &state->miscFlags);
gba->cpu->halted = GBASerializedMiscFlagsGetHalted(miscFlags);
gba->memory.io[REG_POSTFLG >> 1] = GBASerializedMiscFlagsGetPOSTFLG(miscFlags);
GBAVideoDeserialize(&gba->video, state);
GBAMemoryDeserialize(&gba->memory, state);