From 76f940e734f1dbbe34a4b73b007a55e2b6ac906e Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 2 May 2020 11:05:46 +0100 Subject: [PATCH] Remove unintentional static imports Some of these method names only make sense when accompanied with the class name. I think most of these were mistakes in the Java -> Kotlin port. Signed-off-by: Graham --- .../java/dev/openrs2/deob/Deobfuscator.kt | 29 +++++++++---------- .../dev/openrs2/deob/analysis/IntBranch.kt | 5 ++-- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt index fa3760d008..6146bf8a41 100644 --- a/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt +++ b/deob/src/main/java/dev/openrs2/deob/Deobfuscator.kt @@ -3,11 +3,8 @@ package dev.openrs2.deob import com.github.michaelbull.logging.InlineLogger import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.asm.classpath.Library -import dev.openrs2.asm.classpath.Library.Companion.readJar -import dev.openrs2.asm.classpath.Library.Companion.readPack import dev.openrs2.asm.transform.Transformer -import dev.openrs2.deob.SignedClassUtils.move -import dev.openrs2.deob.remap.PrefixRemapper.create +import dev.openrs2.deob.remap.PrefixRemapper import java.nio.file.Files import java.nio.file.Path import javax.inject.Inject @@ -20,13 +17,13 @@ class Deobfuscator @Inject constructor( fun run(input: Path, output: Path) { // read input jars/packs logger.info { "Reading input jars" } - val unpackClass = readJar(input.resolve("unpackclass.pack")) + val unpackClass = Library.readJar(input.resolve("unpackclass.pack")) val glUnpackClass = Library(unpackClass) - val loader = readJar(input.resolve("loader.jar")) - val glLoader = readJar(input.resolve("loader_gl.jar")) - val gl = readPack(input.resolve("jaggl.pack200")) - val client = readJar(input.resolve("runescape.jar")) - val glClient = readPack(input.resolve("runescape_gl.pack200")) + val loader = Library.readJar(input.resolve("loader.jar")) + val glLoader = Library.readJar(input.resolve("loader_gl.jar")) + val gl = Library.readPack(input.resolve("jaggl.pack200")) + val client = Library.readJar(input.resolve("runescape.jar")) + val glClient = Library.readPack(input.resolve("runescape_gl.pack200")) // TODO(gpe): it'd be nice to have separate signlink.jar and // signlink-unsigned.jar files so we don't (effectively) deobfuscate @@ -37,11 +34,11 @@ class Deobfuscator @Inject constructor( // overwrite client's classes with signed classes from the loader logger.info { "Moving signed classes from loader" } val signLink = Library() - move(loader, client, signLink) + SignedClassUtils.move(loader, client, signLink) logger.info { "Moving signed classes from loader_gl" } val glSignLink = Library() - move(glLoader, glClient, glSignLink) + SignedClassUtils.move(glLoader, glClient, glSignLink) // move unpack class out of the loader (so the unpacker and loader can both depend on it) logger.info { "Moving unpack from loader to unpack" } @@ -54,10 +51,10 @@ class Deobfuscator @Inject constructor( // prefix remaining loader/unpacker classes (to avoid conflicts when we rename in the same classpath as the client) logger.info { "Prefixing loader and unpackclass class names" } - loader.remap(create(loader, "loader_")) - glLoader.remap(create(glLoader, "loader_")) - unpackClass.remap(create(unpackClass, "unpackclass_")) - glUnpackClass.remap(create(glUnpackClass, "unpackclass_")) + loader.remap(PrefixRemapper.create(loader, "loader_")) + glLoader.remap(PrefixRemapper.create(glLoader, "loader_")) + unpackClass.remap(PrefixRemapper.create(unpackClass, "unpackclass_")) + glUnpackClass.remap(PrefixRemapper.create(glUnpackClass, "unpackclass_")) // bundle libraries together into a common classpath val runtime = ClassLoader.getPlatformClassLoader() diff --git a/deob/src/main/java/dev/openrs2/deob/analysis/IntBranch.kt b/deob/src/main/java/dev/openrs2/deob/analysis/IntBranch.kt index 62f7b4d3ed..937dc8abe4 100644 --- a/deob/src/main/java/dev/openrs2/deob/analysis/IntBranch.kt +++ b/deob/src/main/java/dev/openrs2/deob/analysis/IntBranch.kt @@ -1,6 +1,5 @@ package dev.openrs2.deob.analysis -import dev.openrs2.deob.analysis.IntBranchResult.Companion.fromTakenNotTaken import org.objectweb.asm.Opcodes.IFEQ import org.objectweb.asm.Opcodes.IFGE import org.objectweb.asm.Opcodes.IFGT @@ -29,7 +28,7 @@ object IntBranch { } } - return fromTakenNotTaken(taken, notTaken) + return IntBranchResult.fromTakenNotTaken(taken, notTaken) } private fun evaluateUnary(opcode: Int, value: Int): Boolean { @@ -61,7 +60,7 @@ object IntBranch { } } - return fromTakenNotTaken(taken, notTaken) + return IntBranchResult.fromTakenNotTaken(taken, notTaken) } private fun evaluateBinary(opcode: Int, value1: Int, value2: Int): Boolean {