GBA: GBARewind now returns how many states it has rewound

This commit is contained in:
Jeffrey Pfau 2015-05-26 20:36:04 -07:00
parent db30642645
commit 4c5cdcaa4e
3 changed files with 6 additions and 4 deletions

View File

@ -40,6 +40,7 @@ Misc:
- Qt: Show version info in window title - Qt: Show version info in window title
- All: Fix sanitize-deb script to set file permissions properly if run as (fake)root - 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 SIO: Add a dummy driver for Normal mode
- GBA: GBARewind now returns how many states it has rewound
0.2.1: (2015-05-13) 0.2.1: (2015-05-13)
Bugfixes: Bugfixes:

View File

@ -314,12 +314,12 @@ void GBARewindSettingsChanged(struct GBAThread* threadContext, int newCapacity,
} }
} }
void GBARewind(struct GBAThread* thread, int nStates) { int GBARewind(struct GBAThread* thread, int nStates) {
if (nStates > thread->rewindBufferSize || nStates < 0) { if (nStates > thread->rewindBufferSize || nStates < 0) {
nStates = thread->rewindBufferSize; nStates = thread->rewindBufferSize;
} }
if (nStates == 0) { if (nStates == 0) {
return; return 0;
} }
int offset = thread->rewindBufferWriteOffset - nStates; int offset = thread->rewindBufferWriteOffset - nStates;
if (offset < 0) { if (offset < 0) {
@ -327,7 +327,7 @@ void GBARewind(struct GBAThread* thread, int nStates) {
} }
struct GBASerializedState* state = thread->rewindBuffer[offset]; struct GBASerializedState* state = thread->rewindBuffer[offset];
if (!state) { if (!state) {
return; return 0;
} }
thread->rewindBufferSize -= nStates; thread->rewindBufferSize -= nStates;
thread->rewindBufferWriteOffset = offset; thread->rewindBufferWriteOffset = offset;
@ -335,6 +335,7 @@ void GBARewind(struct GBAThread* thread, int nStates) {
if (thread->rewindScreenBuffer) { 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]); 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) { void GBARewindAll(struct GBAThread* thread) {

View File

@ -335,7 +335,7 @@ void GBADeallocateState(struct GBASerializedState* state);
void GBARecordFrame(struct GBAThread* thread); void GBARecordFrame(struct GBAThread* thread);
void GBARewindSettingsChanged(struct GBAThread* thread, int newCapacity, int newInterval); 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); void GBARewindAll(struct GBAThread* thread);
#endif #endif