all repos — mgba @ a6ff9f6c60e2b745a2e27323bf89bc4d2d08005e

mGBA Game Boy Advance Emulator

Qt: Fix frame delay with pausing and frame advancing
Jeffrey Pfau jeffrey@endrift.com
Mon, 03 Aug 2015 23:52:18 -0700
commit

a6ff9f6c60e2b745a2e27323bf89bc4d2d08005e

parent

6ae001037d5b9a632954f9fc2417d1e998de5709

1 files changed, 5 insertions(+), 6 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/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);