MCPcopy Create free account
hub / github.com/EasyRPG/Player / IdentifyCanonName

Method IdentifyCanonName

src/meta.cpp:263–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void 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
284bool Meta::Empty() const {
285 return ini == nullptr || ini->ParseError() == -1;

Callers

nothing calls this directly

Calls 3

GameClass · 0.85
crc32fileFunction · 0.85
FindFileMethod · 0.45

Tested by

no test coverage detected