System: Don't print whole path in save OSD messages
This commit is contained in:
parent
6bf0ad789e
commit
589785f8a0
|
@ -1,7 +1,9 @@
|
||||||
#include "memory_card.h"
|
#include "memory_card.h"
|
||||||
|
#include "IconsFontAwesome5.h"
|
||||||
#include "common/byte_stream.h"
|
#include "common/byte_stream.h"
|
||||||
#include "common/file_system.h"
|
#include "common/file_system.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
#include "common/path.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
@ -305,13 +307,23 @@ bool MemoryCard::SaveIfChanged(bool display_osd_message)
|
||||||
if (m_filename.empty())
|
if (m_filename.empty())
|
||||||
return false;
|
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 (!MemoryCardImage::SaveToFile(m_data, m_filename.c_str()))
|
||||||
{
|
{
|
||||||
if (display_osd_message)
|
if (display_osd_message)
|
||||||
{
|
{
|
||||||
Host::AddFormattedOSDMessage(
|
Host::AddIconOSDMessage(
|
||||||
20.0f, Host::TranslateString("OSDMessage", "Failed to save memory card to '%s'"),
|
std::move(osd_key), ICON_FA_SD_CARD,
|
||||||
m_filename.c_str());
|
fmt::format(Host::TranslateString("OSDMessage", "Failed to save memory card to '{}'.").GetCharArray(),
|
||||||
|
Path::GetFileName(display_name)),
|
||||||
|
20.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -319,8 +331,11 @@ bool MemoryCard::SaveIfChanged(bool display_osd_message)
|
||||||
|
|
||||||
if (display_osd_message)
|
if (display_osd_message)
|
||||||
{
|
{
|
||||||
Host::AddFormattedOSDMessage(
|
Host::AddIconOSDMessage(
|
||||||
2.0f, Host::TranslateString("OSDMessage", "Saved memory card to '%s'"), m_filename.c_str());
|
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;
|
return true;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#include "IconsFontAwesome5.h"
|
||||||
#include "achievements.h"
|
#include "achievements.h"
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
|
@ -953,7 +954,15 @@ bool System::LoadState(const char* filename)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Log_InfoPrintf("Loading state from '%s'...", filename);
|
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();
|
SaveUndoLoadState();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue