mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix frame delay with pausing and frame advancing
This commit is contained in:
parent
6ae001037d
commit
a6ff9f6c60
|
@ -121,15 +121,15 @@ GameController::GameController(QObject* parent)
|
|||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
m_threadContext.stopCallback = [](GBAThread* context) {
|
||||
|
@ -464,8 +464,7 @@ void GameController::setPaused(bool paused) {
|
|||
return;
|
||||
}
|
||||
if (paused) {
|
||||
GBAThreadPause(&m_threadContext);
|
||||
emit gamePaused(&m_threadContext);
|
||||
m_pauseAfterFrame.testAndSetRelaxed(false, true);
|
||||
} else {
|
||||
GBAThreadUnpause(&m_threadContext);
|
||||
emit gameUnpaused(&m_threadContext);
|
||||
|
|
Loading…
Reference in New Issue