Qt: Allow pausing game at load (fixes mgba.io/i/1129)

This commit is contained in:
Vicki Pfau 2018-07-22 10:30:45 -07:00
parent 4f246827a6
commit 2f5624e74a
3 changed files with 12 additions and 2 deletions

View File

@ -71,6 +71,7 @@ Misc:
- FFmpeg: Support libswresample (fixes mgba.io/i/1120, mgba.io/b/123)
- FFmpeg: Support lossless h.264 encoding
- Feature: Added loading savestates from command line
- Qt: Allow pausing game at load (fixes mgba.io/i/1129)
0.6.3: (2017-04-14)
Bugfixes:

View File

@ -1198,12 +1198,15 @@ void Window::setupMenu(QMenuBar* menubar) {
pause->setCheckable(true);
pause->setShortcut(tr("Ctrl+P"));
connect(pause, &QAction::triggered, [this](bool paused) {
m_controller->setPaused(paused);
if (m_controller) {
m_controller->setPaused(paused);
} else {
m_pendingPause = paused;
}
});
connect(this, &Window::paused, [pause](bool paused) {
pause->setChecked(paused);
});
m_gameActions.append(pause);
addControlledAction(emulationMenu, pause, "pause");
QAction* frameAdvance = new QAction(tr("&Next frame"), emulationMenu);
@ -1924,6 +1927,11 @@ void Window::setController(CoreController* controller, const QString& fname) {
m_controller->loadState(m_pendingState);
m_pendingState = QString();
}
if (m_pendingPause) {
m_controller->setPaused(true);
m_pendingPause = false;
}
}
WindowBackground::WindowBackground(QWidget* parent)

View File

@ -207,6 +207,7 @@ private:
bool m_wasOpened = false;
QString m_pendingPatch;
QString m_pendingState;
bool m_pendingPause = false;
bool m_hitUnimplementedBiosCall;