Skip to content

Commit

Permalink
Fix incorrect count with mods that have multiple yaml entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Wartori54 committed Jun 20, 2024
1 parent 6ccdeaf commit 05fbdf9
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 @@ -322,6 +322,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 @@ -404,6 +409,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 05fbdf9

Please sign in to comment.