Skip to content

Commit

Permalink
Merge pull request #8443 from JosJuice/redumpverifier-datel-wii
Browse files Browse the repository at this point in the history
RedumpVerifier: Fix handling of Datel Wii disc serials
  • Loading branch information
lioncash committed Oct 30, 2019
2 parents 4f5badb + f9705fd commit 78fad0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 3 additions & 5 deletions Source/Core/DiscIO/VolumeGC.cpp
Expand Up @@ -74,13 +74,11 @@ std::string VolumeGC::GetGameID(const Partition& partition) const

std::string VolumeGC::GetGameTDBID(const Partition& partition) const
{
const std::string game_id = GetGameID(partition);

// Don't return an ID for Datel discs that are using the game ID of NHL Hitz 2002
if (game_id == "GNHE5d" && !GetBootDOLOffset(*this, partition).has_value())
// Don't return an ID for Datel discs
if (!GetBootDOLOffset(*this, PARTITION_NONE).has_value())
return "";

return game_id;
return GetGameID(partition);
}

Region VolumeGC::GetRegion() const
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/DiscIO/VolumeVerifier.cpp
Expand Up @@ -241,9 +241,9 @@ std::vector<RedumpVerifier::PotentialMatch> RedumpVerifier::ScanDatfile(const st
continue;

const std::string serials = game.child("serial").text().as_string();
if (serials.empty())
if (serials.empty() || StringBeginsWith(serials, "DS"))
{
// This case is reached for Datel discs
// GC Datel discs have no serials in Redump, Wii Datel discs have serials like "DS000101"
if (!m_game_id.empty())
continue; // Non-empty m_game_id means we're verifying a non-Datel disc
}
Expand All @@ -265,7 +265,7 @@ std::vector<RedumpVerifier::PotentialMatch> RedumpVerifier::ScanDatfile(const st
const size_t game_id_start =
first_dash == std::string::npos ? std::string::npos : first_dash + 1;

if (serial.size() < game_id_start + 4)
if (game_id_start == std::string::npos || serial.size() < game_id_start + 4)
{
ERROR_LOG(DISCIO, "Invalid serial in redump datfile: %s", serial_str.c_str());
continue;
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DiscIO/VolumeWii.cpp
Expand Up @@ -313,6 +313,10 @@ std::string VolumeWii::GetGameID(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);
}

Expand Down

0 comments on commit 78fad0a

Please sign in to comment.