System: Add option to use per-game memory cards with game title as filename

This commit is contained in:
Connor McLaughlin 2020-04-28 01:04:10 +10:00
parent d04b252962
commit e20fd61f0b
3 changed files with 22 additions and 3 deletions

View File

@ -383,9 +383,10 @@ const char* Settings::GetControllerTypeDisplayName(ControllerType type)
return s_controller_display_names[static_cast<int>(type)];
}
static std::array<const char*, 3> s_memory_card_type_names = {{"None", "Shared", "PerGame"}};
static std::array<const char*, 3> s_memory_card_type_display_names = {
{"No Memory Card", "Shared Between All Games", "Separate Card Per Game"}};
static std::array<const char*, 4> s_memory_card_type_names = {{"None", "Shared", "PerGame", "PerGameTitle"}};
static std::array<const char*, 4> s_memory_card_type_display_names = {{"No Memory Card", "Shared Between All Games",
"Separate Card Per Game (Game Code)",
"Seperate Card Per Game (Game Title)"}};
std::optional<MemoryCardType> Settings::ParseMemoryCardTypeName(const char* str)
{

View File

@ -823,6 +823,23 @@ void System::UpdateMemoryCards()
}
break;
case MemoryCardType::PerGameTitle:
{
if (m_running_game_title.empty())
{
m_host_interface->AddFormattedOSDMessage(5.0f,
"Per-game memory card cannot be used for slot %u as the running "
"game has no title. Using shared card instead.",
i + 1u);
card = MemoryCard::Open(this, m_host_interface->GetSharedMemoryCardPath(i));
}
else
{
card = MemoryCard::Open(this, m_host_interface->GetGameMemoryCardPath(m_running_game_title.c_str(), i));
}
}
break;
case MemoryCardType::Shared:
{
if (settings.memory_card_paths[i].empty())

View File

@ -96,6 +96,7 @@ enum class MemoryCardType
None,
Shared,
PerGame,
PerGameTitle,
Count
};