mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-05 06:22:45 +01:00
Display errors in GUI when loading ROM failed
This commit is contained in:
parent
5eeef06c10
commit
7ad669a911
2 changed files with 29 additions and 3 deletions
|
@ -259,9 +259,34 @@ void GMainWindow::BootGame(const std::string& filename) {
|
||||||
System::Init(render_window);
|
System::Init(render_window);
|
||||||
|
|
||||||
// Load the game
|
// Load the game
|
||||||
if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
|
Loader::ResultStatus result = Loader::LoadFile(filename);
|
||||||
|
if (Loader::ResultStatus::Success != result) {
|
||||||
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
||||||
System::Shutdown();
|
System::Shutdown();
|
||||||
|
|
||||||
|
switch (result) {
|
||||||
|
case Loader::ResultStatus::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(tr("The ROM is probably encrypted !<br/><br/>"
|
||||||
|
"Please check: <a href='https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges'>https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges</a>"));
|
||||||
|
popup_error.setIcon(QMessageBox::Critical);
|
||||||
|
popup_error.exec();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Loader::ResultStatus::ErrorInvalidFormat:
|
||||||
|
QMessageBox::critical(this, tr("Error while loading ROM !"),
|
||||||
|
tr("The ROM format is not supported."));
|
||||||
|
break;
|
||||||
|
case Loader::ResultStatus::Error:
|
||||||
|
|
||||||
|
default:
|
||||||
|
QMessageBox::critical(this, tr("Error while loading ROM !"),
|
||||||
|
tr("Unknown error !"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,12 @@ ResultStatus LoadFile(const std::string& filename) {
|
||||||
AppLoader_NCCH app_loader(std::move(file), filename);
|
AppLoader_NCCH app_loader(std::move(file), filename);
|
||||||
|
|
||||||
// Load application and RomFS
|
// Load application and RomFS
|
||||||
if (ResultStatus::Success == app_loader.Load()) {
|
ResultStatus result = app_loader.Load();
|
||||||
|
if (ResultStatus::Success == result) {
|
||||||
Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS);
|
Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS);
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
}
|
}
|
||||||
break;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CIA file format...
|
// CIA file format...
|
||||||
|
|
Loading…
Reference in a new issue