From b1fb7970491a67cb41803c34563973bcd4129294 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Feb 2020 06:12:19 +0100 Subject: 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 --- pkgs/games/build-support/monogame-patcher/src/patcher.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkgs/games/build-support') 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()) { -- cgit 1.4.1