From 1d5017f1197862d0d9c9f7aa4e13216cad3746d6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 24 Aug 2022 17:49:12 -0400 Subject: fix broken mods with no ID listed as duplicate --- src/SMAPI/Framework/ModLoading/ModResolver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index c5648c74..5f1fbe4b 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -218,12 +218,12 @@ namespace StardewModdingAPI.Framework.ModLoading { var duplicatesByID = mods .GroupBy(mod => mod.Manifest?.UniqueID?.Trim(), mod => mod, StringComparer.OrdinalIgnoreCase) - .Where(p => p.Count() > 1); + .Where(p => !string.IsNullOrEmpty(p.Key) && p.Count() > 1); foreach (var group in duplicatesByID) { foreach (IModMetadata mod in group) { - if (mod.Status == ModMetadataStatus.Failed && mod.FailReason != ModFailReason.InvalidManifest) + if (mod.Status == ModMetadataStatus.Failed && mod.FailReason is not (ModFailReason.InvalidManifest or ModFailReason.LoadFailed or ModFailReason.MissingDependencies)) continue; string folderList = string.Join(", ", group.Select(p => p.GetRelativePathWithRoot()).OrderBy(p => p)); -- cgit From c2f474bf88a43e293d28851785a57a9ca1e60f2e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 24 Aug 2022 17:49:17 -0400 Subject: distinguish empty/XNB folders from invalid manifest for error-tracking --- src/SMAPI/Framework/ModLoading/ModFailReason.cs | 8 +++++++- src/SMAPI/Framework/ModLoading/ModResolver.cs | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/SMAPI/Framework/ModLoading/ModFailReason.cs b/src/SMAPI/Framework/ModLoading/ModFailReason.cs index cd4623e7..cfb76a33 100644 --- a/src/SMAPI/Framework/ModLoading/ModFailReason.cs +++ b/src/SMAPI/Framework/ModLoading/ModFailReason.cs @@ -9,6 +9,9 @@ namespace StardewModdingAPI.Framework.ModLoading /// Multiple copies of the mod are installed. Duplicate, + /// The folder is empty or contains only ignored files. + EmptyFolder, + /// The mod has incompatible code instructions, needs a newer SMAPI version, or is marked 'assume broken' in the SMAPI metadata list. Incompatible, @@ -22,6 +25,9 @@ namespace StardewModdingAPI.Framework.ModLoading MissingDependencies, /// The mod is marked obsolete in the SMAPI metadata list. - Obsolete + Obsolete, + + /// The folder is an XNB mod, which can't be loaded through SMAPI. + XnbMod } } diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index 5f1fbe4b..fe56f4d2 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -48,7 +48,16 @@ namespace StardewModdingAPI.Framework.ModLoading if (shouldIgnore) metadata.SetStatus(status, ModFailReason.DisabledByDotConvention, "disabled by dot convention"); else if (status == ModMetadataStatus.Failed) - metadata.SetStatus(status, ModFailReason.InvalidManifest, folder.ManifestParseErrorText); + { + ModFailReason reason = folder.ManifestParseError switch + { + ModParseError.EmptyFolder or ModParseError.EmptyVortexFolder => ModFailReason.EmptyFolder, + ModParseError.XnbMod => ModFailReason.XnbMod, + _ => ModFailReason.InvalidManifest + }; + + metadata.SetStatus(status, reason, folder.ManifestParseErrorText); + } yield return metadata; } -- cgit From 2bb8e8353ba35c2db96f88a052400997232d25f8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 29 Aug 2022 18:00:41 -0400 Subject: update compatibility workaround for the recent PyTK update --- docs/release-notes.md | 4 +++- src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs | 4 ++-- src/SMAPI.Web/Views/LogParser/Index.cshtml | 4 ++-- src/SMAPI/Framework/ContentManagers/ModContentManager.cs | 2 +- src/SMAPI/Framework/SCore.cs | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/docs/release-notes.md b/docs/release-notes.md index 68dc7874..5e84136c 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,7 +8,9 @@ --> ## Upcoming release -* Fixed broken mods sometimes incorrectly listed as duplicate. +* For players: + * Updated compatibility workaround for the recent PyTK update. + * Fixed broken mods sometimes incorrectly listed as duplicate. ## 3.16.0 Released 22 August 2022 for Stardew Valley 1.5.6 or later. See [release highlights](https://www.patreon.com/posts/70797008). diff --git a/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs b/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs index 9ee864db..83cd42b9 100644 --- a/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs @@ -10,7 +10,7 @@ using StardewModdingAPI.Internal; using StardewModdingAPI.Internal.Patching; // -// This is part of a three-part fix for PyTK 1.23.0 and earlier. When removing this, search +// This is part of a three-part fix for PyTK 1.23.* and earlier. When removing this, search // 'Platonymous.Toolkit' to find the other part in SMAPI and Content Patcher. // @@ -38,7 +38,7 @@ namespace StardewModdingAPI.Mods.ErrorHandler.ModPatches public PyTkPatcher(IModRegistry modRegistry) { IModMetadata? pyTk = (IModMetadata?)modRegistry.Get(@"Platonymous.Toolkit"); - if (pyTk is not null && !pyTk.Manifest.Version.IsNewerThan("1.23.0")) + if (pyTk is not null && pyTk.Manifest.Version.IsOlderThan("1.24.0")) PyTkPatcher.PyTk = pyTk; } diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index f71c6ac1..24fe5fa2 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -17,7 +17,7 @@ LogModInfo[] outdatedMods = log?.Mods.Where(mod => mod.HasUpdate).ToArray() ?? Array.Empty(); LogModInfo? errorHandler = log?.Mods.FirstOrDefault(p => p.IsCodeMod && p.Name == "Error Handler"); bool hasOlderErrorHandler = errorHandler?.GetParsedVersion() is not null && log?.ApiVersionParsed is not null && log.ApiVersionParsed.IsNewerThan(errorHandler.GetParsedVersion()); - bool isPyTkCompatibilityMode = log?.ApiVersionParsed?.IsOlderThan("3.15.0") is false && log.Mods.Any(p => p.IsCodeMod && p.Name == "PyTK" && p.GetParsedVersion()?.IsOlderThan("1.23.1") is true); + bool isPyTkCompatibilityMode = log?.ApiVersionParsed?.IsOlderThan("3.15.0") is false && log.Mods.Any(p => p.IsCodeMod && p.Name == "PyTK" && p.GetParsedVersion()?.IsOlderThan("1.24.0") is true); // get filters IDictionary defaultFilters = Enum @@ -257,7 +257,7 @@ else if (log?.IsValid == true) } @if (isPyTkCompatibilityMode) { -
  • PyTK 1.23.0 or earlier isn't compatible with newer SMAPI performance optimizations. This may increase loading times or in-game lag.
  • +
  • PyTK 1.23.* or earlier isn't compatible with newer SMAPI performance optimizations. This may increase loading times or in-game lag.
  • } @if (outdatedMods.Any()) { diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index 8ecbc4cc..6a36ab48 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -212,7 +212,7 @@ namespace StardewModdingAPI.Framework.ContentManagers // current file has a '.pytk.json' rescale file though, since PyTK may still // rescale it if the original asset or another edit gets rescaled. asRawData = false; - this.Monitor.LogOnce("Enabled compatibility mode for PyTK 1.23.0 or earlier. This won't cause any issues, but may impact performance.", LogLevel.Warn); + this.Monitor.LogOnce("Enabled compatibility mode for PyTK 1.23.* or earlier. This won't cause any issues, but may impact performance.", LogLevel.Warn); } } diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 0f86ed6b..a5e51bdf 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1673,11 +1673,11 @@ namespace StardewModdingAPI.Framework this.ReloadTranslations(loaded); // set temporary PyTK compatibility mode - // This is part of a three-part fix for PyTK 1.23.0 and earlier. When removing this, + // This is part of a three-part fix for PyTK 1.23.* and earlier. When removing this, // search 'Platonymous.Toolkit' to find the other part in SMAPI and Content Patcher. { IModInfo? pyTk = this.ModRegistry.Get("Platonymous.Toolkit"); - ModContentManager.EnablePyTkLegacyMode = pyTk is not null && pyTk.Manifest.Version.IsOlderThan("1.23.1"); + ModContentManager.EnablePyTkLegacyMode = pyTk is not null && pyTk.Manifest.Version.IsOlderThan("1.24.0"); } // initialize loaded non-content-pack mods -- cgit From 47a68fbb7bb6afc9ecaa3a13b450ddc865754de8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 29 Aug 2022 18:17:53 -0400 Subject: deprecate PyTK compatibility mode --- src/SMAPI.Mods.ErrorHandler/ModEntry.cs | 8 ++++++-- src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs | 2 ++ src/SMAPI/Framework/ContentManagers/ModContentManager.cs | 6 +++++- src/SMAPI/Framework/SCore.cs | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/SMAPI.Mods.ErrorHandler/ModEntry.cs b/src/SMAPI.Mods.ErrorHandler/ModEntry.cs index 22e68421..25056b5e 100644 --- a/src/SMAPI.Mods.ErrorHandler/ModEntry.cs +++ b/src/SMAPI.Mods.ErrorHandler/ModEntry.cs @@ -2,7 +2,9 @@ using System; using System.Reflection; using StardewModdingAPI.Events; using StardewModdingAPI.Internal.Patching; +#if SMAPI_DEPRECATED using StardewModdingAPI.Mods.ErrorHandler.ModPatches; +#endif using StardewModdingAPI.Mods.ErrorHandler.Patches; using StardewValley; @@ -39,10 +41,12 @@ namespace StardewModdingAPI.Mods.ErrorHandler new ObjectPatcher(), new SaveGamePatcher(this.Monitor, this.OnSaveContentRemoved), new SpriteBatchPatcher(), - new UtilityPatcher(), + new UtilityPatcher() +#if SMAPI_DEPRECATED // mod patches - new PyTkPatcher(helper.ModRegistry) + , new PyTkPatcher(helper.ModRegistry) +#endif ); // hook events diff --git a/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs b/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs index 83cd42b9..f084902a 100644 --- a/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/ModPatches/PyTkPatcher.cs @@ -1,3 +1,4 @@ +#if SMAPI_DEPRECATED using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; @@ -77,3 +78,4 @@ namespace StardewModdingAPI.Mods.ErrorHandler.ModPatches } } } +#endif diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index 6a36ab48..cc6f8372 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -50,8 +50,10 @@ namespace StardewModdingAPI.Framework.ContentManagers /********* ** Accessors *********/ +#if SMAPI_DEPRECATED /// Whether to enable legacy compatibility mode for PyTK scale-up textures. internal static bool EnablePyTkLegacyMode; +#endif /********* @@ -202,6 +204,7 @@ namespace StardewModdingAPI.Framework.ContentManagers bool expectsRawData = typeof(T).IsAssignableTo(typeof(IRawTextureData)); bool asRawData = expectsRawData || this.UseRawImageLoading; +#if SMAPI_DEPRECATED // disable raw data if PyTK will rescale the image (until it supports raw data) if (asRawData && !expectsRawData) { @@ -212,9 +215,10 @@ namespace StardewModdingAPI.Framework.ContentManagers // current file has a '.pytk.json' rescale file though, since PyTK may still // rescale it if the original asset or another edit gets rescaled. asRawData = false; - this.Monitor.LogOnce("Enabled compatibility mode for PyTK 1.23.* or earlier. This won't cause any issues, but may impact performance.", LogLevel.Warn); + this.Monitor.LogOnce("Enabled compatibility mode for PyTK 1.23.* or earlier. This won't cause any issues, but may impact performance. This will no longer be supported in the upcoming SMAPI 4.0.0.", LogLevel.Warn); } } +#endif // load if (asRawData) diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index a5e51bdf..16ff2537 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1672,6 +1672,7 @@ namespace StardewModdingAPI.Framework // initialize translations this.ReloadTranslations(loaded); +#if SMAPI_DEPRECATED // set temporary PyTK compatibility mode // This is part of a three-part fix for PyTK 1.23.* and earlier. When removing this, // search 'Platonymous.Toolkit' to find the other part in SMAPI and Content Patcher. @@ -1679,6 +1680,7 @@ namespace StardewModdingAPI.Framework IModInfo? pyTk = this.ModRegistry.Get("Platonymous.Toolkit"); ModContentManager.EnablePyTkLegacyMode = pyTk is not null && pyTk.Manifest.Version.IsOlderThan("1.24.0"); } +#endif // initialize loaded non-content-pack mods this.Monitor.Log("Launching mods...", LogLevel.Debug); -- cgit From 8b6c732d7168edacf44d4dbabd8613f2c38ebc19 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 29 Aug 2022 18:18:21 -0400 Subject: prepare for release --- build/common.targets | 2 +- docs/release-notes.md | 6 ++++-- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.ErrorHandler/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/build/common.targets b/build/common.targets index 383e258b..1a81a105 100644 --- a/build/common.targets +++ b/build/common.targets @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed. - 3.16.0 + 3.16.1 SMAPI latest $(AssemblySearchPaths);{GAC} diff --git a/docs/release-notes.md b/docs/release-notes.md index 5e84136c..f306607c 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,9 +7,11 @@ _If needed, you can update to SMAPI 3.16.0 first and then install the latest version._ --> -## Upcoming release +## 3.16.1 +Released 29 August 2022 for Stardew Valley 1.5.6 or later. + * For players: - * Updated compatibility workaround for the recent PyTK update. + * Updated PyTK compatibility mode for the latest PyTK version. * Fixed broken mods sometimes incorrectly listed as duplicate. ## 3.16.0 diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index adc45ec3..f3dc8aef 100644 --- a/src/SMAPI.Mods.ConsoleCommands/manifest.json +++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json @@ -1,9 +1,9 @@ { "Name": "Console Commands", "Author": "SMAPI", - "Version": "3.16.0", + "Version": "3.16.1", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.16.0" + "MinimumApiVersion": "3.16.1" } diff --git a/src/SMAPI.Mods.ErrorHandler/manifest.json b/src/SMAPI.Mods.ErrorHandler/manifest.json index 3a3c9283..cbcf0f82 100644 --- a/src/SMAPI.Mods.ErrorHandler/manifest.json +++ b/src/SMAPI.Mods.ErrorHandler/manifest.json @@ -1,9 +1,9 @@ { "Name": "Error Handler", "Author": "SMAPI", - "Version": "3.16.0", + "Version": "3.16.1", "Description": "Handles some common vanilla errors to log more useful info or avoid breaking the game.", "UniqueID": "SMAPI.ErrorHandler", "EntryDll": "ErrorHandler.dll", - "MinimumApiVersion": "3.16.0" + "MinimumApiVersion": "3.16.1" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index eb98aa32..5aa092ef 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -1,9 +1,9 @@ { "Name": "Save Backup", "Author": "SMAPI", - "Version": "3.16.0", + "Version": "3.16.1", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.16.0" + "MinimumApiVersion": "3.16.1" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index c79a72ef..14aaf166 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -52,7 +52,7 @@ namespace StardewModdingAPI internal static int? LogScreenId { get; set; } /// SMAPI's current raw semantic version. - internal static string RawApiVersion = "3.16.0"; + internal static string RawApiVersion = "3.16.1"; } /// Contains SMAPI's constants and assumptions. -- cgit