From 27c0b997b932dac68ab57dcfd2ce964142b07747 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 12 Oct 2019 13:37:55 +0100 Subject: [PATCH] Share list of bundler transformers --- .../java/dev/openrs2/bundler/Bundler.java | 17 ++++++++ .../java/dev/openrs2/deob/Deobfuscator.java | 40 ++++++++----------- 2 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 bundler/src/main/java/dev/openrs2/bundler/Bundler.java diff --git a/bundler/src/main/java/dev/openrs2/bundler/Bundler.java b/bundler/src/main/java/dev/openrs2/bundler/Bundler.java new file mode 100644 index 0000000000..98ded22e11 --- /dev/null +++ b/bundler/src/main/java/dev/openrs2/bundler/Bundler.java @@ -0,0 +1,17 @@ +package dev.openrs2.bundler; + +import com.google.common.collect.ImmutableList; +import dev.openrs2.asm.transform.Transformer; +import dev.openrs2.bundler.transform.CachePathTransformer; +import dev.openrs2.bundler.transform.HostCheckTransformer; +import dev.openrs2.bundler.transform.MacResizeTransformer; +import dev.openrs2.bundler.transform.RightClickTransformer; + +public final class Bundler { + public static final ImmutableList TRANSFORMERS = ImmutableList.of( + new CachePathTransformer(), + new HostCheckTransformer(), + new MacResizeTransformer(), + new RightClickTransformer() + ); +} diff --git a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java index 6f2860d9f3..0272602d38 100644 --- a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java +++ b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java @@ -9,10 +9,7 @@ import com.google.common.collect.ImmutableList; import dev.openrs2.asm.classpath.ClassPath; import dev.openrs2.asm.classpath.Library; import dev.openrs2.asm.transform.Transformer; -import dev.openrs2.bundler.transform.CachePathTransformer; -import dev.openrs2.bundler.transform.HostCheckTransformer; -import dev.openrs2.bundler.transform.MacResizeTransformer; -import dev.openrs2.bundler.transform.RightClickTransformer; +import dev.openrs2.bundler.Bundler; import dev.openrs2.deob.remap.PrefixRemapper; import dev.openrs2.deob.transform.AccessTransformer; import dev.openrs2.deob.transform.BitShiftTransformer; @@ -34,25 +31,22 @@ import org.slf4j.LoggerFactory; public final class Deobfuscator { private static final Logger logger = LoggerFactory.getLogger(Deobfuscator.class); - private static final ImmutableList TRANSFORMERS = ImmutableList.of( - new OriginalNameTransformer(), - new CachePathTransformer(), - new HostCheckTransformer(), - new MacResizeTransformer(), - new RightClickTransformer(), - new OpaquePredicateTransformer(), - new ExceptionTracingTransformer(), - new BitShiftTransformer(), - new CounterTransformer(), - new CanvasTransformer(), - new FieldOrderTransformer(), - new BitwiseOpTransformer(), - new RemapTransformer(), - new DummyArgTransformer(), - new DummyLocalTransformer(), - new UnusedArgTransformer(), - new AccessTransformer() - ); + private static final ImmutableList TRANSFORMERS = ImmutableList.builder() + .add(new OriginalNameTransformer()) + .addAll(Bundler.TRANSFORMERS) + .add(new OpaquePredicateTransformer()) + .add(new ExceptionTracingTransformer()) + .add(new BitShiftTransformer()) + .add(new CounterTransformer()) + .add(new CanvasTransformer()) + .add(new FieldOrderTransformer()) + .add(new BitwiseOpTransformer()) + .add(new RemapTransformer()) + .add(new DummyArgTransformer()) + .add(new DummyLocalTransformer()) + .add(new UnusedArgTransformer()) + .add(new AccessTransformer()) + .build(); public static void main(String[] args) throws IOException, AnalyzerException { var deobfuscator = new Deobfuscator(Paths.get("nonfree/code"), Paths.get("nonfree/code/deob"));