From ded582dd06ecf8e366d457c57fbaf867b7236026 Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 30 Jul 2019 11:45:55 +0100 Subject: [PATCH] Remove FocusListener from class that claims to implement it but doesn't --- .../java/dev/openrs2/deob/Deobfuscator.java | 4 +++- .../deob/transform/CanvasTransformer.java | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 deob/src/main/java/dev/openrs2/deob/transform/CanvasTransformer.java diff --git a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java index 367fd9c1..ea5e80f3 100644 --- a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java +++ b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.java @@ -13,6 +13,7 @@ import dev.openrs2.asm.Library; import dev.openrs2.asm.Transformer; import dev.openrs2.deob.classpath.ClassPath; import dev.openrs2.deob.classpath.TypedRemapper; +import dev.openrs2.deob.transform.CanvasTransformer; import dev.openrs2.deob.transform.ClassForNameTransformer; import dev.openrs2.deob.transform.ExceptionTracingTransformer; import dev.openrs2.deob.transform.OpaquePredicateTransformer; @@ -25,7 +26,8 @@ public final class Deobfuscator { private static final List TRANSFORMERS = List.of( new OpaquePredicateTransformer(), - new ExceptionTracingTransformer() + new ExceptionTracingTransformer(), + new CanvasTransformer() ); public static void main(String[] args) throws IOException { diff --git a/deob/src/main/java/dev/openrs2/deob/transform/CanvasTransformer.java b/deob/src/main/java/dev/openrs2/deob/transform/CanvasTransformer.java new file mode 100644 index 00000000..d1c62cb5 --- /dev/null +++ b/deob/src/main/java/dev/openrs2/deob/transform/CanvasTransformer.java @@ -0,0 +1,20 @@ +package dev.openrs2.deob.transform; + +import dev.openrs2.asm.Transformer; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.tree.ClassNode; + +public final class CanvasTransformer extends Transformer { + @Override + public void transformClass(ClassNode clazz) { + if (!"java/awt/Canvas".equals(clazz.superName)) { + return; + } + + if ((clazz.access & Opcodes.ACC_FINAL) == 0) { + return; + } + + clazz.interfaces.remove("java/awt/event/FocusListener"); + } +}