System: Use existing media if save state media is not found
This commit is contained in:
parent
eaafd0a00c
commit
b695d3c6ce
|
@ -980,16 +980,33 @@ bool DoLoadState(ByteStream* state, bool force_software_renderer, bool update_di
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
media = g_cdrom.RemoveMedia();
|
std::unique_ptr<CDImage> old_media = g_cdrom.RemoveMedia();
|
||||||
if (!media || media->GetFileName() != media_filename)
|
if (old_media && old_media->GetFileName() == media_filename)
|
||||||
|
{
|
||||||
|
Log_InfoPrintf("Re-using same media '%s'", media_filename.c_str());
|
||||||
|
media = std::move(old_media);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
media = OpenCDImage(media_filename.c_str(), false);
|
media = OpenCDImage(media_filename.c_str(), false);
|
||||||
if (!media)
|
if (!media)
|
||||||
{
|
{
|
||||||
g_host_interface->ReportFormattedError(
|
if (old_media)
|
||||||
g_host_interface->TranslateString("System", "Failed to open CD image from save state: '%s'."),
|
{
|
||||||
media_filename.c_str());
|
g_host_interface->AddFormattedOSDMessage(
|
||||||
return false;
|
30.0f,
|
||||||
|
g_host_interface->TranslateString("OSDMessage", "Failed to open CD image from save state: '%s'. Using "
|
||||||
|
"existing image '%s', this may result in instability."),
|
||||||
|
media_filename.c_str(), old_media->GetFileName().c_str());
|
||||||
|
media = std::move(old_media);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_host_interface->ReportFormattedError(
|
||||||
|
g_host_interface->TranslateString("System", "Failed to open CD image from save state: '%s'."),
|
||||||
|
media_filename.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue