From 44372c8696a1d728efdc4889796b5018c4801846 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 11 Jan 2016 08:44:49 -0500 Subject: [PATCH] Another method --- .../code/instructions/IfACmpEq.java | 26 +++++++++++++++++++ .../deobfuscators/rename/MapStaticTest.java | 13 +++++----- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/IfACmpEq.java b/src/main/java/net/runelite/deob/attributes/code/instructions/IfACmpEq.java index 9cf68576d8..75e5c700e8 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/IfACmpEq.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/IfACmpEq.java @@ -2,6 +2,8 @@ package net.runelite.deob.attributes.code.instructions; import net.runelite.deob.attributes.code.InstructionType; import net.runelite.deob.attributes.code.Instructions; +import net.runelite.deob.execution.InstructionContext; +import net.runelite.deob.execution.StackContext; public class IfACmpEq extends If { @@ -9,4 +11,28 @@ public class IfACmpEq extends If { super(instructions, type, pc); } + + @Override + public boolean isSame(InstructionContext thisIc, InstructionContext otherIc) + { + if (super.isSame(thisIc, otherIc)) + return true; + + if (otherIc.getInstruction() instanceof IfNull) + { + StackContext s1 = thisIc.getPops().get(0), + s2 = thisIc.getPops().get(1); + + if (s1.getPushed().getInstruction() instanceof AConstNull) + { + return true; + } + if (s2.getPushed().getInstruction() instanceof AConstNull) + { + return true; + } + } + + return false; + } } diff --git a/src/test/java/net/runelite/deob/deobfuscators/rename/MapStaticTest.java b/src/test/java/net/runelite/deob/deobfuscators/rename/MapStaticTest.java index 7641ff3cb8..1ebb923170 100644 --- a/src/test/java/net/runelite/deob/deobfuscators/rename/MapStaticTest.java +++ b/src/test/java/net/runelite/deob/deobfuscators/rename/MapStaticTest.java @@ -14,6 +14,7 @@ public class MapStaticTest { "client.vmethod3054", "client.vmethod2973" }, { "class99.method2220", "class99.method2149" }, { "class146.vmethod3158", "class146.vmethod3070" }, + { "class166.method3315", "class166.method3254" }, }; //@Test @@ -31,8 +32,8 @@ public class MapStaticTest //@Test public void testAll() throws IOException { - ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")); - ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar")); + ClassGroup group1 = JarUtil.loadJar(new File("c:/rs/adamin1.jar")); + ClassGroup group2 = JarUtil.loadJar(new File("c:/rs/adamin2.jar")); for (String[] s : methods) { @@ -48,11 +49,11 @@ public class MapStaticTest @Test public void test() throws IOException { - ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")); - ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar")); + ClassGroup group1 = JarUtil.loadJar(new File("c:/rs/adamin1.jar")); + ClassGroup group2 = JarUtil.loadJar(new File("c:/rs/adamin2.jar")); - Method m1 = group1.findClass("class146").findMethod("vmethod3158"); - Method m2 = group2.findClass("class146").findMethod("vmethod3070"); + Method m1 = group1.findClass("class166").findMethod("method3315"); + Method m2 = group2.findClass("class166").findMethod("method3254"); ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2); }