Browse Source

Made updater try to update even mods rejected during the loading process

pull/11/head
Anairkoen Schno 5 years ago
parent
commit
35bd3962b8
4 changed files with 36 additions and 7 deletions
  1. +22
    -5
      IPA.Loader/Loader/PluginLoader.cs
  2. +0
    -2
      IPA.Loader/Loader/PluginManager.cs
  3. +14
    -0
      IPA.Loader/Updating/BeatMods/Updater.cs
  4. BIN
      Refs/UnityEngine.CoreModule.dll

+ 22
- 5
IPA.Loader/Loader/PluginLoader.cs View File

@ -212,6 +212,9 @@ namespace IPA.Loader
} }
} }
// keep track of these for the updater; it should still be able to update mods not loaded
internal static HashSet<PluginMetadata> ignoredPlugins = new HashSet<PluginMetadata>();
internal static void Resolve() internal static void Resolve()
{ // resolves duplicates and conflicts, etc { // resolves duplicates and conflicts, etc
PluginsMetadata.Sort((a, b) => a.Version.CompareTo(b.Version)); PluginsMetadata.Sort((a, b) => a.Version.CompareTo(b.Version));
@ -227,6 +230,7 @@ namespace IPA.Loader
{ {
Logger.loader.Warn($"Found duplicates of {meta.Id}, using newest"); Logger.loader.Warn($"Found duplicates of {meta.Id}, using newest");
ignore.Add(meta); ignore.Add(meta);
ignoredPlugins.Add(meta);
continue; // because of sorted order, hightest order will always be the first one continue; // because of sorted order, hightest order will always be the first one
} }
@ -261,8 +265,13 @@ namespace IPA.Loader
} }
} }
if (ignore.Contains(meta)) continue;
if (meta.Id != null) ids.Add(meta.Id);
if (ignore.Contains(meta))
{
ignoredPlugins.Add(meta);
continue;
}
if (meta.Id != null)
ids.Add(meta.Id);
resolved.Add(meta); resolved.Add(meta);
} }
@ -296,7 +305,8 @@ namespace IPA.Loader
bool load = true; bool load = true;
foreach (var dep in meta.Manifest.Dependencies) foreach (var dep in meta.Manifest.Dependencies)
{ {
if (pluginsToLoad.ContainsKey(dep.Key) && dep.Value.IsSatisfied(pluginsToLoad[dep.Key])) continue;
if (pluginsToLoad.ContainsKey(dep.Key) && dep.Value.IsSatisfied(pluginsToLoad[dep.Key]))
continue;
load = false; load = false;
Logger.loader.Warn($"{meta.Name} is missing dependency {dep.Key}@{dep.Value}"); Logger.loader.Warn($"{meta.Name} is missing dependency {dep.Key}@{dep.Value}");
@ -308,6 +318,8 @@ namespace IPA.Loader
if (meta.Id != null) if (meta.Id != null)
pluginsToLoad.Add(meta.Id, meta.Version); pluginsToLoad.Add(meta.Id, meta.Version);
} }
else
ignoredPlugins.Add(meta);
} }
PluginsMetadata = metadata; PluginsMetadata = metadata;
@ -355,8 +367,8 @@ namespace IPA.Loader
} }
foreach (var plugin in PluginsMetadata) foreach (var plugin in PluginsMetadata)
foreach (var feature in plugin.Features)
feature.Evaluate();
foreach (var feature in plugin.Features)
feature.Evaluate();
} }
foreach (var plugin in parsedFeatures) foreach (var plugin in parsedFeatures)
@ -395,6 +407,7 @@ namespace IPA.Loader
{ {
Logger.loader.Warn( Logger.loader.Warn(
$"Feature {denyingFeature?.GetType()} denied plugin {meta.Name} from loading! {denyingFeature?.InvalidMessage}"); $"Feature {denyingFeature?.GetType()} denied plugin {meta.Name} from loading! {denyingFeature?.InvalidMessage}");
ignoredPlugins.Add(meta);
return null; return null;
} }
@ -412,6 +425,7 @@ namespace IPA.Loader
{ {
Logger.loader.Warn( Logger.loader.Warn(
$"Feature {denyingFeature?.GetType()} denied plugin {meta.Name} from initializing! {denyingFeature?.InvalidMessage}"); $"Feature {denyingFeature?.GetType()} denied plugin {meta.Name} from initializing! {denyingFeature?.InvalidMessage}");
ignoredPlugins.Add(meta);
return null; return null;
} }
@ -431,11 +445,14 @@ namespace IPA.Loader
catch (AmbiguousMatchException) catch (AmbiguousMatchException)
{ {
Logger.loader.Error($"Only one Init allowed per plugin (ambiguous match in {meta.Name})"); Logger.loader.Error($"Only one Init allowed per plugin (ambiguous match in {meta.Name})");
// not adding to ignoredPlugins here because this should only happen in a development context
// if someone fucks this up on release thats on them
return null; return null;
} }
catch (Exception e) catch (Exception e)
{ {
Logger.loader.Error($"Could not init plugin {meta.Name}: {e}"); Logger.loader.Error($"Could not init plugin {meta.Name}: {e}");
ignoredPlugins.Add(meta);
return null; return null;
} }


+ 0
- 2
IPA.Loader/Loader/PluginManager.cs View File

@ -23,8 +23,6 @@ namespace IPA.Loader
{ {
#pragma warning disable CS0618 // Type or member is obsolete (IPlugin) #pragma warning disable CS0618 // Type or member is obsolete (IPlugin)
/// <summary> /// <summary>
/// An <see cref="IEnumerable"/> of new Beat Saber plugins /// An <see cref="IEnumerable"/> of new Beat Saber plugins
/// </summary> /// </summary>


+ 14
- 0
IPA.Loader/Updating/BeatMods/Updater.cs View File

@ -183,6 +183,20 @@ namespace IPA.Updating.BeatMods
} }
} }
foreach (var meta in PluginLoader.ignoredPlugins.Where(m => m.Id != null))
{
depList.Value.Add(new DependencyObject
{
Name = meta.Id,
Version = meta.Version,
Requirement = new Range($">={meta.Version}"),
LocalPluginMeta = new PluginLoader.PluginInfo
{
Metadata = meta, Plugin = null
}
});
}
foreach (var dep in depList.Value) foreach (var dep in depList.Value)
Logger.updater.Debug($"Phantom Dependency: {dep}"); Logger.updater.Debug($"Phantom Dependency: {dep}");


BIN
Refs/UnityEngine.CoreModule.dll View File


Loading…
Cancel
Save