System: Display message on media change

This commit is contained in:
Connor McLaughlin 2021-01-30 15:30:52 +10:00
parent 98b4101cd7
commit 55a1d0437d
2 changed files with 13 additions and 0 deletions

View File

@ -1769,16 +1769,28 @@ bool HasMedia()
return g_cdrom.HasMedia(); return g_cdrom.HasMedia();
} }
const std::string& GetMediaFileName()
{
return g_cdrom.GetMediaFileName();
}
bool InsertMedia(const char* path) bool InsertMedia(const char* path)
{ {
std::unique_ptr<CDImage> image = OpenCDImage(path, false); std::unique_ptr<CDImage> image = OpenCDImage(path, false);
if (!image) if (!image)
{
g_host_interface->AddFormattedOSDMessage(
10.0f, g_host_interface->TranslateString("OSDMessage", "Failed to open disc image '%s'."), path);
return false; return false;
}
UpdateRunningGame(path, image.get()); UpdateRunningGame(path, image.get());
g_cdrom.InsertMedia(std::move(image)); 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(), 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()); 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()) if (g_settings.HasAnyPerGameMemoryCards())
{ {

View File

@ -189,6 +189,7 @@ bool DumpVRAM(const char* filename);
bool DumpSPURAM(const char* filename); bool DumpSPURAM(const char* filename);
bool HasMedia(); bool HasMedia();
const std::string& GetMediaFileName();
bool InsertMedia(const char* path); bool InsertMedia(const char* path);
void RemoveMedia(); void RemoveMedia();