mirror of https://github.com/mgba-emu/mgba.git
GBA: Fix rewind boundary conditions
This commit is contained in:
parent
6d2e81d246
commit
ae41898206
1
CHANGES
1
CHANGES
|
@ -9,6 +9,7 @@ Bugfixes:
|
||||||
- GBA Memory: Ensure changing the timing of a DMA reschedules it
|
- GBA Memory: Ensure changing the timing of a DMA reschedules it
|
||||||
- Qt: Fix window not regaining focus after exiting savestate window
|
- Qt: Fix window not regaining focus after exiting savestate window
|
||||||
- Qt: Fix regression where video would not record if the game had already started
|
- Qt: Fix regression where video would not record if the game had already started
|
||||||
|
- GBA: Fix rewind boundary conditions
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Show multiplayer numbers in window title
|
- Qt: Show multiplayer numbers in window title
|
||||||
|
|
||||||
|
|
|
@ -291,14 +291,14 @@ void GBARewind(struct GBAThread* thread, int nStates) {
|
||||||
}
|
}
|
||||||
int offset = thread->rewindBufferWriteOffset - nStates;
|
int offset = thread->rewindBufferWriteOffset - nStates;
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
offset += thread->rewindBufferSize;
|
offset += thread->rewindBufferCapacity;
|
||||||
}
|
}
|
||||||
struct GBASerializedState* state = thread->rewindBuffer[offset];
|
struct GBASerializedState* state = thread->rewindBuffer[offset];
|
||||||
if (!state) {
|
if (!state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
thread->rewindBufferSize -= nStates - 1;
|
thread->rewindBufferSize -= nStates;
|
||||||
thread->rewindBufferWriteOffset = (offset + 1) % thread->rewindBufferCapacity;
|
thread->rewindBufferWriteOffset = offset;
|
||||||
GBADeserialize(thread->gba, state);
|
GBADeserialize(thread->gba, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue