summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/ModLoading
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Framework/ModLoading')
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs18
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/InstructionHandleResult.cs5
2 files changed, 21 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs b/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs
index 32988f97..1e3c4a05 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/AssemblyLoader.cs
@@ -25,6 +25,9 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>Encapsulates monitoring and logging.</summary>
private readonly IMonitor Monitor;
+ /// <summary>Whether to enable developer mode logging.</summary>
+ private readonly bool IsDeveloperMode;
+
/*********
** Public methods
@@ -32,9 +35,11 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>Construct an instance.</summary>
/// <param name="targetPlatform">The current game platform.</param>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
- public AssemblyLoader(Platform targetPlatform, IMonitor monitor)
+ /// <param name="isDeveloperMode">Whether to enable developer mode logging.</param>
+ public AssemblyLoader(Platform targetPlatform, IMonitor monitor, bool isDeveloperMode)
{
this.Monitor = monitor;
+ this.IsDeveloperMode = isDeveloperMode;
this.AssemblyMap = Constants.GetAssemblyMap(targetPlatform);
// generate type => assembly lookup for types which should be rewritten
@@ -276,6 +281,17 @@ namespace StardewModdingAPI.Framework.ModLoading
this.Monitor.LogOnce(loggedMessages, $"{mod.DisplayName} seems to change the save serialiser. It may change your saves in such a way that they won't work without this mod in the future.", LogLevel.Warn);
break;
+ case InstructionHandleResult.DetectedDynamic:
+ this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Detected 'dynamic' keyword ({handler.NounPhrase}) in assembly {filename}.");
+ this.Monitor.LogOnce(loggedMessages, $"{mod.DisplayName} uses the 'dynamic' keyword, which isn't compatible with Stardew Valley on Linux or Mac.",
+#if SMAPI_FOR_WINDOWS
+ this.IsDeveloperMode ? LogLevel.Warn : LogLevel.Debug
+#else
+ LogLevel.Warn
+#endif
+ );
+ break;
+
case InstructionHandleResult.None:
break;
diff --git a/src/StardewModdingAPI/Framework/ModLoading/InstructionHandleResult.cs b/src/StardewModdingAPI/Framework/ModLoading/InstructionHandleResult.cs
index 95d57ef2..0ae598fc 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/InstructionHandleResult.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/InstructionHandleResult.cs
@@ -16,6 +16,9 @@ namespace StardewModdingAPI.Framework.ModLoading
DetectedGamePatch,
/// <summary>The instruction is compatible, but affects the save serializer in a way that may make saves unloadable without the mod.</summary>
- DetectedSaveSerialiser
+ DetectedSaveSerialiser,
+
+ /// <summary>The instruction is compatible, but uses the <c>dynamic</c> keyword which won't work on Linux/Mac.</summary>
+ DetectedDynamic
}
}