From 7cf8f6046468ef7e4225a01f54bf6c6850065b9f Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 3 Oct 2020 00:28:57 +1000 Subject: [PATCH] Qt: Fix resume without any state wedging emu --- src/duckstation-qt/qthostinterface.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index bef854d57..c1b610f04 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -361,23 +361,24 @@ void QtHostInterface::resumeSystemFromState(const QString& filename, bool boot_o return; } + std::string state_filename = filename.toStdString(); + if (state_filename.empty()) + { + state_filename = GetMostRecentResumeSaveStatePath(); + if (state_filename.empty()) + { + emit errorReported(tr("No resume save state found.")); + return; + } + } + emit emulationStarting(); - if (filename.isEmpty()) - ResumeSystemFromMostRecentState(); - else - ResumeSystemFromState(filename.toStdString().c_str(), boot_on_failure); + ResumeSystemFromState(state_filename.c_str(), boot_on_failure); } void QtHostInterface::resumeSystemFromMostRecentState() { - if (!isOnWorkerThread()) - { - QMetaObject::invokeMethod(this, "resumeSystemFromMostRecentState"); - return; - } - - emit emulationStarting(); - ResumeSystemFromMostRecentState(); + resumeSystemFromState(QString(), false); } void QtHostInterface::onDisplayWindowKeyEvent(int key, bool pressed)