* Calculate and check the MD5 hash of the supplied GRF. * @param file The file get the hash of. * @param subdir The sub directory to get the files from. * @return * - #CR_MATCH if the MD5 hash matches * - #CR_MISMATCH if the MD5 does not match * - #CR_NO_FILE if the file misses */ static */
| 421 | * - #CR_NO_FILE if the file misses |
| 422 | */ |
| 423 | /* static */ MD5File::ChecksumResult GraphicsSet::CheckMD5(const MD5File *file, Subdirectory subdir) |
| 424 | { |
| 425 | size_t size = 0; |
| 426 | auto f = FioFOpenFile(file->filename, "rb", subdir, &size); |
| 427 | if (!f.has_value()) return MD5File::CR_NO_FILE; |
| 428 | |
| 429 | size_t max = GRFGetSizeOfDataSection(*f); |
| 430 | |
| 431 | return file->CheckMD5(subdir, max); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | /** |
nothing calls this directly
no test coverage detected