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

@ -27,7 +27,7 @@
namespace UICommon
{
static constexpr u32 CACHE_REVISION = 15; // Last changed in PR 7816
static constexpr u32 CACHE_REVISION = 16; // Last changed in PR 8313
std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan,
bool recursive_scan)
@ -166,6 +166,7 @@ bool GameFileCache::UpdateAdditionalMetadata(
bool GameFileCache::UpdateAdditionalMetadata(std::shared_ptr<GameFile>* game_file)
{
const bool xml_metadata_changed = (*game_file)->XMLMetadataChanged();
const bool wii_banner_changed = (*game_file)->WiiBannerChanged();
const bool custom_banner_changed = (*game_file)->CustomBannerChanged();
@ -174,14 +175,18 @@ bool GameFileCache::UpdateAdditionalMetadata(std::shared_ptr<GameFile>* game_fil
const bool default_cover_changed = (*game_file)->DefaultCoverChanged();
const bool custom_cover_changed = (*game_file)->CustomCoverChanged();
if (!wii_banner_changed && !custom_banner_changed && !default_cover_changed &&
!custom_cover_changed)
if (!xml_metadata_changed && !wii_banner_changed && !custom_banner_changed &&
!default_cover_changed && !custom_cover_changed)
{
return false;
}
// If a cached file needs an update, apply the updates to a copy and delete the original.
// This makes the usage of cached files in other threads safe.
std::shared_ptr<GameFile> copy = std::make_shared<GameFile>(**game_file);
if (xml_metadata_changed)
copy->XMLMetadataCommit();
if (wii_banner_changed)
copy->WiiBannerCommit();
if (custom_banner_changed)