diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeInterface.java b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeInterface.java index 577d060ee5..2ac648d3d6 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeInterface.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeInterface.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import net.runelite.deob.Field; +import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.attributes.code.instruction.types.MappableInstruction; import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil; import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping; @@ -171,6 +173,29 @@ public class InvokeInterface extends Instruction implements InvokeInstruction for (int i = 0; i < myMethods.size(); ++i) mapping.map(myMethods.get(i), otherMethods.get(i)); + + for (int i = 0; i < ctx.getPops().size(); ++i) + { + StackContext s1 = ctx.getPops().get(i), + s2 = other.getPops().get(i); + + InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1); + InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2); + + if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction) + { + GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(), + gf2 = (GetFieldInstruction) base2.getInstruction(); + + Field f1 = gf1.getMyField(), + f2 = gf2.getMyField(); + + if (f1 != null && f2 != null) + { + mapping.map(f1, f2); + } + } + } } @Override diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeSpecial.java b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeSpecial.java index 3a95e8cdb0..43f02068a4 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeSpecial.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeSpecial.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import net.runelite.deob.Field; +import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil; import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping; import net.runelite.deob.execution.Execution; @@ -171,6 +173,29 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction for (int i = 0; i < myMethods.size(); ++i) mapping.map(myMethods.get(i), otherMethods.get(i)); + + for (int i = 0; i < ctx.getPops().size(); ++i) + { + StackContext s1 = ctx.getPops().get(i), + s2 = other.getPops().get(i); + + InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1); + InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2); + + if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction) + { + GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(), + gf2 = (GetFieldInstruction) base2.getInstruction(); + + Field f1 = gf1.getMyField(), + f2 = gf2.getMyField(); + + if (f1 != null && f2 != null) + { + mapping.map(f1, f2); + } + } + } } @Override diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeStatic.java b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeStatic.java index 5960585200..7fba2f5c18 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeStatic.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeStatic.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import net.runelite.deob.Field; +import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil; import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping; import net.runelite.deob.execution.Execution; @@ -173,6 +175,29 @@ public class InvokeStatic extends Instruction implements InvokeInstruction for (int i = 0; i < myMethods.size(); ++i) mapping.map(myMethods.get(i), otherMethods.get(i)); + + for (int i = 0; i < ctx.getPops().size(); ++i) + { + StackContext s1 = ctx.getPops().get(i), + s2 = other.getPops().get(i); + + InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1); + InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2); + + if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction) + { + GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(), + gf2 = (GetFieldInstruction) base2.getInstruction(); + + Field f1 = gf1.getMyField(), + f2 = gf2.getMyField(); + + if (f1 != null && f2 != null) + { + mapping.map(f1, f2); + } + } + } } @Override diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeVirtual.java b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeVirtual.java index 006163810e..df7fad7ac6 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeVirtual.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/InvokeVirtual.java @@ -24,6 +24,8 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; +import net.runelite.deob.Field; +import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil; import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping; import net.runelite.deob.execution.Execution; @@ -194,6 +196,32 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction mapping.map(m1, m2); } + + /* map arguments */ + assert ctx.getPops().size() == other.getPops().size(); + + for (int i = 0; i < ctx.getPops().size(); ++i) + { + StackContext s1 = ctx.getPops().get(i), + s2 = other.getPops().get(i); + + InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1); + InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2); + + if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction) + { + GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(), + gf2 = (GetFieldInstruction) base2.getInstruction(); + + Field f1 = gf1.getMyField(), + f2 = gf2.getMyField(); + + if (f1 != null && f2 != null) + { + mapping.map(f1, f2); + } + } + } } @Override