diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2025-06-15 11:13:18 +0100 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2025-07-04 23:15:50 +0100 |
| commit | fe6fd2279c195517094538fff8667332049823ad (patch) | |
| tree | 3590fb4e7625615b9b09bf82a1ed1dacf4ff8d57 /Source/Core/DiscIO | |
| parent | a5e85caf0af66fec07b476718a69519b06e6a69f (diff) | |
WiiSaveBanner: fall back to $userdir/Load/WiiBanners
Unlike custom banners which work as an override, this mechanism works as
a fallback. The use case is if you have games you don't really play but
want to keep around for testing purposes without filling up your NAND
with lots of saves. For ease of use, the directory structure is the same
but only title/$title_hi/$title_lo/data/banner.bin files are
relevant.
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/WiiSaveBanner.cpp | 19 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WiiSaveBanner.h | 1 |
2 files changed, 12 insertions, 8 deletions
diff --git a/Source/Core/DiscIO/WiiSaveBanner.cpp b/Source/Core/DiscIO/WiiSaveBanner.cpp index 7c2489ea93..203b033271 100644 --- a/Source/Core/DiscIO/WiiSaveBanner.cpp +++ b/Source/Core/DiscIO/WiiSaveBanner.cpp @@ -3,12 +3,14 @@ #include "DiscIO/WiiSaveBanner.h" +#include <fmt/format.h> #include <iterator> #include <string> #include <vector> #include "Common/ColorUtil.h" #include "Common/CommonTypes.h" +#include "Common/FileUtil.h" #include "Common/IOFile.h" #include "Common/NandPaths.h" #include "Common/StringUtil.h" @@ -20,17 +22,20 @@ constexpr u32 ICON_HEIGHT = 48; constexpr u32 ICON_SIZE = ICON_WIDTH * ICON_HEIGHT * 2; WiiSaveBanner::WiiSaveBanner(u64 title_id) - : WiiSaveBanner(Common::GetTitleDataPath(title_id, Common::FromWhichRoot::Configured) + - "/banner.bin") -{ -} - -WiiSaveBanner::WiiSaveBanner(const std::string& path) : m_path(path) { constexpr u32 BANNER_SIZE = BANNER_WIDTH * BANNER_HEIGHT * 2; constexpr size_t MINIMUM_SIZE = sizeof(Header) + BANNER_SIZE + ICON_SIZE; - File::IOFile file(path, "rb"); + + m_path = Common::GetTitleDataPath(title_id, Common::FromWhichRoot::Configured) + "/banner.bin"; + File::IOFile file(m_path, "rb"); + + if (!file) + { + m_path = Common::GetTitleDataPath(title_id, Common::FromWhichRoot::Banners) + "/banner.bin"; + file = File::IOFile(m_path, "rb"); + } + if (!file.ReadArray(&m_header, 1)) { m_header = {}; diff --git a/Source/Core/DiscIO/WiiSaveBanner.h b/Source/Core/DiscIO/WiiSaveBanner.h index 2531a01f55..88276239ea 100644 --- a/Source/Core/DiscIO/WiiSaveBanner.h +++ b/Source/Core/DiscIO/WiiSaveBanner.h @@ -17,7 +17,6 @@ public: static constexpr u32 BANNER_HEIGHT = 64; explicit WiiSaveBanner(u64 title_id); - explicit WiiSaveBanner(const std::string& path); bool IsValid() const { return m_valid; } const std::string& GetPath() const { return m_path; } |
