Qt: Pause game while open file dialogs are open (fixes #6 on GitHub)

This commit is contained in:
Jeffrey Pfau 2015-04-02 22:32:38 -07:00
parent 120020b0e3
commit 7cc903a217
2 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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);