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
From 37bec598ea28662462dcaab65d5abd6db8372dbc Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Wed, 8 Mar 2017 20:21:31 -0500
Subject: Made some changes from review comments: - Made LoadKernelSystemMode
return a pair consisting of a system mode and a result code (Could use
review). - Deleted ErrorOpenGL error code in favor of just having
ErrorVideoCore. - Made dialog messages more clear. - Compared archive ID in
fs_user.cpp to ArchiveIdCode::NCCH as opposed to hex magic. - Cleaned up some
other stuff.
---
src/citra_qt/main.cpp | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 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 e24c48e90..cc38cfc0e 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -300,7 +300,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
render_window->MakeCurrent();
if (!gladLoadGL()) {
- QMessageBox::critical(this, tr("Error while starting Citra!"),
+ QMessageBox::critical(this, tr("Error while initializing OpenGL 3.3 Core!"),
tr("Your GPU may not support OpenGL 3.3, or you do not"
"have the latest graphics driver."));
return false;
@@ -329,7 +329,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
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.
"
+ "Citra. A real 3DS is required.
"
"For more information on dumping and decrypting games, please see the following "
"wiki pages: "
"- Dumping Game "
@@ -344,10 +344,17 @@ 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."));
+ case Core::System::ResultStatus::ErrorVideoCore:
+ QMessageBox::critical(
+ this, tr("An error occured in the video core."),
+ tr("Citra has encountered an error while running the video core, please see the "
+ "log for more details."
+ "For more information on accessing the log, please see the following page: "
+ "How "
+ "to "
+ "Upload the Log File."
+ "Ensure that you have the latest graphics drivers for your GPU."));
+
break;
default:
@@ -632,9 +639,6 @@ void GMainWindow::UpdateStatusBar() {
}
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(
@@ -664,13 +668,13 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result) {
".");
break;
- case Core::System::ResultStatus::ErrorUnknown:
+ default:
QMessageBox::critical(
this, "Fatal Error",
- "Citra has encountered a fatal error, please see the log for more details.");
- break;
-
- default:
+ "Citra has encountered a fatal error, please see the log for more details. "
+ "For more information on accessing the log, please see the following page: "
+ "How to "
+ "Upload the Log File.");
break;
}
}
@@ -679,9 +683,10 @@ bool GMainWindow::ConfirmClose() {
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
return true;
- return QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No) != QMessageBox::No;
+ 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;
}
void GMainWindow::closeEvent(QCloseEvent* event) {
--
cgit v1.2.3
From b6bab59000cbcdb34aed3f8633c5aae391db6dcb Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Thu, 13 Apr 2017 01:10:19 -0400
Subject: Added message to status bar to show core errors ignored by the user.
---
src/citra_qt/main.cpp | 11 ++++++++++-
1 file changed, 10 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 cc38cfc0e..6121d4728 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -93,6 +93,14 @@ void GMainWindow::InitializeWidgets() {
ui.horizontalLayout->addWidget(game_list);
// Create status bar
+ message_label = new QLabel();
+ // Configured separately for left alignment
+ message_label->setVisible(false);
+ message_label->setFrameStyle(QFrame::NoFrame);
+ message_label->setContentsMargins(4, 0, 4, 0);
+ message_label->setAlignment(Qt::AlignLeft);
+ statusBar()->addPermanentWidget(message_label, 1);
+
emu_speed_label = new QLabel();
emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% "
"indicate emulation is running faster or slower than a 3DS."));
@@ -108,7 +116,7 @@ void GMainWindow::InitializeWidgets() {
label->setVisible(false);
label->setFrameStyle(QFrame::NoFrame);
label->setContentsMargins(4, 0, 4, 0);
- statusBar()->addPermanentWidget(label);
+ statusBar()->addPermanentWidget(label, 0);
}
statusBar()->setVisible(true);
setStyleSheet("QStatusBar::item{border: none;}");
@@ -437,6 +445,7 @@ void GMainWindow::ShutdownGame() {
// Disable status bar updates
status_bar_update_timer.stop();
+ message_label->setVisible(false);
emu_speed_label->setVisible(false);
game_fps_label->setVisible(false);
emu_frametime_label->setVisible(false);
--
cgit v1.2.3
From 0409bdfea5ea046e3d040ab494b8a0764fd35424 Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Thu, 13 Apr 2017 01:15:23 -0400
Subject: Optimized messages that were repetitive and added ability for core
errors to specify more details optionally.
---
src/citra_qt/main.cpp | 86 +++++++++++++++++++++++++++++++--------------------
1 file changed, 52 insertions(+), 34 deletions(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 6121d4728..1688e55cd 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -553,8 +553,10 @@ 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)));
+ qRegisterMetaType>("boost::optional");
+ connect(emu_thread.get(),
+ SIGNAL(ErrorThrown(Core::System::ResultStatus, boost::optional)), this,
+ SLOT(OnCoreError(Core::System::ResultStatus, boost::optional)));
ui.action_Start->setEnabled(false);
ui.action_Start->setText(tr("Continue"));
@@ -647,52 +649,68 @@ void GMainWindow::UpdateStatusBar() {
emu_frametime_label->setVisible(true);
}
-void GMainWindow::OnCoreError(Core::System::ResultStatus result) {
+void GMainWindow::OnCoreError(Core::System::ResultStatus result,
+ boost::optional details) {
+ QMessageBox::StandardButton answer;
+ QString status_message;
+ const QString common_message =
+ tr("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.
Would you like to quit "
+ "back to the game list?");
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"
- ".");
+ case Core::System::ResultStatus::ErrorSystemFiles: {
+ QString message = "Citra was unable to locate a 3DS system archive";
+ if (details)
+ message.append(tr(": %1. ").arg(details.get().c_str()));
+ else
+ message.append(". ");
+ message.append(common_message);
+
+ answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+ status_message = "System Archive Missing";
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"
- ".");
+ case Core::System::ResultStatus::ErrorSharedFont: {
+ QString message = tr("Citra was unable to locate the 3DS shared fonts. ");
+ message.append(common_message);
+ answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message,
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+ status_message = "Shared Font Missing";
break;
+ }
default:
- QMessageBox::critical(
- this, "Fatal Error",
- "Citra has encountered a fatal error, please see the log for more details. "
- "For more information on accessing the log, please see the following page: "
- "How to "
- "Upload the Log File.");
+ answer = QMessageBox::question(
+ this, tr("Fatal Error"),
+ tr("Citra has encountered a fatal error, please see the log for more details. "
+ "For more information on accessing the log, please see the following page: "
+ "How to "
+ "Upload the Log File.
Would you like to quit back to the game list?"),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+ status_message = "Fatal Error encountered.";
break;
}
+
+ if (answer == QMessageBox::Yes) {
+ if (emu_thread != nullptr)
+ ShutdownGame();
+ } else {
+ message_label->setText(status_message);
+ message_label->setVisible(true);
+ }
}
bool GMainWindow::ConfirmClose() {
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
return true;
- auto answer =
+ QMessageBox::StandardButton 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;
--
cgit v1.2.3
From a8aef599e02e336f9ecb8d5cfc50aa856ea0a1c7 Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Thu, 13 Apr 2017 01:18:54 -0400
Subject: Created a whitelist of system archives to prevent false positives
creating dialogs.
---
src/citra_qt/main.cpp | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 1688e55cd..e3b296188 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -553,10 +553,9 @@ void GMainWindow::OnMenuRecentFile() {
void GMainWindow::OnStartGame() {
emu_thread->SetRunning(true);
qRegisterMetaType("Core::System::ResultStatus");
- qRegisterMetaType>("boost::optional");
- connect(emu_thread.get(),
- SIGNAL(ErrorThrown(Core::System::ResultStatus, boost::optional)), this,
- SLOT(OnCoreError(Core::System::ResultStatus, boost::optional)));
+ qRegisterMetaType("std::string");
+ connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus, std::string)), this,
+ SLOT(OnCoreError(Core::System::ResultStatus, std::string)));
ui.action_Start->setEnabled(false);
ui.action_Start->setText(tr("Continue"));
@@ -649,8 +648,7 @@ void GMainWindow::UpdateStatusBar() {
emu_frametime_label->setVisible(true);
}
-void GMainWindow::OnCoreError(Core::System::ResultStatus result,
- boost::optional details) {
+void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
QMessageBox::StandardButton answer;
QString status_message;
const QString common_message =
@@ -664,8 +662,8 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result,
switch (result) {
case Core::System::ResultStatus::ErrorSystemFiles: {
QString message = "Citra was unable to locate a 3DS system archive";
- if (details)
- message.append(tr(": %1. ").arg(details.get().c_str()));
+ if (details != std::string())
+ message.append(tr(": %1. ").arg(details.c_str()));
else
message.append(". ");
message.append(common_message);
@@ -693,7 +691,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result,
"How to "
"Upload the Log File.
Would you like to quit back to the game list?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
- status_message = "Fatal Error encountered.";
+ status_message = "Fatal Error encountered";
break;
}
--
cgit v1.2.3
From ff04320c9716b78b7a6047e3c699a0ea4c5431b3 Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Thu, 25 May 2017 16:49:46 -0400
Subject: Fixed wiki URLs.
---
src/citra_qt/main.cpp | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index e3b296188..c899e075f 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -340,9 +340,9 @@ bool GMainWindow::LoadROM(const QString& filename) {
"Citra. A real 3DS is required.
"
"For more information on dumping and decrypting games, please see the following "
"wiki pages: "));
break;
@@ -355,7 +355,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
case Core::System::ResultStatus::ErrorVideoCore:
QMessageBox::critical(
this, tr("An error occured in the video core."),
- tr("Citra has encountered an error while running the video core, please see the "
+ tr("Citra has encountered an error while running the video core, please see the "
"log for more details."
"For more information on accessing the log, please see the following page: "
"How "
@@ -656,9 +656,10 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
"before playing.
For more information on dumping these files, please see the "
"following wiki page: Dumping System "
+ "dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>Dumping System "
"Archives and the Shared Fonts from a 3DS Console.
Would you like to quit "
- "back to the game list?");
+ "back to the game list? Continuing emulation may result in crashes, corrupted save "
+ "data, or other bugs.");
switch (result) {
case Core::System::ResultStatus::ErrorSystemFiles: {
QString message = "Citra was unable to locate a 3DS system archive";
@@ -689,7 +690,8 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
tr("Citra has encountered a fatal error, please see the log for more details. "
"For more information on accessing the log, please see the following page: "
"How to "
- "Upload the Log File.
Would you like to quit back to the game list?"),
+ "Upload the Log File.
Would you like to quit back to the game list? "
+ "Continuing emulation may result in crashes, corrupted save data, or other bugs."),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
status_message = "Fatal Error encountered";
break;
--
cgit v1.2.3
From f008b22e3b2baa7720ea65c320fe49929a53bad7 Mon Sep 17 00:00:00 2001
From: TheKoopaKingdom
Date: Fri, 2 Jun 2017 17:03:38 -0400
Subject: Addressed Bunnei's review comments, and made some other tweaks: -
Deleted GetStatus() because it wasn't used anywhere outside of Core::System.
- Fixed design flaw where the message bar status could be set despite the
game being stopped.
---
src/citra_qt/main.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
(limited to 'src/citra_qt/main.cpp')
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index c899e075f..4f5b2ddab 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -663,10 +663,11 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
switch (result) {
case Core::System::ResultStatus::ErrorSystemFiles: {
QString message = "Citra was unable to locate a 3DS system archive";
- if (details != std::string())
+ if (!details.empty()) {
message.append(tr(": %1. ").arg(details.c_str()));
- else
+ } else {
message.append(". ");
+ }
message.append(common_message);
answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
@@ -698,11 +699,15 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
}
if (answer == QMessageBox::Yes) {
- if (emu_thread != nullptr)
+ if (emu_thread) {
ShutdownGame();
+ }
} else {
- message_label->setText(status_message);
- message_label->setVisible(true);
+ // Only show the message if the game is still running.
+ if (emu_thread) {
+ message_label->setText(status_message);
+ message_label->setVisible(true);
+ }
}
}
--
cgit v1.2.3