about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2020-02-10 06:12:19 +0100
committeraszlig <aszlig@nix.build>2020-02-10 06:18:13 +0100
commitb1fb7970491a67cb41803c34563973bcd4129294 (patch)
tree049f3ecde130ab799ec1ad02b51d0683e748b042 /pkgs/games
parenta00edf982865a918d95ae822551e9c466cb9298c (diff)
monogame-patcher: Also patch late-bound methods
This is something I encountered in Invisigun Heroes, where there is a
virtual FileManagerAdapter class, which then gets bound to either the
Desktop variant or any of the other ones.

Since we always use the full path of the corresponding type/object, just
adding the Callvirt to the opcodes we patch shouldn't interfere with any
other games we patch that way and using an extra subcommand just for the
Callvirt case would only add additional boilerplate for no additional
benefits.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/patcher.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkgs/games/build-support/monogame-patcher/src/patcher.cs b/pkgs/games/build-support/monogame-patcher/src/patcher.cs
index 0ec013ff..50e50fe6 100644
--- a/pkgs/games/build-support/monogame-patcher/src/patcher.cs
+++ b/pkgs/games/build-support/monogame-patcher/src/patcher.cs
@@ -169,7 +169,8 @@ class ReplaceCall : Command {
         var il = md.Body.GetILProcessor();
 
         var found = md.Body.Instructions
-            .Where(i => i.OpCode == OpCodes.Call)
+            .Where(i => i.OpCode == OpCodes.Call ||
+                        i.OpCode == OpCodes.Callvirt)
             .Where(i => i.Operand.ToString() == this.search);
 
         foreach (Instruction i in found.ToList()) {