Skip to content

Commit

Permalink
reminder to add bsipa to your dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nike4613 committed Sep 2, 2020
1 parent 83e0664 commit 158cc75
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion IPA.Loader/Config/SelfConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void ReadCommandLine(string[] args)
}

internal const string IPAName = "Beat Saber IPA";
internal const string IPAVersion = "4.1.0.0";
internal const string IPAVersion = "4.1.1.0";

// uses Updates.AutoUpdate, Updates.AutoCheckUpdates, YeetMods, Debug.ShowCallSource, Debug.ShowDebug,
// Debug.CondenseModLogs
Expand Down
22 changes: 21 additions & 1 deletion IPA.Loader/Loader/PluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace IPA.Loader

internal partial class PluginLoader
{
internal static PluginMetadata SelfMeta;

internal static Task LoadTask() =>
TaskEx.Run(() =>
{
Expand Down Expand Up @@ -95,6 +97,7 @@ internal static void LoadMetadata()
selfMeta.Manifest = JsonConvert.DeserializeObject<PluginManifest>(manifest);

PluginsMetadata.Add(selfMeta);
SelfMeta = selfMeta;
}
catch (Exception e)
{
Expand Down Expand Up @@ -225,7 +228,7 @@ void TryGetNamespacedPluginType(string ns, PluginMetadata meta)
IEnumerable<string> bareManifests = Directory.GetFiles(UnityGame.PluginsPath, "*.json");
bareManifests = bareManifests.Concat(Directory.GetFiles(UnityGame.PluginsPath, "*.manifest"));
foreach (var manifest in bareManifests)
{ // TODO: maybe find a way to allow a bare manifest to specify an associated file
{
try
{
var metadata = new PluginMetadata
Expand Down Expand Up @@ -641,12 +644,16 @@ internal static void ResolveDependencies()
var disabledLookup = DisabledPlugins.NonNull(m => m.Id).ToDictionary(m => m.Id, m => m.Version);
foreach (var meta in PluginsMetadata)
{
bool ignoreBcNoLoader = true;
var missingDeps = new List<(string id, Range version, bool disabled)>();
foreach (var dep in meta.Manifest.Dependencies)
{
#if DEBUG
Logger.loader.Debug($"Looking for dependency {dep.Key} with version range {dep.Value.Intersect(new SemVer.Range("*.*.*"))}");
#endif
if (dep.Key == SelfMeta.Id)
ignoreBcNoLoader = false;

if (pluginsToLoad.ContainsKey(dep.Key) && dep.Value.IsSatisfied(pluginsToLoad[dep.Key]))
continue;

Expand All @@ -662,6 +669,19 @@ internal static void ResolveDependencies()
}
}

if (meta.PluginType != null && !meta.IsSelf && !meta.IsBare && ignoreBcNoLoader)
{
ignoredPlugins.Add(meta, new IgnoreReason(Reason.Dependency)
{
ReasonText = "BSIPA Plugin does not reference BSIPA!"
});
for (int i = 0; i < 20; i++)
{
Logger.loader.Warn($"HEY {meta.Id} YOU DEPEND ON BSIPA SO DEPEND ON BSIPA");
}
continue;
}

if (missingDeps.Count == 0)
{
metadata.Add(meta);
Expand Down
2 changes: 1 addition & 1 deletion IPA.Loader/Loader/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"#![IPA.Loader.description.md]",
"A mod loader specifically for Beat Saber."
],
"gameVersion": "1.11.0",
"gameVersion": "1.11.1",
"id": "BSIPA",
"name": "Beat Saber IPA",
"version": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion IPA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum Architecture
Unknown
}

public const string FileVersion = "4.1.0.0";
public const string FileVersion = "4.1.1.0";

public static Version Version => Assembly.GetEntryAssembly().GetName().Version;

Expand Down
Binary file modified Refs/UnityEngine.CoreModule.Net4.dll
Binary file not shown.

0 comments on commit 158cc75

Please sign in to comment.