all repos — mgba @ e430e55149e3f488359c9cf2c3f7b4e5a0a0a1d5

mGBA Game Boy Advance Emulator

Core: Add existing state check for rewind
Jeffrey Pfau jeffrey@endrift.com
Wed, 26 Oct 2016 21:41:44 -0700
commit

e430e55149e3f488359c9cf2c3f7b4e5a0a0a1d5

parent

26a62cce6475f765151093597e5c33cf3fdd5d59

2 files changed, 9 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -30,6 +30,7 @@ - PSP2: Improved controller rumble

- GB, GBA: Prevent loading null ROMs - VFS: Allow truncating memory chunk VFiles - Debugger: Modularize CLI debugger + - Core: Clean up some thread state checks 0.5.1: (2016-10-05) Bugfixes:
M src/core/thread.csrc/core/thread.c

@@ -478,6 +478,14 @@ }

void mCoreThreadSetRewinding(struct mCoreThread* threadContext, bool rewinding) { MutexLock(&threadContext->stateMutex); + if (rewinding && (threadContext->state == THREAD_REWINDING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_REWINDING))) { + MutexUnlock(&threadContext->stateMutex); + return; + } + if (!rewinding && (threadContext->state == THREAD_RUNNING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_RUNNING))) { + MutexUnlock(&threadContext->stateMutex); + return; + } _waitOnInterrupt(threadContext); if (rewinding && threadContext->state == THREAD_RUNNING) { threadContext->state = THREAD_REWINDING;