From 226a8eac813564a8a37788637ef58b3139bb57e3 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 10 Jul 2024 21:47:02 +1000 Subject: [PATCH] MemoryCardIconCache: Ignore shared cards --- src/core/memory_card_icon_cache.cpp | 5 +++-- src/core/system.cpp | 6 +++++- src/core/system.h | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/memory_card_icon_cache.cpp b/src/core/memory_card_icon_cache.cpp index aa7c80a57..9745d7add 100644 --- a/src/core/memory_card_icon_cache.cpp +++ b/src/core/memory_card_icon_cache.cpp @@ -105,8 +105,9 @@ bool MemoryCardIconCache::Reload() const MemoryCardImage::IconFrame* MemoryCardIconCache::Lookup(std::string_view serial, std::string_view path) { - std::string memcard_path = System::GetGameMemoryCardPath(serial, path, 0); - if (memcard_path.empty()) + MemoryCardType type; + std::string memcard_path = System::GetGameMemoryCardPath(serial, path, 0, &type); + if (memcard_path.empty() || type == MemoryCardType::Shared) return nullptr; FILESYSTEM_STAT_DATA sd; diff --git a/src/core/system.cpp b/src/core/system.cpp index 1d8c76284..a305963b5 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -4997,7 +4997,8 @@ void System::DeleteSaveStates(const char* serial, bool resume) } } -std::string System::GetGameMemoryCardPath(std::string_view serial, std::string_view path, u32 slot) +std::string System::GetGameMemoryCardPath(std::string_view serial, std::string_view path, u32 slot, + MemoryCardType* out_type) { const char* section = "MemoryCards"; const TinyString type_key = TinyString::from_format("Card{}Type", slot + 1); @@ -5034,6 +5035,9 @@ std::string System::GetGameMemoryCardPath(std::string_view serial, std::string_v type = MemoryCardType::Shared; } + if (out_type) + *out_type = type; + std::string ret; switch (type) { diff --git a/src/core/system.h b/src/core/system.h index 1230242c3..695260571 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -417,7 +417,8 @@ std::optional GetExtendedSaveStateInfo(const char* path); void DeleteSaveStates(const char* serial, bool resume); /// Returns the path to the memory card for the specified game, considering game settings. -std::string GetGameMemoryCardPath(std::string_view serial, std::string_view path, u32 slot); +std::string GetGameMemoryCardPath(std::string_view serial, std::string_view path, u32 slot, + MemoryCardType* out_type = nullptr); /// Returns intended output volume considering fast forwarding. s32 GetAudioOutputVolume();