0x0047118B
| 464 | |
| 465 | // 0x0047118B |
| 466 | static void createIndex(const ObjectFoldersState& currentState) |
| 467 | { |
| 468 | Input::processMessagesMini(); |
| 469 | const auto progressString = _isFirstTime ? StringIds::starting_for_the_first_time : StringIds::checking_object_files; |
| 470 | Ui::ProgressBar::begin(progressString); |
| 471 | |
| 472 | // Reset |
| 473 | reloadAll(); |
| 474 | _installedObjectList.clear(); |
| 475 | |
| 476 | // Create new index by iterating all DAT files and processing |
| 477 | IndexHeader header{}; |
| 478 | header.version = kCurrentIndexVersion; |
| 479 | const auto vanillaObjectPath = Environment::getPathNoWarning(Environment::PathId::vanillaObjects); |
| 480 | addObjectsInFolder(vanillaObjectPath, false, currentState.vanillaInstall.numObjects); |
| 481 | const auto objectPath = Environment::getPathNoWarning(Environment::PathId::objects); |
| 482 | addObjectsInFolder(objectPath, true, currentState.install.numObjects); |
| 483 | const auto customObjectPath = Environment::getPathNoWarning(Environment::PathId::customObjects); |
| 484 | addObjectsInFolder(customObjectPath, true, currentState.customObjects.numObjects); |
| 485 | std::ranges::sort(_installedObjectList, {}, [](const auto& entry) { return entry._name; }); |
| 486 | |
| 487 | // New index creation completed. Reset and save result. |
| 488 | reloadAll(); |
| 489 | header.fileSize = 0; |
| 490 | header.numObjects = static_cast<uint32_t>(_installedObjectList.size()); |
| 491 | header.state = currentState; |
| 492 | saveIndex(header); |
| 493 | |
| 494 | Ui::ProgressBar::end(); |
| 495 | } |
| 496 | |
| 497 | static bool tryLoadIndex(const ObjectFoldersState& currentState) |
| 498 | { |
no test coverage detected