From d0f4584f74d3c2a9f924cec5fa314e0bdfbfa044 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 5 Jan 2015 22:56:56 -0800 Subject: [PATCH] GBA: Fix rewind boundary conditions --- src/gba/gba-serialize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gba/gba-serialize.c b/src/gba/gba-serialize.c index 61c716da3..ecc118674 100644 --- a/src/gba/gba-serialize.c +++ b/src/gba/gba-serialize.c @@ -262,7 +262,7 @@ void GBARewind(struct GBAThread* thread, int nStates) { if (!state) { return; } - thread->rewindBufferSize -= nStates; - thread->rewindBufferWriteOffset = (offset + thread->rewindBufferCapacity - nStates) % thread->rewindBufferCapacity; + thread->rewindBufferSize -= nStates - 1; + thread->rewindBufferWriteOffset = (offset + 1) % thread->rewindBufferCapacity; GBADeserialize(thread->gba, state); }