diff options
author | David Camp <Bpendragon@users.noreply.github.com> | 2021-01-15 18:48:29 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-15 18:48:29 -0500 |
commit | f945349ed40b770c1f7788f659d4ef3980abe3ff (patch) | |
tree | 6e50598531e75d7fa00a1ca9899a23ff18e5c174 /src/SMAPI/Metadata/InstructionMetadata.cs | |
parent | 8a475b35790506a18aa94a68530b40e8326017ca (diff) | |
download | SMAPI-f945349ed40b770c1f7788f659d4ef3980abe3ff.tar.gz SMAPI-f945349ed40b770c1f7788f659d4ef3980abe3ff.tar.bz2 SMAPI-f945349ed40b770c1f7788f659d4ef3980abe3ff.zip |
(feat) Disable Mod rewrites if requested
Diffstat (limited to 'src/SMAPI/Metadata/InstructionMetadata.cs')
-rw-r--r-- | src/SMAPI/Metadata/InstructionMetadata.cs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs index 2c1e14ce..1816e7f9 100644 --- a/src/SMAPI/Metadata/InstructionMetadata.cs +++ b/src/SMAPI/Metadata/InstructionMetadata.cs @@ -27,29 +27,32 @@ namespace StardewModdingAPI.Metadata /// <summary>Get rewriters which detect or fix incompatible CIL instructions in mod assemblies.</summary> /// <param name="paranoidMode">Whether to detect paranoid mode issues.</param> /// <param name="platformChanged">Whether the assembly was rewritten for crossplatform compatibility.</param> - public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool platformChanged) + /// <param name="rewriteMods">Whether to return Rewriters</param> + public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool platformChanged, bool rewriteMods) { /**** ** rewrite CIL to fix incompatible code ****/ // rewrite for crossplatform compatibility - if (platformChanged) - yield return new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchFacade)); + if (rewriteMods) + { + if (platformChanged) + yield return new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchFacade)); - // rewrite for Stardew Valley 1.5 - yield return new FieldReplaceRewriter(typeof(DecoratableLocation), "furniture", typeof(GameLocation), nameof(GameLocation.furniture)); - yield return new FieldReplaceRewriter(typeof(Farm), "resourceClumps", typeof(GameLocation), nameof(GameLocation.resourceClumps)); - yield return new FieldReplaceRewriter(typeof(MineShaft), "resourceClumps", typeof(GameLocation), nameof(GameLocation.resourceClumps)); + // rewrite for Stardew Valley 1.5 + yield return new FieldReplaceRewriter(typeof(DecoratableLocation), "furniture", typeof(GameLocation), nameof(GameLocation.furniture)); + yield return new FieldReplaceRewriter(typeof(Farm), "resourceClumps", typeof(GameLocation), nameof(GameLocation.resourceClumps)); + yield return new FieldReplaceRewriter(typeof(MineShaft), "resourceClumps", typeof(GameLocation), nameof(GameLocation.resourceClumps)); - // heuristic rewrites - yield return new HeuristicFieldRewriter(this.ValidateReferencesToAssemblies); - yield return new HeuristicMethodRewriter(this.ValidateReferencesToAssemblies); + // heuristic rewrites + yield return new HeuristicFieldRewriter(this.ValidateReferencesToAssemblies); + yield return new HeuristicMethodRewriter(this.ValidateReferencesToAssemblies); #if HARMONY_2 // rewrite for SMAPI 3.6 (Harmony 1.x => 2.0 update) yield return new Harmony1AssemblyRewriter(); #endif - + } /**** ** detect mod issues ****/ |