From 6fde1a4bcad2c9acf30ed3ee312917a7bf26c0e3 Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 1 Aug 2019 13:05:57 +0100 Subject: [PATCH] Add Original{Class,Name} annotations even if the name was unchanged I think they will still be useful, as we might refactor the names in the deobfuscated code in the future. --- .../java/dev/openrs2/deob/Deobfuscator.java | 4 +--- .../deob/transform/OriginalNameTransformer.java | 17 +---------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java index a34f2688..36552b8a 100644 --- a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java +++ b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java @@ -140,17 +140,15 @@ public final class Deobfuscator { /* add @OriginalName annotations */ logger.info("Annotating classes and members with original names"); - transformer = new OriginalNameTransformer(remapper); + transformer = new OriginalNameTransformer(); for (var library : libraries) { transformer.transform(library); } - transformer = new OriginalNameTransformer(glRemapper); for (var library : glLibraries) { transformer.transform(library); } - transformer = new OriginalNameTransformer(unsignedRemapper); transformer.transform(unsignedClient); /* write output jars */ diff --git a/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java b/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java index 96c7e9ba..596bdefd 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java +++ b/deob/src/main/java/dev/openrs2/deob/transform/OriginalNameTransformer.java @@ -7,7 +7,6 @@ import dev.openrs2.asm.Transformer; import dev.openrs2.deob.annotation.OriginalClass; import dev.openrs2.deob.annotation.OriginalMember; import org.objectweb.asm.Type; -import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.tree.AnnotationNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; @@ -30,18 +29,8 @@ public final class OriginalNameTransformer extends Transformer { return annotation; } - private final Remapper remapper; - - public OriginalNameTransformer(Remapper remapper) { - this.remapper = remapper; - } - @Override public void transformClass(ClassNode clazz) { - if (clazz.name.equals(remapper.map(clazz.name))) { - return; - } - if (clazz.invisibleAnnotations == null) { clazz.invisibleAnnotations = new ArrayList<>(); } @@ -50,10 +39,6 @@ public final class OriginalNameTransformer extends Transformer { @Override public void transformField(ClassNode clazz, FieldNode field) { - if (field.name.equals(remapper.mapFieldName(clazz.name, field.name, field.desc))) { - return; - } - if (field.invisibleAnnotations == null) { field.invisibleAnnotations = new ArrayList<>(); } @@ -62,7 +47,7 @@ public final class OriginalNameTransformer extends Transformer { @Override public void transformMethod(ClassNode clazz, MethodNode method) { - if (method.name.equals(remapper.mapMethodName(clazz.name, method.name, method.desc))) { + if (method.name.equals("") || method.name.equals("")) { return; }