From d17f0a3923eda4b9aca4024c3a3ca5332e31dab8 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 16 Feb 2020 00:14:33 +0900 Subject: [PATCH] Qt: Implement disc change in QtHostInterface --- src/duckstation-qt/qthostinterface.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index 8200313ea..5ae49e791 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -527,7 +527,19 @@ void QtHostInterface::pauseSystem(bool paused) emit emulationPaused(paused); } -void QtHostInterface::changeDisc(const QString& new_disc_filename) {} +void QtHostInterface::changeDisc(const QString& new_disc_filename) +{ + if (!isOnWorkerThread()) + { + QMetaObject::invokeMethod(this, "changeDisc", Qt::QueuedConnection, Q_ARG(const QString&, new_disc_filename)); + return; + } + + if (!m_system) + return; + + m_system->InsertMedia(new_disc_filename.toStdString().c_str()); +} void QtHostInterface::populateSaveStateMenus(const char* game_code, QMenu* load_menu, QMenu* save_menu) {