diff --git a/src/gba/hardware.c b/src/gba/hardware.c index a584886e3..9f27bf17a 100644 --- a/src/gba/hardware.c +++ b/src/gba/hardware.c @@ -424,7 +424,7 @@ uint8_t GBAHardwareTiltRead(struct GBACartridgeHardware* hw, uint32_t address) { // == Serialization -void GBAHardwareSerialize(struct GBACartridgeHardware* hw, struct GBASerializedState* state) { +void GBAHardwareSerialize(const struct GBACartridgeHardware* hw, struct GBASerializedState* state) { state->hw.readWrite = hw->readWrite; state->hw.pinState = hw->pinState; state->hw.pinDirection = hw->direction; @@ -440,7 +440,7 @@ void GBAHardwareSerialize(struct GBACartridgeHardware* hw, struct GBASerializedS state->hw.lightEdge = hw->lightEdge; } -void GBAHardwareDeserialize(struct GBACartridgeHardware* hw, struct GBASerializedState* state) { +void GBAHardwareDeserialize(struct GBACartridgeHardware* hw, const struct GBASerializedState* state) { hw->readWrite = state->hw.readWrite; hw->pinState = state->hw.pinState; hw->direction = state->hw.pinDirection; diff --git a/src/gba/hardware.h b/src/gba/hardware.h index 841388a6c..55c62794c 100644 --- a/src/gba/hardware.h +++ b/src/gba/hardware.h @@ -149,7 +149,7 @@ void GBAHardwareTiltWrite(struct GBACartridgeHardware* gpio, uint32_t address, u uint8_t GBAHardwareTiltRead(struct GBACartridgeHardware* gpio, uint32_t address); struct GBASerializedState; -void GBAHardwareSerialize(struct GBACartridgeHardware* gpio, struct GBASerializedState* state); -void GBAHardwareDeserialize(struct GBACartridgeHardware* gpio, struct GBASerializedState* state); +void GBAHardwareSerialize(const struct GBACartridgeHardware* gpio, struct GBASerializedState* state); +void GBAHardwareDeserialize(struct GBACartridgeHardware* gpio, const struct GBASerializedState* state); #endif diff --git a/src/gba/io.c b/src/gba/io.c index 271aec632..76305cb1d 100644 --- a/src/gba/io.c +++ b/src/gba/io.c @@ -675,7 +675,7 @@ void GBAIOSerialize(struct GBA* gba, struct GBASerializedState* state) { GBAHardwareSerialize(&gba->memory.hw, state); } -void GBAIODeserialize(struct GBA* gba, struct GBASerializedState* state) { +void GBAIODeserialize(struct GBA* gba, const struct GBASerializedState* state) { int i; for (i = 0; i < REG_MAX; i += 2) { if (_isSpecialRegister[i >> 1]) { diff --git a/src/gba/io.h b/src/gba/io.h index 77b28861a..c6e988097 100644 --- a/src/gba/io.h +++ b/src/gba/io.h @@ -161,6 +161,6 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address); struct GBASerializedState; void GBAIOSerialize(struct GBA* gba, struct GBASerializedState* state); -void GBAIODeserialize(struct GBA* gba, struct GBASerializedState* state); +void GBAIODeserialize(struct GBA* gba, const struct GBASerializedState* state); #endif diff --git a/src/gba/memory.c b/src/gba/memory.c index a0d0e16d4..3ea0b7ece 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -1461,12 +1461,12 @@ void GBAMemoryServiceDMA(struct GBA* gba, int number, struct GBADMA* info) { cpu->cycles += cycles; } -void GBAMemorySerialize(struct GBAMemory* memory, struct GBASerializedState* state) { +void GBAMemorySerialize(const struct GBAMemory* memory, struct GBASerializedState* state) { memcpy(state->wram, memory->wram, SIZE_WORKING_RAM); memcpy(state->iwram, memory->iwram, SIZE_WORKING_IRAM); } -void GBAMemoryDeserialize(struct GBAMemory* memory, struct GBASerializedState* state) { +void GBAMemoryDeserialize(struct GBAMemory* memory, const struct GBASerializedState* state) { memcpy(memory->wram, state->wram, SIZE_WORKING_RAM); memcpy(memory->iwram, state->iwram, SIZE_WORKING_IRAM); } diff --git a/src/gba/memory.h b/src/gba/memory.h index aaa948337..db044d35b 100644 --- a/src/gba/memory.h +++ b/src/gba/memory.h @@ -172,7 +172,7 @@ void GBAMemoryUpdateDMAs(struct GBA* gba, int32_t cycles); int32_t GBAMemoryRunDMAs(struct GBA* gba, int32_t cycles); struct GBASerializedState; -void GBAMemorySerialize(struct GBAMemory* memory, struct GBASerializedState* state); -void GBAMemoryDeserialize(struct GBAMemory* memory, struct GBASerializedState* state); +void GBAMemorySerialize(const struct GBAMemory* memory, struct GBASerializedState* state); +void GBAMemoryDeserialize(struct GBAMemory* memory, const struct GBASerializedState* state); #endif diff --git a/src/gba/serialize.c b/src/gba/serialize.c index 93a873c6e..5b0d8e868 100644 --- a/src/gba/serialize.c +++ b/src/gba/serialize.c @@ -55,7 +55,7 @@ void GBASerialize(struct GBA* gba, struct GBASerializedState* state) { } } -void GBADeserialize(struct GBA* gba, struct GBASerializedState* state) { +void GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) { if (state->versionMagic != GBA_SAVESTATE_MAGIC) { GBALog(gba, GBA_LOG_WARN, "Invalid or too new savestate"); return; diff --git a/src/gba/serialize.h b/src/gba/serialize.h index d9e051614..50c0f717c 100644 --- a/src/gba/serialize.h +++ b/src/gba/serialize.h @@ -292,7 +292,7 @@ struct VDir; struct GBAThread; void GBASerialize(struct GBA* gba, struct GBASerializedState* state); -void GBADeserialize(struct GBA* gba, struct GBASerializedState* state); +void GBADeserialize(struct GBA* gba, const struct GBASerializedState* state); bool GBASaveState(struct GBAThread* thread, struct VDir* dir, int slot, bool screenshot); bool GBALoadState(struct GBAThread* thread, struct VDir* dir, int slot); diff --git a/src/gba/video.c b/src/gba/video.c index 88710f152..06a6042bb 100644 --- a/src/gba/video.c +++ b/src/gba/video.c @@ -235,7 +235,7 @@ static void GBAVideoDummyRendererGetPixels(struct GBAVideoRenderer* renderer, un } -void GBAVideoSerialize(struct GBAVideo* video, struct GBASerializedState* state) { +void GBAVideoSerialize(const struct GBAVideo* video, struct GBASerializedState* state) { memcpy(state->vram, video->renderer->vram, SIZE_VRAM); memcpy(state->oam, video->oam.raw, SIZE_OAM); memcpy(state->pram, video->palette, SIZE_PALETTE_RAM); @@ -249,7 +249,7 @@ void GBAVideoSerialize(struct GBAVideo* video, struct GBASerializedState* state) state->video.frameCounter = video->frameCounter; } -void GBAVideoDeserialize(struct GBAVideo* video, struct GBASerializedState* state) { +void GBAVideoDeserialize(struct GBAVideo* video, const struct GBASerializedState* state) { memcpy(video->renderer->vram, state->vram, SIZE_VRAM); int i; for (i = 0; i < SIZE_OAM; i += 2) { diff --git a/src/gba/video.h b/src/gba/video.h index b34a9a159..b7648719e 100644 --- a/src/gba/video.h +++ b/src/gba/video.h @@ -201,7 +201,7 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles); void GBAVideoWriteDISPSTAT(struct GBAVideo* video, uint16_t value); struct GBASerializedState; -void GBAVideoSerialize(struct GBAVideo* video, struct GBASerializedState* state); -void GBAVideoDeserialize(struct GBAVideo* video, struct GBASerializedState* state); +void GBAVideoSerialize(const struct GBAVideo* video, struct GBASerializedState* state); +void GBAVideoDeserialize(struct GBAVideo* video, const struct GBASerializedState* state); #endif