mirror of https://github.com/mgba-emu/mgba.git
Core: Fix issues with 0 rewind states
This commit is contained in:
parent
72b499dc8e
commit
f97a1524be
|
@ -107,7 +107,7 @@ static THREAD_ENTRY _mCoreThreadRun(void* context) {
|
|||
core->setSync(core, &threadContext->sync);
|
||||
core->reset(core);
|
||||
|
||||
if (core->opts.rewindEnable) {
|
||||
if (core->opts.rewindEnable && core->opts.rewindBufferCapacity > 0) {
|
||||
mCoreRewindContextInit(&threadContext->rewind, core->opts.rewindBufferCapacity);
|
||||
}
|
||||
|
||||
|
@ -487,11 +487,13 @@ void mCoreThreadFrameStarted(struct mCoreThread* thread) {
|
|||
if (!thread) {
|
||||
return;
|
||||
}
|
||||
if (thread->core->opts.rewindEnable && thread->state != THREAD_REWINDING) {
|
||||
mCoreRewindAppend(&thread->rewind, thread->core);
|
||||
} else if (thread->state == THREAD_REWINDING) {
|
||||
if (!mCoreRewindRestore(&thread->rewind, thread->core)) {
|
||||
if (thread->core->opts.rewindEnable && thread->core->opts.rewindBufferCapacity > 0) {
|
||||
if (thread->state != THREAD_REWINDING) {
|
||||
mCoreRewindAppend(&thread->rewind, thread->core);
|
||||
} else if (thread->state == THREAD_REWINDING) {
|
||||
if (!mCoreRewindRestore(&thread->rewind, thread->core)) {
|
||||
mCoreRewindAppend(&thread->rewind, thread->core);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -659,11 +659,12 @@ void GameController::frameAdvance() {
|
|||
void GameController::setRewind(bool enable, int capacity) {
|
||||
if (m_gameOpen) {
|
||||
threadInterrupt();
|
||||
if (m_threadContext.core->opts.rewindEnable) {
|
||||
if (m_threadContext.core->opts.rewindEnable && m_threadContext.core->opts.rewindBufferCapacity > 0) {
|
||||
mCoreRewindContextDeinit(&m_threadContext.rewind);
|
||||
}
|
||||
m_threadContext.core->opts.rewindEnable = enable;
|
||||
if (enable) {
|
||||
m_threadContext.core->opts.rewindBufferCapacity = capacity;
|
||||
if (enable && capacity > 0) {
|
||||
mCoreRewindContextInit(&m_threadContext.rewind, capacity);
|
||||
}
|
||||
threadContinue();
|
||||
|
|
Loading…
Reference in New Issue