This was hard to find. Seems to work better? Old code here was finding wildly irrelevant funcs. Just use the renamer code.

This commit is contained in:
Adam
2016-02-27 23:04:44 -05:00
parent 63272b915b
commit a97ee8881c
3 changed files with 55 additions and 47 deletions

View File

@@ -30,47 +30,47 @@ public class Deob
ClassGroup group = JarUtil.loadJar(new File(args[0])); ClassGroup group = JarUtil.loadJar(new File(args[0]));
// run(group, new RenameUnique()); run(group, new RenameUnique());
//
// // remove except RuntimeException // remove except RuntimeException
// run(group, new RuntimeExceptions()); run(group, new RuntimeExceptions());
//
// // remove unused methods // remove unused methods
// run(group, new UnreachedCode()); run(group, new UnreachedCode());
// run(group, new UnusedMethods()); run(group, new UnusedMethods());
//
// // remove illegal state exceptions, frees up some parameters // remove illegal state exceptions, frees up some parameters
// run(group, new IllegalStateExceptions()); run(group, new IllegalStateExceptions());
//
// // remove constant logically dead parameters // remove constant logically dead parameters
// run(group, new ConstantParameter()); run(group, new ConstantParameter());
//
// // remove unhit blocks // remove unhit blocks
// run(group, new UnreachedCode()); run(group, new UnreachedCode());
// run(group, new UnusedMethods()); run(group, new UnusedMethods());
//
// // remove unused parameters // remove unused parameters
// run(group, new UnusedParameters()); run(group, new UnusedParameters());
//
// // remove unused fields // remove unused fields
// run(group, new UnusedFields()); run(group, new UnusedFields());
//
// // remove unused methods, again? // remove unused methods, again?
// run(group, new UnusedMethods()); run(group, new UnusedMethods());
//
//// run(group, new MethodInliner()); // run(group, new MethodInliner());
//// run(group, new UnusedMethods()); // inliner might leave unused methods // run(group, new UnusedMethods()); // inliner might leave unused methods
//
//// // broken because rename was removed // // broken because rename was removed
//// //run(group, new MethodMover()); // //run(group, new MethodMover());
//
// run(group, new FieldInliner()); run(group, new FieldInliner());
//
//// // XXX this is broken because when moving clinit around, some fields can depend on other fields // // XXX this is broken because when moving clinit around, some fields can depend on other fields
//// // (like multianewarray) // // (like multianewarray)
//// //new FieldMover().run(group); // //new FieldMover().run(group);
//
// run(group, new UnusedClass()); run(group, new UnusedClass());
ModArith mod = new ModArith(); ModArith mod = new ModArith();
mod.run(group); mod.run(group);

View File

@@ -25,6 +25,7 @@ import java.util.List;
import net.runelite.deob.Field; import net.runelite.deob.Field;
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
import net.runelite.deob.attributes.code.instruction.types.MappableInstruction; import net.runelite.deob.attributes.code.instruction.types.MappableInstruction;
import net.runelite.deob.deobfuscators.Renamer;
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil; import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping; import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
import net.runelite.deob.execution.Execution; import net.runelite.deob.execution.Execution;
@@ -151,9 +152,9 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
return; // not our class return; // not our class
// look up this method in this class and anything that inherits from it // look up this method in this class and anything that inherits from it
List<net.runelite.deob.Method> list = new ArrayList<>(); //List<net.runelite.deob.Method> list = new ArrayList<>();
findMethodFromClass(list, otherClass); //findMethodFromClass(list, otherClass);
myMethods = list; myMethods = Renamer.getVirutalMethods(otherClass.findMethod(method.getNameAndType()));
} }
@Override @Override

View File

@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import net.runelite.deob.Field; import net.runelite.deob.Field;
import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction; import net.runelite.deob.attributes.code.instruction.types.GetFieldInstruction;
import net.runelite.deob.deobfuscators.Renamer;
import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil; import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;
import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping; import net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;
import net.runelite.deob.execution.Execution; import net.runelite.deob.execution.Execution;
@@ -168,9 +169,15 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
// when I recompile classes I can see the class of invokevirtuals methods change, get all methods // when I recompile classes I can see the class of invokevirtuals methods change, get all methods
List<net.runelite.deob.Method> list = new ArrayList<>(); //List<net.runelite.deob.Method> list = new ArrayList<>();
findMethodFromClass(new HashSet<>(), list, otherClass); //findMethodFromClass(new HashSet<>(), list, otherClass);
myMethods = list; net.runelite.deob.Method m = otherClass.findMethodDeep(method.getNameAndType());
if (m == null)
{
return;
}
myMethods = Renamer.getVirutalMethods(m);
} }
@Override @Override