System: Make the SBI check a confirm dialog instead of message

This commit is contained in:
Connor McLaughlin 2021-02-11 02:04:47 +10:00
parent 5f6fce9d98
commit 6ab926ab28
1 changed files with 30 additions and 13 deletions

View File

@ -81,6 +81,7 @@ static void DoMemorySaveStates();
static bool Initialize(bool force_software_renderer); static bool Initialize(bool force_software_renderer);
static void UpdateRunningGame(const char* path, CDImage* image); static void UpdateRunningGame(const char* path, CDImage* image);
static bool CheckForSBIFile(CDImage* image);
static State s_state = State::Shutdown; static State s_state = State::Shutdown;
@ -723,6 +724,13 @@ bool Boot(const SystemBootParameters& params)
// Notify change of disc. // Notify change of disc.
UpdateRunningGame(media ? media->GetFileName().c_str() : params.filename.c_str(), media.get()); UpdateRunningGame(media ? media->GetFileName().c_str() : params.filename.c_str(), media.get());
// Check for SBI.
if (!CheckForSBIFile(media.get()))
{
Shutdown();
return false;
}
// Component setup. // Component setup.
if (!Initialize(params.force_software_renderer)) if (!Initialize(params.force_software_renderer))
{ {
@ -1824,24 +1832,33 @@ void UpdateRunningGame(const char* path, CDImage* image)
g_host_interface->GetGameInfo(path, image, &s_running_game_code, &s_running_game_title); g_host_interface->GetGameInfo(path, image, &s_running_game_code, &s_running_game_title);
} }
if (!s_running_game_code.empty() && LibcryptGameList::IsLibcryptGameCode(s_running_game_code) &&
!image->HasNonStandardSubchannel())
{
Log_WarningPrintf("SBI file missing but required for %s (%s)", s_running_game_code.c_str(),
s_running_game_title.c_str());
g_host_interface->ReportFormattedError(
g_host_interface->TranslateString(
"System", "You are attempting to run a libcrypt protected game without a 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 a SBI file."),
s_running_game_code.c_str(), s_running_game_title.c_str());
}
g_texture_replacements.SetGameID(s_running_game_code); g_texture_replacements.SetGameID(s_running_game_code);
g_host_interface->OnRunningGameChanged(); g_host_interface->OnRunningGameChanged();
} }
bool CheckForSBIFile(CDImage* image)
{
if (s_running_game_code.empty() || !LibcryptGameList::IsLibcryptGameCode(s_running_game_code) || !image ||
image->HasNonStandardSubchannel())
{
return true;
}
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(
g_host_interface->TranslateString(
"System",
"You are attempting to run a libcrypt protected game without a 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 a SBI file.\n\nDo "
"you wish to continue?"),
s_running_game_code.c_str(), s_running_game_title.c_str())
.c_str());
}
bool HasMediaPlaylist() bool HasMediaPlaylist()
{ {
return !s_media_playlist_filename.empty(); return !s_media_playlist_filename.empty();