XXX wip save. I think this might be due to calculating max stack incorrectly due to long/double.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package net.runelite.asm.attributes.code;
|
||||
|
||||
import net.runelite.asm.attributes.Code;
|
||||
import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
@@ -9,7 +8,6 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class Instructions
|
||||
|
||||
@@ -23,74 +23,62 @@ import net.runelite.deob.util.JarUtil;
|
||||
public class Deob
|
||||
{
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
//merge(); if(true) return;
|
||||
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
ClassGroup group = JarUtil.loadJar(new File(args[0]));
|
||||
|
||||
run(group, new RenameUnique());
|
||||
|
||||
// remove except RuntimeException
|
||||
run(group, new RuntimeExceptions());
|
||||
|
||||
// remove unused methods
|
||||
run(group, new UnreachedCode());
|
||||
run(group, new UnusedMethods());
|
||||
|
||||
// remove illegal state exceptions, frees up some parameters
|
||||
run(group, new IllegalStateExceptions());
|
||||
|
||||
// remove constant logically dead parameters
|
||||
run(group, new ConstantParameter());
|
||||
|
||||
// remove unhit blocks
|
||||
run(group, new UnreachedCode());
|
||||
run(group, new UnusedMethods());
|
||||
// run(group, new RenameUnique());
|
||||
//
|
||||
// // remove except RuntimeException
|
||||
// run(group, new RuntimeExceptions());
|
||||
//
|
||||
// // remove unused methods
|
||||
// run(group, new UnreachedCode());
|
||||
// run(group, new UnusedMethods());
|
||||
//
|
||||
// // remove illegal state exceptions, frees up some parameters
|
||||
// run(group, new IllegalStateExceptions());
|
||||
//
|
||||
// // remove constant logically dead parameters
|
||||
// run(group, new ConstantParameter());
|
||||
//
|
||||
// // remove unhit blocks
|
||||
// run(group, new UnreachedCode());
|
||||
// run(group, new UnusedMethods());
|
||||
|
||||
// remove unused parameters
|
||||
run(group, new UnusedParameters());
|
||||
|
||||
// remove unused fields
|
||||
run(group, new UnusedFields());
|
||||
|
||||
// remove unused methods, again?
|
||||
run(group, new UnusedMethods());
|
||||
|
||||
// run(group, new MethodInliner());
|
||||
// run(group, new UnusedMethods()); // inliner might leave unused methods
|
||||
|
||||
// // broken because rename was removed
|
||||
// //run(group, new MethodMover());
|
||||
|
||||
run(group, new FieldInliner());
|
||||
|
||||
// // XXX this is broken because when moving clinit around, some fields can depend on other fields
|
||||
// // (like multianewarray)
|
||||
// //new FieldMover().run(group);
|
||||
|
||||
run(group, new UnusedClass());
|
||||
|
||||
ModArith mod = new ModArith();
|
||||
mod.run(group);
|
||||
|
||||
int last = -1, cur;
|
||||
while ((cur = mod.runOnce()) > 0)
|
||||
{
|
||||
new MultiplicationDeobfuscator().run(group);
|
||||
|
||||
new MultiplyOneDeobfuscator().run(group);
|
||||
|
||||
new MultiplyZeroDeobfuscator().run(group);
|
||||
|
||||
if (last == cur)
|
||||
break;
|
||||
|
||||
last = cur;
|
||||
}
|
||||
|
||||
mod.annotateEncryption();
|
||||
//
|
||||
// // remove unused fields
|
||||
// run(group, new UnusedFields());
|
||||
//
|
||||
// // remove unused methods, again?
|
||||
// run(group, new UnusedMethods());
|
||||
//
|
||||
// run(group, new FieldInliner());
|
||||
//
|
||||
// run(group, new UnusedClass());
|
||||
//
|
||||
// ModArith mod = new ModArith();
|
||||
// mod.run(group);
|
||||
//
|
||||
// int last = -1, cur;
|
||||
// while ((cur = mod.runOnce()) > 0)
|
||||
// {
|
||||
// new MultiplicationDeobfuscator().run(group);
|
||||
//
|
||||
// new MultiplyOneDeobfuscator().run(group);
|
||||
//
|
||||
// new MultiplyZeroDeobfuscator().run(group);
|
||||
//
|
||||
// if (last == cur)
|
||||
// break;
|
||||
//
|
||||
// last = cur;
|
||||
// }
|
||||
//
|
||||
// mod.annotateEncryption();
|
||||
|
||||
JarUtil.saveJar(group, new File(args[1]));
|
||||
|
||||
@@ -98,15 +86,6 @@ public class Deob
|
||||
System.out.println("Done in " + ((end - start) / 1000L) + "s");
|
||||
}
|
||||
|
||||
private static void merge() throws IOException
|
||||
{
|
||||
ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")),
|
||||
group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar"));
|
||||
//
|
||||
// Rename2 rename = new Rename2();
|
||||
// rename.run(group1, group2);
|
||||
}
|
||||
|
||||
public static boolean isObfuscated(String name)
|
||||
{
|
||||
return name.length() <= 2 || name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
|
||||
|
||||
@@ -39,11 +39,10 @@ public class UnusedParameters implements Deobfuscator
|
||||
InvokeInstruction ii = (InvokeInstruction) i;
|
||||
List<Method> methods = ii.getMethods();
|
||||
|
||||
if (!unused.containsKey(methods))
|
||||
return;
|
||||
//if (!unused.containsKey(methods))
|
||||
// return;
|
||||
|
||||
for (Method m : methods)
|
||||
invokes.put(i, ictx);
|
||||
invokes.put(i, ictx);
|
||||
}
|
||||
|
||||
private void buildUnused(ClassGroup group)
|
||||
@@ -165,6 +164,7 @@ public class UnusedParameters implements Deobfuscator
|
||||
ii.removeParameter(paramIndex); // remove parameter from instruction
|
||||
|
||||
Collection<InstructionContext> ics = invokes.get(i);//execution.getInstructonContexts(i);
|
||||
assert ics != null;
|
||||
if (ics != null)
|
||||
{
|
||||
InstructionContext ins = ics.toArray(new InstructionContext[0])[0];
|
||||
@@ -231,6 +231,7 @@ public class UnusedParameters implements Deobfuscator
|
||||
System.out.println("PASS " + pnum++ + " " + i);
|
||||
|
||||
count += i;
|
||||
break;
|
||||
}
|
||||
while (i > 0);
|
||||
|
||||
|
||||
@@ -2,13 +2,9 @@ package net.runelite.deob.deobfuscators;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import net.runelite.asm.ClassGroup;
|
||||
import net.runelite.asm.Method;
|
||||
import net.runelite.asm.signature.util.VirtualMethods;
|
||||
import net.runelite.deob.util.JarUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
Reference in New Issue
Block a user