From 931895d9b0aeb295847a2cd9a7c1235c9b660303 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Tue, 5 Feb 2019 21:31:39 +0100 Subject: [PATCH] citra_qt: when opnening a cia file directly, make Citra ask to install it --- src/citra_qt/main.cpp | 16 ++++++++++++++++ src/citra_qt/main.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 5fb010f6d..cd270874a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -801,6 +801,18 @@ bool GMainWindow::LoadROM(const QString& filename) { } void GMainWindow::BootGame(const QString& filename) { + if (filename.endsWith(".cia")) { + const auto answer = QMessageBox::question( + this, tr("CIA must be installed before usage"), + tr("Before using this CIA, you must install it. Do you want to install it now?"), + QMessageBox::Yes | QMessageBox::No); + + if (answer == QMessageBox::Yes) + InstallCIA(QStringList(filename)); + + return; + } + LOG_INFO(Frontend, "Citra starting..."); StoreRecentFile(filename); // Put the filename on top of the list @@ -1075,6 +1087,10 @@ void GMainWindow::OnMenuInstallCIA() { if (filepaths.isEmpty()) return; + InstallCIA(filepaths); +} + +void GMainWindow::InstallCIA(QStringList filepaths) { ui.action_Install_CIA->setEnabled(false); game_list->setDirectoryWatcherEnabled(false); progress_bar->show(); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 720bdedb6..256469215 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -199,6 +199,7 @@ private: void LoadTranslation(); void SetupUIStrings(); void RetranslateStatusBar(); + void InstallCIA(QStringList filepaths); Ui::MainWindow ui;