diff --git a/CHANGES b/CHANGES index e274ccf02..637248327 100644 --- a/CHANGES +++ b/CHANGES @@ -60,6 +60,7 @@ Bugfixes: - GBA Memory: Fix I cycles that had been moved to ARM7 core - GBA Memory: Fix cycle counting for 32-bit load/stores - ARM7: Fix cycle counting for loads + - Qt: Pause game while open file dialogs are open (fixes #6 on GitHub) Misc: - GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples - GBA Memory: Simplify memory API and use fixed bus width diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index cb7c87a0c..019586fe1 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -198,7 +198,14 @@ void Window::saveConfig() { } void Window::selectROM() { + bool doPause = m_controller->isLoaded() && !m_controller->isPaused(); + if (doPause) { + m_controller->setPaused(true); + } QString filename = QFileDialog::getOpenFileName(this, tr("Select ROM"), m_config->getQtOption("lastDirectory").toString(), tr("Game Boy Advance ROMs (*.gba *.zip *.rom *.bin)")); + if (doPause) { + m_controller->setPaused(false); + } if (!filename.isEmpty()) { m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_controller->loadGame(filename); @@ -206,7 +213,14 @@ void Window::selectROM() { } void Window::selectBIOS() { + bool doPause = m_controller->isLoaded() && !m_controller->isPaused(); + if (doPause) { + m_controller->setPaused(true); + } QString filename = QFileDialog::getOpenFileName(this, tr("Select BIOS"), m_config->getQtOption("lastDirectory").toString()); + if (doPause) { + m_controller->setPaused(false); + } if (!filename.isEmpty()) { m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_config->setOption("bios", filename); @@ -218,7 +232,14 @@ void Window::selectBIOS() { } void Window::selectPatch() { + bool doPause = m_controller->isLoaded() && !m_controller->isPaused(); + if (doPause) { + m_controller->setPaused(true); + } QString filename = QFileDialog::getOpenFileName(this, tr("Select patch"), m_config->getQtOption("lastDirectory").toString(), tr("Patches (*.ips *.ups *.bps)")); + if (doPause) { + m_controller->setPaused(false); + } if (!filename.isEmpty()) { m_config->setQtOption("lastDirectory", QFileInfo(filename).dir().path()); m_controller->loadPatch(filename);