Instead of there being an "Abort/Continue" prompt when a savestate fails to save or load, it just brings up a warning box. (#6236)

* This fixes #6041 by changing OnCoreError. Instead of there being an "Abort/Continue" prompt when a savestate fails to save or load, it just brings up a warning box.

I also changed "Abort/Continue" to "Quit Game/Continue" for better clarity

* Fixed formatting
This commit is contained in:
upadsamay387 2023-01-15 10:15:16 -06:00 committed by GitHub
parent ad2cbe2b26
commit bd1cabce86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 16 deletions

View File

@ -2269,6 +2269,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
QString status_message;
QString title, message;
QMessageBox::Icon error_severity_icon;
if (result == Core::System::ResultStatus::ErrorSystemFiles) {
const QString common_message =
tr("%1 is missing. Please <a "
@ -2284,9 +2285,11 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
title = tr("System Archive Not Found");
status_message = tr("System Archive Missing");
error_severity_icon = QMessageBox::Icon::Critical;
} else if (result == Core::System::ResultStatus::ErrorSavestate) {
title = tr("Save/load Error");
message = QString::fromStdString(details);
error_severity_icon = QMessageBox::Icon::Warning;
} else {
title = tr("Fatal Error");
message =
@ -2295,30 +2298,39 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
"the log</a> for details."
"<br/>Continuing emulation may result in crashes and bugs.");
status_message = tr("Fatal Error encountered");
error_severity_icon = QMessageBox::Icon::Critical;
}
QMessageBox message_box;
message_box.setWindowTitle(title);
message_box.setText(message);
message_box.setIcon(QMessageBox::Icon::Critical);
message_box.addButton(tr("Continue"), QMessageBox::RejectRole);
QPushButton* abort_button = message_box.addButton(tr("Abort"), QMessageBox::AcceptRole);
if (result != Core::System::ResultStatus::ShutdownRequested)
message_box.exec();
message_box.setIcon(error_severity_icon);
if (error_severity_icon == QMessageBox::Icon::Critical) {
message_box.addButton(tr("Continue"), QMessageBox::RejectRole);
QPushButton* abort_button = message_box.addButton(tr("Quit Game"), QMessageBox::AcceptRole);
if (result != Core::System::ResultStatus::ShutdownRequested)
message_box.exec();
if (result == Core::System::ResultStatus::ShutdownRequested ||
message_box.clickedButton() == abort_button) {
if (emu_thread) {
ShutdownGame();
if (result == Core::System::ResultStatus::ShutdownRequested ||
message_box.clickedButton() == abort_button) {
if (emu_thread) {
ShutdownGame();
return;
}
}
} else {
// Only show the message if the game is still running.
if (emu_thread) {
emu_thread->SetRunning(true);
message_label->setText(status_message);
message_label->setVisible(true);
message_label_used_for_movie = false;
}
// This block should run when the error isn't too big of a deal
// e.g. when a save state can't be saved or loaded
message_box.addButton(tr("OK"), QMessageBox::RejectRole);
message_box.exec();
}
// Only show the message if the game is still running.
if (emu_thread) {
emu_thread->SetRunning(true);
message_label->setText(status_message);
message_label->setVisible(true);
message_label_used_for_movie = false;
}
}