Merge pull request #8929 from JosJuice/datel-covers

DiscIO: Fix downloading covers for non-GNHE5d Datel discs
This commit is contained in:
Tilka 2020-07-04 14:07:46 +01:00 committed by GitHub
commit c5a3882617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 15 deletions

View File

@ -115,6 +115,7 @@ public:
return 0; return 0;
} }
virtual Platform GetVolumeType() const = 0; virtual Platform GetVolumeType() const = 0;
virtual bool IsDatelDisc() const = 0;
virtual bool SupportsIntegrityCheck() const { return false; } virtual bool SupportsIntegrityCheck() const { return false; }
virtual bool CheckH3TableIntegrity(const Partition& partition) const { return false; } virtual bool CheckH3TableIntegrity(const Partition& partition) const { return false; }
virtual bool CheckBlockIntegrity(u64 block_index, const std::vector<u8>& encrypted_data, virtual bool CheckBlockIntegrity(u64 block_index, const std::vector<u8>& encrypted_data,

View File

@ -59,11 +59,10 @@ const FileSystem* VolumeGC::GetFileSystem(const Partition& partition) const
std::string VolumeGC::GetGameTDBID(const Partition& partition) const std::string VolumeGC::GetGameTDBID(const Partition& partition) const
{ {
// Don't return an ID for Datel discs const std::string game_id = GetGameID(partition);
if (!GetBootDOLOffset(*this, PARTITION_NONE).has_value())
return "";
return GetGameID(partition); // Don't return an ID for Datel discs that are using the game ID of NHL Hitz 2002
return game_id == "GNHE5d" && IsDatelDisc() ? "" : game_id;
} }
Region VolumeGC::GetRegion() const Region VolumeGC::GetRegion() const
@ -133,6 +132,11 @@ Platform VolumeGC::GetVolumeType() const
return Platform::GameCubeDisc; return Platform::GameCubeDisc;
} }
bool VolumeGC::IsDatelDisc() const
{
return !GetBootDOLOffset(*this, PARTITION_NONE).has_value();
}
VolumeGC::ConvertedGCBanner VolumeGC::LoadBannerFile() const VolumeGC::ConvertedGCBanner VolumeGC::LoadBannerFile() const
{ {
GCBanner banner_file; GCBanner banner_file;

View File

@ -43,6 +43,7 @@ public:
std::vector<u32> GetBanner(u32* width, u32* height) const override; std::vector<u32> GetBanner(u32* width, u32* height) const override;
Platform GetVolumeType() const override; Platform GetVolumeType() const override;
bool IsDatelDisc() const override;
Region GetRegion() const override; Region GetRegion() const override;
BlobType GetBlobType() const override; BlobType GetBlobType() const override;
u64 GetSize() const override; u64 GetSize() const override;

View File

@ -56,11 +56,12 @@ RedumpVerifier::DownloadState RedumpVerifier::m_wii_download_state;
void RedumpVerifier::Start(const Volume& volume) void RedumpVerifier::Start(const Volume& volume)
{ {
// We use GetGameTDBID instead of GetGameID so that Datel discs will be represented by an empty if (!volume.IsDatelDisc())
// string, which matches Redump not having any serials for Datel discs. {
m_game_id = volume.GetGameTDBID(); m_game_id = volume.GetGameID();
if (m_game_id.size() > 4) if (m_game_id.size() > 4)
m_game_id = m_game_id.substr(0, 4); m_game_id = m_game_id.substr(0, 4);
}
m_revision = volume.GetRevision().value_or(0); m_revision = volume.GetRevision().value_or(0);
m_disc_number = volume.GetDiscNumber().value_or(0); m_disc_number = volume.GetDiscNumber().value_or(0);

View File

@ -284,6 +284,11 @@ Platform VolumeWAD::GetVolumeType() const
return Platform::WiiWAD; return Platform::WiiWAD;
} }
bool VolumeWAD::IsDatelDisc() const
{
return false;
}
std::map<Language, std::string> VolumeWAD::GetLongNames() const std::map<Language, std::string> VolumeWAD::GetLongNames() const
{ {
if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId())) if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId()))

View File

@ -59,6 +59,7 @@ public:
return ""; return "";
} }
Platform GetVolumeType() const override; Platform GetVolumeType() const override;
bool IsDatelDisc() const override;
Region GetRegion() const override; Region GetRegion() const override;
Country GetCountry(const Partition& partition = PARTITION_NONE) const override; Country GetCountry(const Partition& partition = PARTITION_NONE) const override;

View File

@ -301,10 +301,6 @@ u64 VolumeWii::PartitionOffsetToRawOffset(u64 offset, const Partition& partition
std::string VolumeWii::GetGameTDBID(const Partition& partition) const std::string VolumeWii::GetGameTDBID(const Partition& partition) const
{ {
// Don't return an ID for Datel discs
if (m_game_partition == PARTITION_NONE)
return "";
return GetGameID(partition); return GetGameID(partition);
} }
@ -338,6 +334,11 @@ Platform VolumeWii::GetVolumeType() const
return Platform::WiiDisc; return Platform::WiiDisc;
} }
bool VolumeWii::IsDatelDisc() const
{
return m_game_partition == PARTITION_NONE;
}
BlobType VolumeWii::GetBlobType() const BlobType VolumeWii::GetBlobType() const
{ {
return m_reader->GetBlobType(); return m_reader->GetBlobType();

View File

@ -79,6 +79,7 @@ public:
std::vector<u32> GetBanner(u32* width, u32* height) const override; std::vector<u32> GetBanner(u32* width, u32* height) const override;
Platform GetVolumeType() const override; Platform GetVolumeType() const override;
bool IsDatelDisc() const override;
bool SupportsIntegrityCheck() const override { return m_encrypted; } bool SupportsIntegrityCheck() const override { return m_encrypted; }
bool CheckH3TableIntegrity(const Partition& partition) const override; bool CheckH3TableIntegrity(const Partition& partition) const override;
bool CheckBlockIntegrity(u64 block_index, const std::vector<u8>& encrypted_data, bool CheckBlockIntegrity(u64 block_index, const std::vector<u8>& encrypted_data,

View File

@ -120,8 +120,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
m_file_size = volume->GetRawSize(); m_file_size = volume->GetRawSize();
m_volume_size = volume->GetSize(); m_volume_size = volume->GetSize();
m_volume_size_is_accurate = volume->IsSizeAccurate(); m_volume_size_is_accurate = volume->IsSizeAccurate();
m_is_datel_disc = DiscIO::IsDisc(m_platform) && m_is_datel_disc = volume->IsDatelDisc();
!DiscIO::GetBootDOLOffset(*volume, volume->GetGamePartition());
m_internal_name = volume->GetInternalName(); m_internal_name = volume->GetInternalName();
m_game_id = volume->GetGameID(); m_game_id = volume->GetGameID();