mirror of https://github.com/mgba-emu/mgba.git
Core: Add existing state check for rewind
This commit is contained in:
parent
26a62cce64
commit
e430e55149
1
CHANGES
1
CHANGES
|
@ -30,6 +30,7 @@ Misc:
|
||||||
- GB, GBA: Prevent loading null ROMs
|
- GB, GBA: Prevent loading null ROMs
|
||||||
- VFS: Allow truncating memory chunk VFiles
|
- VFS: Allow truncating memory chunk VFiles
|
||||||
- Debugger: Modularize CLI debugger
|
- Debugger: Modularize CLI debugger
|
||||||
|
- Core: Clean up some thread state checks
|
||||||
|
|
||||||
0.5.1: (2016-10-05)
|
0.5.1: (2016-10-05)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -478,6 +478,14 @@ void mCoreThreadPauseFromThread(struct mCoreThread* threadContext) {
|
||||||
|
|
||||||
void mCoreThreadSetRewinding(struct mCoreThread* threadContext, bool rewinding) {
|
void mCoreThreadSetRewinding(struct mCoreThread* threadContext, bool rewinding) {
|
||||||
MutexLock(&threadContext->stateMutex);
|
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);
|
_waitOnInterrupt(threadContext);
|
||||||
if (rewinding && threadContext->state == THREAD_RUNNING) {
|
if (rewinding && threadContext->state == THREAD_RUNNING) {
|
||||||
threadContext->state = THREAD_REWINDING;
|
threadContext->state = THREAD_REWINDING;
|
||||||
|
|
Loading…
Reference in New Issue