GBA: Fix rewind boundary conditions

This commit is contained in:
Jeffrey Pfau 2015-04-12 20:19:02 -07:00
parent 470538d4db
commit 2a9a738bfb
2 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@ Bugfixes:
- GBA Memory: Ensure changing the timing of a DMA reschedules it
- Qt: Fix window not regaining focus after exiting savestate window
- Qt: Fix regression where video would not record if the game had already started
- GBA: Fix rewind boundary conditions
Misc:
- Qt: Show multiplayer numbers in window title

View File

@ -291,14 +291,14 @@ void GBARewind(struct GBAThread* thread, int nStates) {
}
int offset = thread->rewindBufferWriteOffset - nStates;
if (offset < 0) {
offset += thread->rewindBufferSize;
offset += thread->rewindBufferCapacity;
}
struct GBASerializedState* state = thread->rewindBuffer[offset];
if (!state) {
return;
}
thread->rewindBufferSize -= nStates - 1;
thread->rewindBufferWriteOffset = (offset + 1) % thread->rewindBufferCapacity;
thread->rewindBufferSize -= nStates;
thread->rewindBufferWriteOffset = offset;
GBADeserialize(thread->gba, state);
}