mappable test seems to not work well, I think because of static methods
This commit is contained in:
@@ -2,6 +2,9 @@ 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;
|
||||
import net.runelite.deob.execution.StackContext;
|
||||
|
||||
public class IfACmpNe extends If
|
||||
{
|
||||
@@ -9,4 +12,28 @@ public class IfACmpNe 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 IfNonNull)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 IfNonNull extends If0
|
||||
{
|
||||
@@ -10,4 +12,27 @@ public class IfNonNull 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 IfACmpNe)
|
||||
{
|
||||
StackContext s1 = otherIc.getPops().get(0),
|
||||
s2 = otherIc.getPops().get(1);
|
||||
|
||||
if (s1.getPushed().getInstruction() instanceof AConstNull)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (s2.getPushed().getInstruction() instanceof AConstNull)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.runelite.deob.util.JarUtil;
|
||||
|
||||
public class MappingExecutorUtil
|
||||
{
|
||||
// won't work with static funcs etc
|
||||
public static boolean isMappable(Method m1, Method m2)
|
||||
{
|
||||
assert (m1.getCode() == null) == (m2.getCode() == null);
|
||||
|
||||
@@ -20,17 +20,24 @@ public class MapStaticTest
|
||||
{ "class222.method4086", "class222.method3957" }
|
||||
};
|
||||
|
||||
//@Test
|
||||
public void testMappable() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("c:/rs/adamin1.jar"));
|
||||
ClassGroup group2 = JarUtil.loadJar(new File("c:/rs/adamin2.jar"));
|
||||
|
||||
// Assert.assertTrue(MappingExecutorUtil.isMappable(
|
||||
// group1.findClass("class99").findMethod("method2220"),
|
||||
// group2.findClass("class99").findMethod("method2149")
|
||||
// ));
|
||||
}
|
||||
// @Test
|
||||
// public void testMappable() throws IOException
|
||||
// {
|
||||
// ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar"));
|
||||
// ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||
//
|
||||
// for (String[] s : methods)
|
||||
// {
|
||||
// String[] one = s[0].split("\\."), two = s[1].split("\\.");
|
||||
//
|
||||
// Method m1 = group1.findClass(one[0]).findMethod(one[1]);
|
||||
// Method m2 = group2.findClass(two[0]).findMethod(two[1]);
|
||||
//
|
||||
// Assert.assertTrue(MappingExecutorUtil.isMappable(
|
||||
// m1, m2
|
||||
// ));
|
||||
// }
|
||||
// }
|
||||
|
||||
//@Test
|
||||
public void testAll() throws IOException
|
||||
@@ -55,8 +62,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("class222").findMethod("method4086");
|
||||
Method m2 = group2.findClass("class222").findMethod("method3957");
|
||||
Method m1 = group1.findClass("class40").findMethod("method851");
|
||||
Method m2 = group2.findClass("class40").findMethod("method803");
|
||||
|
||||
ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user