From 1ecb322daa0e2521fe0e179e87889db9aaaf63b0 Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Wed, 8 Mar 2017 16:28:30 -0500
Subject: Added system for handling core errors in citra-qt.
---
src/citra_qt/main.cpp | 86 +++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 69 insertions(+), 17 deletions(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index eb2c7d613..e24c48e90 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -301,8 +301,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
if (!gladLoadGL()) {
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 "
+ tr("Your GPU may not support OpenGL 3.3, or you do not"
"have the latest graphics driver."));
return false;
}
@@ -327,18 +326,17 @@ bool GMainWindow::LoadROM(const QString& filename) {
break;
case Core::System::ResultStatus::ErrorLoader_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(
+ QMessageBox::critical(
+ this, tr("Error while loading ROM!"),
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();
+ "For more information on dumping and decrypting games, please see the following "
+ "wiki pages:
"));
break;
}
case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
@@ -346,8 +344,16 @@ bool GMainWindow::LoadROM(const QString& filename) {
tr("The ROM format is not supported."));
break;
+ case Core::System::ResultStatus::ErrorOpenGL:
+ QMessageBox::critical(this, tr("Error while loading OpenGL!"),
+ tr("Your GPU may not support OpenGL 3.3, or you do not "
+ "have the latest graphics driver."));
+ break;
+
default:
- QMessageBox::critical(this, tr("Error while loading ROM!"), tr("Unknown error!"));
+ QMessageBox::critical(
+ this, tr("Error while loading ROM!"),
+ tr("An unknown error occured. Please see the log for more details."));
break;
}
return false;
@@ -530,6 +536,9 @@ void GMainWindow::OnMenuRecentFile() {
void GMainWindow::OnStartGame() {
emu_thread->SetRunning(true);
+ qRegisterMetaType("Core::System::ResultStatus");
+ connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus)), this,
+ SLOT(OnCoreError(Core::System::ResultStatus)));
ui.action_Start->setEnabled(false);
ui.action_Start->setText(tr("Continue"));
@@ -622,14 +631,57 @@ void GMainWindow::UpdateStatusBar() {
emu_frametime_label->setVisible(true);
}
+void GMainWindow::OnCoreError(Core::System::ResultStatus result) {
+ // Waiting for the dialog to be closed before shutting down causes a segfault, maybe because of
+ // the profiler
+ ShutdownGame();
+ switch (result) {
+ case Core::System::ResultStatus::ErrorSystemFiles:
+ QMessageBox::critical(
+ this, "System Archive Not Found",
+ "Citra was unable to locate the 3DS system archive.
"
+ "The game you are trying to load requires additional files from your 3DS to be dumped "
+ "before playing.
"
+ "For more information on dumping these files, please see the following wiki page: "
+ "Dumping System "
+ "Archives and the Shared Fonts from a 3DS Console"
+ ".");
+ break;
+
+ case Core::System::ResultStatus::ErrorSharedFont:
+ QMessageBox::critical(
+ this, "Shared Fonts Not Found",
+ "Citra was unable to locate the 3DS shared fonts.
"
+ "The game you are trying to load requires additional files from your 3DS to be dumped "
+ "before playing.
"
+ "For more information on dumping these files, please see the following wiki page: "
+ "Dumping System "
+ "Archives and the Shared Fonts from a 3DS Console"
+ ".");
+ break;
+
+ case Core::System::ResultStatus::ErrorUnknown:
+ QMessageBox::critical(
+ this, "Fatal Error",
+ "Citra has encountered a fatal error, please see the log for more details.");
+ break;
+
+ default:
+ break;
+ }
+}
+
bool GMainWindow::ConfirmClose() {
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
return true;
- auto answer =
- QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- return answer != QMessageBox::No;
+ return QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No) != QMessageBox::No;
}
void GMainWindow::closeEvent(QCloseEvent* event) {
--
cgit v1.2.3