Dont know if this is right, but the pkt handlers at least can be picked up now.

This commit is contained in:
Adam
2016-02-14 18:33:51 -05:00
parent 3294e1add0
commit 83f338a2e9
5 changed files with 81 additions and 20 deletions

View File

@@ -26,6 +26,7 @@ public class Field
private String name;
private Type type;
private Attributes attributes;
public boolean packetHandler;
Field(Fields fields, DataInputStream is) throws IOException
{

View File

@@ -86,12 +86,26 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
ins.pop(one, two);
Frame other = frame.dup();
other.created = this;
other.forking = ins;
other.jump(ins, to);
ins.branch(other);
Field f1 = getComparedField(ins);
if (f1 != null && f1.getName().equals("field289"))
{
int i =5;
}
// if (f1 != null && f1.packetHandler)
// {
// assert this instanceof IfICmpNe;
//
// frame.jump(ins, to);
// }
// else
{
Frame other = frame.dup();
other.created = this;
other.forking = ins;
other.jump(ins, to);
ins.branch(other);
}
frame.addInstructionContext(ins);
}
@@ -112,14 +126,20 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
@Override
public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
{
Frame branch1 = ctx.getBranches().get(0),
branch2 = other.getBranches().get(0);
assert ctx.getBranches().size() == other.getBranches().size();
assert branch1.other == null;
assert branch2.other == null;
branch1.other = branch2;
branch2.other = branch1;
// can be empty for packet handlers
if (!ctx.getBranches().isEmpty())
{
Frame branch1 = ctx.getBranches().get(0),
branch2 = other.getBranches().get(0);
assert branch1.other == null;
assert branch2.other == null;
branch1.other = branch2;
branch2.other = branch1;
}
this.mapArguments(mapping, ctx, other);
}
@@ -173,6 +193,12 @@ public abstract class If extends Instruction implements JumpingInstruction, Comp
assert f1.getType().equals(f2.getType());
mapping.map(f1, f2);
if (f1.packetHandler && f2.packetHandler)
{
mapping.packetHandler1.add(this);
mapping.packetHandler2.add((If) other.getInstruction());
}
}
private Field getComparedField(InstructionContext ctx)

View File

@@ -7,6 +7,7 @@ import java.util.Map;
import net.runelite.deob.ClassGroup;
import net.runelite.deob.Field;
import net.runelite.deob.Method;
import net.runelite.deob.attributes.code.instructions.If;
public class ParallelExecutorMapping
{
@@ -15,6 +16,8 @@ public class ParallelExecutorMapping
//private List<Object> order = new ArrayList<>();
public Method m1, m2;
public boolean crashed;
public List<If> packetHandler1 = new ArrayList<>();
public List<If> packetHandler2 = new ArrayList<>();
public ParallelExecutorMapping(ClassGroup group, ClassGroup group2)
{

View File

@@ -29,7 +29,7 @@ public class ParallellMappingExecutor
++count;
if (count == 65925)
if (count == 26)
{
int i = 5;
}
@@ -70,8 +70,9 @@ public class ParallellMappingExecutor
// assert f2.returnTo == null;
// XXX I dont know if this is right! only helps a few fields.
popStack(f1);
popStack(f2);
// XXX if a frame exits from a jump loop it would step out which might be bad
//popStack(f1);
//popStack(f2);
e.frames.remove(f1);
e2.frames.remove(f2);
@@ -304,9 +305,9 @@ public class ParallellMappingExecutor
// if (!f.getInstructions().isEmpty())
// return f;
//
// InstructionContext i = f.getInstructions().get(f.getInstructions().size() - 1);
// if (!(i.getInstruction() instanceof ReturnInstruction))
// return f;
InstructionContext i = f.getInstructions().get(f.getInstructions().size() - 1);
if (!(i.getInstruction() instanceof ReturnInstruction))
return f;
Frame r = popStackForce(f);