Solved methods 860, solved fields 856, unsolved methods 253, unsolved fields 1439 - I guess because i changed how graph building works
This commit is contained in:
@@ -28,6 +28,7 @@ import net.runelite.deob.deobfuscators.rename.graph.Edge;
|
|||||||
import net.runelite.deob.deobfuscators.rename.graph.EdgeType;
|
import net.runelite.deob.deobfuscators.rename.graph.EdgeType;
|
||||||
import net.runelite.deob.deobfuscators.rename.graph.FieldEdge;
|
import net.runelite.deob.deobfuscators.rename.graph.FieldEdge;
|
||||||
import net.runelite.deob.deobfuscators.rename.graph.Graph;
|
import net.runelite.deob.deobfuscators.rename.graph.Graph;
|
||||||
|
import net.runelite.deob.deobfuscators.rename.graph.GraphBuilder;
|
||||||
import net.runelite.deob.deobfuscators.rename.graph.Vertex;
|
import net.runelite.deob.deobfuscators.rename.graph.Vertex;
|
||||||
import net.runelite.deob.deobfuscators.rename.graph.VertexType;
|
import net.runelite.deob.deobfuscators.rename.graph.VertexType;
|
||||||
import net.runelite.deob.execution.Execution;
|
import net.runelite.deob.execution.Execution;
|
||||||
@@ -309,20 +310,20 @@ public class Rename2
|
|||||||
public NameMappings run(ClassGroup one, ClassGroup two)
|
public NameMappings run(ClassGroup one, ClassGroup two)
|
||||||
{
|
{
|
||||||
Execution eone = new Execution(one);
|
Execution eone = new Execution(one);
|
||||||
eone.setBuildGraph(true);
|
//eone.setBuildGraph(true);
|
||||||
eone.populateInitialMethods();
|
eone.populateInitialMethods();
|
||||||
eone.run();
|
eone.run();
|
||||||
|
|
||||||
Execution etwo = new Execution(two);
|
Execution etwo = new Execution(two);
|
||||||
etwo.setBuildGraph(true);
|
//etwo.setBuildGraph(true);
|
||||||
etwo.populateInitialMethods();
|
etwo.populateInitialMethods();
|
||||||
etwo.run();
|
etwo.run();
|
||||||
|
|
||||||
g1 = eone.getGraph();
|
g1 = GraphBuilder.build(one);
|
||||||
g2 = etwo.getGraph();
|
g2 = GraphBuilder.build(two);
|
||||||
|
|
||||||
System.out.println(eone.getGraph());
|
// System.out.println(eone.getGraph());
|
||||||
System.out.println(etwo.getGraph());
|
// System.out.println(etwo.getGraph());
|
||||||
|
|
||||||
for (int i = 0; i < 250; ++i)
|
for (int i = 0; i < 250; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -121,10 +121,10 @@ public class Edge
|
|||||||
|
|
||||||
if (this.type == EdgeType.SETFIELD)// || this.type == EdgeType.SETFIELD_FROM)
|
if (this.type == EdgeType.SETFIELD)// || this.type == EdgeType.SETFIELD_FROM)
|
||||||
{
|
{
|
||||||
if (!compareSetField(getGraph(), other.getGraph(),
|
// if (!compareSetField(getGraph(), other.getGraph(),
|
||||||
(Field) this.getTo().getObject(), (Field) other.getTo().getObject(),
|
// (Field) this.getTo().getObject(), (Field) other.getTo().getObject(),
|
||||||
other.getIns()))
|
// other.getIns()))
|
||||||
return false;
|
// return false;
|
||||||
}
|
}
|
||||||
// if (this.weight != other.weight)
|
// if (this.weight != other.weight)
|
||||||
// return false;
|
// return false;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public class Execution
|
|||||||
public Set<Instruction> executed = new HashSet<>(); // executed instructions
|
public Set<Instruction> executed = new HashSet<>(); // executed instructions
|
||||||
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 step = true;
|
||||||
|
|
||||||
public Execution(ClassGroup group)
|
public Execution(ClassGroup group)
|
||||||
{
|
{
|
||||||
@@ -105,6 +107,7 @@ 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 (hasInvoked(from, to))
|
if (hasInvoked(from, to))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -123,6 +126,7 @@ public class Execution
|
|||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
assert !paused;
|
||||||
|
|
||||||
int fcount = 0;
|
int fcount = 0;
|
||||||
while (!frames.isEmpty())
|
while (!frames.isEmpty())
|
||||||
@@ -144,10 +148,17 @@ public class Execution
|
|||||||
System.out.println("Processed " + fcount + " frames");
|
System.out.println("Processed " + fcount + " frames");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
// public InstructionContext getPaused()
|
||||||
|
// {
|
||||||
}
|
// if (frames.isEmpty())
|
||||||
|
// return null;
|
||||||
|
//
|
||||||
|
// Frame f = frames.get(0);
|
||||||
|
// return f.getInstructions().get(f.getInstructions().size() - 1);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Collection<InstructionContext> getInstructonContexts(Instruction i)
|
||||||
{
|
{
|
||||||
|
return contexts.getCollection(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ public class Frame
|
|||||||
/* jump */
|
/* jump */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldCur instanceof MappableInstruction)
|
if (!execution.step && oldCur instanceof MappableInstruction)
|
||||||
{
|
{
|
||||||
execution.paused = true;
|
execution.paused = true;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import java.util.List;
|
|||||||
import net.runelite.deob.Method;
|
import net.runelite.deob.Method;
|
||||||
import net.runelite.deob.attributes.code.Instruction;
|
import net.runelite.deob.attributes.code.Instruction;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.LVTInstruction;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.SetFieldInstruction;
|
||||||
|
|
||||||
public class InstructionContext
|
public class InstructionContext
|
||||||
{
|
{
|
||||||
@@ -158,4 +161,52 @@ public class InstructionContext
|
|||||||
{
|
{
|
||||||
return "InstructionContext{" + "ins=" + ins + '}';
|
return "InstructionContext{" + "ins=" + ins + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InstructionContext resolve(
|
||||||
|
StackContext from // pushed from this
|
||||||
|
)
|
||||||
|
{
|
||||||
|
InstructionContext ctx = this;
|
||||||
|
|
||||||
|
if (ctx.getInstruction() instanceof SetFieldInstruction)
|
||||||
|
{
|
||||||
|
StackContext s = ctx.getPops().get(0);
|
||||||
|
return s.getPushed().resolve(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx.getInstruction() instanceof DupInstruction)
|
||||||
|
{
|
||||||
|
DupInstruction d = (DupInstruction) ctx.getInstruction();
|
||||||
|
StackContext s = d.getOriginal(from);
|
||||||
|
return s.getPushed().resolve(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx.getInstruction() instanceof LVTInstruction)
|
||||||
|
{
|
||||||
|
LVTInstruction lvt = (LVTInstruction) ctx.getInstruction();
|
||||||
|
Variables variables = ctx.getVariables();
|
||||||
|
|
||||||
|
if (lvt.store())
|
||||||
|
{
|
||||||
|
StackContext s = ctx.getPops().get(0); // is this right?
|
||||||
|
return s.getPushed().resolve(s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VariableContext vctx = variables.get(lvt.getVariableIndex()); // variable being loaded
|
||||||
|
assert vctx != null;
|
||||||
|
|
||||||
|
InstructionContext storedCtx = vctx.getInstructionWhichStored();
|
||||||
|
if (storedCtx == null)
|
||||||
|
return ctx; // initial parameter
|
||||||
|
|
||||||
|
if (vctx.isIsParameter())
|
||||||
|
return ctx; // parameter (storedCtx is invoking instruction in another frame). this lvt index is fixed.
|
||||||
|
|
||||||
|
return storedCtx.resolve(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user