summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs6
-rw-r--r--src/SMAPI/Framework/ModLoading/ModFailReason.cs8
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs15
-rw-r--r--src/SMAPI/Framework/SCore.cs6
4 files changed, 28 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index 8ecbc4cc..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
/// <summary>Whether to enable legacy compatibility mode for PyTK scale-up textures.</summary>
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.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. 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/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
/// <summary>Multiple copies of the mod are installed.</summary>
Duplicate,
+ /// <summary>The folder is empty or contains only ignored files.</summary>
+ EmptyFolder,
+
/// <summary>The mod has incompatible code instructions, needs a newer SMAPI version, or is marked 'assume broken' in the SMAPI metadata list.</summary>
Incompatible,
@@ -22,6 +25,9 @@ namespace StardewModdingAPI.Framework.ModLoading
MissingDependencies,
/// <summary>The mod is marked obsolete in the SMAPI metadata list.</summary>
- Obsolete
+ Obsolete,
+
+ /// <summary>The folder is an XNB mod, which can't be loaded through SMAPI.</summary>
+ XnbMod
}
}
diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs
index c5648c74..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;
}
@@ -218,12 +227,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));
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 0f86ed6b..16ff2537 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -1672,13 +1672,15 @@ 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.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");
}
+#endif
// initialize loaded non-content-pack mods
this.Monitor.Log("Launching mods...", LogLevel.Debug);