From 55a1d0437dd2267a4a47ba3f48ef5de30c154492 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 30 Jan 2021 15:30:52 +1000 Subject: [PATCH] System: Display message on media change --- src/core/system.cpp | 12 ++++++++++++ src/core/system.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/core/system.cpp b/src/core/system.cpp index 40716daf1..8221435da 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1769,16 +1769,28 @@ bool HasMedia() return g_cdrom.HasMedia(); } +const std::string& GetMediaFileName() +{ + return g_cdrom.GetMediaFileName(); +} + bool InsertMedia(const char* path) { std::unique_ptr image = OpenCDImage(path, false); if (!image) + { + g_host_interface->AddFormattedOSDMessage( + 10.0f, g_host_interface->TranslateString("OSDMessage", "Failed to open disc image '%s'."), path); return false; + } UpdateRunningGame(path, image.get()); g_cdrom.InsertMedia(std::move(image)); Log_InfoPrintf("Inserted media from %s (%s, %s)", s_running_game_path.c_str(), s_running_game_code.c_str(), s_running_game_title.c_str()); + g_host_interface->AddFormattedOSDMessage(10.0f, + g_host_interface->TranslateString("OSDMessage", "Inserted disc '%s' (%s)."), + s_running_game_title.c_str(), s_running_game_code.c_str()); if (g_settings.HasAnyPerGameMemoryCards()) { diff --git a/src/core/system.h b/src/core/system.h index f9e58ef62..43251da23 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -189,6 +189,7 @@ bool DumpVRAM(const char* filename); bool DumpSPURAM(const char* filename); bool HasMedia(); +const std::string& GetMediaFileName(); bool InsertMedia(const char* path); void RemoveMedia();