Qt: Fix frame delay with pausing and frame advancing
Jeffrey Pfau jeffrey@endrift.com
Mon, 03 Aug 2015 23:52:18 -0700
1 files changed,
5 insertions(+),
6 deletions(-)
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -121,14 +121,14 @@ };
m_threadContext.frameCallback = [](GBAThread* context) { GameController* controller = static_cast<GameController*>(context->userData); - if (controller->m_pauseAfterFrame.testAndSetAcquire(true, false)) { - GBAThreadPauseFromThread(context); - controller->gamePaused(&controller->m_threadContext); - } if (GBASyncDrawingFrame(&controller->m_threadContext.sync)) { controller->frameAvailable(controller->m_drawContext); } else { controller->frameAvailable(nullptr); + } + if (controller->m_pauseAfterFrame.testAndSetAcquire(true, false)) { + GBAThreadPauseFromThread(context); + controller->gamePaused(&controller->m_threadContext); } };@@ -464,8 +464,7 @@ if (!m_gameOpen || m_rewindTimer.isActive() || paused == GBAThreadIsPaused(&m_threadContext)) {
return; } if (paused) { - GBAThreadPause(&m_threadContext); - emit gamePaused(&m_threadContext); + m_pauseAfterFrame.testAndSetRelaxed(false, true); } else { GBAThreadUnpause(&m_threadContext); emit gameUnpaused(&m_threadContext);