diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-03-26 19:01:35 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-03-26 19:01:35 -0400 |
commit | 85ed48809032fdbb8461ce4c34acfbe06f68652b (patch) | |
tree | 957c768ddcb8d3a7dc4928803aae775e9b632970 /src/StardewModdingAPI/Constants.cs | |
parent | 23443721cd2cc5391510a6e65b4e6559037e5b5e (diff) | |
download | SMAPI-85ed48809032fdbb8461ce4c34acfbe06f68652b.tar.gz SMAPI-85ed48809032fdbb8461ce4c34acfbe06f68652b.tar.bz2 SMAPI-85ed48809032fdbb8461ce4c34acfbe06f68652b.zip |
merge CIL finders & rewriters into one interface (#254)
Diffstat (limited to 'src/StardewModdingAPI/Constants.cs')
-rw-r--r-- | src/StardewModdingAPI/Constants.cs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs index 52be6c05..de0eab57 100644 --- a/src/StardewModdingAPI/Constants.cs +++ b/src/StardewModdingAPI/Constants.cs @@ -137,12 +137,15 @@ namespace StardewModdingAPI return new PlatformAssemblyMap(targetPlatform, removeAssemblyReferences, targetAssemblies); } - /// <summary>Get finders which match incompatible CIL instructions in mod assemblies.</summary> - internal static IEnumerable<IInstructionFinder> GetIncompatibilityFinders() + /// <summary>Get rewriters which detect or fix incompatible CIL instructions in mod assemblies.</summary> + internal static IEnumerable<IInstructionRewriter> GetRewriters() { - return new IInstructionFinder[] + return new IInstructionRewriter[] { - // changes in Stardew Valley 1.2 (that don't have rewriters) + /**** + ** Finders throw an exception when incompatible code is found. + ****/ + // changes in Stardew Valley 1.2 (with no rewriters) new FieldFinder("StardewValley.Item", "set_Name"), // APIs removed in SMAPI 1.9 @@ -161,15 +164,11 @@ namespace StardewModdingAPI new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderHudEventNoCheck"), new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPostRenderGuiEventNoCheck"), new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderHudEventNoCheck"), - new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck") - }; - } + new EventFinder("StardewModdingAPI.Events.GraphicsEvents", "OnPreRenderGuiEventNoCheck"), - /// <summary>Get rewriters which fix incompatible CIL instructions in mod assemblies.</summary> - internal static IEnumerable<IInstructionRewriter> GetRewriters() - { - return new IInstructionRewriter[] - { + /**** + ** Rewriters change CIL as needed to fix incompatible code + ****/ // crossplatform new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchWrapper), onlyIfPlatformChanged: true), |