| 261 | } |
| 262 | |
| 263 | void Meta::IdentifyCanonName(std::string_view lmtFile, std::string_view ldbFile) { |
| 264 | // Calculate the lookup based on the LMT/LDB hashes, preferring to use LMT only if possible. |
| 265 | // This requires a mandatory field, for which we will use "Name". |
| 266 | if (!Empty()) { |
| 267 | std::string lmtPath = FileFinder::Game().FindFile(ToString(lmtFile)); |
| 268 | std::string crcLMT = crc32file(lmtPath); |
| 269 | std::string crcLDB = "*"; |
| 270 | Output::Debug("CRC32 of 'LMT' file ('{}') is {}", lmtFile, crcLMT); |
| 271 | if (ini->HasValue(crcLMT + "/" + crcLDB , MTINI_NAME)) { |
| 272 | canon_ini_lookup = crcLMT + "/" + crcLDB; |
| 273 | } else { |
| 274 | std::string ldbPath = FileFinder::Game().FindFile(ToString(ldbFile)); |
| 275 | crcLDB = crc32file(ldbPath); |
| 276 | if (ini->HasValue(crcLMT + "/" + crcLDB , MTINI_NAME)) { |
| 277 | canon_ini_lookup = crcLMT + "/" + crcLDB; |
| 278 | } |
| 279 | Output::Debug("CRC32 of 'LDB' file ('{}') file is {}", ldbFile, crcLDB); |
| 280 | } |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | bool Meta::Empty() const { |
| 285 | return ini == nullptr || ini->ParseError() == -1; |