diff --git a/src/test/java/net/runelite/deob/deobfuscators/arithmetic/ModArithTest.java b/src/test/java/net/runelite/deob/deobfuscators/arithmetic/ModArithTest.java index 7135978710..fbc2cca4c8 100644 --- a/src/test/java/net/runelite/deob/deobfuscators/arithmetic/ModArithTest.java +++ b/src/test/java/net/runelite/deob/deobfuscators/arithmetic/ModArithTest.java @@ -1,12 +1,8 @@ -package net.runelite.deob.deobfuscators; +package net.runelite.deob.deobfuscators.arithmetic; import java.io.File; import java.io.IOException; import net.runelite.asm.ClassGroup; -import net.runelite.deob.deobfuscators.arithmetic.ModArith; -import net.runelite.deob.deobfuscators.arithmetic.MultiplicationDeobfuscator; -import net.runelite.deob.deobfuscators.arithmetic.MultiplyOneDeobfuscator; -import net.runelite.deob.deobfuscators.arithmetic.MultiplyZeroDeobfuscator; import net.runelite.deob.util.JarUtil; import org.junit.After; import org.junit.Before; @@ -32,7 +28,7 @@ public class ModArithTest @After public void after() throws IOException { - JarUtil.saveJar(group, folder.newFile()); + JarUtil.saveJar(group, new File("d:/rs/07/adamout.jar"));//folder.newFile()); } @Test diff --git a/src/test/java/net/runelite/deob/deobfuscators/rename/AnnotationMapperTest.java b/src/test/java/net/runelite/deob/deobfuscators/rename/AnnotationMapperTest.java index 10f26fbf61..fc22f8d8e7 100644 --- a/src/test/java/net/runelite/deob/deobfuscators/rename/AnnotationMapperTest.java +++ b/src/test/java/net/runelite/deob/deobfuscators/rename/AnnotationMapperTest.java @@ -9,7 +9,7 @@ import org.junit.Test; public class AnnotationMapperTest { private static final String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar", - JAR2 = "d:/rs/07/gamepack_v18_deobbed.jar", + JAR2 = "d:/rs/07/gamepack_v20_deobfuscated.jar", OUT = "d:/rs/07/adamout.jar"; @Test diff --git a/src/test/java/net/runelite/deob/deobfuscators/rename/MapTest.java b/src/test/java/net/runelite/deob/deobfuscators/rename/MapTest.java index c8d1279aaf..bfa88ba729 100644 --- a/src/test/java/net/runelite/deob/deobfuscators/rename/MapTest.java +++ b/src/test/java/net/runelite/deob/deobfuscators/rename/MapTest.java @@ -2,22 +2,60 @@ package net.runelite.deob.deobfuscators.rename; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import net.runelite.asm.ClassFile; import net.runelite.asm.ClassGroup; +import net.runelite.asm.Field; import net.runelite.asm.Method; +import net.runelite.asm.signature.Signature; +import static net.runelite.deob.deobfuscators.rename.MapStaticTest.print; +import static net.runelite.deob.deobfuscators.rename.MapStaticTest.summary; import net.runelite.deob.util.JarUtil; import org.junit.Test; public class MapTest { + private static final String JAR1 = "C:\\Users\\Adam\\.m2\\repository\\net\\runelite\\rs\\rs-client\\1.0-SNAPSHOT\\rs-client-1.0-SNAPSHOT.jar", + JAR2 = "d:/rs/07/gamepack_v20_deobfuscated.jar"; + @Test - public void test() throws IOException + public void test2() throws IOException { - ClassGroup group1 = JarUtil.loadJar(new File("d:/rs/07/adamin1.jar")); - ClassGroup group2 = JarUtil.loadJar(new File("d:/rs/07/adamin2.jar")); - - Method m1 = group1.findClass("class99").findMethod("method2220"); - Method m2 = group2.findClass("class99").findMethod("method2149"); - - ParallelExecutorMapping mappings = MappingExecutorUtil.map(m1, m2); + ClassGroup group1 = JarUtil.loadJar(new File(JAR1)); + ClassGroup group2 = JarUtil.loadJar(new File(JAR2)); + + Method m = group1.findClass("class106").findMethod("method2379"); + Method m2 = group2.findClass("class9").findMethod("method125"); + + ParallelExecutorMapping mappings = MappingExecutorUtil.map(m, m2); + System.out.println(mappings); + //System.out.println(mappings.get(group1.findClass("class209").findField("field3120"))); + } + + //@Test + public void test3() throws IOException + { + ClassGroup group1 = JarUtil.loadJar(new File(JAR1)); + ClassGroup group2 = JarUtil.loadJar(new File(JAR2)); + + Mapper mapper = new Mapper(group1, group2); + mapper.run(); + ParallelExecutorMapping mapping = mapper.getMapping(); + + Method m = group1.findClass("class120").findMethod("method2747"); + + System.out.println(m); + System.out.println(mapping.get(m)); + } + + private List getMethodsOfSignature(ClassFile cf, Signature signature) + { + List l = new ArrayList<>(); + for (Method m : cf.getMethods().getMethods()) + if (m.getDescriptor().equals(signature) && !m.isStatic() && !m.getName().startsWith("<")) + l.add(m); + return l; } } diff --git a/src/test/java/net/runelite/deob/injection/InjectTest.java b/src/test/java/net/runelite/deob/injection/InjectTest.java index f05377d2b0..98e1cf5d19 100644 --- a/src/test/java/net/runelite/deob/injection/InjectTest.java +++ b/src/test/java/net/runelite/deob/injection/InjectTest.java @@ -10,8 +10,8 @@ import org.junit.Test; public class InjectTest { - private static final File DEOBFUSCATED = new File("d:/rs/07/gamepack_v18_with_annotations.jar"); - private static final File VANILLA = new File(InjectTest.class.getResource("/gamepack_v18.jar").getFile()); + private static final File DEOBFUSCATED = new File("d:/rs/07/gamepack_v20_mapped.jar"); + private static final File VANILLA = new File(InjectTest.class.getResource("/gamepack_v20.jar").getFile()); private static final File OUT = new File("d:/rs/07/adamout.jar"); private ClassGroup deob, vanilla;