From 5c699e9d6cbfbcd5768a876a8fdbb42f6cfaf9d6 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 ccf0b708f..95ed22aab 100644 --- a/src/gba/gba-serialize.c +++ b/src/gba/gba-serialize.c @@ -264,7 +264,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); }