diff --git a/Directory.Build.props b/Directory.Build.props index 582628b6..01b58844 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 1.5.0 + 1.5.1 netstandard2.0 SpaceWarp 11 diff --git a/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs b/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs index 6d527c15..aa4c00dc 100644 --- a/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs +++ b/SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs @@ -86,6 +86,7 @@ public SpecVersion(string version = null) public static bool operator <=(SpecVersion a, SpecVersion b) => Compare(a, b) <= 0; public static bool operator >=(SpecVersion a, SpecVersion b) => Compare(a, b) >= 0; + private static int Compare(SpecVersion a, SpecVersion b) { if (a.Major != b.Major) diff --git a/SpaceWarp.Core/API/Mods/PluginList.cs b/SpaceWarp.Core/API/Mods/PluginList.cs index 97ea2079..73c7f22d 100644 --- a/SpaceWarp.Core/API/Mods/PluginList.cs +++ b/SpaceWarp.Core/API/Mods/PluginList.cs @@ -167,6 +167,7 @@ public static void Disable(string guid) public static SpaceWarpErrorDescription GetErrorDescriptor(SpaceWarpPluginDescriptor plugin) { + if (_allErroredPlugins.Any(x => x.Plugin == plugin)) { return _allErroredPlugins.First(x => x.Plugin == plugin); diff --git a/SpaceWarp.Core/Backend/Modding/PluginRegister.cs b/SpaceWarp.Core/Backend/Modding/PluginRegister.cs index 82cbe719..88d24c1c 100644 --- a/SpaceWarp.Core/Backend/Modding/PluginRegister.cs +++ b/SpaceWarp.Core/Backend/Modding/PluginRegister.cs @@ -187,9 +187,10 @@ ModInfo metadata private static string ClearPrerelease(string version) { var semver = new SemanticVersion(version); - return $"{semver.Major}.{semver.Minor}.{semver.Patch}{(semver.VersionNumbers.Count > 3 ? $".{semver.VersionNumbers[3]}" : "")}"; + return + $"{semver.Major}.{semver.Minor}.{semver.Patch}{(semver.VersionNumbers.Count > 3 ? $".{semver.VersionNumbers[3]}" : "")}"; } - + private static bool AssertMatchingVersions( SpaceWarpPluginDescriptor descriptor, BaseUnityPlugin plugin, @@ -460,7 +461,10 @@ private static void RegisterAllErroredMods() { info.Location = plugin.Key; if (PluginList.AllPlugins.Any( - x => string.Equals(x.Guid, info.Metadata.GUID, StringComparison.InvariantCultureIgnoreCase) + x => string.Equals(x.Guid, info.Metadata.GUID, StringComparison.InvariantCultureIgnoreCase) || + (x.Plugin is BaseUnityPlugin baseUnityPlugin && string.Equals( + baseUnityPlugin.Info.Metadata.GUID, info.Metadata.GUID, + StringComparison.InvariantCultureIgnoreCase)) )) continue; var descriptor = new SpaceWarpPluginDescriptor( diff --git a/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs b/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs index ac4eec67..6f53e861 100644 --- a/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs +++ b/SpaceWarp.Core/Patching/LoadingActions/FunctionalLoadingActions.cs @@ -16,7 +16,7 @@ string filename if (assetBundle == null) { throw new Exception( - $"Failed to load AssetBundle {internalPath}"); + $"Failed to load AssetBundle {internalPath} ({filename})"); } internalPath = internalPath.Replace(".bundle", ""); diff --git a/SpaceWarp.Core/SpaceWarpPlugin.cs b/SpaceWarp.Core/SpaceWarpPlugin.cs index 92abfd40..a4bdec41 100644 --- a/SpaceWarp.Core/SpaceWarpPlugin.cs +++ b/SpaceWarp.Core/SpaceWarpPlugin.cs @@ -41,6 +41,7 @@ public sealed class SpaceWarpPlugin : BaseSpaceWarpPlugin public SpaceWarpPlugin() { + // Load the type forwarders Assembly.LoadFile( $"{new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName}\\SpaceWarp.dll"); Logger = base.Logger; @@ -59,6 +60,7 @@ private static void OnLanguageSourceAssetLoaded(LanguageSourceAsset asset) } public void Awake() { + BepInEx.Bootstrap.Chainloader.ManagerObject.Persist(); IOProvider.Init(); Harmony.CreateAndPatchAll(typeof(SpaceWarpPlugin).Assembly, ModGuid); @@ -98,7 +100,6 @@ private void SetupLuaState() public override void OnPreInitialized() { // Persist all game objects so I don't need to stomp on config - BepInEx.Bootstrap.Chainloader.ManagerObject.Persist(); ModuleManager.PreInitializeAllModules(); } diff --git a/SpaceWarp.VersionChecking/Modules/VersionChecking.cs b/SpaceWarp.VersionChecking/Modules/VersionChecking.cs index e3998a34..84677fed 100644 --- a/SpaceWarp.VersionChecking/Modules/VersionChecking.cs +++ b/SpaceWarp.VersionChecking/Modules/VersionChecking.cs @@ -111,11 +111,16 @@ private IEnumerator CheckVersion(string guid, SpaceWarpPluginDescriptor info) { ModuleLogger.LogError($"Unable to check version for {guid} due to error {e}"); } - + info.Outdated = isOutdated; info.Unsupported = unsupported; + if (isOutdated) + { + ModuleLogger.LogWarning($"{guid} is outdated"); + } if (unsupported) { + ModuleLogger.LogWarning($"{guid} is unsupported"); info.SWInfo.SupportedKsp2Versions = newKSP2Versions; } } @@ -206,6 +211,11 @@ private void CheckModKspVersion(string guid, SpaceWarpPluginDescriptor info, str ModuleLogger.LogError($"Unable to check KSP version for {guid} due to error {e}"); } + if (unsupported) + { + ModuleLogger.LogWarning($"{guid} is unsupported"); + } + info.Unsupported = info.Unsupported || unsupported; } } \ No newline at end of file diff --git a/SpaceWarpBuildTemplate/swinfo.json b/SpaceWarpBuildTemplate/swinfo.json index 98344e8f..7facc128 100644 --- a/SpaceWarpBuildTemplate/swinfo.json +++ b/SpaceWarpBuildTemplate/swinfo.json @@ -6,7 +6,7 @@ "description": "Space-Warp is an API for KSP2 mod developers.", "source": "https://github.com/SpaceWarpDev/SpaceWarp", "version_check": "https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/SpaceWarpBuildTemplate/swinfo.json", - "version": "1.5.0", + "version": "1.5.1", "dependencies": [ { "id": "UitkForKsp2",