summaryrefslogtreecommitdiff
path: root/src/citra_qt/main.cpp
diff options
context:
space:
mode:
authorGravatar TheKoopaKingdom2017-03-08 16:28:30 -0500
committerGravatar TheKoopaKingdom2017-06-02 18:27:56 -0400
commit1ecb322daa0e2521fe0e179e87889db9aaaf63b0 (patch)
tree6f8cc571b41a76c7ab93843472809bfc9121abb7 /src/citra_qt/main.cpp
parentFixed encrypted ROM error messages. (diff)
downloadyuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.gz
yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.xz
yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.zip
Added system for handling core errors in citra-qt.
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r--src/citra_qt/main.cpp86
1 files changed, 69 insertions, 17 deletions
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) {
301 301
302 if (!gladLoadGL()) { 302 if (!gladLoadGL()) {
303 QMessageBox::critical(this, tr("Error while starting Citra!"), 303 QMessageBox::critical(this, tr("Error while starting Citra!"),
304 tr("Failed to initialize the video core!\n\n" 304 tr("Your GPU may not support OpenGL 3.3, or you do not"
305 "Please ensure that your GPU supports OpenGL 3.3 and that you "
306 "have the latest graphics driver.")); 305 "have the latest graphics driver."));
307 return false; 306 return false;
308 } 307 }
@@ -327,18 +326,17 @@ bool GMainWindow::LoadROM(const QString& filename) {
327 break; 326 break;
328 327
329 case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: { 328 case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: {
330 // Build the MessageBox ourselves to have clickable link 329 QMessageBox::critical(
331 QMessageBox popup_error; 330 this, tr("Error while loading ROM!"),
332 popup_error.setTextFormat(Qt::RichText);
333 popup_error.setWindowTitle(tr("Error while loading ROM!"));
334 popup_error.setText(
335 tr("The game that you are trying to load must be decrypted before being used with " 331 tr("The game that you are trying to load must be decrypted before being used with "
336 "Citra.<br/><br/>" 332 "Citra.<br/><br/>"
337 "For more information on dumping and decrypting games, please see: <a " 333 "For more information on dumping and decrypting games, please see the following "
338 "href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://" 334 "wiki pages: <ul>"
339 "citra-emu.org/wiki/Dumping-Game-Cartridges</a>")); 335 "<li><a href='https://citra-emu.org/wiki/Dumping-Game-Cartridges/'>Dumping Game "
340 popup_error.setIcon(QMessageBox::Critical); 336 "Cartridges</a></li>"
341 popup_error.exec(); 337 "<li><a href='https://citra-emu.org/wiki/Dumping-Installed-Titles/'>Dumping "
338 "Installed Titles</a></li>"
339 "</ul>"));
342 break; 340 break;
343 } 341 }
344 case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: 342 case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
@@ -346,8 +344,16 @@ bool GMainWindow::LoadROM(const QString& filename) {
346 tr("The ROM format is not supported.")); 344 tr("The ROM format is not supported."));
347 break; 345 break;
348 346
347 case Core::System::ResultStatus::ErrorOpenGL:
348 QMessageBox::critical(this, tr("Error while loading OpenGL!"),
349 tr("Your GPU may not support OpenGL 3.3, or you do not "
350 "have the latest graphics driver."));
351 break;
352
349 default: 353 default:
350 QMessageBox::critical(this, tr("Error while loading ROM!"), tr("Unknown error!")); 354 QMessageBox::critical(
355 this, tr("Error while loading ROM!"),
356 tr("An unknown error occured. Please see the log for more details."));
351 break; 357 break;
352 } 358 }
353 return false; 359 return false;
@@ -530,6 +536,9 @@ void GMainWindow::OnMenuRecentFile() {
530 536
531void GMainWindow::OnStartGame() { 537void GMainWindow::OnStartGame() {
532 emu_thread->SetRunning(true); 538 emu_thread->SetRunning(true);
539 qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
540 connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus)), this,
541 SLOT(OnCoreError(Core::System::ResultStatus)));
533 542
534 ui.action_Start->setEnabled(false); 543 ui.action_Start->setEnabled(false);
535 ui.action_Start->setText(tr("Continue")); 544 ui.action_Start->setText(tr("Continue"));
@@ -622,14 +631,57 @@ void GMainWindow::UpdateStatusBar() {
622 emu_frametime_label->setVisible(true); 631 emu_frametime_label->setVisible(true);
623} 632}
624 633
634void GMainWindow::OnCoreError(Core::System::ResultStatus result) {
635 // Waiting for the dialog to be closed before shutting down causes a segfault, maybe because of
636 // the profiler
637 ShutdownGame();
638 switch (result) {
639 case Core::System::ResultStatus::ErrorSystemFiles:
640 QMessageBox::critical(
641 this, "System Archive Not Found",
642 "Citra was unable to locate the 3DS system archive.<br/><br/>"
643 "The game you are trying to load requires additional files from your 3DS to be dumped "
644 "before playing.<br/><br/>"
645 "For more information on dumping these files, please see the following wiki page: "
646 "<a "
647 "href='https://citra-emu.org/wiki/"
648 "Dumping-System-Archives-and-the-Shared-Fonts-from-a-3DS-Console/'>Dumping System "
649 "Archives and the Shared Fonts from a 3DS Console</a>"
650 ".");
651 break;
652
653 case Core::System::ResultStatus::ErrorSharedFont:
654 QMessageBox::critical(
655 this, "Shared Fonts Not Found",
656 "Citra was unable to locate the 3DS shared fonts.<br/><br/>"
657 "The game you are trying to load requires additional files from your 3DS to be dumped "
658 "before playing.<br/><br/>"
659 "For more information on dumping these files, please see the following wiki page: "
660 "<a "
661 "href='https://citra-emu.org/wiki/"
662 "Dumping-System-Archives-and-the-Shared-Fonts-from-a-3DS-Console/'>Dumping System "
663 "Archives and the Shared Fonts from a 3DS Console</a>"
664 ".");
665 break;
666
667 case Core::System::ResultStatus::ErrorUnknown:
668 QMessageBox::critical(
669 this, "Fatal Error",
670 "Citra has encountered a fatal error, please see the log for more details.");
671 break;
672
673 default:
674 break;
675 }
676}
677
625bool GMainWindow::ConfirmClose() { 678bool GMainWindow::ConfirmClose() {
626 if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) 679 if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
627 return true; 680 return true;
628 681
629 auto answer = 682 return QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"),
630 QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"), 683 QMessageBox::Yes | QMessageBox::No,
631 QMessageBox::Yes | QMessageBox::No, QMessageBox::No); 684 QMessageBox::No) != QMessageBox::No;
632 return answer != QMessageBox::No;
633} 685}
634 686
635void GMainWindow::closeEvent(QCloseEvent* event) { 687void GMainWindow::closeEvent(QCloseEvent* event) {