From 7ad669a9115dfaf3271487269d8d8bcdf2c51e03 Mon Sep 17 00:00:00 2001
From: LittleWhite
Date: Thu, 7 Jan 2016 18:36:10 +0100
Subject: Display errors in GUI when loading ROM failed
---
src/citra_qt/main.cpp | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index da9ea6c91..d2ba3f9db 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -259,9 +259,34 @@ void GMainWindow::BootGame(const std::string& filename) {
System::Init(render_window);
// Load the game
- if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
+ Loader::ResultStatus result = Loader::LoadFile(filename);
+ if (Loader::ResultStatus::Success != result) {
LOG_CRITICAL(Frontend, "Failed to load ROM!");
System::Shutdown();
+
+ switch (result) {
+ case Loader::ResultStatus::ErrorEncrypted: {
+ // Build the MessageBox ourselves to have clickable link
+ QMessageBox popup_error;
+ popup_error.setTextFormat(Qt::RichText);
+ popup_error.setWindowTitle(tr("Error while loading ROM !"));
+ popup_error.setText(tr("The ROM is probably encrypted !
"
+ "Please check: https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges"));
+ popup_error.setIcon(QMessageBox::Critical);
+ popup_error.exec();
+ break;
+ }
+ case Loader::ResultStatus::ErrorInvalidFormat:
+ QMessageBox::critical(this, tr("Error while loading ROM !"),
+ tr("The ROM format is not supported."));
+ break;
+ case Loader::ResultStatus::Error:
+
+ default:
+ QMessageBox::critical(this, tr("Error while loading ROM !"),
+ tr("Unknown error !"));
+ break;
+ }
return;
}
--
cgit v1.2.3
From 4be68dddfbdc7065139351e6e39b5fa97844264a Mon Sep 17 00:00:00 2001
From: LittleWhite
Date: Thu, 7 Jan 2016 20:33:54 +0100
Subject: Improve error report from Init() functions Add error popup when citra
initialization failed
---
src/citra_qt/main.cpp | 50 ++++++++++++++++++++++++++++++++++++++------------
1 file changed, 38 insertions(+), 12 deletions(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index d2ba3f9db..21f4e3a80 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -248,17 +248,32 @@ void GMainWindow::OnDisplayTitleBars(bool show)
}
}
-void GMainWindow::BootGame(const std::string& filename) {
- LOG_INFO(Frontend, "Citra starting...");
-
+bool GMainWindow::InitializeSystem() {
// Shutdown previous session if the emu thread is still active...
if (emu_thread != nullptr)
ShutdownGame();
// Initialize the core emulation
- System::Init(render_window);
+ System::Result system_result = System::Init(render_window);
+ if (System::Result::Success != system_result) {
+ switch (system_result) {
+ case System::Result::ErrorInitVideoCore:
+ QMessageBox::critical(this, tr("Error while starting Citra!"),
+ tr("Failed to initialize the video core!\n\n"
+ "Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver."));
+ break;
+
+ default:
+ QMessageBox::critical(this, tr("Error while starting Citra!"),
+ tr("Unknown error (please check the log)!"));
+ break;
+ }
+ return false;
+ }
+ return true;
+}
- // Load the game
+bool GMainWindow::LoadROM(const std::string& filename) {
Loader::ResultStatus result = Loader::LoadFile(filename);
if (Loader::ResultStatus::Success != result) {
LOG_CRITICAL(Frontend, "Failed to load ROM!");
@@ -269,26 +284,37 @@ void GMainWindow::BootGame(const std::string& filename) {
// Build the MessageBox ourselves to have clickable link
QMessageBox popup_error;
popup_error.setTextFormat(Qt::RichText);
- popup_error.setWindowTitle(tr("Error while loading ROM !"));
- popup_error.setText(tr("The ROM is probably encrypted !
"
- "Please check: https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges"));
+ popup_error.setWindowTitle(tr("Error while loading ROM!"));
+ popup_error.setText(tr("The game that you are trying to load must be decrypted before being used with Citra.
"
+ "For more information on dumping and decrypting games, please see: https://citra-emu.org/wiki/Dumping-Game-Cartridges"));
popup_error.setIcon(QMessageBox::Critical);
popup_error.exec();
break;
}
case Loader::ResultStatus::ErrorInvalidFormat:
- QMessageBox::critical(this, tr("Error while loading ROM !"),
+ QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM format is not supported."));
break;
case Loader::ResultStatus::Error:
default:
- QMessageBox::critical(this, tr("Error while loading ROM !"),
- tr("Unknown error !"));
+ QMessageBox::critical(this, tr("Error while loading ROM!"),
+ tr("Unknown error!"));
break;
}
- return;
+ return false;
}
+ return true;
+}
+
+void GMainWindow::BootGame(const std::string& filename) {
+ LOG_INFO(Frontend, "Citra starting...");
+
+ if (!InitializeSystem())
+ return;
+
+ if (!LoadROM(filename))
+ return;
// Create and start the emulation thread
emu_thread = Common::make_unique(render_window);
--
cgit v1.2.3