all repos — mgba @ 90edf4d1a085f8611822a8eaa98f063704ab00fb

mGBA Game Boy Advance Emulator

GBA Serialize: Savestates now store if CPU was halted
Jeffrey Pfau jeffrey@endrift.com
Sun, 28 Aug 2016 20:36:12 -0700
commit

90edf4d1a085f8611822a8eaa98f063704ab00fb

parent

c9b69bba44337992d0b6de63a57ea162ae9757f9

3 files changed, 17 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -80,6 +80,7 @@ - GBA Video: Optimize compositing cases slightly

- VFS: Improve zip file detection - Util: Add endswith - GUI: Only reload config if manually saved + - GBA Serialize: Savestates now store if CPU was halted 0.4.1: (2016-07-11) Bugfixes:
M src/gba/serialize.csrc/gba/serialize.c

@@ -66,11 +66,16 @@ STORE_32(gba->cpu->prefetch[0], 0, state->cpuPrefetch);

STORE_32(gba->cpu->prefetch[1], 4, state->cpuPrefetch); STORE_32(gba->memory.lastPrefetchedPc, 0, &state->lastPrefetchedPc); + GBASerializedMiscFlags miscFlags = 0; + miscFlags = GBASerializedMiscFlagsSetHalted(miscFlags, gba->cpu->halted); + STORE_32(miscFlags, 0, &state->miscFlags); + GBAMemorySerialize(&gba->memory, state); GBAIOSerialize(gba, state); GBAVideoSerialize(&gba->video, state); GBAAudioSerialize(&gba->audio, state); GBASavedataSerialize(&gba->memory.savedata, state); + #ifndef _MSC_VER struct timeval tv;

@@ -197,6 +202,9 @@ LOAD_32(gba->cpu->prefetch[0], (gba->cpu->gprs[ARM_PC] - WORD_SIZE_ARM) & gba->cpu->memory.activeMask, gba->cpu->memory.activeRegion);

LOAD_32(gba->cpu->prefetch[1], (gba->cpu->gprs[ARM_PC]) & gba->cpu->memory.activeMask, gba->cpu->memory.activeRegion); } } + GBASerializedMiscFlags miscFlags = 0; + LOAD_32(miscFlags, 0, &state->miscFlags); + gba->cpu->halted = GBASerializedMiscFlagsGetHalted(miscFlags); GBAVideoDeserialize(&gba->video, state); GBAMemoryDeserialize(&gba->memory, state);
M src/gba/serialize.hsrc/gba/serialize.h

@@ -196,7 +196,9 @@ * 0x00300 - 0x00303: Associated movie stream ID for record/replay (or 0 if no stream)

* 0x00304 - 0x0030F: Reserved (leave zero) * 0x00310 - 0x00317: Savestate creation time (usec since 1970) * 0x00318 - 0x0031B: Last prefetched program counter - * 0x0031C - 0x003FF: Reserved (leave zero) + * 0x0031C - 0x0031F: Miscellaneous flags + * | bit 0: Is CPU halted? + * 0x00320 - 0x003FF: Reserved (leave zero) * 0x00400 - 0x007FF: I/O memory * 0x00800 - 0x00BFF: Palette * 0x00C00 - 0x00FFF: OAM

@@ -222,6 +224,9 @@

DECL_BITFIELD(GBASerializedSavedataFlags, uint8_t); DECL_BITS(GBASerializedSavedataFlags, FlashState, 0, 2); DECL_BIT(GBASerializedSavedataFlags, FlashBank, 4); + +DECL_BITFIELD(GBASerializedMiscFlags, uint32_t); +DECL_BIT(GBASerializedMiscFlags, Halted, 0); struct GBASerializedState { uint32_t versionMagic;

@@ -313,8 +318,9 @@

uint64_t creationUsec; uint32_t lastPrefetchedPc; + GBASerializedMiscFlags miscFlags; - uint32_t reserved[57]; + uint32_t reserved[56]; uint16_t io[SIZE_IO >> 1]; uint16_t pram[SIZE_PALETTE_RAM >> 1];