diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index 1cfaa18071..9da02b248c 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -811,8 +811,7 @@ void MainWindow::onGameListEntryActivated() if (m_vm_valid) { // change disc on double click - g_emu_thread->changeDisc(QString::fromStdString(entry->path)); - switchToEmulationView(); + doDiscChange(QString::fromStdString(entry->path)); return; } @@ -923,6 +922,7 @@ void MainWindow::onChangeDiscFromFileActionTriggered() void MainWindow::onChangeDiscFromGameListActionTriggered() { + m_was_disc_change_request = true; switchToGameListView(); } @@ -1069,6 +1069,7 @@ void MainWindow::onVMStarting() void MainWindow::onVMStarted() { m_vm_valid = true; + m_was_disc_change_request = false; updateEmulationActions(true, true); updateWindowTitle(); updateStatusBarWidgetVisibility(); @@ -1097,6 +1098,7 @@ void MainWindow::onVMResumed() } m_vm_paused = false; + m_was_disc_change_request = false; updateWindowTitle(); updateStatusBarWidgetVisibility(); m_status_fps_widget->setText(m_last_fps_status); @@ -1699,3 +1701,22 @@ void MainWindow::updateSaveStateMenus(const QString& filename, const QString& se if (save_enabled) populateSaveStateMenu(m_ui.menuSaveState, serial, crc); } + +void MainWindow::doDiscChange(const QString& path) +{ + bool reset_system = false; + if (!m_was_disc_change_request) + { + const int choice = QMessageBox::question(this, tr("Confirm Disc Change"), tr("Do you want to swap discs or boot the new image (via system reset)?"), + tr("Swap Disc"), tr("Reset"), tr("Cancel"), 0, 2); + if (choice == 2) + return; + reset_system = (choice != 0); + } + + switchToEmulationView(); + + g_emu_thread->changeDisc(path); + if (reset_system) + g_emu_thread->resetVM(); +} diff --git a/pcsx2-qt/MainWindow.h b/pcsx2-qt/MainWindow.h index b76b216680..8f1646884c 100644 --- a/pcsx2-qt/MainWindow.h +++ b/pcsx2-qt/MainWindow.h @@ -160,6 +160,7 @@ private: void populateLoadStateMenu(QMenu* menu, const QString& filename, const QString& serial, quint32 crc); void populateSaveStateMenu(QMenu* menu, const QString& serial, quint32 crc); void updateSaveStateMenus(const QString& filename, const QString& serial, quint32 crc); + void doDiscChange(const QString& path); Ui::MainWindow m_ui; @@ -184,6 +185,7 @@ private: bool m_vm_paused = false; bool m_save_states_invalidated = false; bool m_was_paused_on_surface_loss = false; + bool m_was_disc_change_request = false; QString m_last_fps_status; };