From def680fb9c575e74483aa236070ac4586f29cd93 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 29 Jan 2016 20:31:22 -0500 Subject: [PATCH] iflt --- .../attributes/code/instructions/IfCmpLt.java | 28 +++++++++++++++++++ .../attributes/code/instructions/IfLt.java | 28 +++++++++++++++++++ .../deobfuscators/rename/MapStaticTest.java | 13 +++++---- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/IfCmpLt.java b/src/main/java/net/runelite/deob/attributes/code/instructions/IfCmpLt.java index 0fdc66ef1b..710d302393 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/IfCmpLt.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/IfCmpLt.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.deobfuscators.rename.ParallelExecutorMapping; +import net.runelite.deob.execution.InstructionContext; public class IfCmpLt extends If { @@ -10,4 +12,30 @@ public class IfCmpLt 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 IfCmpGe) + { + return true; + } + + return false; + } + + @Override + public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other) + { + if (other.getInstruction() instanceof IfCmpGe) + { + super.mapOtherBranch(mapping, ctx, other); + } + else + { + super.map(mapping, ctx, other); + } + } } diff --git a/src/main/java/net/runelite/deob/attributes/code/instructions/IfLt.java b/src/main/java/net/runelite/deob/attributes/code/instructions/IfLt.java index c1fcfd7f39..ebb6536798 100644 --- a/src/main/java/net/runelite/deob/attributes/code/instructions/IfLt.java +++ b/src/main/java/net/runelite/deob/attributes/code/instructions/IfLt.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.deobfuscators.rename.ParallelExecutorMapping; +import net.runelite.deob.execution.InstructionContext; public class IfLt extends If0 { @@ -10,4 +12,30 @@ public class IfLt extends If0 super(instructions, type, pc); } + @Override + public boolean isSame(InstructionContext thisIc, InstructionContext otherIc) + { + if (super.isSame(thisIc, otherIc)) + return true; + + if (otherIc.getInstruction() instanceof IfGe) + { + return true; + } + + return false; + } + + @Override + public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other) + { + if (other.getInstruction() instanceof IfGe) + { + super.mapOtherBranch(mapping, ctx, other); + } + else + { + super.map(mapping, ctx, other); + } + } } 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 585c10b0af..5fe65f8e5f 100644 --- a/src/test/java/net/runelite/deob/deobfuscators/rename/MapStaticTest.java +++ b/src/test/java/net/runelite/deob/deobfuscators/rename/MapStaticTest.java @@ -35,6 +35,7 @@ public class MapStaticTest { "class162.method3270", "class86.method2020" }, { "class29.method711", "class36.method742" }, { "class72.run", "class72.run" }, + { "class64.vmethod3787", "class64.vmethod3664" }, }; // @Test @@ -79,8 +80,8 @@ public class MapStaticTest ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")); ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar")); - Method m1 = group1.findClass("client").findMethod("init"); - Method m2 = group2.findClass("client").findMethod("init"); + Method m1 = group1.findClass("class64").findMethod("vmethod3787"); + Method m2 = group2.findClass("class64").findMethod("vmethod3664"); ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2); @@ -97,8 +98,8 @@ public class MapStaticTest ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")); ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar")); - Method m1 = group1.findClass("class72").findMethod("run"); - Method m2 = group2.findClass("class72").findMethod("run"); + Method m1 = group1.findClass("class64").findMethod("vmethod3787"); + Method m2 = group2.findClass("class64").findMethod("vmethod3664"); HashMap all = new HashMap(); map(all, new HashSet(), m1, m2); @@ -122,7 +123,7 @@ public class MapStaticTest } } - //@Test + @Test public void testAllMap() throws Exception { ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")); @@ -147,8 +148,8 @@ public class MapStaticTest { System.out.println(e.getKey() + " <-> " + e.getValue()); } - System.out.println("Total " + all.size()); } + System.out.println("Total " + all.size()); } public List getInitialMethods(ClassGroup group)