diff --git a/src/core/memory_card.cpp b/src/core/memory_card.cpp index faa46e1f8..d47cb259d 100644 --- a/src/core/memory_card.cpp +++ b/src/core/memory_card.cpp @@ -1,7 +1,9 @@ #include "memory_card.h" +#include "IconsFontAwesome5.h" #include "common/byte_stream.h" #include "common/file_system.h" #include "common/log.h" +#include "common/path.h" #include "common/string_util.h" #include "host.h" #include "system.h" @@ -305,13 +307,23 @@ bool MemoryCard::SaveIfChanged(bool display_osd_message) if (m_filename.empty()) return false; + std::string osd_key; + std::string display_name; + if (display_osd_message) + { + osd_key = fmt::format("memory_card_save_{}", m_filename); + display_name = FileSystem::GetDisplayNameFromPath(m_filename); + } + if (!MemoryCardImage::SaveToFile(m_data, m_filename.c_str())) { if (display_osd_message) { - Host::AddFormattedOSDMessage( - 20.0f, Host::TranslateString("OSDMessage", "Failed to save memory card to '%s'"), - m_filename.c_str()); + Host::AddIconOSDMessage( + std::move(osd_key), ICON_FA_SD_CARD, + fmt::format(Host::TranslateString("OSDMessage", "Failed to save memory card to '{}'.").GetCharArray(), + Path::GetFileName(display_name)), + 20.0f); } return false; @@ -319,8 +331,11 @@ bool MemoryCard::SaveIfChanged(bool display_osd_message) if (display_osd_message) { - Host::AddFormattedOSDMessage( - 2.0f, Host::TranslateString("OSDMessage", "Saved memory card to '%s'"), m_filename.c_str()); + Host::AddIconOSDMessage( + std::move(osd_key), ICON_FA_SD_CARD, + fmt::format(Host::TranslateString("OSDMessage", "Saved memory card to '{}'.").GetCharArray(), + Path::GetFileName(display_name)), + 5.0f); } return true; diff --git a/src/core/system.cpp b/src/core/system.cpp index 2fa4eac2b..e038c4c28 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1,4 +1,5 @@ #include "system.h" +#include "IconsFontAwesome5.h" #include "achievements.h" #include "bios.h" #include "bus.h" @@ -953,7 +954,15 @@ bool System::LoadState(const char* filename) return false; Log_InfoPrintf("Loading state from '%s'...", filename); - Host::AddFormattedOSDMessage(5.0f, Host::TranslateString("OSDMessage", "Loading state from '%s'..."), filename); + + { + const std::string display_name(FileSystem::GetDisplayNameFromPath(filename)); + Host::AddIconOSDMessage( + "load_state", ICON_FA_FOLDER_OPEN, + fmt::format(Host::TranslateString("OSDMessage", "Loading state from '{}'...").GetCharArray(), + Path::GetFileName(display_name)), + 5.0f); + } SaveUndoLoadState();