all repos — mgba @ c3a5fb497af232da51a45e1fb14d8e57557fb951

mGBA Game Boy Advance Emulator

Fix rewind buffer sizing itself wrong
Jeffrey Pfau jeffrey@endrift.com
Sun, 26 Jan 2014 12:47:47 -0800
commit

c3a5fb497af232da51a45e1fb14d8e57557fb951

parent

705b6e9b139b7c0c6fe1c10ffe21a0a44241f9a9

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M src/gba/gba-serialize.csrc/gba/gba-serialize.c

@@ -119,7 +119,7 @@ thread->rewindBuffer[offset] = state;

} GBASerialize(thread->gba, state); 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) {

@@ -138,5 +138,6 @@ if (!state) {

return; } thread->rewindBufferSize -= nStates; + thread->rewindBufferWriteOffset = (offset + thread->rewindBufferCapacity - nStates) % thread->rewindBufferCapacity; GBADeserialize(thread->gba, state); }