all repos — mgba @ 4c5cdcaa4e4e9951edaf8f0bb791f32c29dbcf6a

mGBA Game Boy Advance Emulator

GBA: GBARewind now returns how many states it has rewound
Jeffrey Pfau jeffrey@endrift.com
Tue, 26 May 2015 20:36:04 -0700
commit

4c5cdcaa4e4e9951edaf8f0bb791f32c29dbcf6a

parent

db30642645ddf33e1ba9a03e96c8d43b26b78e47

3 files changed, 6 insertions(+), 4 deletions(-)

jump to
M CHANGESCHANGES

@@ -40,6 +40,7 @@ - All: Add --help flag for command line programs

- Qt: Show version info in window title - All: Fix sanitize-deb script to set file permissions properly if run as (fake)root - GBA SIO: Add a dummy driver for Normal mode + - GBA: GBARewind now returns how many states it has rewound 0.2.1: (2015-05-13) Bugfixes:
M src/gba/serialize.csrc/gba/serialize.c

@@ -314,12 +314,12 @@ threadContext->rewindScreenBuffer = 0;

} } -void GBARewind(struct GBAThread* thread, int nStates) { +int GBARewind(struct GBAThread* thread, int nStates) { if (nStates > thread->rewindBufferSize || nStates < 0) { nStates = thread->rewindBufferSize; } if (nStates == 0) { - return; + return 0; } int offset = thread->rewindBufferWriteOffset - nStates; if (offset < 0) {

@@ -327,7 +327,7 @@ offset += thread->rewindBufferCapacity;

} struct GBASerializedState* state = thread->rewindBuffer[offset]; if (!state) { - return; + return 0; } thread->rewindBufferSize -= nStates; thread->rewindBufferWriteOffset = offset;

@@ -335,6 +335,7 @@ GBADeserialize(thread->gba, state);

if (thread->rewindScreenBuffer) { thread->gba->video.renderer->putPixels(thread->gba->video.renderer, VIDEO_HORIZONTAL_PIXELS, &thread->rewindScreenBuffer[offset * VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * BYTES_PER_PIXEL]); } + return nStates; } void GBARewindAll(struct GBAThread* thread) {
M src/gba/serialize.hsrc/gba/serialize.h

@@ -335,7 +335,7 @@ void GBADeallocateState(struct GBASerializedState* state);

void GBARecordFrame(struct GBAThread* thread); void GBARewindSettingsChanged(struct GBAThread* thread, int newCapacity, int newInterval); -void GBARewind(struct GBAThread* thread, int nStates); +int GBARewind(struct GBAThread* thread, int nStates); void GBARewindAll(struct GBAThread* thread); #endif