| 524 | } |
| 525 | |
| 526 | bool FileFinder::IsMajorUpdatedTree() { |
| 527 | auto fs = Game(); |
| 528 | assert(fs); |
| 529 | |
| 530 | // Find an MP3 music file only when official Harmony.dll exists |
| 531 | // in the gamedir or the file doesn't exist because |
| 532 | // the detection doesn't return reliable results for games created with |
| 533 | // "RPG2k non-official English translation (older engine) + MP3 patch" |
| 534 | bool find_mp3 = true; |
| 535 | std::string harmony = Game().FindFile("Harmony.dll"); |
| 536 | if (!harmony.empty()) { |
| 537 | auto size = fs.GetFilesize(harmony); |
| 538 | if (size != -1 && size != KnownFileSize::OFFICIAL_HARMONY_DLL) { |
| 539 | Output::Debug("Non-official Harmony.dll found, skipping MP3 test"); |
| 540 | find_mp3 = false; |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | if (find_mp3) { |
| 545 | auto entries = fs.ListDirectory("music"); |
| 546 | if (entries) { |
| 547 | for (const auto& entry : *entries) { |
| 548 | if (entry.second.type == DirectoryTree::FileType::Regular && EndsWith(entry.first, ".mp3")) { |
| 549 | Output::Debug("MP3 file ({}) found", entry.second.name); |
| 550 | return true; |
| 551 | } |
| 552 | } |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | // Compare the size of RPG_RT.exe with threshold |
| 557 | std::string rpg_rt = Game().FindFile("RPG_RT.exe"); |
| 558 | if (!rpg_rt.empty()) { |
| 559 | auto size = fs.GetFilesize(rpg_rt); |
| 560 | if (size != -1) { |
| 561 | return size > (Player::IsRPG2k() ? RpgrtMajorUpdateThreshold::RPG2K : RpgrtMajorUpdateThreshold::RPG2K3); |
| 562 | } |
| 563 | } |
| 564 | Output::Debug("Could not get the size of RPG_RT.exe"); |
| 565 | |
| 566 | // Assume the most popular version |
| 567 | // Japanese or RPG2k3 games: newer engine |
| 568 | // non-Japanese RPG2k games: older engine |
| 569 | bool assume_newer = Player::IsCP932() || Player::IsRPG2k3(); |
| 570 | Output::Debug("Assuming {} engine", assume_newer ? "newer" : "older"); |
| 571 | return assume_newer; |
| 572 | } |
| 573 | |
| 574 | std::string FileFinder::GetFullFilesystemPath(FilesystemView fs) { |
| 575 | FilesystemView cur_fs = fs; |
nothing calls this directly
no test coverage detected