From e30c0a6881ed1d8abdab9bd1bed5d311899df159 Mon Sep 17 00:00:00 2001
From: Connor McLaughlin <stenzek@gmail.com>
Date: Fri, 24 Jul 2020 02:37:09 +1000
Subject: [PATCH] Qt: Don't allow booting when changing disc from game list

---
 src/duckstation-qt/mainwindow.cpp | 47 +++++++++++++++++++------------
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp
index 040e69fa6..704db0569 100644
--- a/src/duckstation-qt/mainwindow.cpp
+++ b/src/duckstation-qt/mainwindow.cpp
@@ -373,26 +373,37 @@ void MainWindow::onGameListContextMenuRequested(const QPoint& point, const GameL
 
     menu.addSeparator();
 
-    if (!entry->code.empty())
+    if (!m_emulation_running)
     {
-      m_host_interface->populateGameListContextMenu(entry->code.c_str(), this, &menu);
-      menu.addSeparator();
+      if (!entry->code.empty())
+      {
+        m_host_interface->populateGameListContextMenu(entry->code.c_str(), this, &menu);
+        menu.addSeparator();
+      }
+
+      connect(menu.addAction(tr("Default Boot")), &QAction::triggered,
+              [this, entry]() { m_host_interface->bootSystem(SystemBootParameters(entry->path)); });
+
+      connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
+        SystemBootParameters boot_params(entry->path);
+        boot_params.override_fast_boot = true;
+        m_host_interface->bootSystem(boot_params);
+      });
+
+      connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [this, entry]() {
+        SystemBootParameters boot_params(entry->path);
+        boot_params.override_fast_boot = false;
+        m_host_interface->bootSystem(boot_params);
+      });
+    }
+    else
+    {
+      connect(menu.addAction(tr("Change Disc")), &QAction::triggered, [this, entry]() {
+        m_host_interface->changeDisc(QString::fromStdString(entry->path));
+        m_host_interface->pauseSystem(false);
+        switchToEmulationView();
+      });
     }
-
-    connect(menu.addAction(tr("Default Boot")), &QAction::triggered,
-            [this, entry]() { m_host_interface->bootSystem(SystemBootParameters(entry->path)); });
-
-    connect(menu.addAction(tr("Fast Boot")), &QAction::triggered, [this, entry]() {
-      SystemBootParameters boot_params(entry->path);
-      boot_params.override_fast_boot = true;
-      m_host_interface->bootSystem(boot_params);
-    });
-
-    connect(menu.addAction(tr("Full Boot")), &QAction::triggered, [this, entry]() {
-      SystemBootParameters boot_params(entry->path);
-      boot_params.override_fast_boot = false;
-      m_host_interface->bootSystem(boot_params);
-    });
 
     menu.addSeparator();
   }