mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-19 17:39:50 -04:00
Fix loading bar going out of bounds (#688)
The actual reason lies in the loader implementation, which for some reason can sometimes count up the `m_refreshedModCount` twice for some mods which are disabled. This small change checks the actual loaded mod count instead of relying on an incorrect `LoaderImpl` member and fixes issue #687.
This commit is contained in:
parent
6516adb557
commit
e50c3abff4
1 changed files with 16 additions and 2 deletions
|
@ -146,13 +146,27 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
|
|||
LoaderImpl::get()->updateResources(true);
|
||||
this->continueLoadAssets();
|
||||
}
|
||||
|
||||
int getLoadedMods() {
|
||||
auto allMods = Loader::get()->getAllMods();
|
||||
return std::count_if(allMods.begin(), allMods.end(), [&](auto& item) {
|
||||
return item->isEnabled();
|
||||
});
|
||||
}
|
||||
|
||||
int getEnabledMods() {
|
||||
auto allMods = Loader::get()->getAllMods();
|
||||
return std::count_if(allMods.begin(), allMods.end(), [&](auto& item) {
|
||||
return item->shouldLoad();
|
||||
});
|
||||
}
|
||||
|
||||
int getCurrentStep() {
|
||||
return m_fields->m_geodeLoadStep + m_loadStep + 1 + LoaderImpl::get()->m_refreshedModCount;
|
||||
return m_fields->m_geodeLoadStep + m_loadStep + getLoadedMods();
|
||||
}
|
||||
|
||||
int getTotalStep() {
|
||||
return 18 + m_fields->m_totalMods;
|
||||
return 3 + 14 + getEnabledMods();
|
||||
}
|
||||
|
||||
void updateLoadingBar() {
|
||||
|
|
Loading…
Reference in a new issue