System: Add non-persistent memory card type

This commit is contained in:
Connor McLaughlin 2021-05-23 17:11:59 +10:00
parent 3dc7ef92c2
commit d9a655fb41
4 changed files with 13 additions and 4 deletions

View file

@ -21,6 +21,7 @@ public:
static std::unique_ptr<MemoryCard> Open(std::string_view filename); static std::unique_ptr<MemoryCard> Open(std::string_view filename);
const MemoryCardImage::DataArray& GetData() const { return m_data; } const MemoryCardImage::DataArray& GetData() const { return m_data; }
MemoryCardImage::DataArray& GetData() { return m_data; }
const std::string& GetFilename() const { return m_filename; } const std::string& GetFilename() const { return m_filename; }
void SetFilename(std::string filename) { m_filename = std::move(filename); } void SetFilename(std::string filename) { m_filename = std::move(filename); }

View file

@ -910,13 +910,14 @@ const char* Settings::GetControllerTypeDisplayName(ControllerType type)
return s_controller_display_names[static_cast<int>(type)]; return s_controller_display_names[static_cast<int>(type)];
} }
static std::array<const char*, 5> s_memory_card_type_names = { static std::array<const char*, 6> s_memory_card_type_names = {
{"None", "Shared", "PerGame", "PerGameTitle", "PerGameFileTitle"}}; {"None", "Shared", "PerGame", "PerGameTitle", "PerGameFileTitle", "NonPersistent"}};
static std::array<const char*, 5> s_memory_card_type_display_names = { static std::array<const char*, 6> s_memory_card_type_display_names = {
{TRANSLATABLE("MemoryCardType", "No Memory Card"), TRANSLATABLE("MemoryCardType", "Shared Between All Games"), {TRANSLATABLE("MemoryCardType", "No Memory Card"), TRANSLATABLE("MemoryCardType", "Shared Between All Games"),
TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Game Code)"), TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Game Code)"),
TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Game Title)"), TRANSLATABLE("MemoryCardType", "Separate Card Per Game (Game Title)"),
TRANSLATABLE("MemoryCardType", "Separate Card Per Game (File Title)")}}; TRANSLATABLE("MemoryCardType", "Separate Card Per Game (File Title)"),
TRANSLATABLE("MemoryCardType", "Non-Persistent Card (Do Not Save)")}};
std::optional<MemoryCardType> Settings::ParseMemoryCardTypeName(const char* str) std::optional<MemoryCardType> Settings::ParseMemoryCardTypeName(const char* str)
{ {

View file

@ -1871,6 +1871,12 @@ void UpdateMemoryCards()
card = MemoryCard::Open(g_settings.memory_card_paths[i]); card = MemoryCard::Open(g_settings.memory_card_paths[i]);
} }
break; break;
case MemoryCardType::NonPersistent:
{
card = MemoryCard::Create();
}
break;
} }
if (card) if (card)

View file

@ -135,6 +135,7 @@ enum class MemoryCardType
PerGame, PerGame,
PerGameTitle, PerGameTitle,
PerGameFileTitle, PerGameFileTitle,
NonPersistent,
Count Count
}; };