mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
The systems are now counted upfront for accurate progress bar positioning if there's a custom es_systems.xml file in use.
This commit is contained in:
parent
90851befc5
commit
fc282f559c
|
@ -1300,6 +1300,8 @@ void CollectionSystemsManager::removeCollectionsFromDisplayedSystems()
|
||||||
|
|
||||||
// Remove all custom collections in bundle.
|
// Remove all custom collections in bundle.
|
||||||
// This should not delete the objects from memory!
|
// This should not delete the objects from memory!
|
||||||
|
if (mCustomCollectionsBundle == nullptr)
|
||||||
|
return;
|
||||||
FileData* customRoot {mCustomCollectionsBundle->getRootFolder()};
|
FileData* customRoot {mCustomCollectionsBundle->getRootFolder()};
|
||||||
std::vector<FileData*> mChildren {customRoot->getChildren()};
|
std::vector<FileData*> mChildren {customRoot->getChildren()};
|
||||||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); ++it) {
|
for (auto it = mChildren.cbegin(); it != mChildren.cend(); ++it) {
|
||||||
|
|
|
@ -460,9 +460,34 @@ bool SystemData::loadConfig()
|
||||||
|
|
||||||
const std::vector<std::string>& configPaths {getConfigPath(true)};
|
const std::vector<std::string>& configPaths {getConfigPath(true)};
|
||||||
const std::string& rompath {FileData::getROMDirectory()};
|
const std::string& rompath {FileData::getROMDirectory()};
|
||||||
|
|
||||||
bool onlyProcessCustomFile {false};
|
bool onlyProcessCustomFile {false};
|
||||||
|
|
||||||
|
const bool splashScreen {Settings::getInstance()->getBool("SplashScreen")};
|
||||||
|
float systemCount {0.0f};
|
||||||
|
float loadedSystems {0.0f};
|
||||||
|
|
||||||
|
// This is only done to get the total system count, for calculating the progress bar position.
|
||||||
|
for (auto& configPath : configPaths) {
|
||||||
|
pugi::xml_document doc;
|
||||||
|
#if defined(_WIN64)
|
||||||
|
const pugi::xml_parse_result& res {
|
||||||
|
doc.load_file(Utils::String::stringToWideString(configPath).c_str())};
|
||||||
|
#else
|
||||||
|
const pugi::xml_parse_result& res {doc.load_file(configPath.c_str())};
|
||||||
|
#endif
|
||||||
|
if (!res)
|
||||||
|
break;
|
||||||
|
const pugi::xml_node& systemList {doc.child("systemList")};
|
||||||
|
if (!systemList)
|
||||||
|
continue;
|
||||||
|
for (pugi::xml_node system {systemList.child("system")}; system;
|
||||||
|
system = system.next_sibling("system")) {
|
||||||
|
++systemCount;
|
||||||
|
}
|
||||||
|
if (doc.child("loadExclusive"))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& configPath : configPaths) {
|
for (auto& configPath : configPaths) {
|
||||||
// If the loadExclusive tag is present in the custom es_systems.xml file, then skip
|
// If the loadExclusive tag is present in the custom es_systems.xml file, then skip
|
||||||
// processing of the bundled configuration file.
|
// processing of the bundled configuration file.
|
||||||
|
@ -510,17 +535,9 @@ bool SystemData::loadConfig()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool splashScreen {Settings::getInstance()->getBool("SplashScreen")};
|
|
||||||
float systemCount {0.0f};
|
|
||||||
float loadedSystems {0.0f};
|
|
||||||
uint64_t lastTime {0};
|
uint64_t lastTime {0};
|
||||||
uint64_t accumulator {0};
|
uint64_t accumulator {0};
|
||||||
|
|
||||||
for (pugi::xml_node system {systemList.child("system")}; system;
|
|
||||||
system = system.next_sibling("system")) {
|
|
||||||
++systemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (pugi::xml_node system {systemList.child("system")}; system;
|
for (pugi::xml_node system {systemList.child("system")}; system;
|
||||||
system = system.next_sibling("system")) {
|
system = system.next_sibling("system")) {
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -749,10 +766,11 @@ bool SystemData::loadConfig()
|
||||||
sSystemVector.emplace_back(newSys);
|
sSystemVector.emplace_back(newSys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (splashScreen)
|
|
||||||
Window::getInstance()->renderSplashScreen(Window::SplashScreenState::SCANNING, 0.5f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (splashScreen)
|
||||||
|
Window::getInstance()->renderSplashScreen(Window::SplashScreenState::SCANNING, 0.5f);
|
||||||
|
|
||||||
// Sort systems by sortName, which will normally be the same as the full name.
|
// Sort systems by sortName, which will normally be the same as the full name.
|
||||||
std::sort(std::begin(sSystemVector), std::end(sSystemVector), [](SystemData* a, SystemData* b) {
|
std::sort(std::begin(sSystemVector), std::end(sSystemVector), [](SystemData* a, SystemData* b) {
|
||||||
return Utils::String::toUpper(a->getSortName()) < Utils::String::toUpper(b->getSortName());
|
return Utils::String::toUpper(a->getSortName()) < Utils::String::toUpper(b->getSortName());
|
||||||
|
@ -818,7 +836,7 @@ std::vector<std::string> SystemData::getConfigPath(bool legacyWarning)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string path = customSystemsDirectory + "/es_systems.xml";
|
std::string path {customSystemsDirectory + "/es_systems.xml"};
|
||||||
|
|
||||||
if (Utils::FileSystem::exists(path)) {
|
if (Utils::FileSystem::exists(path)) {
|
||||||
LOG(LogInfo) << "Found custom systems configuration file";
|
LOG(LogInfo) << "Found custom systems configuration file";
|
||||||
|
|
Loading…
Reference in a new issue