Fix tests
This commit is contained in:
@@ -38,7 +38,7 @@ public class Execution
|
|||||||
private MultiValueMap<InstructionContext, Method> invokes = new MultiValueMap<>();
|
private MultiValueMap<InstructionContext, Method> invokes = new MultiValueMap<>();
|
||||||
public MultiValueMap<Instruction, InstructionContext> contexts = new MultiValueMap<>();
|
public MultiValueMap<Instruction, InstructionContext> contexts = new MultiValueMap<>();
|
||||||
public boolean paused;
|
public boolean paused;
|
||||||
public boolean step = true;
|
public boolean step = false;
|
||||||
|
|
||||||
public Execution(ClassGroup group)
|
public Execution(ClassGroup group)
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,9 @@ public class Execution
|
|||||||
|
|
||||||
public Frame invoke(InstructionContext from, Method to)
|
public Frame invoke(InstructionContext from, Method to)
|
||||||
{
|
{
|
||||||
if(!step) return null;//THIS BREAKS THIS
|
if (step) // step executor
|
||||||
|
return null;
|
||||||
|
|
||||||
if (hasInvoked(from, to))
|
if (hasInvoked(from, to))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ public class Frame
|
|||||||
/* jump */
|
/* jump */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!execution.step && oldCur instanceof MappableInstruction)
|
if (execution.step && oldCur instanceof MappableInstruction)
|
||||||
{
|
{
|
||||||
execution.paused = true;
|
execution.paused = true;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ParallellMappingExecutor
|
|||||||
|
|
||||||
p1 = p2 = null;
|
p1 = p2 = null;
|
||||||
|
|
||||||
if (e.frames.isEmpty())
|
if (e.frames.isEmpty() || e2.frames.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Frame f1 = e.frames.get(0), f2 = e2.frames.get(0);
|
Frame f1 = e.frames.get(0), f2 = e2.frames.get(0);
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package net.runelite.deob.deobfuscators.rename;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import net.runelite.deob.ClassGroup;
|
import net.runelite.deob.ClassGroup;
|
||||||
import net.runelite.deob.Method;
|
import net.runelite.deob.Method;
|
||||||
@@ -30,6 +32,31 @@ public class MapTest
|
|||||||
if (l1.size() != l2.size())
|
if (l1.size() != l2.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Map<Class, Integer> map1 = new HashMap<>(),
|
||||||
|
map2 = new HashMap<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < l1.size(); ++i)
|
||||||
|
{
|
||||||
|
Instruction i1 = l1.get(i);
|
||||||
|
|
||||||
|
Integer c = map1.get(i1.getClass());
|
||||||
|
if (c == null)
|
||||||
|
map1.put(i1.getClass(), 1);
|
||||||
|
else
|
||||||
|
map1.put(i1.getClass(), c + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < l2.size(); ++i)
|
||||||
|
{
|
||||||
|
Instruction i2 = l2.get(i);
|
||||||
|
|
||||||
|
Integer c = map2.get(i2.getClass());
|
||||||
|
if (c == null)
|
||||||
|
map2.put(i2.getClass(), 1);
|
||||||
|
else
|
||||||
|
map2.put(i2.getClass(), c + 1);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,8 +67,8 @@ public class MapTest
|
|||||||
ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||||
|
|
||||||
Assert.assertTrue(isMappable(
|
Assert.assertTrue(isMappable(
|
||||||
group1.findClass("client").findMethod("init"),
|
group1.findClass("class99").findMethod("method2220"),
|
||||||
group2.findClass("client").findMethod("init")
|
group2.findClass("class99").findMethod("method2149")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,12 +80,14 @@ public class MapTest
|
|||||||
|
|
||||||
Method m1 = group1.findClass("class99").findMethod("method2220");
|
Method m1 = group1.findClass("class99").findMethod("method2220");
|
||||||
Execution e = new Execution(group1);
|
Execution e = new Execution(group1);
|
||||||
|
e.step = true;
|
||||||
Frame frame = new Frame(e, m1);
|
Frame frame = new Frame(e, m1);
|
||||||
frame.initialize();
|
frame.initialize();
|
||||||
e.frames.add(frame);
|
e.frames.add(frame);
|
||||||
|
|
||||||
Method m2 = group2.findClass("class99").findMethod("method2149");
|
Method m2 = group2.findClass("class99").findMethod("method2149");
|
||||||
Execution e2 = new Execution(group2);
|
Execution e2 = new Execution(group2);
|
||||||
|
e2.step = true;
|
||||||
Frame frame2 = new Frame(e2, m2);
|
Frame frame2 = new Frame(e2, m2);
|
||||||
frame2.initialize();
|
frame2.initialize();
|
||||||
e2.frames.add(frame2);
|
e2.frames.add(frame2);
|
||||||
|
|||||||
Reference in New Issue
Block a user