pause emu during file select prompts

This commit is contained in:
Arisotura 2024-10-27 17:21:41 +01:00
parent 238c552599
commit e42829ea81
1 changed files with 14 additions and 2 deletions

View File

@ -1196,6 +1196,8 @@ QString MainWindow::pickFileFromArchive(QString archiveFileName)
QStringList MainWindow::pickROM(bool gba) QStringList MainWindow::pickROM(bool gba)
{ {
emuThread->emuPause();
const QString console = gba ? "GBA" : "DS"; const QString console = gba ? "GBA" : "DS";
const QStringList& romexts = gba ? GbaRomExtensions : NdsRomExtensions; const QStringList& romexts = gba ? GbaRomExtensions : NdsRomExtensions;
@ -1220,10 +1222,16 @@ QStringList MainWindow::pickROM(bool gba)
"All supported files (*" + allROMs + ")" + extraFilters "All supported files (*" + allROMs + ")" + extraFilters
); );
if (filename.isEmpty()) return {}; if (filename.isEmpty())
{
emuThread->emuUnpause();
return {};
}
globalCfg.SetQString("LastROMFolder", QFileInfo(filename).dir().path()); globalCfg.SetQString("LastROMFolder", QFileInfo(filename).dir().path());
return splitArchivePath(filename, false); auto ret = splitArchivePath(filename, false);
emuThread->emuUnpause();
return ret;
} }
void MainWindow::updateCartInserted(bool gba) void MainWindow::updateCartInserted(bool gba)
@ -1465,10 +1473,12 @@ void MainWindow::onSaveState()
else else
{ {
// TODO: specific 'last directory' for savestate files? // TODO: specific 'last directory' for savestate files?
emuThread->emuPause();
filename = QFileDialog::getSaveFileName(this, filename = QFileDialog::getSaveFileName(this,
"Save state", "Save state",
globalCfg.GetQString("LastROMFolder"), globalCfg.GetQString("LastROMFolder"),
"melonDS savestates (*.mln);;Any file (*.*)"); "melonDS savestates (*.mln);;Any file (*.*)");
emuThread->emuUnpause();
if (filename.isEmpty()) if (filename.isEmpty())
return; return;
} }
@ -1498,10 +1508,12 @@ void MainWindow::onLoadState()
else else
{ {
// TODO: specific 'last directory' for savestate files? // TODO: specific 'last directory' for savestate files?
emuThread->emuPause();
filename = QFileDialog::getOpenFileName(this, filename = QFileDialog::getOpenFileName(this,
"Load state", "Load state",
globalCfg.GetQString("LastROMFolder"), globalCfg.GetQString("LastROMFolder"),
"melonDS savestates (*.ml*);;Any file (*.*)"); "melonDS savestates (*.ml*);;Any file (*.*)");
emuThread->emuUnpause();
if (filename.isEmpty()) if (filename.isEmpty())
return; return;
} }