This commit is contained in:
Adam
2016-01-29 21:24:07 -05:00
parent 39ac3f1d68
commit f50c6523c0
3 changed files with 31 additions and 6 deletions

View File

@@ -43,6 +43,10 @@ public class IfICmpEq extends If
if (isZero(s1) || isZero(s2))
return true;
}
else if (otherIc.getInstruction() instanceof IfICmpNe)
{
return true;
}
return false;
}
@@ -50,7 +54,7 @@ public class IfICmpEq extends If
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
if (other.getInstruction() instanceof IfNe)
if (other.getInstruction() instanceof IfNe || other.getInstruction() instanceof IfICmpNe)
{
super.mapOtherBranch(mapping, ctx, other);
}

View File

@@ -3,6 +3,7 @@ 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.attributes.code.instruction.types.PushConstantInstruction;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
import net.runelite.deob.execution.InstructionContext;
import net.runelite.deob.execution.StackContext;
@@ -34,7 +35,7 @@ public class IfICmpNe extends If
return true;
// check for other being ifne and this has a constant 0
if (otherIc.getInstruction() instanceof IfNe)
if (otherIc.getInstruction() instanceof IfNe || otherIc.getInstruction() instanceof IfEq)
{
StackContext s1 = thisIc.getPops().get(0),
s2 = thisIc.getPops().get(1);
@@ -45,4 +46,17 @@ public class IfICmpNe extends If
return false;
}
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
if (other.getInstruction() instanceof IfEq)
{
super.mapOtherBranch(mapping, ctx, other);
}
else
{
super.map(mapping, ctx, other);
}
}
}

View File

@@ -37,6 +37,7 @@ public class MapStaticTest
{ "class72.run", "class72.run" },
{ "class64.vmethod3787", "class64.vmethod3664" },
{ "class207.method3965", "class207.method3846" },
{ "class183.method3685", "class183.method3560" },
};
// @Test
@@ -81,8 +82,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("class207").findMethod("method3965");
Method m2 = group2.findClass("class207").findMethod("method3846");
Method m1 = group1.findClass("class183").findMethod("method3685");
Method m2 = group2.findClass("class183").findMethod("method3560");
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
@@ -93,14 +94,18 @@ public class MapStaticTest
}
}
private static boolean test;
@Test
public void testDeep() throws IOException
{
//test = true;
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("class207").findMethod("method3965");
Method m2 = group2.findClass("class207").findMethod("method3846");
Method m1 = group1.findClass("class183").findMethod("method3685");
Method m2 = group2.findClass("class183").findMethod("method3560");
HashMap<Object, Object> all = new HashMap();
map(all, new HashSet(), m1, m2);
@@ -206,6 +211,8 @@ public class MapStaticTest
catch (Throwable ex)
{
System.err.println("Error mapping " + m1 + " to " + m2);
if (test)
throw ex;
return;
}