From fe1a5829094e859851e9f925f92804df7faf6419 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 22 Apr 2021 13:39:38 +1000 Subject: [PATCH] System: Disallow booting when SBI files are missing --- src/core/system.cpp | 28 +++++++++++++------ src/duckstation-qt/advancedsettingswidget.cpp | 4 +++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index f32cb9e2a..c34b077e4 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1935,15 +1935,27 @@ bool CheckForSBIFile(CDImage* image) Log_WarningPrintf("SBI file missing but required for %s (%s)", s_running_game_code.c_str(), s_running_game_title.c_str()); - return g_host_interface->ConfirmMessage( - StringUtil::StdStringFromFormat( + if (g_host_interface->GetBoolSettingValue("CDROM", "AllowBootingWithoutSBIFile", false)) + { + return g_host_interface->ConfirmMessage( + StringUtil::StdStringFromFormat( + g_host_interface->TranslateString( + "System", + "You are attempting to run a libcrypt protected game without an SBI file:\n\n%s: %s\n\nThe game will " + "likely not run properly.\n\nPlease check the README for instructions on how to add an SBI file.\n\nDo " + "you wish to continue?"), + s_running_game_code.c_str(), s_running_game_title.c_str()) + .c_str()); + } + else + { + g_host_interface->ReportError(SmallString::FromFormat( g_host_interface->TranslateString( - "System", - "You are attempting to run a libcrypt protected game without an SBI file:\n\n%s: %s\n\nThe game will " - "likely not run properly.\n\nPlease check the README for instructions on how to add an SBI file.\n\nDo " - "you wish to continue?"), - s_running_game_code.c_str(), s_running_game_title.c_str()) - .c_str()); + "System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n%s: %s\n\nYour dump is " + "incomplete, you must add the SBI file to run this game."), + s_running_game_code.c_str(), s_running_game_title.c_str())); + return false; + } } bool HasMediaSubImages() diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index 310a9e699..8c73aeba3 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -193,6 +193,9 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main", "IncreaseTimerResolution", true); + addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Allow Booting Without SBI File"), "CDROM", + "AllowBootingWithoutSBIFile", false); + dialog->registerWidgetHelp(m_ui.logLevel, tr("Log Level"), tr("Information"), tr("Sets the verbosity of messages logged. Higher levels will log more messages.")); dialog->registerWidgetHelp(m_ui.logToConsole, tr("Log To System Console"), tr("User Preference"), @@ -231,4 +234,5 @@ void AdvancedSettingsWidget::onResetToDefaultClicked() setIntRangeTweakOption(m_ui.tweakOptionTable, 17, static_cast(Settings::DEFAULT_GPU_MAX_RUN_AHEAD)); setBooleanTweakOption(m_ui.tweakOptionTable, 18, false); setBooleanTweakOption(m_ui.tweakOptionTable, 19, true); + setBooleanTweakOption(m_ui.tweakOptionTable, 20, false); }