From 26cca79582f8f328d1c8e05731f450a712a634d3 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Thu, 19 Sep 2024 12:17:05 +0300 Subject: [PATCH] hot fix : always check if eboot.bin is available in path --- src/main.cpp | 5 +++++ src/qt_gui/main_window.cpp | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index cc64d9f7..cea92be0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,11 @@ int main(int argc, char* argv[]) { fmt::print("Usage: {} \n", argv[0]); return -1; } + // check if eboot file exists + if (!std::filesystem::exists(argv[1])) { + fmt::print("Eboot.bin file not found\n"); + return -1; + } for (int i = 0; i < argc; i++) { std::string curArg = argv[i]; diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index e5b502c5..c8981919 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -509,6 +509,10 @@ void MainWindow::StartGame() { if (gamePath != "") { AddRecentFiles(gamePath); Core::Emulator emulator; + if (!std::filesystem::exists(gamePath.toUtf8().constData())) { + QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Eboot.bin file not found"))); + return; + } emulator.Run(gamePath.toUtf8().constData()); } } @@ -610,6 +614,11 @@ void MainWindow::BootGame() { path = std::filesystem::path(fileNames[0].toStdWString()); #endif Core::Emulator emulator; + if (!std::filesystem::exists(path) { + QMessageBox::critical(nullptr, tr("Run Game"), + QString(tr("Eboot.bin file not found"))); + return; + } emulator.Run(path); } } @@ -915,6 +924,10 @@ void MainWindow::CreateRecentGameActions() { QString gamePath = action->text(); AddRecentFiles(gamePath); // Update the list. Core::Emulator emulator; + if (!std::filesystem::exists(gamePath.toUtf8().constData())) { + QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Eboot.bin file not found"))); + return; + } emulator.Run(gamePath.toUtf8().constData()); }); }