From db8e1b0edfee096f9e563d15d2075075b0417ad0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 27 Jul 2020 20:45:47 -0400 Subject: [PATCH] Adds feedback on unidentified ROMs. --- OSBindings/Qt/mainwindow.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 8a85b99dc..2d0882f27 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -715,6 +715,7 @@ void MainWindow::dropEvent(QDropEvent* event) { bool foundROM = false; const auto appDataLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).toStdString(); + QString unusedRoms; for(const auto &url: event->mimeData()->urls()) { const char *const name = url.toLocalFile().toUtf8(); FILE *const file = fopen(name, "rb"); @@ -724,6 +725,7 @@ void MainWindow::dropEvent(QDropEvent* event) { CRC::CRC32 generator; const uint32_t crc = generator.compute_crc(*contents); + bool wasUsed = false; for(const auto &rom: missingRoms) { if(std::find(rom.crc32s.begin(), rom.crc32s.end(), crc) != rom.crc32s.end()) { foundROM = true; @@ -739,10 +741,22 @@ void MainWindow::dropEvent(QDropEvent* event) { FILE *const target = fopen(destination.c_str(), "wb"); fwrite(contents->data(), 1, contents->size(), target); fclose(target); + + wasUsed = true; } } + + if(!wasUsed) { + if(!unusedRoms.isEmpty()) unusedRoms += ", "; + unusedRoms += url.fileName(); + } } + if(!unusedRoms.isEmpty()) { + QMessageBox msgBox; + msgBox.setText("Couldn't identify ROMs: " + unusedRoms); + msgBox.exec(); + } if(foundROM) launchMachine(); } break; }