GBA Serialize: Serialize POSTFLG

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

View File

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

View File

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