1
0
Fork 0

Optimized messages that were repetitive and added ability for core errors to specify more details optionally.

This commit is contained in:
TheKoopaKingdom 2017-04-13 01:15:23 -04:00
parent b6bab59000
commit 0409bdfea5
5 changed files with 71 additions and 40 deletions

View File

@ -39,7 +39,7 @@ void EmuThread::run() {
Core::System::ResultStatus result = Core::System::GetInstance().RunLoop(); Core::System::ResultStatus result = Core::System::GetInstance().RunLoop();
if (result != Core::System::ResultStatus::Success) { if (result != Core::System::ResultStatus::Success) {
emit ErrorThrown(result); emit ErrorThrown(result, Core::System::GetInstance().GetStatusDetails());
} }
was_active = running || exec_step; was_active = running || exec_step;

View File

@ -99,7 +99,7 @@ signals:
*/ */
void DebugModeLeft(); void DebugModeLeft();
void ErrorThrown(Core::System::ResultStatus); void ErrorThrown(Core::System::ResultStatus, boost::optional<std::string>);
}; };
class GRenderWindow : public QWidget, public EmuWindow { class GRenderWindow : public QWidget, public EmuWindow {

View File

@ -553,8 +553,10 @@ void GMainWindow::OnMenuRecentFile() {
void GMainWindow::OnStartGame() { void GMainWindow::OnStartGame() {
emu_thread->SetRunning(true); emu_thread->SetRunning(true);
qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus"); qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus)), this, qRegisterMetaType<boost::optional<std::string>>("boost::optional<std::string>");
SLOT(OnCoreError(Core::System::ResultStatus))); connect(emu_thread.get(),
SIGNAL(ErrorThrown(Core::System::ResultStatus, boost::optional<std::string>)), this,
SLOT(OnCoreError(Core::System::ResultStatus, boost::optional<std::string>)));
ui.action_Start->setEnabled(false); ui.action_Start->setEnabled(false);
ui.action_Start->setText(tr("Continue")); ui.action_Start->setText(tr("Continue"));
@ -647,52 +649,68 @@ void GMainWindow::UpdateStatusBar() {
emu_frametime_label->setVisible(true); emu_frametime_label->setVisible(true);
} }
void GMainWindow::OnCoreError(Core::System::ResultStatus result) { void GMainWindow::OnCoreError(Core::System::ResultStatus result,
boost::optional<std::string> 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.<br/><br/>For more information on dumping these files, please see the "
"following wiki page: <a "
"href='https://citra-emu.org/wiki/"
"Dumping-System-Archives-and-the-Shared-Fonts-from-a-3DS-Console/'>Dumping System "
"Archives and the Shared Fonts from a 3DS Console</a>.<br/><br/>Would you like to quit "
"back to the game list?");
switch (result) { switch (result) {
case Core::System::ResultStatus::ErrorSystemFiles: case Core::System::ResultStatus::ErrorSystemFiles: {
QMessageBox::critical( QString message = "Citra was unable to locate a 3DS system archive";
this, "System Archive Not Found", if (details)
"Citra was unable to locate the 3DS system archive.<br/><br/>" message.append(tr(": %1. ").arg(details.get().c_str()));
"The game you are trying to load requires additional files from your 3DS to be dumped " else
"before playing.<br/><br/>" message.append(". ");
"For more information on dumping these files, please see the following wiki page: " message.append(common_message);
"<a "
"href='https://citra-emu.org/wiki/"
"Dumping-System-Archives-and-the-Shared-Fonts-from-a-3DS-Console/'>Dumping System "
"Archives and the Shared Fonts from a 3DS Console</a>"
".");
break;
case Core::System::ResultStatus::ErrorSharedFont: answer = QMessageBox::question(this, tr("System Archive Not Found"), message,
QMessageBox::critical( QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
this, "Shared Fonts Not Found", status_message = "System Archive Missing";
"Citra was unable to locate the 3DS shared fonts.<br/><br/>"
"The game you are trying to load requires additional files from your 3DS to be dumped "
"before playing.<br/><br/>"
"For more information on dumping these files, please see the following wiki page: "
"<a "
"href='https://citra-emu.org/wiki/"
"Dumping-System-Archives-and-the-Shared-Fonts-from-a-3DS-Console/'>Dumping System "
"Archives and the Shared Fonts from a 3DS Console</a>"
".");
break; break;
}
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: default:
QMessageBox::critical( answer = QMessageBox::question(
this, "Fatal Error", this, tr("Fatal Error"),
"Citra has encountered a fatal error, please see the log for more details. " 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: " "For more information on accessing the log, please see the following page: "
"<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How to " "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How to "
"Upload the Log File</a>."); "Upload the Log File</a>.<br/><br/>Would you like to quit back to the game list?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
status_message = "Fatal Error encountered.";
break; break;
} }
if (answer == QMessageBox::Yes) {
if (emu_thread != nullptr)
ShutdownGame();
} else {
message_label->setText(status_message);
message_label->setVisible(true);
}
} }
bool GMainWindow::ConfirmClose() { bool GMainWindow::ConfirmClose() {
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
return true; return true;
auto answer = QMessageBox::StandardButton answer =
QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"), QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No); QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
return answer != QMessageBox::No; return answer != QMessageBox::No;

View File

@ -125,7 +125,7 @@ private slots:
void OnDisplayTitleBars(bool); void OnDisplayTitleBars(bool);
void ToggleWindowMode(); void ToggleWindowMode();
void OnCreateGraphicsSurfaceViewer(); void OnCreateGraphicsSurfaceViewer();
void OnCoreError(Core::System::ResultStatus); void OnCoreError(Core::System::ResultStatus, boost::optional<std::string>);
private: private:
void UpdateStatusBar(); void UpdateStatusBar();

View File

@ -6,6 +6,9 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/optional.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/memory.h" #include "core/memory.h"
#include "core/perf_stats.h" #include "core/perf_stats.h"
@ -112,8 +115,16 @@ public:
return status; return status;
} }
void SetStatus(ResultStatus newStatus) { void SetStatus(ResultStatus new_status, std::string details = std::string()) {
status = newStatus; status = new_status;
if (details == std::string())
status_details = boost::none;
else
status_details = details;
}
boost::optional<std::string> GetStatusDetails() {
return status_details;
} }
private: private:
@ -141,7 +152,9 @@ private:
std::unique_ptr<Core::TelemetrySession> telemetry_session; std::unique_ptr<Core::TelemetrySession> telemetry_session;
static System s_instance; static System s_instance;
ResultStatus status; ResultStatus status;
boost::optional<std::string> status_details;
}; };
inline ARM_Interface& CPU() { inline ARM_Interface& CPU() {