CDROM: Display OSD message on backend read fail

This commit is contained in:
Stenzek 2025-05-16 19:06:51 +10:00
parent 7310aa509a
commit 4ea90f948d
No known key found for this signature in database

View File

@ -27,6 +27,7 @@
#include "common/log.h" #include "common/log.h"
#include "common/xorshift_prng.h" #include "common/xorshift_prng.h"
#include "IconsEmoji.h"
#include "fmt/format.h" #include "fmt/format.h"
#include "imgui.h" #include "imgui.h"
@ -3259,8 +3260,13 @@ void CDROM::StopMotor()
void CDROM::DoSectorRead() void CDROM::DoSectorRead()
{ {
// TODO: Queue the next read here and swap the buffer. // TODO: Queue the next read here and swap the buffer.
if (!s_reader.WaitForReadToComplete()) if (!s_reader.WaitForReadToComplete()) [[unlikely]]
{ {
Host::AddIconOSDWarning(
"DiscReadError", ICON_EMOJI_WARNING,
TRANSLATE_STR("OSDMessage", "Failed to read sector from disc image. The game will probably crash now.\nYour "
"dump may be corrupted, or the physical disc is scratched."),
Host::OSD_CRITICAL_ERROR_DURATION);
StopReadingWithError(); StopReadingWithError();
return; return;
} }