From 8bbacbb45619c284c0055c890063789b1d15760e Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Thu, 16 Apr 2020 18:02:23 -0500 Subject: [PATCH] Fixed issue where loadAfter mods that failed to initialize would prevent the mods supposed to load after them from loading --- IPA.Loader/Loader/PluginLoader.cs | 17 +++++++++++++---- IPA.Loader/Loader/PluginMetadata.cs | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/IPA.Loader/Loader/PluginLoader.cs b/IPA.Loader/Loader/PluginLoader.cs index f86014ba..98e377e8 100644 --- a/IPA.Loader/Loader/PluginLoader.cs +++ b/IPA.Loader/Loader/PluginLoader.cs @@ -573,11 +573,15 @@ namespace IPA.Loader inserted = inserted || InsertInto(sr.Dependencies, meta); if (meta.Id != null) - if (sr.Manifest.Dependencies.ContainsKey(meta.Id) || sr.Manifest.LoadAfter.Contains(meta.Id)) + { + if (sr.Manifest.Dependencies.ContainsKey(meta.Id)) inserted = inserted || sr.Dependencies.Add(meta); + else if (sr.Manifest.LoadAfter.Contains(meta.Id)) + inserted = inserted || sr.LoadsAfter.Add(meta); + } if (sr.Id != null) if (meta.Manifest.LoadBefore.Contains(sr.Id)) - inserted = inserted || sr.Dependencies.Add(meta); + inserted = inserted || sr.LoadsAfter.Add(meta); } if (isRoot) @@ -587,11 +591,15 @@ namespace IPA.Loader InsertInto(meta.Dependencies, sr); if (sr.Id != null) - if (meta.Manifest.Dependencies.ContainsKey(sr.Id) || meta.Manifest.LoadAfter.Contains(sr.Id)) + { + if (meta.Manifest.Dependencies.ContainsKey(sr.Id)) meta.Dependencies.Add(sr); + else if (meta.Manifest.LoadAfter.Contains(sr.Id)) + meta.LoadsAfter.Add(sr); + } if (meta.Id != null) if (sr.Manifest.LoadBefore.Contains(meta.Id)) - meta.Dependencies.Add(sr); + meta.LoadsAfter.Add(sr); } root.Add(meta); @@ -610,6 +618,7 @@ namespace IPA.Loader if (!into.Contains(st)) { DeTree(into, st.Dependencies); + DeTree(into, st.LoadsAfter); into.Add(st); } } diff --git a/IPA.Loader/Loader/PluginMetadata.cs b/IPA.Loader/Loader/PluginMetadata.cs index fd298c22..05ef64d1 100644 --- a/IPA.Loader/Loader/PluginMetadata.cs +++ b/IPA.Loader/Loader/PluginMetadata.cs @@ -116,6 +116,7 @@ namespace IPA.Loader private PluginManifest manifest; internal HashSet Dependencies { get; } = new HashSet(); + internal HashSet LoadsAfter { get; } = new HashSet(); internal PluginManifest Manifest {