Handle missing cases of Emu.BootGame failure

This commit is contained in:
Megamouse 2021-01-28 19:56:22 +01:00
parent 6784301376
commit 3359458175
2 changed files with 27 additions and 5 deletions

View File

@ -493,13 +493,15 @@ int main(int argc, char** argv)
return 0;
}
const bool has_no_gui = parser.isSet(arg_no_gui);
if (auto gui_app = qobject_cast<gui_application*>(app.data()))
{
gui_app->setAttribute(Qt::AA_UseHighDpiPixmaps);
gui_app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
gui_app->setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
gui_app->SetShowGui(!parser.isSet(arg_no_gui));
gui_app->SetShowGui(!has_no_gui);
gui_app->SetUseCliStyle(use_cli_style);
gui_app->Init();
}
@ -508,6 +510,11 @@ int main(int argc, char** argv)
s_headless = true;
headless_app->Init();
}
else
{
// Should be unreachable
report_fatal_error("RPCS3 initialization failed!");
}
#ifdef _WIN32
// Set 0.5 msec timer resolution for best performance
@ -560,11 +567,20 @@ int main(int argc, char** argv)
}
// Ugly workaround
QTimer::singleShot(2, [config_override_path, path = sstr(QFileInfo(args.at(0)).absoluteFilePath()), argv = std::move(argv)]() mutable
QTimer::singleShot(2, [config_override_path, has_no_gui, path = sstr(QFileInfo(args.at(0)).absoluteFilePath()), argv = std::move(argv)]() mutable
{
Emu.argv = std::move(argv);
Emu.SetForceBoot(true);
Emu.BootGame(path, "", true);
if (const game_boot_result error = Emu.BootGame(path, "", true); error != game_boot_result::no_errors)
{
sys_log.error("Booting '%s' with cli argument failed: reason: %s", path, error);
if (s_headless || has_no_gui)
{
report_fatal_error(fmt::format("Booting '%s' failed!\n\nReason: %s", path, error));
}
}
});
}

View File

@ -1259,7 +1259,6 @@ void main_window::OnEmuStop()
{
const QString title = GetCurrentTitle();
const QString play_tooltip = Emu.IsReady() ? tr("Play %0").arg(title) : tr("Resume %0").arg(title);
const QString restart_tooltip = tr("Restart %0").arg(title);
m_debugger_frame->UpdateUI();
@ -1280,6 +1279,8 @@ void main_window::OnEmuStop()
}
else
{
const QString restart_tooltip = tr("Restart %0").arg(title);
ui->toolbar_start->setEnabled(true);
ui->toolbar_start->setIcon(m_icon_restart);
ui->toolbar_start->setText(tr("Restart"));
@ -2339,7 +2340,12 @@ void main_window::CreateFirmwareCache()
}
Emu.SetForceBoot(true);
Emu.BootGame(g_cfg.vfs.get_dev_flash() + "sys/external/", "", true);
if (const game_boot_result error = Emu.BootGame(g_cfg.vfs.get_dev_flash() + "sys/external/", "", true);
error != game_boot_result::no_errors)
{
gui_log.error("Creating firmware cache failed: reason: %s", error);
}
}
void main_window::keyPressEvent(QKeyEvent *keyEvent)