From 1d284f6f1e0afc61431c639b7fafc892d4fffc64 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Fri, 25 Oct 2024 16:16:23 +0200 Subject: [PATCH] as promised, reroute dropEvent() through EmuThread --- src/frontend/qt_sdl/Window.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/frontend/qt_sdl/Window.cpp b/src/frontend/qt_sdl/Window.cpp index 47113993..7c6c0c4c 100644 --- a/src/frontend/qt_sdl/Window.cpp +++ b/src/frontend/qt_sdl/Window.cpp @@ -920,20 +920,12 @@ void MainWindow::dropEvent(QDropEvent* event) QList urls = event->mimeData()->urls(); if (urls.count() > 1) return; // not handling more than one file at once - emuThread->emuPause(); - if (!verifySetup()) - { - emuThread->emuUnpause(); return; - } const QStringList file = splitArchivePath(urls.at(0).toLocalFile(), false); if (file.isEmpty()) - { - emuThread->emuUnpause(); return; - } const QString filename = file.last(); const bool romInsideArchive = file.size() > 1; @@ -947,9 +939,8 @@ void MainWindow::dropEvent(QDropEvent* event) if (isNdsRom) { - if (!emuInstance->loadROM(file, true)) + if (!emuThread->bootROM(file)) { - emuThread->emuUnpause(); return; } @@ -958,28 +949,20 @@ void MainWindow::dropEvent(QDropEvent* event) recentFileList.prepend(barredFilename); updateRecentFilesMenu(); - assert(emuInstance->nds != nullptr); - emuInstance->nds->Start(); - emuThread->emuRun(); - updateCartInserted(false); } else if (isGbaRom) { - if (!emuInstance->loadGBAROM(file)) + if (!emuThread->insertCart(file, true)) { - emuThread->emuUnpause(); return; } - emuThread->emuUnpause(); - updateCartInserted(true); } else { QMessageBox::critical(this, "melonDS", "The file could not be recognized as a DS or GBA ROM."); - emuThread->emuUnpause(); return; } }