Fix rewind buffer sizing itself wrong

This commit is contained in:
Jeffrey Pfau 2014-01-26 12:47:47 -08:00
parent 705b6e9b13
commit c3a5fb497a
1 changed files with 2 additions and 1 deletions

View File

@ -119,7 +119,7 @@ void GBARecordFrame(struct GBAThread* thread) {
} }
GBASerialize(thread->gba, state); GBASerialize(thread->gba, state);
thread->rewindBufferSize = thread->rewindBufferSize == thread->rewindBufferCapacity ? thread->rewindBufferCapacity : thread->rewindBufferSize + 1; thread->rewindBufferSize = thread->rewindBufferSize == thread->rewindBufferCapacity ? thread->rewindBufferCapacity : thread->rewindBufferSize + 1;
thread->rewindBufferWriteOffset = (offset + 1) % thread->rewindBufferSize; thread->rewindBufferWriteOffset = (offset + 1) % thread->rewindBufferCapacity;
} }
void GBARewind(struct GBAThread* thread, int nStates) { void GBARewind(struct GBAThread* thread, int nStates) {
@ -138,5 +138,6 @@ void GBARewind(struct GBAThread* thread, int nStates) {
return; return;
} }
thread->rewindBufferSize -= nStates; thread->rewindBufferSize -= nStates;
thread->rewindBufferWriteOffset = (offset + thread->rewindBufferCapacity - nStates) % thread->rewindBufferCapacity;
GBADeserialize(thread->gba, state); GBADeserialize(thread->gba, state);
} }