System: Swap to fmt for media errors

This commit is contained in:
Stenzek 2023-09-17 00:51:28 +10:00
parent 6bfd498e31
commit 6b34c2a66d

View file

@ -2256,19 +2256,20 @@ bool System::LoadStateFromStream(ByteStream* state, bool update_display, bool ig
{ {
if (old_media) if (old_media)
{ {
Host::AddFormattedOSDMessage( Host::AddOSDMessage(
30.0f, fmt::format(TRANSLATE_FS("OSDMessage", "Failed to open CD image from save state '{}': {}.\nUsing "
TRANSLATE("OSDMessage", "Failed to open CD image from save state '%s': %s. Using " "existing image '{}', this may result in instability."),
"existing image '%s', this may result in instability."), media_filename, error.GetDescription(), old_media->GetFileName()),
media_filename.c_str(), error.GetDescription().c_str(), old_media->GetFileName().c_str()); Host::OSD_CRITICAL_ERROR_DURATION);
media = std::move(old_media); media = std::move(old_media);
header.media_subimage_index = media->GetCurrentSubImage(); header.media_subimage_index = media->GetCurrentSubImage();
} }
else else
{ {
Host::ReportFormattedErrorAsync("Error", Host::ReportErrorAsync(
TRANSLATE("System", "Failed to open CD image '%s' used by save state: %s."), TRANSLATE_SV("OSDMessage", "Error"),
media_filename.c_str(), error.GetDescription().c_str()); fmt::format(TRANSLATE_FS("System", "Failed to open CD image '{}' used by save state: {}."),
media_filename, error.GetDescription()));
return false; return false;
} }
} }
@ -2284,9 +2285,11 @@ bool System::LoadStateFromStream(ByteStream* state, bool update_display, bool ig
(media->HasSubImages() && media->GetCurrentSubImage() != header.media_subimage_index && (media->HasSubImages() && media->GetCurrentSubImage() != header.media_subimage_index &&
!media->SwitchSubImage(header.media_subimage_index, &error))) !media->SwitchSubImage(header.media_subimage_index, &error)))
{ {
Host::ReportFormattedErrorAsync( Host::ReportErrorAsync(
"Error", TRANSLATE("System", "Failed to switch to subimage %u in CD image '%s' used by save state: %s."), TRANSLATE_SV("OSDMessage", "Error"),
header.media_subimage_index + 1u, media_filename.c_str(), error.GetDescription().c_str()); fmt::format(
TRANSLATE_FS("System", "Failed to switch to subimage {} in CD image '{}' used by save state: {}."),
header.media_subimage_index + 1u, media_filename, error.GetDescription()));
return false; return false;
} }
else else