GameDB: Detect and skip patches with duplicate CRCs

This commit is contained in:
Tyler Wilding 2020-11-13 23:39:07 -05:00 committed by refractionpcsx2
parent b800ed0a10
commit dc52ec7aec
1 changed files with 10 additions and 1 deletions

View File

@ -137,10 +137,19 @@ GameDatabaseSchema::GameEntry YamlGameDatabaseImpl::entryFromYaml(const std::str
for (YAML::const_iterator it = patches.begin(); it != patches.end(); ++it)
{
const YAML::Node& node = *it;
std::string crc = safeGetString(node, "crc", "default");
if (gameEntry.patches.count(crc) == 1)
{
Console.Error(fmt::format("[GameDB] Patch with duplicate CRC: '{}' detected for serial: '{}'. Skipping patch.", crc, serial));
continue;
}
GameDatabaseSchema::Patch patchCol;
patchCol.author = safeGetString(node, "author");
patchCol.patchLines = safeGetMultilineString(node, "content");
gameEntry.patches[safeGetString(node, "crc", "default")] = patchCol;
gameEntry.patches[crc] = patchCol;
}
}
}