From 106de31a9df571894108497b6a4da482c1da99b8 Mon Sep 17 00:00:00 2001 From: ThatGamerBlue Date: Wed, 26 Aug 2020 20:53:29 +0100 Subject: [PATCH] deobber: fixes --- build.gradle.kts | 1 + buildSrc/src/main/kotlin/Dependencies.kt | 2 +- deobfuscator/deobfuscator.gradle.kts | 6 ++--- .../runelite/deob/deobfuscators/Renamer.java | 24 +++++++++++++++---- .../mapping/AnnotationMapper.java | 2 +- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index dd7c52b6f8..6357fa204c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,6 +28,7 @@ import org.ajoberstar.grgit.Grgit buildscript { repositories { + mavenLocal() gradlePluginPortal() maven(url = "https://repo.openosrs.com/repository/maven/") maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master") diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index c6f46b6c4e..f5e22dae9d 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -29,6 +29,6 @@ object ProjectVersions { const val openosrsVersion = "3.4.2" - const val rsversion = 190 + const val rsversion = 191 const val cacheversion = 165 } diff --git a/deobfuscator/deobfuscator.gradle.kts b/deobfuscator/deobfuscator.gradle.kts index 58af1ba65b..956c74662f 100644 --- a/deobfuscator/deobfuscator.gradle.kts +++ b/deobfuscator/deobfuscator.gradle.kts @@ -93,14 +93,14 @@ tasks { filteringCharset = "UTF-8" } // TODO: Enable assertions on all 3 - register("Downloader.main()") { + register("Downloader\$main()") { group = "gamepack" classpath = project.sourceSets.main.get().runtimeClasspath main = "net.runelite.gamepack.Downloader" } - register("Deob.main()") { + register("Deob\$main()") { group = "gamepack" classpath = project.sourceSets.main.get().runtimeClasspath @@ -108,7 +108,7 @@ tasks { args = listOf(tokens["vanilla.jar"], "$buildDir/libs/deobfuscated-$version.jar") } - register("UpdateMappings.main()") { + register("UpdateMappings\$main()") { group = "gamepack" classpath = project.sourceSets.main.get().runtimeClasspath diff --git a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Renamer.java b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Renamer.java index 94e858745e..967019191a 100644 --- a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Renamer.java +++ b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Renamer.java @@ -42,12 +42,11 @@ import net.runelite.asm.signature.Signature; import net.runelite.asm.signature.util.VirtualMethods; import net.runelite.deob.DeobAnnotations; +import static net.runelite.deob.DeobAnnotations.*; import net.runelite.deob.Deobfuscator; import net.runelite.deob.util.NameMappings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static net.runelite.deob.DeobAnnotations.OBFUSCATED_NAME; -import static net.runelite.deob.DeobAnnotations.OBFUSCATED_SIGNATURE; public class Renamer implements Deobfuscator { @@ -137,7 +136,10 @@ private void renameClass(ClassGroup group, ClassFile cf, String name) if (!method.getDescriptor().equals(newSignature)) { - method.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement( "descriptor", method.getDescriptor().toString()); + if (method.findAnnotation(OBFUSCATED_SIGNATURE) == null) + { + method.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement("descriptor", method.getDescriptor().toString()); + } } method.setDescriptor(newSignature); @@ -154,7 +156,10 @@ private void renameClass(ClassGroup group, ClassFile cf, String name) { if (field.getType().getInternalName().equals(cf.getName())) { - field.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement("descriptor", field.getType().toString()); + if (field.findAnnotation(OBFUSCATED_SIGNATURE) == null) + { + field.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement("descriptor", field.getType().toString()); + } field.setType(Type.getType("L" + name + ";", field.getType().getDimensions())); } } @@ -168,10 +173,16 @@ private void renameClass(ClassGroup group, ClassFile cf, String name) private void regeneratePool(ClassGroup group) { for (ClassFile cf : group.getClasses()) + { for (Method m : cf.getMethods()) + { if (m.getCode() != null) + { m.getCode().getInstructions() .regeneratePool(); + } + } + } } @Override @@ -276,6 +287,9 @@ else if (newParams.length < 1 || index > newParams.length - 1 || Strings.isNullO private static void addObfuscatedName(T object) { - object.findAnnotation(OBFUSCATED_NAME, true).setElement(object.getName()); + if (object.findAnnotation(OBFUSCATED_NAME) == null) + { + object.findAnnotation(OBFUSCATED_NAME, true).setElement(object.getName()); + } } } diff --git a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/AnnotationMapper.java b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/AnnotationMapper.java index 7cbe4c9862..f12aaaac55 100644 --- a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/AnnotationMapper.java +++ b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/AnnotationMapper.java @@ -123,7 +123,7 @@ private int copyAnnotations(Annotated from, Annotated to) { if (isCopyable(a)) { - to.addAnnotation(a.getType(), a); + to.addAnnotation(a); ++count; } }