From 83e16d56c05f2e7714c29b52f50a8b943b027f27 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 8 Jul 2014 21:56:03 -0700 Subject: [PATCH] Fix a case where deserializing the FIFO may not restore up to three bytes --- src/gba/gba-audio.c | 8 ++++---- src/gba/gba-serialize.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gba/gba-audio.c b/src/gba/gba-audio.c index 9c7b052d2..e3a01769d 100644 --- a/src/gba/gba-audio.c +++ b/src/gba/gba-audio.c @@ -732,10 +732,10 @@ void GBAAudioDeserialize(struct GBAAudio* audio, const struct GBASerializedState CircleBufferClear(&audio->chA.fifo); CircleBufferClear(&audio->chB.fifo); - unsigned i; - for (i = 0; i < state->audio.fifoSize / sizeof(uint32_t); ++i) { - CircleBufferWrite32(&audio->chA.fifo, state->audio.fifoA[i]); - CircleBufferWrite32(&audio->chB.fifo, state->audio.fifoB[i]); + int i; + for (i = 0; i < state->audio.fifoSize; ++i) { + CircleBufferWrite8(&audio->chA.fifo, state->audio.fifoA[i]); + CircleBufferWrite8(&audio->chB.fifo, state->audio.fifoB[i]); } audio->nextEvent = state->audio.nextEvent; diff --git a/src/gba/gba-serialize.h b/src/gba/gba-serialize.h index aa140de86..51e54b748 100644 --- a/src/gba/gba-serialize.h +++ b/src/gba/gba-serialize.h @@ -175,8 +175,8 @@ struct GBASerializedState { int32_t endTime; int32_t nextEvent; } ch4; - uint32_t fifoA[8]; - uint32_t fifoB[8]; + uint8_t fifoA[32]; + uint8_t fifoB[32]; int32_t nextEvent; int32_t eventDiff; int32_t nextSample;