diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-09 14:28:44 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-09 14:28:44 -0500 |
commit | 5f9c03a8a93d51202e737d1d32c21e4a2e55ff08 (patch) | |
tree | 0183d835a7be1b89091b51ac3a24fb389e656934 /src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs | |
parent | 74a56a7b3b3bde30fbcb711eaef977ad69601e03 (diff) | |
download | SMAPI-5f9c03a8a93d51202e737d1d32c21e4a2e55ff08.tar.gz SMAPI-5f9c03a8a93d51202e737d1d32c21e4a2e55ff08.tar.bz2 SMAPI-5f9c03a8a93d51202e737d1d32c21e4a2e55ff08.zip |
add field rewriter for the `Game1.activeClickableMenu` change in SDV 1.2 (#231)
Diffstat (limited to 'src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs')
-rw-r--r-- | src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs b/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs index c9729ee8..e53e5c56 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs +++ b/src/StardewModdingAPI.AssemblyRewriters/Framework/BaseMethodRewriter.cs @@ -17,13 +17,9 @@ namespace StardewModdingAPI.AssemblyRewriters.Framework /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param> public bool ShouldRewrite(Instruction instruction, bool platformChanged) { - // ignore non-method-call instructions if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt) - return false; - - // check reference - MethodReference methodRef = (MethodReference)instruction.Operand; - return this.ShouldRewrite(methodRef, platformChanged); + return false; // not a method reference + return this.ShouldRewrite(instruction, (MethodReference)instruction.Operand, platformChanged); } /// <summary>Rewrite a CIL instruction for compatibility.</summary> @@ -42,9 +38,10 @@ namespace StardewModdingAPI.AssemblyRewriters.Framework ** Protected methods *********/ /// <summary>Get whether a method reference should be rewritten.</summary> + /// <param name="instruction">The IL instruction.</param> /// <param name="methodRef">The method reference.</param> /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param> - protected abstract bool ShouldRewrite(MethodReference methodRef, bool platformChanged); + protected abstract bool ShouldRewrite(Instruction instruction, MethodReference methodRef, bool platformChanged); /// <summary>Rewrite a method for compatibility.</summary> /// <param name="module">The module being rewritten.</param> |