Solved methods 942, solved fields 1295, unsolved methods 171, unsolved fields 1000
This commit is contained in:
@@ -251,16 +251,16 @@ public class Rename2
|
|||||||
assert e.getFrom() == s;
|
assert e.getFrom() == s;
|
||||||
|
|
||||||
boolean b = false;
|
boolean b = false;
|
||||||
if (e.toString().equals("Edge{from=Vertex{object=class97.<init>()V}, to=Vertex{object=I class97.field1653}, type=SETFIELD}"))
|
// if (e.toString().equals("Edge{from=Vertex{object=class97.<init>()V}, to=Vertex{object=I class97.field1653}, type=SETFIELD}"))
|
||||||
{
|
// {
|
||||||
b = true;
|
// b = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (e.getTo().getOther() != null)
|
if (e.getTo().getOther() != null)
|
||||||
continue; // skip solved edges
|
continue; // skip solved edges
|
||||||
|
|
||||||
Vertex v = e.getTo(); // end of edge in g1
|
Vertex v = e.getTo(); // end of edge in g1
|
||||||
if (v.toString().equals("Vertex{object=I class97.field1653}"))
|
if (v.toString().equals("Vertex{object=I class100.field1728}"))
|
||||||
{
|
{
|
||||||
b = true;
|
b = true;
|
||||||
}
|
}
|
||||||
@@ -277,17 +277,28 @@ public class Rename2
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b)
|
if (b && e.getType() == EdgeType.SETFIELD && e2.getType() == EdgeType.SETFIELD)
|
||||||
{
|
{
|
||||||
int i = 5;
|
int i = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!e.couldBeEqual(e2))
|
if (!e.couldBeEqual(e2))
|
||||||
{
|
{
|
||||||
|
//Edge{from=Vertex{object=class96.<init>(IIIIIIIIIIIIIIIIIII)V}, to=Vertex{object=I[] class96.field1630}, type=SETFIELD}
|
||||||
|
//Edge{from=Vertex{object=class96.<init>(IIIIIIIIIIIIIIIIIII)V}, to=Vertex{object=I[] class96.field1632}, type=GETFIELD}
|
||||||
|
|
||||||
|
//if (e.getTo().toString().equals("Vertex{object=I[] class96.field1630}") && e.getType() == EdgeType.SETFIELD
|
||||||
|
// && e2.getTo().toString().equals("Vertex{object=I[] class96.field1632}") && e2.getType() == EdgeType.SETFIELD)
|
||||||
|
{
|
||||||
|
e.couldBeEqual(e2);
|
||||||
|
}
|
||||||
|
|
||||||
// System.out.println(e + " != " + e2);
|
// System.out.println(e + " != " + e2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.couldBeEqual(e2);
|
||||||
|
|
||||||
Vertex v2 = e2.getTo();
|
Vertex v2 = e2.getTo();
|
||||||
|
|
||||||
l.add(v2);
|
l.add(v2);
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package net.runelite.deob.deobfuscators.rename.graph;
|
package net.runelite.deob.deobfuscators.rename.graph;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import net.runelite.deob.Field;
|
import net.runelite.deob.Field;
|
||||||
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 net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.FieldInstruction;
|
||||||
|
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.InvokeInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.InvokeInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.LVTInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.LVTInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
@@ -120,7 +121,9 @@ 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((Field) this.getTo().getObject(), (Field) other.getTo().getObject(), other.getIns()))
|
if (!compareSetField(getGraph(), other.getGraph(),
|
||||||
|
(Field) this.getTo().getObject(), (Field) other.getTo().getObject(),
|
||||||
|
other.getIns()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if (this.weight != other.weight)
|
// if (this.weight != other.weight)
|
||||||
@@ -230,15 +233,15 @@ public class Edge
|
|||||||
// return ctx;
|
// return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareSetField(Field field1, Field field2, InstructionContext other)
|
private boolean compareSetField(Graph g1, Graph g2, Field field1, Field field2, InstructionContext other)
|
||||||
{
|
{
|
||||||
InstructionContext thisp = resolve(ins.getPops().get(0).getPushed(), ins.getPops().get(0)),
|
InstructionContext thisp = resolve(ins.getPops().get(0).getPushed(), ins.getPops().get(0)),
|
||||||
otherp = resolve(other.getPops().get(0).getPushed(), other.getPops().get(0));
|
otherp = resolve(other.getPops().get(0).getPushed(), other.getPops().get(0));
|
||||||
|
|
||||||
return couldBeEqual(field1, field2, thisp, otherp, null);
|
return couldBeEqual(g1, g2, field1, field2, thisp, otherp, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean couldBeEqual(Field field1, Field field2, InstructionContext one, InstructionContext two, InstructionContext from)
|
private boolean couldBeEqual(Graph g1, Graph g2, Field field1, Field field2, InstructionContext one, InstructionContext two, InstructionContext from)
|
||||||
{
|
{
|
||||||
Instruction i1 = one.getInstruction(), i2 = two.getInstruction();
|
Instruction i1 = one.getInstruction(), i2 = two.getInstruction();
|
||||||
|
|
||||||
@@ -265,7 +268,8 @@ public class Edge
|
|||||||
if (i1 instanceof NewArray && i2 instanceof NewArray)
|
if (i1 instanceof NewArray && i2 instanceof NewArray)
|
||||||
{
|
{
|
||||||
NewArray a1 = (NewArray) i1, a2 = (NewArray) i2;
|
NewArray a1 = (NewArray) i1, a2 = (NewArray) i2;
|
||||||
return a1.getArrayType() == a2.getArrayType();
|
if (a1.getArrayType() != a2.getArrayType())
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX check for invokestatic vs.
|
// XXX check for invokestatic vs.
|
||||||
@@ -294,7 +298,41 @@ public class Edge
|
|||||||
else if (i1 instanceof InvokeStatic || i2 instanceof InvokeStatic)
|
else if (i1 instanceof InvokeStatic || i2 instanceof InvokeStatic)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
//int i = 5;
|
}
|
||||||
|
|
||||||
|
if (i1 instanceof FieldInstruction && i2 instanceof FieldInstruction)
|
||||||
|
{
|
||||||
|
assert i1 instanceof GetFieldInstruction;
|
||||||
|
assert i2 instanceof GetFieldInstruction;
|
||||||
|
|
||||||
|
GetFieldInstruction gf1 = (GetFieldInstruction) i1, gf2 = (GetFieldInstruction) i2;
|
||||||
|
Field f1 = gf1.getMyField(), f2 = gf2.getMyField();
|
||||||
|
|
||||||
|
if ((f1 != null) != (f2 != null))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//if (f1 == null || f2 == null)
|
||||||
|
// return
|
||||||
|
|
||||||
|
if (!f1.getType().equals(f2.getType()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// lookup already solved fields.
|
||||||
|
|
||||||
|
Vertex v1 = g1.getVertexFor(f1), v2 = g2.getVertexFor(f2); // vertex of fields whose value is being set to
|
||||||
|
|
||||||
|
// get solved field
|
||||||
|
v1 = v1.getOther();
|
||||||
|
v2 = v2.getOther();
|
||||||
|
|
||||||
|
if ((v1 != null) != (v2 != null))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (v1 != null || v2 != null)
|
||||||
|
{
|
||||||
|
if (v1.getObject() != f2 || v2.getObject() != f1)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i1 instanceof PushConstantInstruction && i2 instanceof PushConstantInstruction)
|
if (i1 instanceof PushConstantInstruction && i2 instanceof PushConstantInstruction)
|
||||||
@@ -319,6 +357,7 @@ public class Edge
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!couldBeEqual(
|
if (!couldBeEqual(
|
||||||
|
g1, g2,
|
||||||
field1, field2,
|
field1, field2,
|
||||||
resolve(s1.getPushed(), s1),
|
resolve(s1.getPushed(), s1),
|
||||||
resolve(s2.getPushed(), s2),
|
resolve(s2.getPushed(), s2),
|
||||||
@@ -359,4 +398,10 @@ public class Edge
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Graph getGraph()
|
||||||
|
{
|
||||||
|
assert from.getGraph() == to.getGraph();
|
||||||
|
return from.getGraph();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user