From 557f2fb5041afd8ebd8f3071f44b7999d28af3eb Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 27 Aug 2019 21:43:59 +0100 Subject: [PATCH] Move remapping into a RemapTransformer This allows us to run the remapping immediately between OriginalNameTransformer and DummyArgTransformer. --- .../src/main/java/dev/openrs2/deob/Deobfuscator.java | 9 ++------- .../dev/openrs2/deob/transform/RemapTransformer.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 deob/src/main/java/dev/openrs2/deob/transform/RemapTransformer.java diff --git a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java index 2fd85e9e..47a3e703 100644 --- a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java +++ b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java @@ -12,7 +12,6 @@ import dev.openrs2.asm.transform.Transformer; import dev.openrs2.bundler.transform.HostCheckTransformer; import dev.openrs2.bundler.transform.RightClickTransformer; import dev.openrs2.deob.remap.PrefixRemapper; -import dev.openrs2.deob.remap.TypedRemapper; import dev.openrs2.deob.transform.BitShiftTransformer; import dev.openrs2.deob.transform.BitwiseOpTransformer; import dev.openrs2.deob.transform.CanvasTransformer; @@ -23,6 +22,7 @@ import dev.openrs2.deob.transform.ExceptionTracingTransformer; import dev.openrs2.deob.transform.FieldOrderTransformer; import dev.openrs2.deob.transform.OpaquePredicateTransformer; import dev.openrs2.deob.transform.OriginalNameTransformer; +import dev.openrs2.deob.transform.RemapTransformer; import org.objectweb.asm.tree.analysis.AnalyzerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,6 +41,7 @@ public final class Deobfuscator { new CanvasTransformer(), new FieldOrderTransformer(), new BitwiseOpTransformer(), + new RemapTransformer(), new DummyArgTransformer(), new DummyLocalTransformer() ); @@ -131,12 +132,6 @@ public final class Deobfuscator { transformer.transform(unsignedClassPath); } - /* remap all class, method and field names */ - logger.info("Remapping"); - classPath.remap(TypedRemapper.create(classPath)); - glClassPath.remap(TypedRemapper.create(glClassPath)); - unsignedClassPath.remap(TypedRemapper.create(unsignedClassPath)); - /* write output jars */ logger.info("Writing output jars"); diff --git a/deob/src/main/java/dev/openrs2/deob/transform/RemapTransformer.java b/deob/src/main/java/dev/openrs2/deob/transform/RemapTransformer.java new file mode 100644 index 00000000..497e5954 --- /dev/null +++ b/deob/src/main/java/dev/openrs2/deob/transform/RemapTransformer.java @@ -0,0 +1,12 @@ +package dev.openrs2.deob.transform; + +import dev.openrs2.asm.classpath.ClassPath; +import dev.openrs2.asm.transform.Transformer; +import dev.openrs2.deob.remap.TypedRemapper; + +public final class RemapTransformer extends Transformer { + @Override + protected void preTransform(ClassPath classPath) { + classPath.remap(TypedRemapper.create(classPath)); + } +}