Skip to content

Commit

Permalink
Merge pull request #781 from Wartori54/everest-splash-fixes-3
Browse files Browse the repository at this point in the history
Fix incorrect count with mods that have multiple yaml entries
  • Loading branch information
maddie480 authored Jun 20, 2024
2 parents 616fe31 + 05fbdf9 commit eb5d325
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Celeste.Mod.mm/Mod/Everest/Everest.Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ public static void LoadZip(string archive) {
};

if (multimetas != null) {
// When estimating the total mod count for the splash it is assumed that there will be exactly one
// ModuleMetadata per filesystem entry, which is a valid assumption most of the time, but very few
// mods do have multiple ModuleMetadatas in its everest.yaml, that's why we increase the total count
// late here when we realize that one may contain multiple
EverestSplashHandler.IncreaseTotalModCount(multimetas.Length-1);
foreach (EverestModuleMetadata multimeta in multimetas) {
multimeta.Multimeta = multimetas;
if (contentMetaParent == null)
Expand Down Expand Up @@ -405,6 +410,11 @@ public static void LoadDir(string dir) {
};

if (multimetas != null) {
// When estimating the total mod count for the splash it is assumed that there will be exactly one
// ModuleMetadata per filesystem entry, which is a valid assumption most of the time, but very few
// mods do have multiple ModuleMetadatas in its everest.yaml, that's why we increase the total count
// late here when we realize that one may contain multiple
EverestSplashHandler.IncreaseTotalModCount(multimetas.Length-1);
foreach (EverestModuleMetadata multimeta in multimetas) {
multimeta.Multimeta = multimetas;
if (contentMetaParent == null)
Expand Down
4 changes: 4 additions & 0 deletions Celeste.Mod.mm/Mod/Everest/EverestSplashHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public static void SetSplashLoadingModCount(int modCount) {
totalMods = modCount;
}

public static void IncreaseTotalModCount(int amount) {
totalMods += amount;
}

public static void IncreaseLoadedModCount(string latestLoadedMod) {
loadedMods++;
SendMessageToSplash("#progress" + loadedMods + ";" + totalMods + ";" + latestLoadedMod);
Expand Down

0 comments on commit eb5d325

Please sign in to comment.