| 84 | } |
| 85 | |
| 86 | void GameDatabase::parseAndInsert(const std::string_view serial, const ryml::NodeRef& node) |
| 87 | { |
| 88 | GameDatabaseSchema::GameEntry gameEntry; |
| 89 | if (node.has_child("name")) |
| 90 | { |
| 91 | node["name"] >> gameEntry.name; |
| 92 | } |
| 93 | if (node.has_child("name-sort")) |
| 94 | { |
| 95 | node["name-sort"] >> gameEntry.name_sort; |
| 96 | } |
| 97 | if (node.has_child("name-en")) |
| 98 | { |
| 99 | node["name-en"] >> gameEntry.name_en; |
| 100 | } |
| 101 | if (node.has_child("region")) |
| 102 | { |
| 103 | node["region"] >> gameEntry.region; |
| 104 | } |
| 105 | if (node.has_child("compat")) |
| 106 | { |
| 107 | int val = 0; |
| 108 | node["compat"] >> val; |
| 109 | gameEntry.compat = static_cast<GameDatabaseSchema::Compatibility>(val); |
| 110 | } |
| 111 | if (node.has_child("roundModes")) |
| 112 | { |
| 113 | if (node["roundModes"].has_child("eeRoundMode")) |
| 114 | { |
| 115 | int eeVal = -1; |
| 116 | node["roundModes"]["eeRoundMode"] >> eeVal; |
| 117 | if (eeVal >= 0 && eeVal < static_cast<int>(FPRoundMode::MaxCount)) |
| 118 | gameEntry.eeRoundMode = static_cast<FPRoundMode>(eeVal); |
| 119 | else |
| 120 | Console.Error(fmt::format("GameDB: Invalid EE round mode '{}', specified for serial: '{}'.", eeVal, serial)); |
| 121 | } |
| 122 | if (node["roundModes"].has_child("eeDivRoundMode")) |
| 123 | { |
| 124 | int eeVal = -1; |
| 125 | node["roundModes"]["eeDivRoundMode"] >> eeVal; |
| 126 | if (eeVal >= 0 && eeVal < static_cast<int>(FPRoundMode::MaxCount)) |
| 127 | gameEntry.eeDivRoundMode = static_cast<FPRoundMode>(eeVal); |
| 128 | else |
| 129 | Console.Error(fmt::format("GameDB: Invalid EE division round mode '{}', specified for serial: '{}'.", eeVal, serial)); |
| 130 | } |
| 131 | if (node["roundModes"].has_child("vuRoundMode")) |
| 132 | { |
| 133 | int vuVal = -1; |
| 134 | node["roundModes"]["vuRoundMode"] >> vuVal; |
| 135 | if (vuVal >= 0 && vuVal < static_cast<int>(FPRoundMode::MaxCount)) |
| 136 | { |
| 137 | gameEntry.vu0RoundMode = static_cast<FPRoundMode>(vuVal); |
| 138 | gameEntry.vu1RoundMode = static_cast<FPRoundMode>(vuVal); |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | Console.Error(fmt::format("GameDB: Invalid VU round mode '{}', specified for serial: '{}'.", vuVal, serial)); |
| 143 | } |
nothing calls this directly
no test coverage detected