From e9a9a8f962e6b5b579786bfe59b6698fbd3ba710 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 4 Jan 2020 14:53:04 +0000 Subject: [PATCH] Format with ktlint --- .../main/java/dev/openrs2/asm/MemberRef.kt | 6 +++- .../java/dev/openrs2/asm/MethodNodeUtils.kt | 6 +++- .../java/dev/openrs2/asm/StackMetadata.kt | 7 +++- .../java/dev/openrs2/asm/classpath/Library.kt | 3 +- .../openrs2/asm/remap/ClassForNameRemapper.kt | 6 ++-- .../main/java/dev/openrs2/bundler/Bundler.kt | 7 +++- .../bundler/transform/HostCheckTransformer.kt | 6 +++- .../bundler/transform/MacResizeTransformer.kt | 19 +++++++++-- .../transform/RightClickTransformer.kt | 7 +++- .../common/collect/ForestDisjointSet.kt | 3 +- .../dev/openrs2/deob/ast/AstDeobfuscator.kt | 12 ++++++- .../dev/openrs2/deob/ast/util/ExprUtils.kt | 7 +++- .../java/dev/openrs2/deob/Deobfuscator.kt | 15 +++++++- .../deob/transform/BitwiseOpTransformer.kt | 6 +++- .../deob/transform/DummyArgTransformer.kt | 34 ++++++++++++++++--- .../transform/ExceptionTracingTransformer.kt | 15 ++++++-- .../transform/OpaquePredicateTransformer.kt | 17 ++++++++-- .../deob/transform/ResetTransformer.kt | 8 ++++- .../deob/transform/UnusedArgTransformer.kt | 6 +++- 19 files changed, 159 insertions(+), 31 deletions(-) diff --git a/asm/src/main/java/dev/openrs2/asm/MemberRef.kt b/asm/src/main/java/dev/openrs2/asm/MemberRef.kt index 5bc0392d97..b0a6e8abee 100644 --- a/asm/src/main/java/dev/openrs2/asm/MemberRef.kt +++ b/asm/src/main/java/dev/openrs2/asm/MemberRef.kt @@ -1,6 +1,10 @@ package dev.openrs2.asm -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.FieldInsnNode +import org.objectweb.asm.tree.FieldNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode data class MemberRef(val owner: String, val name: String, val desc: String) { constructor(clazz: ClassNode, field: FieldNode) : this(clazz.name, field.name, field.desc) diff --git a/asm/src/main/java/dev/openrs2/asm/MethodNodeUtils.kt b/asm/src/main/java/dev/openrs2/asm/MethodNodeUtils.kt index df9cc2ce83..e7edcda99b 100644 --- a/asm/src/main/java/dev/openrs2/asm/MethodNodeUtils.kt +++ b/asm/src/main/java/dev/openrs2/asm/MethodNodeUtils.kt @@ -2,7 +2,11 @@ package dev.openrs2.asm import org.objectweb.asm.Opcodes import org.objectweb.asm.Type -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.FrameNode +import org.objectweb.asm.tree.IincInsnNode +import org.objectweb.asm.tree.LabelNode +import org.objectweb.asm.tree.MethodNode +import org.objectweb.asm.tree.VarInsnNode import org.objectweb.asm.tree.analysis.Analyzer import org.objectweb.asm.tree.analysis.BasicInterpreter import org.objectweb.asm.tree.analysis.BasicValue diff --git a/asm/src/main/java/dev/openrs2/asm/StackMetadata.kt b/asm/src/main/java/dev/openrs2/asm/StackMetadata.kt index e6d9e64c49..b7290b58bf 100644 --- a/asm/src/main/java/dev/openrs2/asm/StackMetadata.kt +++ b/asm/src/main/java/dev/openrs2/asm/StackMetadata.kt @@ -2,7 +2,12 @@ package dev.openrs2.asm import org.objectweb.asm.Opcodes import org.objectweb.asm.Type -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.AbstractInsnNode +import org.objectweb.asm.tree.FieldInsnNode +import org.objectweb.asm.tree.InvokeDynamicInsnNode +import org.objectweb.asm.tree.LdcInsnNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MultiANewArrayInsnNode data class StackMetadata(val pops: Int, val pushes: Int) diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt b/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt index 8553fcdae2..6393201e45 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/Library.kt @@ -16,7 +16,8 @@ import java.io.ByteArrayInputStream import java.io.SequenceInputStream import java.nio.file.Files import java.nio.file.Path -import java.util.* +import java.util.HashSet +import java.util.TreeMap import java.util.jar.JarEntry import java.util.jar.JarInputStream import java.util.jar.JarOutputStream diff --git a/asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt b/asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt index ee80e2975e..e928ca60b1 100644 --- a/asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt +++ b/asm/src/main/java/dev/openrs2/asm/remap/ClassForNameRemapper.kt @@ -17,9 +17,9 @@ object ClassForNameRemapper { } val invokestatic = match[1] as MethodInsnNode - return invokestatic.owner == "java/lang/Class" - && invokestatic.name == "forName" - && invokestatic.desc == "(Ljava/lang/String;)Ljava/lang/Class;" + return invokestatic.owner == "java/lang/Class" && + invokestatic.name == "forName" && + invokestatic.desc == "(Ljava/lang/String;)Ljava/lang/Class;" } fun remap(remapper: Remapper, method: MethodNode) { diff --git a/bundler/src/main/java/dev/openrs2/bundler/Bundler.kt b/bundler/src/main/java/dev/openrs2/bundler/Bundler.kt index e6b297d338..7c81343f04 100644 --- a/bundler/src/main/java/dev/openrs2/bundler/Bundler.kt +++ b/bundler/src/main/java/dev/openrs2/bundler/Bundler.kt @@ -1,6 +1,11 @@ package dev.openrs2.bundler -import dev.openrs2.bundler.transform.* +import dev.openrs2.bundler.transform.BufferSizeTransformer +import dev.openrs2.bundler.transform.CachePathTransformer +import dev.openrs2.bundler.transform.HostCheckTransformer +import dev.openrs2.bundler.transform.LoadLibraryTransformer +import dev.openrs2.bundler.transform.MacResizeTransformer +import dev.openrs2.bundler.transform.RightClickTransformer class Bundler { companion object { diff --git a/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.kt b/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.kt index 2604fb23fa..e1ed8a24ef 100644 --- a/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.kt +++ b/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.kt @@ -36,7 +36,11 @@ class HostCheckTransformer : Transformer() { } val insn3 = it[2] as MethodInsnNode - if (insn3.owner != "java/lang/String" || insn3.name != "toLowerCase" || insn3.desc != "()Ljava/lang/String;") { + if ( + insn3.owner != "java/lang/String" || + insn3.name != "toLowerCase" || + insn3.desc != "()Ljava/lang/String;" + ) { return@forEach } diff --git a/bundler/src/main/java/dev/openrs2/bundler/transform/MacResizeTransformer.kt b/bundler/src/main/java/dev/openrs2/bundler/transform/MacResizeTransformer.kt index cd39957f91..246797e7fb 100644 --- a/bundler/src/main/java/dev/openrs2/bundler/transform/MacResizeTransformer.kt +++ b/bundler/src/main/java/dev/openrs2/bundler/transform/MacResizeTransformer.kt @@ -6,7 +6,12 @@ import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.transform.Transformer import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.FieldInsnNode +import org.objectweb.asm.tree.JumpInsnNode +import org.objectweb.asm.tree.LdcInsnNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode class MacResizeTransformer : Transformer() { private var branchesRemoved = 0 @@ -18,7 +23,11 @@ class MacResizeTransformer : Transformer() { override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean { DETECT_MAC_MATCHER.match(method).forEach { val getstatic = it[0] as FieldInsnNode - if (getstatic.owner == "loader" || getstatic.owner == clazz.name || getstatic.desc != "Ljava/lang/String;") { + if ( + getstatic.owner == "loader" || + getstatic.owner == clazz.name || + getstatic.desc != "Ljava/lang/String;" + ) { return@forEach } @@ -28,7 +37,11 @@ class MacResizeTransformer : Transformer() { } val invokevirtual = it[2] as MethodInsnNode - if (invokevirtual.owner != "java/lang/String" || invokevirtual.name != "startsWith" || invokevirtual.desc != "(Ljava/lang/String;)Z") { + if ( + invokevirtual.owner != "java/lang/String" || + invokevirtual.name != "startsWith" || + invokevirtual.desc != "(Ljava/lang/String;)Z" + ) { return@forEach } diff --git a/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.kt b/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.kt index 96580c829e..43c993a5dd 100644 --- a/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.kt +++ b/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.kt @@ -5,7 +5,12 @@ import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.transform.Transformer import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.FieldInsnNode +import org.objectweb.asm.tree.InsnList +import org.objectweb.asm.tree.InsnNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode class RightClickTransformer : Transformer() { private var metaDownCalls = 0 diff --git a/common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt b/common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt index 39db54394e..f16f5e4535 100644 --- a/common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt +++ b/common/src/main/java/dev/openrs2/common/collect/ForestDisjointSet.kt @@ -1,7 +1,6 @@ package dev.openrs2.common.collect -import java.util.* -import kotlin.NoSuchElementException +import java.util.ArrayDeque class ForestDisjointSet : DisjointSet { private class Node(val value: T) : DisjointSet.Partition { diff --git a/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt b/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt index f58d52ceae..fcfb3bc153 100644 --- a/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt +++ b/deob-ast/src/main/java/dev/openrs2/deob/ast/AstDeobfuscator.kt @@ -9,7 +9,17 @@ import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSol import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver import com.github.javaparser.utils.SourceRoot -import dev.openrs2.deob.ast.transform.* +import dev.openrs2.deob.ast.transform.AddSubTransformer +import dev.openrs2.deob.ast.transform.BinaryExprOrderTransformer +import dev.openrs2.deob.ast.transform.BitMaskTransformer +import dev.openrs2.deob.ast.transform.ComplementTransformer +import dev.openrs2.deob.ast.transform.EncloseTransformer +import dev.openrs2.deob.ast.transform.IfElseTransformer +import dev.openrs2.deob.ast.transform.NegativeLiteralTransformer +import dev.openrs2.deob.ast.transform.NewInstanceTransformer +import dev.openrs2.deob.ast.transform.TernaryTransformer +import dev.openrs2.deob.ast.transform.UnencloseTransformer +import dev.openrs2.deob.ast.transform.ValueOfTransformer import java.nio.file.Path import java.nio.file.Paths import java.util.function.Function diff --git a/deob-ast/src/main/java/dev/openrs2/deob/ast/util/ExprUtils.kt b/deob-ast/src/main/java/dev/openrs2/deob/ast/util/ExprUtils.kt index aa3ae8fb7f..3d6c34f305 100644 --- a/deob-ast/src/main/java/dev/openrs2/deob/ast/util/ExprUtils.kt +++ b/deob-ast/src/main/java/dev/openrs2/deob/ast/util/ExprUtils.kt @@ -1,6 +1,11 @@ package dev.openrs2.deob.ast.util -import com.github.javaparser.ast.expr.* +import com.github.javaparser.ast.expr.BinaryExpr +import com.github.javaparser.ast.expr.BooleanLiteralExpr +import com.github.javaparser.ast.expr.Expression +import com.github.javaparser.ast.expr.IntegerLiteralExpr +import com.github.javaparser.ast.expr.LongLiteralExpr +import com.github.javaparser.ast.expr.UnaryExpr fun Expression.isIntegerOrLongLiteral(): Boolean { return isIntegerLiteralExpr || isLongLiteralExpr diff --git a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt index eb54e08778..11349384a1 100644 --- a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt +++ b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt @@ -8,7 +8,20 @@ import dev.openrs2.asm.classpath.Library.Companion.readPack import dev.openrs2.bundler.Bundler import dev.openrs2.deob.SignedClassUtils.move import dev.openrs2.deob.remap.PrefixRemapper.create -import dev.openrs2.deob.transform.* +import dev.openrs2.deob.transform.AccessTransformer +import dev.openrs2.deob.transform.BitShiftTransformer +import dev.openrs2.deob.transform.BitwiseOpTransformer +import dev.openrs2.deob.transform.CanvasTransformer +import dev.openrs2.deob.transform.CounterTransformer +import dev.openrs2.deob.transform.DummyArgTransformer +import dev.openrs2.deob.transform.DummyLocalTransformer +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 dev.openrs2.deob.transform.ResetTransformer +import dev.openrs2.deob.transform.UnusedArgTransformer import java.nio.file.Files import java.nio.file.Path import java.nio.file.Paths diff --git a/deob/src/main/java/dev/openrs2/deob/transform/BitwiseOpTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/BitwiseOpTransformer.kt index 361a864cff..835ac27091 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/BitwiseOpTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/BitwiseOpTransformer.kt @@ -8,7 +8,11 @@ import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.hasCode import dev.openrs2.asm.transform.Transformer import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.InsnNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode +import org.objectweb.asm.tree.VarInsnNode import kotlin.streams.asSequence class BitwiseOpTransformer : Transformer() { diff --git a/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt index 694e2ba183..06319d7538 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt @@ -3,9 +3,17 @@ package dev.openrs2.deob.transform import com.github.michaelbull.logging.InlineLogger import com.google.common.collect.HashMultimap import com.google.common.collect.Multimap -import dev.openrs2.asm.* +import dev.openrs2.asm.InsnMatcher +import dev.openrs2.asm.MemberRef import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library +import dev.openrs2.asm.createIntConstant +import dev.openrs2.asm.deleteSimpleExpression +import dev.openrs2.asm.intConstant +import dev.openrs2.asm.nextReal +import dev.openrs2.asm.pure +import dev.openrs2.asm.replaceSimpleExpression +import dev.openrs2.asm.stackMetadata import dev.openrs2.asm.transform.Transformer import dev.openrs2.common.collect.DisjointSet import dev.openrs2.deob.ArgRef @@ -14,7 +22,12 @@ import dev.openrs2.deob.analysis.IntValue import dev.openrs2.deob.analysis.SourcedIntValue import org.objectweb.asm.Opcodes import org.objectweb.asm.Type -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.AbstractInsnNode +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.JumpInsnNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode +import org.objectweb.asm.tree.VarInsnNode import org.objectweb.asm.tree.analysis.Analyzer class DummyArgTransformer : Transformer() { @@ -247,7 +260,8 @@ class DummyArgTransformer : Transformer() { BranchResult.NEVER_TAKEN -> neverTakenBranches.add(insn as JumpInsnNode) } } - Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPLT, Opcodes.IF_ICMPGE, Opcodes.IF_ICMPGT, Opcodes.IF_ICMPLE -> { + Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPLT, Opcodes.IF_ICMPGE, Opcodes.IF_ICMPGT, + Opcodes.IF_ICMPLE -> { val value1 = frame.getStack(stackSize - 2) val value2 = frame.getStack(stackSize - 1) if (value1 !is IntValue.Constant || value2 !is IntValue.Constant) { @@ -340,8 +354,18 @@ class DummyArgTransformer : Transformer() { companion object { private val logger = InlineLogger() - private val CONDITIONAL_CALL_MATCHER = - InsnMatcher.compile("ILOAD (IFEQ | IFNE | (ICONST | BIPUSH | SIPUSH | LDC) (IF_ICMPEQ | IF_ICMPNE | IF_ICMPLT | IF_ICMPGE | IF_ICMPGT | IF_ICMPLE)) ALOAD? (ICONST | FCONST | DCONST | BIPUSH | SIPUSH | LDC | ACONST_NULL CHECKCAST)+ (INVOKEVIRTUAL | INVOKESTATIC | INVOKEINTERFACE)") + private val CONDITIONAL_CALL_MATCHER = InsnMatcher.compile( + """ + ILOAD + (IFEQ | IFNE | + (ICONST | BIPUSH | SIPUSH | LDC) + (IF_ICMPEQ | IF_ICMPNE | IF_ICMPLT | IF_ICMPGE | IF_ICMPGT | IF_ICMPLE) + ) + ALOAD? + (ICONST | FCONST | DCONST | BIPUSH | SIPUSH | LDC | ACONST_NULL CHECKCAST)+ + (INVOKEVIRTUAL | INVOKESTATIC | INVOKEINTERFACE) + """ + ) private fun evaluateUnaryBranch(opcode: Int, values: Set): BranchResult { require(values.isNotEmpty()) diff --git a/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt index bb9106b047..556b9635ca 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/ExceptionTracingTransformer.kt @@ -41,7 +41,18 @@ class ExceptionTracingTransformer : Transformer() { companion object { private val logger = InlineLogger() - private val CATCH_MATCHER = - InsnMatcher.compile("ASTORE ALOAD (| LDC INVOKESTATIC | NEW DUP (LDC INVOKESPECIAL | INVOKESPECIAL LDC INVOKEVIRTUAL) ((ILOAD | LLOAD | FLOAD | DLOAD | (ALOAD IFNULL LDC GOTO LDC) | BIPUSH) INVOKEVIRTUAL)* INVOKEVIRTUAL INVOKESTATIC) ATHROW") + private val CATCH_MATCHER = InsnMatcher.compile( + """ + ASTORE + ALOAD + (| LDC INVOKESTATIC | + NEW DUP + (LDC INVOKESPECIAL | INVOKESPECIAL LDC INVOKEVIRTUAL) + ((ILOAD | LLOAD | FLOAD | DLOAD | (ALOAD IFNULL LDC GOTO LDC) | BIPUSH) INVOKEVIRTUAL)* + INVOKEVIRTUAL INVOKESTATIC + ) + ATHROW + """ + ) } } diff --git a/deob/src/main/java/dev/openrs2/deob/transform/OpaquePredicateTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/OpaquePredicateTransformer.kt index a056b1b6b7..716f76c6ed 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/OpaquePredicateTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/OpaquePredicateTransformer.kt @@ -8,7 +8,12 @@ import dev.openrs2.asm.classpath.Library import dev.openrs2.asm.hasCode import dev.openrs2.asm.transform.Transformer import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.AbstractInsnNode +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.FieldInsnNode +import org.objectweb.asm.tree.JumpInsnNode +import org.objectweb.asm.tree.MethodNode +import org.objectweb.asm.tree.VarInsnNode class OpaquePredicateTransformer : Transformer() { private val flowObstructors = mutableSetOf() @@ -105,8 +110,14 @@ class OpaquePredicateTransformer : Transformer() { companion object { private val logger = InlineLogger() - private val FLOW_OBSTRUCTOR_INITIALIZER_MATCHER = - InsnMatcher.compile("(GETSTATIC | ILOAD) IFEQ (((GETSTATIC ISTORE)? IINC ILOAD) | ((GETSTATIC | ILOAD) IFEQ ICONST GOTO ICONST)) PUTSTATIC") + private val FLOW_OBSTRUCTOR_INITIALIZER_MATCHER = InsnMatcher.compile( + """ + (GETSTATIC | ILOAD) + IFEQ + (((GETSTATIC ISTORE)? IINC ILOAD) | ((GETSTATIC | ILOAD) IFEQ ICONST GOTO ICONST)) + PUTSTATIC + """ + ) private val OPAQUE_PREDICATE_MATCHER = InsnMatcher.compile("(GETSTATIC | ILOAD) (IFEQ | IFNE)") private val STORE_MATCHER = InsnMatcher.compile("GETSTATIC ISTORE") } diff --git a/deob/src/main/java/dev/openrs2/deob/transform/ResetTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/ResetTransformer.kt index 226630a5c3..b9c07256f7 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/ResetTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/ResetTransformer.kt @@ -9,7 +9,13 @@ import dev.openrs2.asm.nextReal import dev.openrs2.asm.removeDeadCode import dev.openrs2.asm.transform.Transformer import org.objectweb.asm.Opcodes -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.AbstractInsnNode +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.InsnNode +import org.objectweb.asm.tree.LdcInsnNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode +import org.objectweb.asm.tree.VarInsnNode class ResetTransformer : Transformer() { private val resetMethods = mutableSetOf() diff --git a/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt index c1b24953fc..a6e1d86e5d 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/UnusedArgTransformer.kt @@ -14,7 +14,11 @@ import dev.openrs2.deob.analysis.ConstSourceValue import dev.openrs2.deob.remap.TypedRemapper import org.objectweb.asm.Opcodes import org.objectweb.asm.Type -import org.objectweb.asm.tree.* +import org.objectweb.asm.tree.AbstractInsnNode +import org.objectweb.asm.tree.ClassNode +import org.objectweb.asm.tree.MethodInsnNode +import org.objectweb.asm.tree.MethodNode +import org.objectweb.asm.tree.VarInsnNode import org.objectweb.asm.tree.analysis.Analyzer class UnusedArgTransformer : Transformer() {