all repos — mgba @ 77922aea5d34574ab7ea09ecb827917bcdb4be1d

mGBA Game Boy Advance Emulator

GBA Serialize: Savestates now properly store prefetch
Jeffrey Pfau jeffrey@endrift.com
Mon, 01 Aug 2016 02:32:02 -0700
commit

77922aea5d34574ab7ea09ecb827917bcdb4be1d

parent

2d94f202a60d64b46a372fe4348f7f485ce5984b

3 files changed, 9 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -11,6 +11,7 @@ - Util: Fix realloc semantics in utf16to8

- PSP2: Fix GPU crash while exiting - PSP2: Fix VSync - ARM7: Fix decoding of Thumb ADD (variants 5 and 6) + - GBA Serialize: Savestates now properly store prefetch Misc: - 3DS: Use blip_add_delta_fast for a small speed improvement - OpenGL: Log shader compilation failure
M src/gba/serialize.csrc/gba/serialize.c

@@ -61,9 +61,10 @@ }

STORE_32(gba->cpu->bankedSPSRs[i], i * sizeof(gba->cpu->bankedSPSRs[0]), state->cpu.bankedSPSRs); } - state->biosPrefetch = gba->memory.biosPrefetch; + STORE_32(gba->memory.biosPrefetch, 0, &state->biosPrefetch); 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); GBAMemorySerialize(&gba->memory, state); GBAIOSerialize(gba, state);

@@ -172,6 +173,7 @@ gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]);

if (state->biosPrefetch) { LOAD_32(gba->memory.biosPrefetch, 0, &state->biosPrefetch); } + LOAD_32(gba->memory.lastPrefetchedPc, 0, &state->lastPrefetchedPc); if (gba->cpu->cpsr.t) { gba->cpu->executionMode = MODE_THUMB; if (state->cpuPrefetch[0] && state->cpuPrefetch[1]) {
M src/gba/serialize.hsrc/gba/serialize.h

@@ -195,7 +195,8 @@ * | 0x002FC - 0x002FF: CPU prefetch (fetch slot)

* 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 - 0x003FF: Reserved (leave zero) + * 0x00318 - 0x0031B: Last prefetched program counter + * 0x0031C - 0x003FF: Reserved (leave zero) * 0x00400 - 0x007FF: I/O memory * 0x00800 - 0x00BFF: Palette * 0x00C00 - 0x00FFF: OAM

@@ -311,7 +312,9 @@ uint32_t reservedRr[3];

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