GameFile: Support HBC-style XML metadata

This feature was originally exclusive to the previous iteration of
DolphinQt (the one that was the reason for the current iteration
being named DolphinQt2 initially).

https://bugs.dolphin-emu.org/issues/8949
This commit is contained in:
JosJuice
2019-08-13 18:01:27 +02:00
parent edfb0f66b6
commit 59f27ae4e1
9 changed files with 109 additions and 17 deletions

View File

@ -52,8 +52,8 @@ public:
const std::string& GetFilePath() const { return m_file_path; }
const std::string& GetFileName() const { return m_file_name; }
const std::string& GetName(const Core::TitleDatabase& title_database) const;
const std::string& GetName(bool long_name = true) const;
const std::string& GetMaker(bool long_maker = true) const;
const std::string& GetName(bool allow_custom_name, bool long_name = true) const;
const std::string& GetMaker(bool allow_custom_maker, bool long_maker = true) const;
const std::string& GetShortName(DiscIO::Language l) const { return Lookup(l, m_short_names); }
const std::string& GetShortName() const { return LookupUsingConfigLanguage(m_short_names); }
const std::string& GetLongName(DiscIO::Language l) const { return Lookup(l, m_long_names); }
@ -63,7 +63,7 @@ public:
const std::string& GetLongMaker(DiscIO::Language l) const { return Lookup(l, m_long_makers); }
const std::string& GetLongMaker() const { return LookupUsingConfigLanguage(m_long_makers); }
const std::string& GetDescription(DiscIO::Language l) const { return Lookup(l, m_descriptions); }
const std::string& GetDescription() const { return LookupUsingConfigLanguage(m_descriptions); }
const std::string& GetDescription(bool allow_custom_description) const;
std::vector<DiscIO::Language> GetLanguages() const;
const std::string& GetInternalName() const { return m_internal_name; }
const std::string& GetGameID() const { return m_game_id; }
@ -85,6 +85,8 @@ public:
const GameBanner& GetBannerImage() const;
const GameCover& GetCoverImage() const;
void DoState(PointerWrap& p);
bool XMLMetadataChanged();
void XMLMetadataCommit();
bool WiiBannerChanged();
void WiiBannerCommit();
bool CustomBannerChanged();
@ -102,6 +104,7 @@ private:
const std::string&
LookupUsingConfigLanguage(const std::map<DiscIO::Language, std::string>& strings) const;
bool IsElfOrDol() const;
bool ReadXMLMetadata(const std::string& path);
bool ReadPNGBanner(const std::string& path);
// IMPORTANT: Nearly all data members must be save/restored in DoState.
@ -134,6 +137,9 @@ private:
u8 m_disc_number{};
std::string m_apploader_date;
std::string m_custom_name;
std::string m_custom_description;
std::string m_custom_maker;
GameBanner m_volume_banner{};
GameBanner m_custom_banner{};
GameCover m_default_cover{};
@ -143,6 +149,9 @@ private:
// of GameFiles in a threadsafe way. They should not be handled in DoState.
struct
{
std::string custom_name;
std::string custom_description;
std::string custom_maker;
GameBanner volume_banner;
GameBanner custom_banner;
GameCover default_cover;