summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading
diff options
context:
space:
mode:
authorDavid Camp <Bpendragon@users.noreply.github.com>2021-01-15 18:48:29 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-15 18:48:29 -0500
commitf945349ed40b770c1f7788f659d4ef3980abe3ff (patch)
tree6e50598531e75d7fa00a1ca9899a23ff18e5c174 /src/SMAPI/Framework/ModLoading
parent8a475b35790506a18aa94a68530b40e8326017ca (diff)
downloadSMAPI-f945349ed40b770c1f7788f659d4ef3980abe3ff.tar.gz
SMAPI-f945349ed40b770c1f7788f659d4ef3980abe3ff.tar.bz2
SMAPI-f945349ed40b770c1f7788f659d4ef3980abe3ff.zip
(feat) Disable Mod rewrites if requested
Diffstat (limited to 'src/SMAPI/Framework/ModLoading')
-rw-r--r--src/SMAPI/Framework/ModLoading/AssemblyLoader.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
index 9fb5384e..d6a32621 100644
--- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
+++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
@@ -37,6 +37,9 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>The objects to dispose as part of this instance.</summary>
private readonly HashSet<IDisposable> Disposables = new HashSet<IDisposable>();
+ /// <summary>Whether mods should be re-writen for compatibility.</summary>
+ private readonly bool RewriteMods;
+
/*********
** Public methods
@@ -45,10 +48,12 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <param name="targetPlatform">The current game platform.</param>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
/// <param name="paranoidMode">Whether to detect paranoid mode issues.</param>
- public AssemblyLoader(Platform targetPlatform, IMonitor monitor, bool paranoidMode)
+ /// <param name="rewriteMods">Whether to rewrite potentially broken mods or not.</param>
+ public AssemblyLoader(Platform targetPlatform, IMonitor monitor, bool paranoidMode, bool rewriteMods)
{
this.Monitor = monitor;
this.ParanoidMode = paranoidMode;
+ this.RewriteMods = rewriteMods;
this.AssemblyMap = this.TrackForDisposal(Constants.GetAssemblyMap(targetPlatform));
// init resolver
@@ -308,7 +313,7 @@ namespace StardewModdingAPI.Framework.ModLoading
}
// find or rewrite code
- IInstructionHandler[] handlers = new InstructionMetadata().GetHandlers(this.ParanoidMode, platformChanged).ToArray();
+ IInstructionHandler[] handlers = new InstructionMetadata().GetHandlers(this.ParanoidMode, platformChanged, this.RewriteMods).ToArray();
RecursiveRewriter rewriter = new RecursiveRewriter(
module: module,
rewriteType: (type, replaceWith) =>