System: Fix double popup on missing SBI file

This commit is contained in:
Stenzek 2024-05-12 17:20:37 +10:00
parent eab4271bf7
commit e7765d26fb
No known key found for this signature in database

View file

@ -131,7 +131,7 @@ static bool FastForwardToFirstFrame();
static bool UpdateGameSettingsLayer(); static bool UpdateGameSettingsLayer();
static void UpdateRunningGame(const char* path, CDImage* image, bool booting); static void UpdateRunningGame(const char* path, CDImage* image, bool booting);
static bool CheckForSBIFile(CDImage* image); static bool CheckForSBIFile(CDImage* image, Error* error);
static std::unique_ptr<MemoryCard> GetMemoryCardForSlot(u32 slot, MemoryCardType type); static std::unique_ptr<MemoryCard> GetMemoryCardForSlot(u32 slot, MemoryCardType type);
static void UpdateSessionTime(const std::string& prev_serial); static void UpdateSessionTime(const std::string& prev_serial);
@ -1421,7 +1421,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
} }
// Check for SBI. // Check for SBI.
if (!CheckForSBIFile(disc.get())) if (!CheckForSBIFile(disc.get(), error))
{ {
s_state = State::Shutdown; s_state = State::Shutdown;
ClearRunningGame(); ClearRunningGame();
@ -3556,7 +3556,7 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting)
Host::OnGameChanged(s_running_game_path, s_running_game_serial, s_running_game_title); Host::OnGameChanged(s_running_game_path, s_running_game_serial, s_running_game_title);
} }
bool System::CheckForSBIFile(CDImage* image) bool System::CheckForSBIFile(CDImage* image, Error* error)
{ {
if (!s_running_game_entry || !s_running_game_entry->HasTrait(GameDatabase::Trait::IsLibCryptProtected) || !image || if (!s_running_game_entry || !s_running_game_entry->HasTrait(GameDatabase::Trait::IsLibCryptProtected) || !image ||
image->HasNonStandardSubchannel()) image->HasNonStandardSubchannel())
@ -3569,31 +3569,30 @@ bool System::CheckForSBIFile(CDImage* image)
if (Host::GetBoolSettingValue("CDROM", "AllowBootingWithoutSBIFile", false)) if (Host::GetBoolSettingValue("CDROM", "AllowBootingWithoutSBIFile", false))
{ {
return Host::ConfirmMessage( if (Host::ConfirmMessage(
"Confirm Unsupported Configuration", "Confirm Unsupported Configuration",
LargeString::from_format( LargeString::from_format(
TRANSLATE_FS("System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n{0}: " TRANSLATE_FS("System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n{0}: "
"{1}\n\nThe game will likely not run properly.\n\nPlease check the README for " "{1}\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?"), "instructions on how to add an SBI file.\n\nDo you wish to continue?"),
s_running_game_serial, s_running_game_title)); s_running_game_serial, s_running_game_title)))
}
else
{ {
return true;
}
}
#ifndef __ANDROID__ #ifndef __ANDROID__
Host::ReportErrorAsync( Error::SetStringFmt(
TRANSLATE("System", "Error"), error,
LargeString::from_format(
TRANSLATE_FS("System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n{0}: " TRANSLATE_FS("System", "You are attempting to run a libcrypt protected game without an SBI file:\n\n{0}: "
"{1}\n\nYour dump is incomplete, you must add the SBI file to run this game. \n\nThe " "{1}\n\nYour dump is incomplete, you must add the SBI file to run this game. \n\nThe "
"name of the SBI file must match the name of the disc image."), "name of the SBI file must match the name of the disc image."),
s_running_game_serial, s_running_game_title)); s_running_game_serial, s_running_game_title);
#else #else
// Shorter because no confirm messages. // Shorter because no confirm messages.
Host::ReportErrorAsync("Missing SBI file.", "The selected game requires a SBI file to run properly."); Error::SetStringView(error, "Missing SBI file.", "The selected game requires a SBI file to run properly.");
#endif #endif
return false; return false;
}
} }
bool System::HasMediaSubImages() bool System::HasMediaSubImages()