Basic edge type.
This commit is contained in:
@@ -101,14 +101,15 @@ public class Rename2
|
||||
Vertex other = s.getOther();
|
||||
|
||||
s.getEdges().stream()
|
||||
.map(e -> e.getTo()) // e.from is always s
|
||||
.filter(v -> v.getOther() == null) // only get vertexes that aren't solved yet
|
||||
.forEach(v ->
|
||||
v.merge(
|
||||
//.map(e -> e.getTo()) // e.from is always s
|
||||
.filter(e -> e.getTo().getOther() == null) // only get vertexes that aren't solved yet
|
||||
.forEach(e ->
|
||||
e.getTo().merge(
|
||||
other.getEdges().stream()
|
||||
.map(e -> e.getTo())
|
||||
.filter(v2 -> v2.getOther() == null)
|
||||
.filter(v2 -> v.couldBeEqual(v2))
|
||||
.filter(e2 -> e2.getTo().getOther() == null)
|
||||
.filter(e2 -> e.getTo().couldBeEqual(e2.getTo()))
|
||||
.filter(e2 -> e.getType() == e2.getType())
|
||||
.map(e2 -> e2.getTo())
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
|
||||
@@ -5,11 +5,13 @@ import java.util.Objects;
|
||||
public class Edge
|
||||
{
|
||||
private final Vertex from, to;
|
||||
private final EdgeType type;
|
||||
|
||||
public Edge(Vertex from, Vertex to)
|
||||
public Edge(Vertex from, Vertex to, EdgeType type)
|
||||
{
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.type = type;
|
||||
|
||||
assert from.getGraph() == to.getGraph();
|
||||
}
|
||||
@@ -24,12 +26,18 @@ public class Edge
|
||||
return to;
|
||||
}
|
||||
|
||||
public EdgeType getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 11 * hash + Objects.hashCode(this.from);
|
||||
hash = 11 * hash + Objects.hashCode(this.to);
|
||||
int hash = 5;
|
||||
hash = 89 * hash + Objects.hashCode(this.from);
|
||||
hash = 89 * hash + Objects.hashCode(this.to);
|
||||
hash = 89 * hash + Objects.hashCode(this.type);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -57,8 +65,10 @@ public class Edge
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.type != other.type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.runelite.deob.deobfuscators.rename.graph;
|
||||
|
||||
public enum EdgeType
|
||||
{
|
||||
INVOKE,
|
||||
GETFIELD,
|
||||
SETFIELD;
|
||||
}
|
||||
@@ -24,14 +24,14 @@ public class Graph
|
||||
return v;
|
||||
}
|
||||
|
||||
public void addEdge(Object from, Object to)
|
||||
public void addEdge(Object from, Object to, EdgeType type)
|
||||
{
|
||||
assert from != null;
|
||||
assert to != null;
|
||||
|
||||
Vertex v1 = getVertexFor(from), v2 = getVertexFor(to);
|
||||
|
||||
Edge e = new Edge(v1, v2);
|
||||
Edge e = new Edge(v1, v2, type);
|
||||
if (v1.addEdge(e))
|
||||
++edgeCount;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
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.instructions.InvokeStatic;
|
||||
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
||||
import net.runelite.deob.deobfuscators.rename.graph.EdgeType;
|
||||
import net.runelite.deob.deobfuscators.rename.graph.Graph;
|
||||
import org.apache.commons.collections4.map.MultiValueMap;
|
||||
|
||||
@@ -213,7 +215,7 @@ public class Execution
|
||||
return;
|
||||
|
||||
for (Method m : methods)
|
||||
graph.addEdge(frame.nonStatic, m);
|
||||
graph.addEdge(frame.nonStatic, m, EdgeType.INVOKE);
|
||||
}
|
||||
else if (i instanceof FieldInstruction)
|
||||
{
|
||||
@@ -222,7 +224,8 @@ public class Execution
|
||||
if (fi.getMyField() == null)
|
||||
return;
|
||||
|
||||
graph.addEdge(frame.nonStatic, fi.getMyField());
|
||||
EdgeType type = fi instanceof GetFieldInstruction ? EdgeType.GETFIELD : EdgeType.SETFIELD;
|
||||
graph.addEdge(frame.nonStatic, fi.getMyField(), type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user