| 298 | } |
| 299 | |
| 300 | bool CGhostLoader::CheckHeaderMap(const CGhostHeader &Header, const char *pFilename, const char *pMap, const SHA256_DIGEST &MapSha256, unsigned MapCrc, bool LogMapMismatch) const |
| 301 | { |
| 302 | if(str_comp(Header.m_aMap, pMap) != 0) |
| 303 | { |
| 304 | if(LogMapMismatch) |
| 305 | { |
| 306 | log_error_color(LOG_COLOR_GHOST, "ghost_loader", "Failed to read ghost file '%s': ghost map name '%s' does not match current map '%s'", pFilename, Header.m_aMap, pMap); |
| 307 | } |
| 308 | return false; |
| 309 | } |
| 310 | |
| 311 | if(Header.m_Version >= 6) |
| 312 | { |
| 313 | if(Header.m_MapSha256 != MapSha256 && g_Config.m_ClRaceGhostStrictMap) |
| 314 | { |
| 315 | if(LogMapMismatch) |
| 316 | { |
| 317 | char aGhostSha256[SHA256_MAXSTRSIZE]; |
| 318 | sha256_str(Header.m_MapSha256, aGhostSha256, sizeof(aGhostSha256)); |
| 319 | char aMapSha256[SHA256_MAXSTRSIZE]; |
| 320 | sha256_str(MapSha256, aMapSha256, sizeof(aMapSha256)); |
| 321 | log_error_color(LOG_COLOR_GHOST, "ghost_loader", "Failed to read ghost file '%s': ghost map SHA256 mismatch (wanted='%s', ghost='%s')", pFilename, aMapSha256, aGhostSha256); |
| 322 | } |
| 323 | return false; |
| 324 | } |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | const unsigned GhostMapCrc = bytes_be_to_uint(Header.m_aZeroes); |
| 329 | if(GhostMapCrc != MapCrc && g_Config.m_ClRaceGhostStrictMap) |
| 330 | { |
| 331 | if(LogMapMismatch) |
| 332 | { |
| 333 | log_error_color(LOG_COLOR_GHOST, "ghost_loader", "Failed to read ghost file '%s': ghost map CRC mismatch (wanted='%08x', ghost='%08x')", pFilename, MapCrc, GhostMapCrc); |
| 334 | } |
| 335 | return false; |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | return true; |
| 340 | } |
| 341 | |
| 342 | bool CGhostLoader::Load(const char *pFilename, const char *pMap, const SHA256_DIGEST &MapSha256, unsigned MapCrc) |
| 343 | { |
nothing calls this directly
no test coverage detected