GBA: STORE_32/16-ize I/O
Jeffrey Pfau jeffrey@endrift.com
Mon, 19 Oct 2015 21:13:15 -0700
1 files changed,
14 insertions(+),
8 deletions(-)
jump to
M
src/gba/io.c
→
src/gba/io.c
@@ -690,21 +690,27 @@ void GBAIOSerialize(struct GBA* gba, struct GBASerializedState* state) {
int i; for (i = 0; i < REG_MAX; i += 2) { if (_isSpecialRegister[i >> 1]) { - state->io[i >> 1] = gba->memory.io[i >> 1]; + STORE_16(gba->memory.io[i >> 1], i, state->io); } else if (_isValidRegister[i >> 1]) { - state->io[i >> 1] = GBAIORead(gba, i); + uint16_t reg = GBAIORead(gba, i); + STORE_16(reg, i, state->io); } } for (i = 0; i < 4; ++i) { - state->io[(REG_DMA0CNT_LO + i * 12) >> 1] = gba->memory.io[(REG_DMA0CNT_LO + i * 12) >> 1]; - state->dma[i].nextSource = gba->memory.dma[i].nextSource; - state->dma[i].nextDest = gba->memory.dma[i].nextDest; - state->dma[i].nextCount = gba->memory.dma[i].nextCount; - state->dma[i].nextEvent = gba->memory.dma[i].nextEvent; + STORE_16(gba->memory.io[(REG_DMA0CNT_LO + i * 12) >> 1], (REG_DMA0CNT_LO + i * 12), state->io); + STORE_16(gba->timers[i].reload, 0, &state->timers[i].reload); + STORE_16(gba->timers[i].oldReload, 0, &state->timers[i].oldReload); + STORE_32(gba->timers[i].lastEvent, 0, &state->timers[i].lastEvent); + STORE_32(gba->timers[i].nextEvent, 0, &state->timers[i].nextEvent); + STORE_32(gba->timers[i].overflowInterval, 0, &state->timers[i].overflowInterval); + STORE_32(gba->timers[i].flags, 0, &state->timers[i].flags); + STORE_32(gba->memory.dma[i].nextSource, 0, &state->dma[i].nextSource); + STORE_32(gba->memory.dma[i].nextDest, 0, &state->dma[i].nextDest); + STORE_32(gba->memory.dma[i].nextCount, 0, &state->dma[i].nextCount); + STORE_32(gba->memory.dma[i].nextEvent, 0, &state->dma[i].nextEvent); } - memcpy(state->timers, gba->timers, sizeof(state->timers)); GBAHardwareSerialize(&gba->memory.hw, state); }