mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 23:25:41 +00:00
System: Remove memory card warnings on config change
This commit is contained in:
parent
b483931444
commit
2915d4ce01
|
@ -2979,21 +2979,25 @@ std::unique_ptr<MemoryCard> System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp
|
||||||
if (is_running_psf)
|
if (is_running_psf)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
std::string message_key = fmt::format("MemoryCard{}SharedWarning", slot);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case MemoryCardType::PerGame:
|
case MemoryCardType::PerGame:
|
||||||
{
|
{
|
||||||
if (s_running_game_serial.empty())
|
if (s_running_game_serial.empty())
|
||||||
{
|
{
|
||||||
Host::AddFormattedOSDMessage(5.0f,
|
Host::AddIconOSDMessage(
|
||||||
TRANSLATE("System",
|
std::move(message_key), ICON_FA_SD_CARD,
|
||||||
"Per-game memory card cannot be used for slot %u as the running "
|
fmt::format(TRANSLATE_FS("System", "Per-game memory card cannot be used for slot {} as the running "
|
||||||
"game has no code. Using shared card instead."),
|
"game has no code. Using shared card instead."),
|
||||||
slot + 1u);
|
slot + 1u),
|
||||||
|
Host::OSD_INFO_DURATION);
|
||||||
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Host::RemoveKeyedOSDMessage(std::move(message_key));
|
||||||
return MemoryCard::Open(g_settings.GetGameMemoryCardPath(s_running_game_serial.c_str(), slot));
|
return MemoryCard::Open(g_settings.GetGameMemoryCardPath(s_running_game_serial.c_str(), slot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3002,11 +3006,12 @@ std::unique_ptr<MemoryCard> System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp
|
||||||
{
|
{
|
||||||
if (s_running_game_title.empty())
|
if (s_running_game_title.empty())
|
||||||
{
|
{
|
||||||
Host::AddFormattedOSDMessage(5.0f,
|
Host::AddIconOSDMessage(
|
||||||
TRANSLATE("System",
|
std::move(message_key), ICON_FA_SD_CARD,
|
||||||
"Per-game memory card cannot be used for slot %u as the running "
|
fmt::format(TRANSLATE_FS("System", "Per-game memory card cannot be used for slot {} as the running "
|
||||||
"game has no title. Using shared card instead."),
|
"game has no title. Using shared card instead."),
|
||||||
slot + 1u);
|
slot + 1u),
|
||||||
|
Host::OSD_INFO_DURATION);
|
||||||
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3049,6 +3054,7 @@ std::unique_ptr<MemoryCard> System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Host::RemoveKeyedOSDMessage(std::move(message_key));
|
||||||
return MemoryCard::Open(card_path.c_str());
|
return MemoryCard::Open(card_path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3059,15 +3065,16 @@ std::unique_ptr<MemoryCard> System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp
|
||||||
const std::string_view file_title(Path::GetFileTitle(display_name));
|
const std::string_view file_title(Path::GetFileTitle(display_name));
|
||||||
if (file_title.empty())
|
if (file_title.empty())
|
||||||
{
|
{
|
||||||
Host::AddFormattedOSDMessage(5.0f,
|
Host::AddIconOSDMessage(
|
||||||
TRANSLATE("System",
|
std::move(message_key), ICON_FA_SD_CARD,
|
||||||
"Per-game memory card cannot be used for slot %u as the running "
|
fmt::format(TRANSLATE_FS("System", "Per-game memory card cannot be used for slot {} as the running "
|
||||||
"game has no path. Using shared card instead."),
|
"game has no path. Using shared card instead."),
|
||||||
slot + 1u);
|
slot + 1u));
|
||||||
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Host::RemoveKeyedOSDMessage(std::move(message_key));
|
||||||
return MemoryCard::Open(
|
return MemoryCard::Open(
|
||||||
g_settings.GetGameMemoryCardPath(MemoryCard::SanitizeGameTitleForFileName(file_title).c_str(), slot));
|
g_settings.GetGameMemoryCardPath(MemoryCard::SanitizeGameTitleForFileName(file_title).c_str(), slot));
|
||||||
}
|
}
|
||||||
|
@ -3075,17 +3082,24 @@ std::unique_ptr<MemoryCard> System::GetMemoryCardForSlot(u32 slot, MemoryCardTyp
|
||||||
|
|
||||||
case MemoryCardType::Shared:
|
case MemoryCardType::Shared:
|
||||||
{
|
{
|
||||||
|
Host::RemoveKeyedOSDMessage(std::move(message_key));
|
||||||
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
return MemoryCard::Open(g_settings.GetSharedMemoryCardPath(slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
case MemoryCardType::NonPersistent:
|
case MemoryCardType::NonPersistent:
|
||||||
|
{
|
||||||
|
Host::RemoveKeyedOSDMessage(std::move(message_key));
|
||||||
return MemoryCard::Create();
|
return MemoryCard::Create();
|
||||||
|
}
|
||||||
|
|
||||||
case MemoryCardType::None:
|
case MemoryCardType::None:
|
||||||
default:
|
default:
|
||||||
|
{
|
||||||
|
Host::RemoveKeyedOSDMessage(std::move(message_key));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void System::UpdateMemoryCardTypes()
|
void System::UpdateMemoryCardTypes()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue