Browse Source

Fix loadBefores

pull/94/head
Anairkoen Schno 3 years ago
parent
commit
b7f3071722
Signed by: DaNike GPG Key ID: BEFB74D5F3FC4387
1 changed files with 15 additions and 10 deletions
  1. +15
    -10
      IPA.Loader/Loader/PluginLoader.cs

+ 15
- 10
IPA.Loader/Loader/PluginLoader.cs View File

@ -770,6 +770,20 @@ namespace IPA.Loader
}
}
// preprocess LoadBefore into LoadAfter
foreach (var kvp in metadataCache)
{ // we iterate the metadata cache because it contains both disabled and enabled plugins
var loadBefore = kvp.Value.Meta.Manifest.LoadBefore;
foreach (var id in loadBefore)
{
if (metadataCache.TryGetValue(id, out var plugin))
{
// if the id exists in our metadata cache, make sure it knows to load after the plugin in kvp
_ = plugin.Meta.LoadsAfter.Add(kvp.Value.Meta);
}
}
}
var loadedPlugins = new Dictionary<string, (PluginMetadata Meta, bool Disabled, bool Ignored)>();
var outputOrder = new List<PluginMetadata>(PluginsMetadata.Count);
@ -920,16 +934,7 @@ namespace IPA.Loader
// we can now load the current plugin
outputOrder!.Add(plugin);
// then we can handle loadbefores
foreach (var id in plugin.Manifest.LoadBefore)
{
if (TryResolveId(id, out var meta, out var depDisabled, out var depIgnored) && !depIgnored)
{
// same logic as with loadafters
// both loadafter and loadbefore get condensed to just LoadsAfter in memory, for simplicity's sake
_ = meta.LoadsAfter.Add(plugin);
}
}
// loadbefores have already been preprocessed into loadafters
}
// run TryResolveId over every plugin, which recursively calculates load order


Loading…
Cancel
Save