mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
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.
This commit is contained in:
@ -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 = {};
|
||||
|
@ -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; }
|
||||
|
Reference in New Issue
Block a user