From 49977446dd859e3079698a4c79948a47644984e1 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 30 Oct 2019 09:58:37 +0100 Subject: [PATCH 1/3] RedumpVerifier: Don't crash on missing hyphen in serial --- Source/Core/DiscIO/VolumeVerifier.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index aed3c87a44..de1d434dca 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -265,7 +265,7 @@ std::vector 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; From 42ec8614697978346233f6292d6c0baaceff4e14 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 30 Oct 2019 10:05:12 +0100 Subject: [PATCH 2/3] RedumpVerifier: Fix handling of Datel Wii disc serials GC Datel discs have empty serials, but Wii Datel discs have serials starting with DS followed by some digits. --- Source/Core/DiscIO/VolumeVerifier.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index de1d434dca..9d61e23564 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -241,9 +241,9 @@ std::vector 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 } From f9705fd1176432755df3dba0ef5c50f505193371 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 30 Oct 2019 10:12:01 +0100 Subject: [PATCH 3/3] Return nothing from VolumeWii::GetGameTDBID if Datel RedumpVerifier relies on this. --- Source/Core/DiscIO/VolumeGC.cpp | 8 +++----- Source/Core/DiscIO/VolumeWii.cpp | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp index 8e4a33d099..9ecb8bb266 100644 --- a/Source/Core/DiscIO/VolumeGC.cpp +++ b/Source/Core/DiscIO/VolumeGC.cpp @@ -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 diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp index 5b6524f807..bc39a7aae4 100644 --- a/Source/Core/DiscIO/VolumeWii.cpp +++ b/Source/Core/DiscIO/VolumeWii.cpp @@ -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); }