New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GameFile: Support HBC-style XML metadata #8313
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ PUBLIC | |
common | ||
cpp-optparse | ||
minizip | ||
pugixml | ||
|
||
PRIVATE | ||
$<$<BOOL:APPLE>:${IOK_LIBRARY}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,13 @@ bool operator!=(const GameBanner& lhs, const GameBanner& rhs); | |
class GameFile final | ||
{ | ||
public: | ||
enum class Variant | ||
{ | ||
LongAndPossiblyCustom, | ||
LongAndNotCustom, | ||
ShortAndNotCustom, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be the nittiest of nits, but...thoughts on using You should probably ignore this comment for the sake of all the sheds we built so far. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
}; | ||
|
||
GameFile(); | ||
explicit GameFile(std::string path); | ||
~GameFile(); | ||
|
@@ -52,8 +59,8 @@ class GameFile final | |
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(Variant variant) const; | ||
const std::string& GetMaker(Variant variant) 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 +70,7 @@ class GameFile final | |
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(Variant variant) 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 +92,8 @@ class GameFile final | |
const GameBanner& GetBannerImage() const; | ||
const GameCover& GetCoverImage() const; | ||
void DoState(PointerWrap& p); | ||
bool XMLMetadataChanged(); | ||
void XMLMetadataCommit(); | ||
bool WiiBannerChanged(); | ||
void WiiBannerCommit(); | ||
bool CustomBannerChanged(); | ||
|
@@ -102,6 +111,7 @@ class GameFile final | |
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 +144,9 @@ class GameFile final | |
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 +156,9 @@ class GameFile final | |
// 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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do append the revision to the game name (altho this is a
u16
and not just any plain string); and there would be the apploader date field (which is a string)...so we potentially could use those two.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really not like to change the revision from
u16
tostd::string
. I could do the apploader date, but an apploader date isn't really the same as a release date, and any custom data doesn't show up in the properties dialog anyway the way things are now (which is the only place where you can see the apploader date). Maybe we could rework this if we add a properties dialog for DOL/ELF files at some point.