From 3edf7e2f4c8e828906c4c5246bdc1b59d9760c09 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 9 Nov 2015 21:18:21 -0500 Subject: [PATCH] Trying to run the better inliner so the graph matches up. Maybe instead figure out a way to passively ignored the static func calls. Regardless this assert fails due to a corrupted jump graph. --- src/main/java/net/runelite/deob/Deob.java | 2 +- .../deob/attributes/code/Instructions.java | 2 ++ .../deob/deobfuscators/MethodInliner.java | 26 ++++++++++++------- .../deob/deobfuscators/rename/Rename.java | 10 ++++++- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/runelite/deob/Deob.java b/src/main/java/net/runelite/deob/Deob.java index 8f1745b9c6..d818cb1221 100644 --- a/src/main/java/net/runelite/deob/Deob.java +++ b/src/main/java/net/runelite/deob/Deob.java @@ -37,7 +37,7 @@ public class Deob { public static void main(String[] args) throws IOException { - merge(); if(true) return; + //merge(); if(true) return; long start = System.currentTimeMillis(); diff --git a/src/main/java/net/runelite/deob/attributes/code/Instructions.java b/src/main/java/net/runelite/deob/attributes/code/Instructions.java index 1dce88b0ea..10cd193640 100644 --- a/src/main/java/net/runelite/deob/attributes/code/Instructions.java +++ b/src/main/java/net/runelite/deob/attributes/code/Instructions.java @@ -280,7 +280,9 @@ public class Instructions assert ins.jump.contains(oldi); ins.jump.remove(oldi); + ins.jump.add(newi); + newi.from.add(ins); ins.replace(oldi, newi); } diff --git a/src/main/java/net/runelite/deob/deobfuscators/MethodInliner.java b/src/main/java/net/runelite/deob/deobfuscators/MethodInliner.java index 9548ab5f01..d416f327c4 100644 --- a/src/main/java/net/runelite/deob/deobfuscators/MethodInliner.java +++ b/src/main/java/net/runelite/deob/deobfuscators/MethodInliner.java @@ -265,7 +265,12 @@ public class MethodInliner implements Deobfuscator // instead of return, jump to next instruction after the invoke Instruction oldI = i; + i = new Goto(methodInstructions, nextInstruction); + + i.jump.add(nextInstruction); + nextInstruction.from.add(i); + assert nextInstruction.getInstructions() == methodInstructions; assert methodInstructions.getInstructions().contains(nextInstruction); @@ -287,16 +292,17 @@ public class MethodInliner implements Deobfuscator Instruction oldI = i; i = lvt.setVariableIndex(newIndex); - if (oldI != i) - { - for (Instruction i2 : insMap.values()) - i2.replace(oldI, i); - - for (net.runelite.deob.attributes.code.Exception e : toExceptions.getExceptions()) - e.replace(oldI, i); - - insMap.put(orig, i); - } + assert oldI == i; +// if (oldI != i) +// { +// for (Instruction i2 : insMap.values()) +// i2.replace(oldI, i); +// +// for (net.runelite.deob.attributes.code.Exception e : toExceptions.getExceptions()) +// e.replace(oldI, i); +// +// insMap.put(orig, i); +// } } assert !methodInstructions.getInstructions().contains(i); diff --git a/src/main/java/net/runelite/deob/deobfuscators/rename/Rename.java b/src/main/java/net/runelite/deob/deobfuscators/rename/Rename.java index 24a968c072..2883e58c91 100644 --- a/src/main/java/net/runelite/deob/deobfuscators/rename/Rename.java +++ b/src/main/java/net/runelite/deob/deobfuscators/rename/Rename.java @@ -36,7 +36,10 @@ public class Rename IsomorphismTester isoTest = new TypedVF2IsomorphismTester(); if (!isoTest.areIsomorphic(g1, g2)) + { + System.out.println("Not isomorphic " + g1.size() + " " + g2.size()); return false; + } Map mapping = isoTest.findIsomorphism(g1, g2); Map map1 = f1.getMethodCtx().getIdMap(), map2 = f2.getMethodCtx().getIdMap(); @@ -93,7 +96,12 @@ public class Rename for (Frame fr1 : f1) for (Frame fr2 : f2) { - compare(fr1, fr2); + boolean b = compare(fr1, fr2); + if (!b) + { + System.out.println("Mismatch " + p1.getMethod().getMethods().getClassFile().getName() + "." + p1.getMethod().getName() + " <-> " + p2.getMethod().getMethods().getClassFile().getName() + "." + p2.getMethod().getName()); + int i =7; + } break; }