GameDB: Fix incorrect parsing around round and clamp modes

This commit is contained in:
Tyler Wilding 2020-12-16 16:54:53 -05:00 committed by refractionpcsx2
parent 7b7278bc85
commit 57c7e56203
1 changed files with 11 additions and 4 deletions

View File

@ -95,10 +95,17 @@ GameDatabaseSchema::GameEntry YamlGameDatabaseImpl::entryFromYaml(const std::str
gameEntry.name = node["name"].as<std::string>(""); gameEntry.name = node["name"].as<std::string>("");
gameEntry.region = node["region"].as<std::string>(""); gameEntry.region = node["region"].as<std::string>("");
gameEntry.compat = static_cast<GameDatabaseSchema::Compatibility>(node["compat"].as<int>(enum_cast(gameEntry.compat))); gameEntry.compat = static_cast<GameDatabaseSchema::Compatibility>(node["compat"].as<int>(enum_cast(gameEntry.compat)));
gameEntry.eeRoundMode = static_cast<GameDatabaseSchema::RoundMode>(node["eeRoundMode"].as<int>(enum_cast(gameEntry.eeRoundMode))); // Safely grab round mode and clamp modes from the YAML, otherwise default t
gameEntry.vuRoundMode = static_cast<GameDatabaseSchema::RoundMode>(node["vuRoundMode"].as<int>(enum_cast(gameEntry.vuRoundMode))); if (YAML::Node roundModeNode = node["roundModes"])
gameEntry.eeClampMode = static_cast<GameDatabaseSchema::ClampMode>(node["eeClampMode"].as<int>(enum_cast(gameEntry.eeClampMode))); {
gameEntry.vuClampMode = static_cast<GameDatabaseSchema::ClampMode>(node["vuClampMode"].as<int>(enum_cast(gameEntry.vuClampMode))); gameEntry.eeRoundMode = static_cast<GameDatabaseSchema::RoundMode>(roundModeNode["eeRoundMode"].as<int>(enum_cast(gameEntry.eeRoundMode)));
gameEntry.vuRoundMode = static_cast<GameDatabaseSchema::RoundMode>(roundModeNode["vuRoundMode"].as<int>(enum_cast(gameEntry.vuRoundMode)));
}
if (YAML::Node clampModeNode = node["clampModes"])
{
gameEntry.eeClampMode = static_cast<GameDatabaseSchema::ClampMode>(clampModeNode["eeClampMode"].as<int>(enum_cast(gameEntry.eeClampMode)));
gameEntry.vuClampMode = static_cast<GameDatabaseSchema::ClampMode>(clampModeNode["vuClampMode"].as<int>(enum_cast(gameEntry.vuClampMode)));
}
// Validate game fixes, invalid ones will be dropped! // Validate game fixes, invalid ones will be dropped!
for (std::string& fix : node["gameFixes"].as<std::vector<std::string>>(std::vector<std::string>())) for (std::string& fix : node["gameFixes"].as<std::vector<std::string>>(std::vector<std::string>()))