Merge pull request #2745 from Lucwousin/deob-annot

Deob/asm: Improve cfg deob, reproducible jars, smart annotations
This commit is contained in:
Tyler Bochard
2020-08-01 19:23:04 -04:00
committed by GitHub
396 changed files with 3392 additions and 4343 deletions
+4 -2
View File
@@ -34,8 +34,8 @@ buildscript {
} }
dependencies { dependencies {
classpath("org.ajoberstar.grgit:grgit-core:4.0.2") classpath("org.ajoberstar.grgit:grgit-core:4.0.2")
classpath("com.github.ben-manes:gradle-versions-plugin:0.29.0") classpath("com.github.ben-manes:gradle-versions-plugin:0.28.0")
classpath("com.openosrs:injector-plugin:1.1.4") classpath("com.openosrs:injector-plugin:1.1.5")
} }
} }
@@ -202,6 +202,8 @@ subprojects {
} }
} }
} }
configurations["compileOnly"].extendsFrom(configurations["annotationProcessor"])
} }
application { application {
+4 -1
View File
@@ -35,6 +35,8 @@ dependencies {
deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString()) deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString())
deobjars(project(":runescape-client")) deobjars(project(":runescape-client"))
annotationProcessor(group = "org.projectlombok", name = "lombok", version = "1.18.12")
implementation(group = "org.jetbrains", name = "annotations", version = "19.0.0") implementation(group = "org.jetbrains", name = "annotations", version = "19.0.0")
implementation(group = "org.ow2.asm", name = "asm", version = "8.0.1") implementation(group = "org.ow2.asm", name = "asm", version = "8.0.1")
implementation(group = "org.ow2.asm", name = "asm-util", version = "8.0.1") implementation(group = "org.ow2.asm", name = "asm-util", version = "8.0.1")
@@ -90,7 +92,7 @@ tasks {
filter(ReplaceTokens::class, "tokens" to tokens) filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8" filteringCharset = "UTF-8"
} }
// TODO: Enable assertions on all 3
register<JavaExec>("Downloader.main()") { register<JavaExec>("Downloader.main()") {
group = "gamepack" group = "gamepack"
@@ -103,6 +105,7 @@ tasks {
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.deob.Deob" main = "net.runelite.deob.Deob"
args = listOf(tokens["vanilla.jar"], "$buildDir/libs/deobfuscated-$version.jar")
} }
register<JavaExec>("UpdateMappings.main()") { register<JavaExec>("UpdateMappings.main()") {
@@ -1,17 +0,0 @@
package net.runelite.asm;
import java.util.Iterator;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.annotation.Annotation;
import org.jetbrains.annotations.NotNull;
public interface Annotated extends Iterable<Annotation>
{
Annotations getAnnotations();
@NotNull
default Iterator<Annotation> iterator()
{
return getAnnotations().iterator();
}
}
@@ -0,0 +1,217 @@
/*
* Copyright (c) 2020, Lucas <https://github.com/Lucwousin>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.asm;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.jetbrains.annotations.NotNull;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;
/**
* Note: this class has a natural ordering that is inconsistent with equals.
*/
public class Annotation extends AnnotationVisitor implements Comparable<Annotation>
{
/**
* Name:Value pairs in this annotation. Uses a tree map to make order reproducible.
*
* Data can be any of the following:
* - Primitive values
* - Strings
* - Class objects
* - Enum constants (not implemented)
* - Arrays of any of the above (use {@link ArrayList}
* - Other Annotations
*/
private final TreeMap<String, Object> data = new TreeMap<>();
private final Type type;
/**
* Unused for now but here for easy implementation later if anyone wants to
*/
private final boolean visible;
public Annotation(Type type)
{
this(type, true);
}
public Annotation(Type type, Object val)
{
this(type);
this.setElement(val);
}
public Annotation(Type type, boolean visible)
{
super(Opcodes.ASM5);
this.type = type;
this.visible = visible;
}
public Type getType()
{
return type;
}
public void addElement(String name, Object value)
{
if (data.put(name, value) != null)
throw new IllegalStateException("The annotation already contains a value mapped to " + name);
}
public void addElement(Object value)
{
addElement("value", value);
}
public void setElement(String name, Object value)
{
data.put(name, value);
}
public void setElement(Object value)
{
setElement("value", value);
}
public Object remove(String name)
{
return data.remove(name);
}
public Object get(String name)
{
return data.get(name);
}
public Object getValue()
{
return get("value");
}
public String getValueString()
{
return (String) getValue();
}
public int size()
{
return data.size();
}
@Override
public void visit(String name, Object value)
{
data.put(name, value);
}
@Override
public AnnotationVisitor visitAnnotation(String name, String descriptor)
{
final var annotation = new Annotation(new Type(descriptor));
data.put(name, annotation);
return annotation;
}
@Override
public AnnotationVisitor visitArray(String name)
{
final var lst = new ArrayList<>();
data.put(name, lst);
return new AnnotationVisitor(Opcodes.ASM5)
{
@Override
public void visit(String name, Object value)
{
lst.add(value);
}
@Override
public AnnotationVisitor visitAnnotation(String name, String descriptor)
{
Annotation annotation = new Annotation(new Type(descriptor));
lst.add(annotation);
return annotation;
}
};
}
public void accept(AnnotationVisitor visitor)
{
if (visitor == null)
return;
for (var entry : data.entrySet())
accept(visitor, entry.getKey(), entry.getValue());
visitor.visitEnd();
}
private static void accept(AnnotationVisitor visitor, final String name, final Object value)
{
if (visitor == null)
return;
if (value instanceof Annotation)
{
Annotation annotation = (Annotation) value;
annotation.accept(visitor.visitAnnotation(name, annotation.getType().toString()));
}
else if (value instanceof List)
{
AnnotationVisitor arr = visitor.visitArray(name);
List<?> arrayValue = (List<?>) value;
for (Object o : arrayValue)
{
accept(arr, null, o);
}
arr.visitEnd();
}
else
{
visitor.visit(name, value);
}
}
@Override
public int compareTo(@NotNull Annotation that)
{
return this.type.toString().compareTo(that.type.toString());
}
@Override
public String toString()
{
StringBuilder str = new StringBuilder('@' + type.toAsmString().replace('/', '.') + '(');
for (Map.Entry<String, Object> e : data.entrySet())
str.append(e.getKey()).append('=').append(e.getValue().toString());
str.append(')');
return str.toString();
}
}
@@ -25,9 +25,11 @@
package net.runelite.asm; package net.runelite.asm;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import net.runelite.asm.attributes.Annotations; import java.util.Map;
import net.runelite.asm.attributes.annotation.Annotation; import lombok.Getter;
import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.pool.Class; import net.runelite.asm.pool.Class;
import net.runelite.asm.signature.Signature; import net.runelite.asm.signature.Signature;
import static net.runelite.deob.DeobAnnotations.*; import static net.runelite.deob.DeobAnnotations.*;
@@ -51,14 +53,14 @@ public class ClassFile implements Annotated, Named
private final Interfaces interfaces; private final Interfaces interfaces;
private final List<Field> fields = new ArrayList<>(); private final List<Field> fields = new ArrayList<>();
private final List<Method> methods = new ArrayList<>(); private final List<Method> methods = new ArrayList<>();
private final Annotations annotations; @Getter
private final Map<Type, Annotation> annotations = new LinkedHashMap<>();
public ClassFile(ClassGroup group) public ClassFile(ClassGroup group)
{ {
this.group = group; this.group = group;
interfaces = new Interfaces(this); interfaces = new Interfaces(this);
annotations = new Annotations();
} }
public ClassFile() public ClassFile()
@@ -99,7 +101,7 @@ public class ClassFile implements Annotated, Named
visitor.visit(version, access, name.getName(), null, super_class.getName(), ints); visitor.visit(version, access, name.getName(), null, super_class.getName(), ints);
visitor.visitSource(source, null); visitor.visitSource(source, null);
for (Annotation annotation : annotations) for (Annotation annotation : annotations.values())
{ {
annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true)); annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true));
} }
@@ -170,11 +172,6 @@ public class ClassFile implements Annotated, Named
methods.remove(method); methods.remove(method);
} }
public Annotations getAnnotations()
{
return annotations;
}
public String getName() public String getName()
{ {
return name.getName(); return name.getName();
@@ -312,7 +309,7 @@ public class ClassFile implements Annotated, Named
for (Method m : methods) for (Method m : methods)
{ {
if (m.isStatic() && if (m.isStatic() &&
name.equals(getObfuscatedName(m.getAnnotations())) && name.equals(getObfuscatedName(m)) &&
type.equals(getObfuscatedSignature(m))) type.equals(getObfuscatedSignature(m)))
{ {
return m; return m;
@@ -151,7 +151,7 @@ public class ClassGroup implements Iterable<ClassFile>
{ {
for (ClassFile cf : classes) for (ClassFile cf : classes)
{ {
if (name.equals(getObfuscatedName(cf.getAnnotations()))) if (name.equals(getObfuscatedName(cf)))
{ {
return cf; return cf;
} }
@@ -24,8 +24,10 @@
*/ */
package net.runelite.asm; package net.runelite.asm;
import net.runelite.asm.attributes.Annotations; import java.util.LinkedHashMap;
import net.runelite.asm.attributes.annotation.Annotation; import java.util.Map;
import lombok.Getter;
import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
@@ -43,20 +45,19 @@ public class Field implements Annotated, Named
private String name; private String name;
private Type type; private Type type;
private Object value; // ConstantValue private Object value; // ConstantValue
private final Annotations annotations; @Getter
private final Map<Type, Annotation> annotations = new LinkedHashMap<>();
public Field(ClassFile classFile, String name, Type type) public Field(ClassFile classFile, String name, Type type)
{ {
this.classFile = classFile; this.classFile = classFile;
this.name = name; this.name = name;
this.type = type; this.type = type;
this.annotations = new Annotations();
} }
public void accept(FieldVisitor visitor) public void accept(FieldVisitor visitor)
{ {
for (Annotation annotation : annotations.getAnnotations()) for (Annotation annotation : annotations.values())
{ {
annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true)); annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true));
} }
@@ -150,15 +151,10 @@ public class Field implements Annotated, Named
this.value = value; this.value = value;
} }
public Annotations getAnnotations()
{
return annotations;
}
public net.runelite.asm.pool.Field getPoolField() public net.runelite.asm.pool.Field getPoolField()
{ {
return new net.runelite.asm.pool.Field( return new net.runelite.asm.pool.Field(
new net.runelite.asm.pool.Class(classFile.getName()), classFile.getPoolClass(),
this.getName(), this.getName(),
this.getType() this.getType()
); );
@@ -98,7 +98,7 @@ public class Interfaces implements Iterable<Class>
final List<String> names = new ArrayList<>(); final List<String> names = new ArrayList<>();
for (ClassFile c : getMyInterfaces()) for (ClassFile c : getMyInterfaces())
{ {
String name = DeobAnnotations.getObfuscatedName(c.getAnnotations()); String name = DeobAnnotations.getObfuscatedName(c);
if (name == null) if (name == null)
{ {
continue; continue;
@@ -25,11 +25,13 @@
package net.runelite.asm; package net.runelite.asm;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import net.runelite.asm.attributes.Annotations; import java.util.Map;
import lombok.Getter;
import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.Code; import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.Exceptions; import net.runelite.asm.attributes.Exceptions;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.LocalVariable; import net.runelite.asm.attributes.code.LocalVariable;
import net.runelite.asm.attributes.code.Parameter; import net.runelite.asm.attributes.code.Parameter;
@@ -55,8 +57,9 @@ public class Method implements Annotated, Named
private int accessFlags; private int accessFlags;
private String name; private String name;
private Signature arguments; private Signature arguments;
private Exceptions exceptions; private final Exceptions exceptions;
private Annotations annotations; @Getter
private final Map<Type, Annotation> annotations = new LinkedHashMap<>();
private List<Parameter> parameters; private List<Parameter> parameters;
private Code code; private Code code;
@@ -66,7 +69,6 @@ public class Method implements Annotated, Named
this.name = name; this.name = name;
this.arguments = signature; this.arguments = signature;
exceptions = new Exceptions(); exceptions = new Exceptions();
annotations = new Annotations();
parameters = new ArrayList<>(); parameters = new ArrayList<>();
} }
@@ -89,7 +91,7 @@ public class Method implements Annotated, Named
visitor.visitParameter(p.getName(), p.getAccess()); visitor.visitParameter(p.getName(), p.getAccess());
} }
for (Annotation annotation : annotations.getAnnotations()) for (Annotation annotation : annotations.values())
{ {
annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true)); annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true));
} }
@@ -277,11 +279,6 @@ public class Method implements Annotated, Named
this.code = code; this.code = code;
} }
public Annotations getAnnotations()
{
return annotations;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Instruction & LVTInstruction> List<T> findLVTInstructionsForVariable(int index) public <T extends Instruction & LVTInstruction> List<T> findLVTInstructionsForVariable(int index)
{ {
@@ -313,7 +310,7 @@ public class Method implements Annotated, Named
public net.runelite.asm.pool.Method getPoolMethod() public net.runelite.asm.pool.Method getPoolMethod()
{ {
return new net.runelite.asm.pool.Method( return new net.runelite.asm.pool.Method(
new net.runelite.asm.pool.Class(classFile.getName()), classFile.getPoolClass(),
name, name,
arguments arguments
); );
@@ -0,0 +1,51 @@
package net.runelite.asm.attributes;
import java.util.Map;
import net.runelite.asm.Annotation;
import net.runelite.asm.Type;
/**
* Objects implementing this only have to implement getAnnotations.
*/
public interface Annotated
{
Map<Type, Annotation> getAnnotations();
default Annotation findAnnotation(Type type, boolean createNew)
{
if (createNew)
return getAnnotations().computeIfAbsent(type, Annotation::new);
else
return getAnnotations().get(type);
}
default Annotation findAnnotation(Type type)
{
return findAnnotation(type, false);
}
default void addAnnotation(Annotation annotation)
{
if (getAnnotations().put(annotation.getType(), annotation) != null)
throw new IllegalStateException("Annotation with type " + annotation.getType() + " already exists");
}
default void addAnnotation(Type type)
{
if (getAnnotations().put(type, new Annotation(type)) != null)
throw new IllegalStateException("Annotation with type " + type + " already exists");
}
default void addAnnotation(Type type, Object val)
{
getAnnotations().put(type, new Annotation(type, val));
}
default void addAnnotation(Type type, String key, Object val)
{
final var a = new Annotation(type);
a.setElement(key, val);
if (getAnnotations().put(type, a) != null)
throw new IllegalStateException("Annotation with type " + type + " already exists");
}
}
@@ -1,91 +0,0 @@
/*
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.asm.attributes;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.runelite.asm.Type;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.attributes.annotation.SimpleElement;
import org.jetbrains.annotations.NotNull;
public class Annotations implements Iterable<Annotation>
{
private final List<Annotation> annotations = new ArrayList<>();
public List<Annotation> getAnnotations()
{
return annotations;
}
public void addAnnotation(Annotation annotation)
{
annotations.add(annotation);
}
public void removeAnnotation(Annotation annotation)
{
annotations.remove(annotation);
}
public void clearAnnotations()
{
annotations.clear();
}
public Annotation find(Type type)
{
for (Annotation a : annotations)
if (a.getType().equals(type))
return a;
return null;
}
public int size()
{
return annotations.size();
}
public Annotation addAnnotation(Type type, String name, Object value)
{
Annotation annotation = new Annotation(type);
addAnnotation(annotation);
Element element = new SimpleElement(name, value);
annotation.addElement(element);
return annotation;
}
@NotNull
@Override
public Iterator<Annotation> iterator()
{
return this.annotations.iterator();
}
}
@@ -1,99 +0,0 @@
/*
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.asm.attributes.annotation;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.runelite.asm.Type;
import org.jetbrains.annotations.NotNull;
import org.objectweb.asm.AnnotationVisitor;
public class Annotation extends Element<List<Element>> implements Iterable<Element>
{
private final Type type;
public Annotation(Type type)
{
this.value = new ArrayList<>();
this.type = type;
}
public Annotation(String name, Type type)
{
this.value = new ArrayList<>();
this.name = name;
this.type = type;
}
public Type getType()
{
return type;
}
public List<Element> getElements()
{
return value;
}
public Element getElement()
{
return value.get(0);
}
public void addElement(Element element)
{
value.add(element);
}
@Override
public final void setValue(List<Element> value)
{
throw new UnsupportedOperationException();
}
public void accept(AnnotationVisitor visitor)
{
if (visitor == null)
{
return;
}
for (Element element : this)
{
accept(visitor, element.name, element.value);
}
visitor.visitEnd();
}
@NotNull
@Override
public Iterator<Element> iterator()
{
return this.value.iterator();
}
}
@@ -1,42 +0,0 @@
package net.runelite.asm.attributes.annotation;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;
import org.jetbrains.annotations.NotNull;
public class ArrayElement extends Element<List> implements Iterable<Object>
{
public ArrayElement(String name)
{
this.name = name;
this.value = new ArrayList<>();
}
@SuppressWarnings("unchecked")
public void addValue(Object value)
{
this.value.add(value);
}
@Override
public final void setValue(List value)
{
throw new UnsupportedOperationException();
}
@NotNull
@Override
@SuppressWarnings("unchecked")
public Iterator<Object> iterator()
{
return this.value.iterator();
}
@SuppressWarnings("unchecked")
public Stream<Object> stream()
{
return this.value.stream();
}
}
@@ -1,91 +0,0 @@
/*
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.asm.attributes.annotation;
import java.util.List;
import org.objectweb.asm.AnnotationVisitor;
public abstract class Element<T>
{
String name = "value";
T value;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public T getValue()
{
return value;
}
public void setValue(T value)
{
this.value = value;
}
public String getString()
{
return value.toString();
}
public static void accept(AnnotationVisitor visitor, final String name, final Object value)
{
if (visitor == null)
{
return;
}
if (value instanceof Annotation)
{
Annotation annotation = (Annotation) value;
annotation.accept(visitor.visitAnnotation(name, annotation.getType().toString()));
}
else if (value instanceof List)
{
AnnotationVisitor arr = visitor.visitArray(name);
List<?> arrayValue = (List<?>) value;
for (Object o : arrayValue)
{
accept(arr, null, o);
}
arr.visitEnd();
}
else
{
visitor.visit(name, value);
}
}
}
@@ -1,15 +0,0 @@
package net.runelite.asm.attributes.annotation;
public class SimpleElement extends Element<Object>
{
public SimpleElement(Object value)
{
this.value = value;
}
public SimpleElement(String name, Object value)
{
this.name = name;
this.value = value;
}
}
@@ -204,6 +204,18 @@ public class Execution
this.addFrame(f); this.addFrame(f);
} }
public void addMethods(Iterable<Method> methods)
{
for (Method m : methods)
{
if (m.getCode() == null)
continue;
Frame f = new Frame(this, m);
f.initialize();
this.addFrame(f);
}
}
public void run() public void run()
{ {
assert !paused; assert !paused;
@@ -28,20 +28,17 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.runelite.asm.Type; import net.runelite.asm.Type;
public class Signature public class Signature
{ {
private static Pattern paramRetPattern = Pattern.compile("\\((.*)\\)(.*)"), private static final Pattern RLAPITORSAPI = Pattern.compile("net/runelite/(rs/)?api/(RS)?");
paramsPattern = Pattern.compile("(\\[*(?:B|C|Z|S|I|J|F|D|(?:L[^;]*;)))");
private final List<Type> arguments; private final List<Type> arguments;
private final Type rv; private final Type rv;
private Signature(List<Type> arguments, Type rv) public Signature(List<Type> arguments, Type rv)
{ {
this.arguments = new ArrayList<>(arguments); this.arguments = new ArrayList<>(arguments);
this.rv = rv; this.rv = rv;
@@ -49,23 +46,12 @@ public class Signature
public Signature(String str) public Signature(String str)
{ {
Matcher m = paramRetPattern.matcher(str); final int rvStart = str.indexOf(')');
if (!m.find()) if (rvStart == -1)
{ throw new IllegalArgumentException("Descriptor has no return value!");
throw new IllegalArgumentException("Signature has no arguments");
}
String args = m.group(1), ret = m.group(2); rv = new Type(str.substring(rvStart + 1));
arguments = findArgs(str, new ArrayList<>(), str.indexOf('(') + 1, rvStart);
m = paramsPattern.matcher(args);
arguments = new ArrayList<>();
while (m.find())
{
String arg = m.group(1);
arguments.add(new Type(arg));
}
rv = new Type(ret);
} }
public Signature(Signature other) public Signature(Signature other)
@@ -74,6 +60,21 @@ public class Signature
rv = other.rv; rv = other.rv;
} }
private static List<Type> findArgs(final String str, final List<Type> ret, final int from, final int to)
{
if (from >= to) return ret;
int i = from;
while (str.charAt(i) == '[') ++i;
if (str.charAt(i) == 'L')
i = str.indexOf(';', i);
ret.add(new Type(str.substring(from, ++i)));
return findArgs(str, ret, i, to);
}
@Override @Override
public boolean equals(Object other) public boolean equals(Object other)
{ {
@@ -82,17 +83,13 @@ public class Signature
return false; return false;
} }
Signature a = (Signature) other; return this.toString().equals(other.toString());
return arguments.equals(a.arguments) && rv.equals(a.rv);
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
int hash = 5; return this.toString().hashCode();
hash = 97 * hash + Objects.hashCode(this.arguments);
hash = 97 * hash + Objects.hashCode(this.rv);
return hash;
} }
@Override @Override
@@ -176,6 +173,6 @@ public class Signature
public Signature rsApiToRsClient() public Signature rsApiToRsClient()
{ {
return new Signature(this.toString().replaceAll("net/runelite/(rs/)?api/(RS)?", "")); return new Signature(RLAPITORSAPI.matcher(this.toString()).replaceAll(""));
} }
} }
@@ -1,83 +0,0 @@
/*
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.asm.visitors;
import net.runelite.asm.Type;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.ArrayElement;
import net.runelite.asm.attributes.annotation.SimpleElement;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;
public class AnnotationElementVisitor extends AnnotationVisitor
{
private final Annotation annotation;
AnnotationElementVisitor(Annotation annotation)
{
super(Opcodes.ASM5);
this.annotation = annotation;
}
@Override
public void visit(String name, Object value)
{
SimpleElement element = new SimpleElement(name, value);
annotation.addElement(element);
}
@Override
public AnnotationVisitor visitArray(String name)
{
ArrayElement element = new ArrayElement(name);
this.annotation.addElement(element);
return new AnnotationVisitor(Opcodes.ASM5)
{
@Override
public void visit(String name, Object value)
{
element.addValue(value);
}
@Override
public AnnotationVisitor visitAnnotation(String name, String descriptor)
{
Annotation annotation = new Annotation(name, new Type(descriptor));
element.addValue(annotation);
return new AnnotationElementVisitor(annotation);
}
};
}
@Override
public AnnotationVisitor visitAnnotation(String name, String descriptor)
{
Annotation annotation = new Annotation(name, new Type(descriptor));
this.annotation.addElement(annotation);
return new AnnotationElementVisitor(annotation);
}
}
@@ -27,7 +27,7 @@ package net.runelite.asm.visitors;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.Annotation;
import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute; import org.objectweb.asm.Attribute;
import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.FieldVisitor;
@@ -51,9 +51,9 @@ public class ClassFieldVisitor extends FieldVisitor
@Override @Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) public AnnotationVisitor visitAnnotation(String desc, boolean visible)
{ {
Annotation element = new Annotation(new Type(desc)); Annotation annotation = new Annotation(new Type(desc), visible);
this.field.getAnnotations().addAnnotation(element); this.field.addAnnotation(annotation);
return new AnnotationElementVisitor(element); return annotation;
} }
@Override @Override
@@ -27,7 +27,7 @@ package net.runelite.asm.visitors;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.Annotation;
import net.runelite.asm.signature.Signature; import net.runelite.asm.signature.Signature;
import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassVisitor;
@@ -71,9 +71,8 @@ public class ClassFileVisitor extends ClassVisitor
public AnnotationVisitor visitAnnotation(String desc, boolean visible) public AnnotationVisitor visitAnnotation(String desc, boolean visible)
{ {
Annotation annotation = new Annotation(new Type(desc)); Annotation annotation = new Annotation(new Type(desc));
classFile.getAnnotations().addAnnotation(annotation); classFile.addAnnotation(annotation);
return annotation;
return new AnnotationElementVisitor(annotation);
} }
@Override @Override
@@ -32,7 +32,7 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Code; import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.code.Exceptions; import net.runelite.asm.attributes.code.Exceptions;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType; import net.runelite.asm.attributes.code.InstructionType;
@@ -108,9 +108,9 @@ public class CodeVisitor extends MethodVisitor
@Override @Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) public AnnotationVisitor visitAnnotation(String desc, boolean visible)
{ {
Annotation element = new Annotation(new Type(desc)); Annotation annotation = new Annotation(new Type(desc), visible);
this.method.getAnnotations().addAnnotation(element); this.method.addAnnotation(annotation);
return new AnnotationElementVisitor(element); return annotation;
} }
@Override @Override
@@ -37,7 +37,6 @@ import net.runelite.deob.deobfuscators.Lvt;
import net.runelite.deob.deobfuscators.Order; import net.runelite.deob.deobfuscators.Order;
import net.runelite.deob.deobfuscators.RenameUnique; import net.runelite.deob.deobfuscators.RenameUnique;
import net.runelite.deob.deobfuscators.RuntimeExceptions; import net.runelite.deob.deobfuscators.RuntimeExceptions;
import net.runelite.deob.deobfuscators.StaticShouldBeInstance;
import net.runelite.deob.deobfuscators.UnreachedCode; import net.runelite.deob.deobfuscators.UnreachedCode;
import net.runelite.deob.deobfuscators.UnusedClass; import net.runelite.deob.deobfuscators.UnusedClass;
import net.runelite.deob.deobfuscators.UnusedFields; import net.runelite.deob.deobfuscators.UnusedFields;
@@ -80,68 +79,63 @@ public class Deob
ClassGroup group = JarUtil.loadJar(new File(args[0])); ClassGroup group = JarUtil.loadJar(new File(args[0]));
run(group, new StaticShouldBeInstance()); // remove except RuntimeException
run(group, new RuntimeExceptions());
if (args.length <= 2 || !args[2].equals("rl")) run(group, new ControlFlowDeobfuscator());
{
// remove except RuntimeException
run(group, new RuntimeExceptions());
run(group, new ControlFlowDeobfuscator()); run(group, new RenameUnique());
run(group, new RenameUnique()); // remove unused methods - this leaves Code with no instructions,
// which is not valid, so unused methods is run after
run(group, new UnreachedCode());
run(group, new UnusedMethods());
// remove unused methods - this leaves Code with no instructions, // remove illegal state exceptions, frees up some parameters
// which is not valid, so unused methods is run after run(group, new IllegalStateExceptions());
run(group, new UnreachedCode());
run(group, new UnusedMethods());
// remove illegal state exceptions, frees up some parameters // remove constant logically dead parameters
run(group, new IllegalStateExceptions()); run(group, new ConstantParameter());
// remove constant logically dead parameters // remove unhit blocks
run(group, new ConstantParameter()); run(group, new UnreachedCode());
run(group, new UnusedMethods());
// remove unhit blocks // remove unused parameters
run(group, new UnreachedCode()); run(group, new UnusedParameters());
run(group, new UnusedMethods());
// remove unused parameters // remove unused fields
run(group, new UnusedParameters()); run(group, new UnusedFields());
// remove unused fields run(group, new FieldInliner());
run(group, new UnusedFields());
run(group, new FieldInliner()); // order uses class name order for sorting fields/methods,
// so run it before removing classes below
run(group, new Order());
// order uses class name order for sorting fields/methods, run(group, new UnusedClass());
// so run it before removing classes below
run(group, new Order());
run(group, new UnusedClass()); runMath(group);
runMath(group); run(group, new ExprArgOrder());
run(group, new ExprArgOrder()); run(group, new Lvt());
run(group, new Lvt()); run(group, new CastNull());
run(group, new CastNull()); run(group, new EnumDeobfuscator());
run(group, new EnumDeobfuscator()); new OpcodesTransformer().transform(group);
//run(group, new PacketHandlerOrder());
//run(group, new PacketWriteDeobfuscator());
new OpcodesTransformer().transform(group); run(group, new MenuActionDeobfuscator());
//run(group, new PacketHandlerOrder());
//run(group, new PacketWriteDeobfuscator());
run(group, new MenuActionDeobfuscator()); new GetPathTransformer().transform(group);
new ClientErrorTransformer().transform(group);
new GetPathTransformer().transform(group); new ReflectionTransformer().transform(group);
new ClientErrorTransformer().transform(group); //new MaxMemoryTransformer().transform(group);
new ReflectionTransformer().transform(group); //new RuneliteBufferTransformer().transform(group);
//new MaxMemoryTransformer().transform(group);
//new RuneliteBufferTransformer().transform(group);
}
JarUtil.saveJar(group, new File(args[1])); JarUtil.saveJar(group, new File(args[1]));
@@ -24,15 +24,15 @@
*/ */
package net.runelite.deob; package net.runelite.deob;
import java.util.List; import javax.annotation.Nullable;
import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.signature.Signature; import net.runelite.asm.signature.Signature;
import org.jetbrains.annotations.NotNull;
public class DeobAnnotations public class DeobAnnotations
{ {
@@ -41,98 +41,77 @@ public class DeobAnnotations
public static final Type IMPLEMENTS = new Type("Lnet/runelite/mapping/Implements;"); public static final Type IMPLEMENTS = new Type("Lnet/runelite/mapping/Implements;");
public static final Type OBFUSCATED_GETTER = new Type("Lnet/runelite/mapping/ObfuscatedGetter;"); public static final Type OBFUSCATED_GETTER = new Type("Lnet/runelite/mapping/ObfuscatedGetter;");
public static final Type OBFUSCATED_SIGNATURE = new Type("Lnet/runelite/mapping/ObfuscatedSignature;"); public static final Type OBFUSCATED_SIGNATURE = new Type("Lnet/runelite/mapping/ObfuscatedSignature;");
public static final Type HOOK = new Type("Lnet/runelite/mapping/Hook;");
public static Signature getObfuscatedSignature(Method m) public static Signature getObfuscatedSignature(Method m)
{ {
String str = getAnnotationValue(m.getAnnotations(), OBFUSCATED_SIGNATURE); Object val = get(m, OBFUSCATED_SIGNATURE, "descriptor");
if (str == null) if (val == null)
{
return null; return null;
}
return new Signature(str); return new Signature((String) val);
} }
public static Type getObfuscatedType(Field f) public static Type getObfuscatedType(Field f)
{ {
String str = getAnnotationValue(f.getAnnotations(), OBFUSCATED_SIGNATURE); Object val = get(f, OBFUSCATED_SIGNATURE, "descriptor");
if (str == null) if (val == null)
{
return null; return null;
}
return new Type(str); return new Type((String) val);
} }
public static String getObfuscatedName(Annotations an) @Nullable
public static String getObfuscatedName(@NotNull Annotated an)
{ {
return getAnnotationValue(an, OBFUSCATED_NAME); return getStringValue(an, OBFUSCATED_NAME);
} }
public static String getExportedName(Annotations an) @Nullable
public static String getExportedName(@NotNull Annotated an)
{ {
return getAnnotationValue(an, EXPORT); return getStringValue(an, EXPORT);
} }
public static String getImplements(ClassFile cf) @Nullable
public static String getImplements(@NotNull ClassFile cf)
{ {
return getAnnotationValue(cf.getAnnotations(), IMPLEMENTS); return getStringValue(cf, IMPLEMENTS);
} }
public static Number getObfuscatedGetter(Field field) @Nullable
public static Number getObfuscatedGetter(@NotNull Field field)
{ {
if (field == null || field.getAnnotations() == null) final var a = field.findAnnotation(OBFUSCATED_GETTER);
{
return null;
}
Annotation an = field.getAnnotations().find(OBFUSCATED_GETTER);
if (an == null)
{
return null;
}
return (Number) an.getElement().getValue();
}
public static String getDecoder(Method method)
{
if (method == null || method.getAnnotations() == null)
{
return null;
}
Annotation an = method.getAnnotations().find(OBFUSCATED_SIGNATURE);
if (an == null)
{
return null;
}
List<Element> elements = an.getElements();
if (elements == null || elements.size() < 2)
{
return null;
}
return (String) elements.get(1).getValue();
}
public static String getAnnotationValue(Annotations an, Type type)
{
if (an == null)
{
return null;
}
Annotation a = an.find(type);
if (a == null) if (a == null)
{
return null; return null;
}
return a.getElement().getString(); if (field.getType().equals(Type.INT))
return (Integer) a.get("intValue");
if (field.getType().equals(Type.LONG))
return (Long) a.get("longValue"); // very long v
throw new IllegalArgumentException("Field with getter but not a long or an int?");
}
@Nullable
public static String getDecoder(@NotNull Method method)
{
Annotation a = method.findAnnotation(OBFUSCATED_SIGNATURE);
return a == null ? null : (String) a.get("garbageValue");
}
@Nullable
public static Object get(Annotated an, Type type, String name)
{
final var a = an.findAnnotation(type);
return a == null ? null : a.get(name);
}
@Nullable
public static String getStringValue(Annotated an, Type type)
{
final var a = an.findAnnotation(type);
return a == null ? null : a.getValueString();
} }
} }
@@ -24,7 +24,6 @@
*/ */
package net.runelite.deob.deobfuscators; package net.runelite.deob.deobfuscators;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -32,7 +31,7 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.execution.Execution; import net.runelite.asm.execution.Execution;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.Deobfuscator; import net.runelite.deob.Deobfuscator;
@@ -64,7 +63,7 @@ public class Order implements Deobfuscator
for (int i = 0; i < group.getClasses().size(); i++) for (int i = 0; i < group.getClasses().size(); i++)
{ {
ClassFile cf = group.getClasses().get(i); ClassFile cf = group.getClasses().get(i);
String className = DeobAnnotations.getObfuscatedName(cf.getAnnotations()); String className = DeobAnnotations.getObfuscatedName(cf);
nameIndices.put(className, i); nameIndices.put(className, i);
} }
@@ -73,7 +72,7 @@ public class Order implements Deobfuscator
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ {
List<Method> m = cf.getMethods(); List<Method> m = cf.getMethods();
Collections.sort(m, this::compareMethod); m.sort(this::compare);
sortedMethods += m.size(); sortedMethods += m.size();
@@ -81,7 +80,7 @@ public class Order implements Deobfuscator
if (!cf.isEnum()) if (!cf.isEnum())
{ {
List<Field> f = cf.getFields(); List<Field> f = cf.getFields();
Collections.sort(f, this::compareFields); f.sort(this::compare);
sortedFields += f.size(); sortedFields += f.size();
} }
@@ -91,47 +90,27 @@ public class Order implements Deobfuscator
} }
// static fields, member fields, clinit, init, methods, static methods // static fields, member fields, clinit, init, methods, static methods
private int compareMethod(Method m1, Method m2) private int compare(Annotated a, Annotated b)
{ {
int i1 = getType(m1), i2 = getType(m2); int i1 = getType(a), i2 = getType(b);
if (i1 != i2) if (i1 != i2)
{ {
return Integer.compare(i1, i2); return Integer.compare(i1, i2);
} }
int nameIdx1 = getNameIdx(m1.getAnnotations()); int nameIdx1 = getNameIdx(a);
int nameIdx2 = getNameIdx(m2.getAnnotations()); int nameIdx2 = getNameIdx(b);
if (nameIdx1 != nameIdx2) if (nameIdx1 != nameIdx2)
{ {
return Integer.compare(nameIdx1, nameIdx2); return Integer.compare(nameIdx1, nameIdx2);
} }
return compareOrder(m1, m2); return compareOrder(a, b);
} }
private int compareFields(Field f1, Field f2) private int getNameIdx(Annotated annotations)
{
int i1 = getType(f1), i2 = getType(f2);
if (i1 != i2)
{
return Integer.compare(i1, i2);
}
int nameIdx1 = getNameIdx(f1.getAnnotations());
int nameIdx2 = getNameIdx(f2.getAnnotations());
if (nameIdx1 != nameIdx2)
{
return Integer.compare(nameIdx1, nameIdx2);
}
return compareOrder(f1, f2);
}
private int getNameIdx(Annotations annotations)
{ {
String name = DeobAnnotations.getObfuscatedName(annotations); String name = DeobAnnotations.getObfuscatedName(annotations);
@@ -140,6 +119,15 @@ public class Order implements Deobfuscator
return nameIdx != null ? nameIdx : -1; return nameIdx != null ? nameIdx : -1;
} }
private int getType(Annotated a)
{
if (a instanceof Method)
return getType((Method) a);
else if (a instanceof Field)
return getType((Field) a);
throw new RuntimeException("kys");
}
private int getType(Method m) private int getType(Method m)
{ {
if (m.getName().equals("<clinit>")) if (m.getName().equals("<clinit>"))
@@ -151,7 +151,7 @@ public class PacketHandlerOrder implements Deobfuscator
// check if the invoke is on buffer/packetbuffer classes // check if the invoke is on buffer/packetbuffer classes
boolean matches = ii.getMethods().stream() boolean matches = ii.getMethods().stream()
.filter(m -> m.getDescriptor().size() == 0) .filter(m -> m.getDescriptor().size() == 0)
.map(method -> method.getClassFile()) .map(Method::getClassFile)
.anyMatch(cf -> cf == bf.getBuffer() || cf == bf.getPacketBuffer()); .anyMatch(cf -> cf == bf.getBuffer() || cf == bf.getPacketBuffer());
if (matches) if (matches)
{ {
@@ -269,7 +269,7 @@ public class PacketHandlerOrder implements Deobfuscator
logger.warn("Unable to differentiate {} from {}", p1, p2); logger.warn("Unable to differentiate {} from {}", p1, p2);
return 0; return 0;
}) })
.map(s -> s.clone()) .map(PacketHandler::clone)
.collect(Collectors.toList()); .collect(Collectors.toList());
assert sortedHandlers.size() == handlers.getHandlers().size(); assert sortedHandlers.size() == handlers.getHandlers().size();
@@ -277,7 +277,7 @@ public class PacketHandlerOrder implements Deobfuscator
for (PacketHandler handler : sortedHandlers) for (PacketHandler handler : sortedHandlers)
{ {
handler.sortedReads = new ArrayList<>(handler.reads); handler.sortedReads = new ArrayList<>(handler.reads);
Collections.sort(handler.sortedReads, (PacketRead p1, PacketRead p2) -> handler.sortedReads.sort((PacketRead p1, PacketRead p2) ->
{ {
LVTInstruction l1 = (LVTInstruction) p1.getStore(); LVTInstruction l1 = (LVTInstruction) p1.getStore();
LVTInstruction l2 = (LVTInstruction) p2.getStore(); LVTInstruction l2 = (LVTInstruction) p2.getStore();
@@ -350,7 +350,7 @@ public class PacketHandlerOrder implements Deobfuscator
// Find unique methods // Find unique methods
List<Method> methods = unsortedHandlers.stream() List<Method> methods = unsortedHandlers.stream()
.map(ph -> ph.getMethod()) .map(PacketHandler::getMethod)
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -439,10 +439,6 @@ public class PacketHandlerOrder implements Deobfuscator
} }
List<Instruction> follow = follow(instructions, handler.getStart(), afterRead); List<Instruction> follow = follow(instructions, handler.getStart(), afterRead);
if (follow == null)
{
continue;
}
for (Instruction i : follow) for (Instruction i : follow)
{ {
@@ -559,11 +555,11 @@ public class PacketHandlerOrder implements Deobfuscator
private int compareReads(List<PacketRead> r1, List<PacketRead> r2) private int compareReads(List<PacketRead> r1, List<PacketRead> r2)
{ {
List<Type> t1 = r1.stream() List<Type> t1 = r1.stream()
.map(pr -> pr.getType()) .map(PacketRead::getType)
.sorted(this::compareType) .sorted(this::compareType)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<Type> t2 = r2.stream() List<Type> t2 = r2.stream()
.map(pr -> pr.getType()) .map(PacketRead::getType)
.sorted(this::compareType) .sorted(this::compareType)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (t1.size() != t2.size()) if (t1.size() != t2.size())
@@ -38,50 +38,33 @@ import net.runelite.deob.util.NameMappings;
public class RenameUnique implements Deobfuscator public class RenameUnique implements Deobfuscator
{ {
private Renamer renamer;
private void generateClassNames(NameMappings map, ClassGroup group) private void generateClassNames(NameMappings map, ClassGroup group)
{ {
int i = 0; int i = 0;
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ if (cf.getName().length() <= Deob.OBFUSCATED_NAME_MAX_LEN)
if (cf.getName().length() > Deob.OBFUSCATED_NAME_MAX_LEN) map.map(cf.getPoolClass(), "class" + i++);
{ map.setClasses(i);
continue;
}
map.map(cf.getPoolClass(), "class" + i++);
}
} }
private void generateFieldNames(NameMappings map, ClassGroup group) private void generateFieldNames(NameMappings map, ClassGroup group)
{ {
int i = 0; int i = 0;
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
for (Field field : cf.getFields()) for (Field field : cf.getFields())
{ if (Deob.isObfuscated(field.getName()) && !field.getName().equals(DeobAnnotations.getExportedName(field)))
if (!Deob.isObfuscated(field.getName()) || field.getName().equals(DeobAnnotations.getExportedName(field.getAnnotations()))) map.map(field.getPoolField(), "field" + i++);
{ map.setFields(i);
continue;
}
map.map(field.getPoolField(), "field" + i++);
}
} }
private void generateMethodNames(NameMappings map, ClassGroup group) private void generateMethodNames(NameMappings map, ClassGroup group)
{ {
int i = 0; int i = 0;
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
for (Method method : cf.getMethods()) for (Method method : cf.getMethods())
{ {
if (!Deob.isObfuscated(method.getName()) || method.getName().equals(DeobAnnotations.getExportedName(method.getAnnotations()))) if (!Deob.isObfuscated(method.getName()) || method.getName().equals(DeobAnnotations.getExportedName(method)))
{
continue; continue;
}
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(method); List<Method> virtualMethods = VirtualMethods.getVirtualMethods(method);
assert !virtualMethods.isEmpty(); assert !virtualMethods.isEmpty();
@@ -95,6 +78,7 @@ public class RenameUnique implements Deobfuscator
for (Method m : virtualMethods) for (Method m : virtualMethods)
map.map(m.getPoolMethod(), name); map.map(m.getPoolMethod(), name);
} }
map.setMethods(i);
} }
@Override @Override
@@ -109,7 +93,7 @@ public class RenameUnique implements Deobfuscator
this.generateFieldNames(mappings, group); this.generateFieldNames(mappings, group);
this.generateMethodNames(mappings, group); this.generateMethodNames(mappings, group);
renamer = new Renamer(mappings); Renamer renamer = new Renamer(mappings);
renamer.run(group); renamer.run(group);
} }
} }
@@ -31,9 +31,10 @@ import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Interfaces; import net.runelite.asm.Interfaces;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Named;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.Code; import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.code.Exceptions; import net.runelite.asm.attributes.code.Exceptions;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.LocalVariable; import net.runelite.asm.attributes.code.LocalVariable;
@@ -45,6 +46,8 @@ import net.runelite.deob.Deobfuscator;
import net.runelite.deob.util.NameMappings; import net.runelite.deob.util.NameMappings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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 public class Renamer implements Deobfuscator
{ {
@@ -134,12 +137,7 @@ public class Renamer implements Deobfuscator
if (!method.getDescriptor().equals(newSignature)) if (!method.getDescriptor().equals(newSignature))
{ {
//Signature was updated. Annotate it method.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement( "descriptor", method.getDescriptor().toString());
if (method.getAnnotations().find(DeobAnnotations.OBFUSCATED_SIGNATURE) == null)
{
//Signature was not previously renamed
method.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, "signature", method.getDescriptor().toString());
}
} }
method.setDescriptor(newSignature); method.setDescriptor(newSignature);
@@ -156,21 +154,13 @@ public class Renamer implements Deobfuscator
{ {
if (field.getType().getInternalName().equals(cf.getName())) if (field.getType().getInternalName().equals(cf.getName()))
{ {
if (field.getAnnotations().find(DeobAnnotations.OBFUSCATED_SIGNATURE) == null) field.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement("descriptor", field.getType().toString());
{
//Signature was updated. Annotate it
field.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, "signature", field.getType().toString());
}
field.setType(Type.getType("L" + name + ";", field.getType().getDimensions())); field.setType(Type.getType("L" + name + ";", field.getType().getDimensions()));
} }
} }
} }
if (cf.getAnnotations().find(DeobAnnotations.OBFUSCATED_NAME) == null) addObfuscatedName(cf);
{
cf.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", cf.getName());
}
group.renameClass(cf, name); group.renameClass(cf, name);
} }
@@ -178,22 +168,13 @@ public class Renamer implements Deobfuscator
private void regeneratePool(ClassGroup group) private void regeneratePool(ClassGroup group)
{ {
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{
for (Method m : cf.getMethods()) for (Method m : cf.getMethods())
{ if (m.getCode() != null)
Code c = m.getCode(); m.getCode().getInstructions()
if (c == null) .regeneratePool();
{
continue;
}
c.getInstructions().regeneratePool();
}
}
} }
@Override @Override
@SuppressWarnings("unchecked")
public void run(ClassGroup group) public void run(ClassGroup group)
{ {
group.buildClassGraph(); group.buildClassGraph();
@@ -212,12 +193,9 @@ public class Renamer implements Deobfuscator
continue; continue;
} }
if (field.getAnnotations().find(DeobAnnotations.OBFUSCATED_NAME) == null) addObfuscatedName(field);
{
field.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", field.getName());
}
assert DeobAnnotations.getExportedName(field.getAnnotations()) == null || DeobAnnotations.getExportedName(field.getAnnotations()).equals(newName) : "Tried changing field name to something other than the exported name!"; assert DeobAnnotations.getExportedName(field) == null || newName.equals(DeobAnnotations.getExportedName(field)) : "Tried changing field name to something other than the exported name!";
field.setName(newName); field.setName(newName);
++fields; ++fields;
@@ -232,15 +210,6 @@ public class Renamer implements Deobfuscator
String newName = mappings.get(method.getPoolMethod()); String newName = mappings.get(method.getPoolMethod());
String[] newParams = mappings.getP(method.getPoolMethod()); String[] newParams = mappings.getP(method.getPoolMethod());
// rename on obfuscated signature
Annotation an = method.getAnnotations().find(DeobAnnotations.OBFUSCATED_SIGNATURE);
if (an != null)
{
Signature obfuscatedSig = new Signature(an.getElement().getString());
Signature updatedSig = renameSignature(obfuscatedSig);
an.getElement().setValue(updatedSig.toString());
}
if (newName == null) if (newName == null)
{ {
continue; continue;
@@ -279,10 +248,7 @@ public class Renamer implements Deobfuscator
++parameters; ++parameters;
} }
if (m.getAnnotations().find(DeobAnnotations.OBFUSCATED_NAME) == null) addObfuscatedName(m);
{
m.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", m.getName());
}
m.setName(newName); m.setName(newName);
} }
@@ -308,35 +274,8 @@ public class Renamer implements Deobfuscator
logger.info("Renamed {} classes, {} fields, {} methods, and {} parameters", classes, fields, methods, parameters); logger.info("Renamed {} classes, {} fields, {} methods, and {} parameters", classes, fields, methods, parameters);
} }
private Type renameType(Type t) private static <T extends Annotated & Named> void addObfuscatedName(T object)
{ {
if (t.isPrimitive()) object.findAnnotation(OBFUSCATED_NAME, true).setElement(object.getName());
{
return t;
}
String className = t.getInternalName();
String newName = mappings.get(new net.runelite.asm.pool.Class(className));
if (newName == null)
{
return t;
}
Type type = Type.getType("L" + newName + ";", t.getDimensions());
logger.debug("Renamed {} -> {}", t, type);
return type;
}
private Signature renameSignature(Signature s)
{
Signature.Builder builder = new Signature.Builder()
.setReturnType(renameType(s.getReturnValue()));
for (Type t : s.getArguments())
{
builder.addArgument(renameType(t));
}
return builder.build();
} }
} }
@@ -1,171 +0,0 @@
package net.runelite.deob.deobfuscators;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instruction.types.ReturnInstruction;
import net.runelite.asm.attributes.code.instructions.InvokeStatic;
import net.runelite.asm.attributes.code.instructions.InvokeVirtual;
import net.runelite.asm.pool.Method;
import net.runelite.asm.signature.Signature;
import net.runelite.deob.Deobfuscator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class StaticShouldBeInstance implements Deobfuscator
{
private static final Logger logger = LoggerFactory.getLogger(StaticShouldBeInstance.class);
private static Map<Method, Method> methods = new HashMap<>();
public void run(ClassGroup group)
{
int replacedCalls = 0;
int removedInstructions = 0;
int removedMethods = 0;
int removedAnnotations = 0;
List<net.runelite.asm.Method> obfuscatedMethods = new ArrayList<>();
for (ClassFile cf : group.getClasses())
{
// Remove unused annotations
Annotations a = cf.getAnnotations();
removedAnnotations += a.getAnnotations().size();
a.clearAnnotations();
Type type = new Type('L' + cf.getClassName() + ';');
obfuscatedMethods.clear();
for (net.runelite.asm.Method m : cf.getMethods())
{
// Remove unused annotations
a = m.getAnnotations();
removedAnnotations += a.size();
a.clearAnnotations();
if (m.isStatic() && m.getCode() != null)
{
if (checkIfObf(m, type, cf))
{
removedMethods++;
obfuscatedMethods.add(m);
}
}
}
for (net.runelite.asm.Method m : obfuscatedMethods)
{
Signature sig = m.getDescriptor();
Signature.Builder builder = new Signature.Builder();
builder.setReturnType(sig.getReturnValue());
if (sig.getArguments().size() > 1)
{
builder.addArguments(sig.getArguments().subList(1, sig.getArguments().size()));
}
Signature toFind = builder.build();
net.runelite.asm.Method notStatic = cf.findMethod(m.getName(), toFind);
net.runelite.asm.pool.Method oldPool = m.getPoolMethod();
cf.removeMethod(notStatic);
m.setDescriptor(toFind);
m.setStatic(false);
Code c = m.getCode();
Instructions ins = c.getInstructions();
int startLength = ins.getInstructions().size();
ListIterator<Instruction> it = ins.getInstructions().listIterator();
assert it.hasNext();
Instruction i = it.next();
while (!(i instanceof ReturnInstruction))
{
it.remove();
i = it.next();
}
it.remove();
net.runelite.asm.pool.Method newPool = m.getPoolMethod();
methods.put(oldPool, newPool);
removedInstructions += startLength - ins.getInstructions().size();
}
for (Field fi : cf.getFields())
{
a = fi.getAnnotations();
if (a.find(new Type("Ljavax/inject/Inject;")) == null)
{
removedAnnotations += a.size();
a.clearAnnotations();
}
else
{
logger.info("Class {}, field {} has inject", cf.getClassName(), fi.getName());
}
}
}
for (ClassFile cf : group.getClasses())
{
for (net.runelite.asm.Method m : cf.getMethods())
{
if (m.getCode() == null)
{
continue;
}
Instructions ins = m.getCode().getInstructions();
List<Instruction> instructions = ins.getInstructions();
for (int i1 = 0, instructionsSize = instructions.size(); i1 < instructionsSize; i1++)
{
Instruction i = instructions.get(i1);
if (!(i instanceof InvokeStatic))
{
continue;
}
if (methods.containsKey(((InvokeStatic) i).getMethod()))
{
InvokeVirtual invoke = new InvokeVirtual(ins, methods.get(((InvokeStatic) i).getMethod()));
ins.replace(i, invoke);
replacedCalls++;
}
}
}
}
logger.info("Made {} methods not static, removed {} instructions, replaced {} invokes, and removed {} annotations", removedMethods, removedInstructions, replacedCalls, removedAnnotations);
}
private static boolean checkIfObf(net.runelite.asm.Method m, Type type, ClassFile cf)
{
Signature sig = m.getDescriptor();
if (sig.getArguments().size() < 1 || !sig.getTypeOfArg(0).equals(type))
{
return false;
}
Signature.Builder builder = new Signature.Builder();
builder.setReturnType(sig.getReturnValue());
if (sig.getArguments().size() > 1)
{
builder.addArguments(sig.getArguments().subList(1, sig.getArguments().size()));
}
Signature toFind = builder.build();
net.runelite.asm.Method notStatic = cf.findMethod(m.getName(), toFind);
return notStatic != null;
}
}
@@ -97,22 +97,22 @@ public class UnusedParameters implements Deobfuscator
private boolean shouldRemove(Method m, int parameter) private boolean shouldRemove(Method m, int parameter)
{ {
Signature obSig = DeobAnnotations.getObfuscatedSignature(m); final var a = m.findAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE);
if (obSig == null) if (a == null)
{
return false; return false;
} final var str = a.get("descriptor");
return parameter + 1 == obSig.size(); return parameter + 1 == new Signature((String) str).size();
} }
private int processUnused(Execution execution, ClassGroup group) private int processUnused(Execution execution, ClassGroup group)
{ {
int count = 0; int count = 0;
for (List<Method> m : unused.keySet()) for (Map.Entry<List<Method>, Collection<Integer>> entry : unused.entrySet())
{ {
Collection<Integer> u = unused.get(m); List<Method> m = entry.getKey();
Collection<Integer> u = entry.getValue();
int offset = m.size() == 1 && m.get(0).isStatic() ? 0 : 1; int offset = m.size() == 1 && m.get(0).isStatic() ? 0 : 1;
@@ -188,7 +188,7 @@ public class UnusedParameters implements Deobfuscator
} }
} }
List<Integer> l = new ArrayList<>(list); List<Integer> l = new ArrayList<>(list != null ? list : new ArrayList<>()); // i know
Collections.sort(l); Collections.sort(l);
Collections.reverse(l); Collections.reverse(l);
return l; return l;
@@ -218,7 +218,7 @@ public class UnusedParameters implements Deobfuscator
InvokeInstruction ii = (InvokeInstruction) i; InvokeInstruction ii = (InvokeInstruction) i;
if (!ii.getMethods().stream().anyMatch(me -> methods.contains(me))) if (ii.getMethods().stream().noneMatch(methods::contains))
{ {
continue; continue;
} }
@@ -227,20 +227,17 @@ public class UnusedParameters implements Deobfuscator
Collection<InstructionContext> ics = invokes.get(i); Collection<InstructionContext> ics = invokes.get(i);
assert ics != null; assert ics != null;
if (ics != null) for (InstructionContext ins : ics)
{ {
for (InstructionContext ins : ics) int pops = signature.size() - paramIndex - 1; // index from top of stack of parameter. 0 is the last parameter
StackContext sctx = ins.getPops().get(pops);
if (sctx.getPushed().getInstruction().getInstructions() == null)
{ {
int pops = signature.size() - paramIndex - 1; // index from top of stack of parameter. 0 is the last parameter continue;
StackContext sctx = ins.getPops().get(pops);
if (sctx.getPushed().getInstruction().getInstructions() == null)
{
continue;
}
ins.removeStack(pops); // remove parameter from stack
} }
ins.removeStack(pops); // remove parameter from stack
} }
} }
} }
@@ -286,25 +283,20 @@ public class UnusedParameters implements Deobfuscator
public void run(ClassGroup group) public void run(ClassGroup group)
{ {
int i; int i;
int pnum = 1;
do
{
group.buildClassGraph();
invokes.clear(); group.buildClassGraph();
this.buildUnused(group);
Execution execution = new Execution(group); invokes.clear();
execution.addExecutionVisitor(ictx -> visit(ictx)); this.buildUnused(group);
execution.populateInitialMethods();
execution.run();
i = this.processUnused(execution, group); Execution execution = new Execution(group);
execution.addExecutionVisitor(this::visit);
execution.populateInitialMethods();
execution.run();
count += i; i = this.processUnused(execution, group);
break;
} count += i;
while (i > 0);
logger.info("Removed {} unused parameters", count); logger.info("Removed {} unused parameters", count);
} }
@@ -783,7 +783,7 @@ public class ModArith implements Deobfuscator
String ename = pair.getType() == Long.class String ename = pair.getType() == Long.class
? "longValue" ? "longValue"
: "intValue"; : "intValue";
f.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_GETTER, ename, pair.getter); f.addAnnotation(DeobAnnotations.OBFUSCATED_GETTER, ename, pair.getter);
} }
} }
} }
@@ -26,8 +26,13 @@ package net.runelite.deob.deobfuscators.cfg;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.Getter;
import lombok.Setter;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Label;
@Getter
@Setter
public class Block public class Block
{ {
private int id = -1; private int id = -1;
@@ -36,64 +41,44 @@ public class Block
/** /**
* blocks which jump here * blocks which jump here
*/ */
private final List<Block> prev = new ArrayList<>(); private final List<Block> preds = new ArrayList<>();
/** /**
* blocks which this jumps to * blocks which this jumps to
*/ */
private final List<Block> next = new ArrayList<>(); private final List<Block> succs = new ArrayList<>();
/** /**
* block which flows directly into this block * block which flows directly into this block
*/ */
private Block flowsFrom; private Block pred;
/** /**
* block which this directly flows into * block which this directly flows into
*/ */
private Block flowsInto; private Block succ;
/** /**
* instructions in this block * instructions in this block
*/ */
private final List<Instruction> instructions = new ArrayList<>(); private final List<Instruction> instructions = new ArrayList<>();
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public boolean isJumptarget()
{
return jumptarget;
}
public void setJumptarget(boolean jumptarget)
{
this.jumptarget = jumptarget;
}
@Override @Override
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Block ID ").append(id).append("\n"); sb.append("Block ID ").append(id).append("\n");
if (flowsFrom != null) if (pred != null)
{ {
sb.append(" flows from ").append(flowsFrom.id).append("\n"); sb.append(" flows from ").append(pred.id).append("\n");
} }
for (Instruction i : instructions) for (Instruction i : instructions)
{ {
sb.append(" ").append(i.toString()).append("\n"); sb.append(" ").append(i.toString()).append("\n");
} }
if (flowsInto != null) if (succ != null)
{ {
sb.append(" flows into ").append(flowsInto.id).append("\n"); sb.append(" flows into ").append(succ.id).append("\n");
} }
sb.append("\n"); sb.append("\n");
return sb.toString(); return sb.toString();
@@ -111,54 +96,37 @@ public class Block
instructions.add(i); instructions.add(i);
} }
public List<Instruction> getInstructions()
{
return instructions;
}
public void addPrev(Block block) public void addPrev(Block block)
{ {
if (!prev.contains(block)) if (!preds.contains(block))
{ {
prev.add(block); preds.add(block);
} }
} }
public List<Block> getPrev()
{
return prev;
}
public void addNext(Block block) public void addNext(Block block)
{ {
if (!next.contains(block)) if (!succs.contains(block))
{ {
next.add(block); succs.add(block);
} }
} }
public List<Block> getNext() static int compare(Block a, Block b)
{ {
return next; final int l1 = a.getLineNumber();
final int l2 = b.getLineNumber();
if (l1 == l2 || l1 == -1 || l2 == -1)
return 0;
return Integer.compare(l1, l2);
} }
public Block getFlowsFrom() private int getLineNumber()
{ {
return flowsFrom; for (Instruction i : instructions)
} if (i instanceof Label)
if (((Label) i).getLineNumber() != null)
public void setFlowsFrom(Block flowsFrom) return ((Label) i).getLineNumber();
{ return -1;
this.flowsFrom = flowsFrom;
}
public Block getFlowsInto()
{
return flowsInto;
}
public void setFlowsInto(Block flowsInto)
{
this.flowsInto = flowsInto;
} }
} }
@@ -24,16 +24,11 @@
*/ */
package net.runelite.deob.deobfuscators.cfg; package net.runelite.deob.deobfuscators.cfg;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Code; import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Exception;
import net.runelite.asm.attributes.code.Exceptions;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Instructions; import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.Label; import net.runelite.asm.attributes.code.Label;
@@ -64,7 +59,6 @@ public class ControlFlowDeobfuscator implements Deobfuscator
continue; continue;
} }
split(code);
run(code); run(code);
runJumpLabel(code); runJumpLabel(code);
} }
@@ -74,167 +68,49 @@ public class ControlFlowDeobfuscator implements Deobfuscator
insertedJump, placedBlocks, removedJumps, insertedJump - removedJumps); insertedJump, placedBlocks, removedJumps, insertedJump - removedJumps);
} }
/**
* Add gotos at the end of blocks without terminal instructions
*
* @param code
*/
private void split(Code code)
{
Instructions ins = code.getInstructions();
Exceptions exceptions = code.getExceptions();
ControlFlowGraph graph = new ControlFlowGraph.Builder().build(code);
List<Exception> exc = new ArrayList<>(exceptions.getExceptions());
exceptions.clear(); // Must clear this before ins.clear() runs
ins.clear();
// insert jumps where blocks flow into others
for (Block block : graph.getBlocks())
{
if (block.getFlowsInto() == null)
{
continue;
}
Block into = block.getFlowsInto();
assert into.getFlowsFrom() == block;
Instruction first = into.getInstructions().get(0);
Label label;
if (!(first instanceof Label))
{
label = new Label(null);
into.addInstruction(0, label);
}
else
{
label = (Label) first;
}
Goto g = new Goto(null, label);
block.addInstruction(g);
block.setFlowsInto(null);
into.setFlowsFrom(null);
++insertedJump;
}
// Readd instructions from modified blocks
for (Block block : graph.getBlocks())
{
for (Instruction i : block.getInstructions())
{
assert i.getInstructions() == null;
i.setInstructions(ins); // I shouldn't have to do this here
ins.addInstruction(i);
}
}
// Readd exceptions
for (Exception ex : exc)
{
exceptions.add(ex);
}
}
private int compareBlock(Block o1, Block o2)
{
// higher numbers have the lowest priority
if (o1.isJumptarget() && !o2.isJumptarget())
{
return -1;
}
if (o2.isJumptarget() && !o1.isJumptarget())
{
return 1;
}
return 0;
}
private void run(Code code) private void run(Code code)
{ {
Instructions ins = code.getInstructions(); Instructions ins = code.getInstructions();
Exceptions exceptions = code.getExceptions();
ControlFlowGraph graph = new ControlFlowGraph.Builder().build(code); ControlFlowGraph graph = new ControlFlowGraph(code);
for (Block block : graph.getBlocks())
{
assert block.getFlowsFrom() == null;
assert block.getFlowsInto() == null;
}
if (logger.isDebugEnabled()) // graph.toString() is expensive if (logger.isDebugEnabled()) // graph.toString() is expensive
{ {
logger.debug(graph.toString()); logger.debug(graph.toString());
} }
List<Exception> originalExceptions = new ArrayList<>(exceptions.getExceptions()); // Clear existing instructions as we are going to rebuild them
// Clear existing exceptions and instructions as we are going to
// rebuild them
exceptions.clear();
ins.clear(); ins.clear();
final List<Block> sorted = graph.topologicalSort();
List<Block> done = new ArrayList<>(); for (Block b : sorted)
Queue<Block> queue = new PriorityQueue<>(this::compareBlock);
// add initial code block
queue.add(graph.getHead());
while (!queue.isEmpty())
{ {
Block block = queue.remove();
if (done.contains(block))
{
continue;
}
done.add(block);
++placedBlocks; ++placedBlocks;
for (Instruction i : b.getInstructions())
logger.debug("Placed block {}", block.getId());
List<Block> next = block.getNext();
if (next.isEmpty() == false)
{ {
// jumps are added in order their instructions are reached by ControlFlowGraph,
// so the last jump is the goto.
//
// removing this line causes the priority queue (due to implementation detail on how
// it handles objects with equal priority) to try to optimize for block closeness
// (how close blocks which are neighbors are to each other in bytecode).
// I get a jump delta of ~+14k with this on 143, vs ~-47k when priotiziing optimizing
// out jumps. I can't tell which is better.
next.get(next.size() - 1).setJumptarget(true);
}
// add next reachable blocks
for (Block bl : next)
{
queue.add(bl);
}
for (Instruction i : block.getInstructions())
{
assert i.getInstructions() == null;
i.setInstructions(ins); // I shouldn't have to do this here
ins.addInstruction(i); ins.addInstruction(i);
i.setInstructions(ins);
}
if (b.getSucc() != null && b.getInstructions().size() > 0)
{
final var i = b.getInstructions().get(b.getInstructions().size() - 1);
if (!i.isTerminal())
{
final var next = b.getSucc();
var maybeLabel = next.getInstructions().get(0);
if (!(maybeLabel instanceof Label))
{
maybeLabel = new Label(ins);
next.getInstructions().add(0, maybeLabel);
}
ins.addInstruction(new Goto(ins, (Label) maybeLabel));
++insertedJump;
}
} }
} }
} }
/** /**
* remove jumps followed immediately by the label they are jumping to * remove jumps followed immediately by the label they are jumping to
*
* @param code
*/ */
private void runJumpLabel(Code code) private void runJumpLabel(Code code)
{ {
@@ -26,9 +26,12 @@ package net.runelite.deob.deobfuscators.cfg;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import net.runelite.asm.attributes.Code; import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Label; import net.runelite.asm.attributes.code.Label;
@@ -36,10 +39,90 @@ import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
public class ControlFlowGraph public class ControlFlowGraph
{ {
private Map<Label, Block> blocks = new HashMap<>(); private final Map<Label, Block> blocks = new HashMap<>();
private List<Block> allBlocks = new ArrayList<>(); private final List<Block> allBlocks = new ArrayList<>();
private final Block head; private final Block head;
public ControlFlowGraph(Code code)
{
int id = 0;
this.head = new Block();
for (Instruction i : code.getInstructions())
if (i instanceof Label)
blocks.computeIfAbsent((Label) i, lbl -> {
var b = new Block();
allBlocks.add(b);
return b;
});
allBlocks.add(0, head);
Block cur = head;
for (Instruction i : code.getInstructions())
{
if (i instanceof Label)
{
Block next = blocks.get(i);
if (next.getId() == -1)
{
next.setId(id++);
}
if (next != cur)
{
Instruction last = cur.getInstructions().isEmpty()
? null
: cur.getInstructions().get(cur.getInstructions().size() - 1);
if (last == null || !last.isTerminal())
{
assert next.getPred() == null;
assert cur.getSucc() == null;
// previous block flows directly into next
next.setPred(cur);
cur.setSucc(next);
}
cur = next;
}
}
cur.addInstruction(i);
if (i instanceof JumpingInstruction)
{
JumpingInstruction ji = (JumpingInstruction) i;
for (Label l : ji.getJumps())
{
Block next = blocks.get(l);
if (next.getId() == -1)
{
next.setId(id++);
}
cur.addNext(next);
next.addPrev(cur);
}
}
}
assert head.getPred() == null;
}
List<Block> topologicalSort()
{
final List<Block> ret = new ArrayList<>();
walk(head, ret, new HashSet<>());
Collections.reverse(ret);
return ret;
}
private static void walk(Block cur, List<Block> order, Set<Block> done)
{
Block dirsucc = cur.getSucc();
if (dirsucc != null && done.add(dirsucc))
walk(cur.getSucc(), order, done);
List<Block> succs = cur.getSuccs();
succs.sort(Block::compare);
for (Block succ : succs)
if (done.add(succ))
walk(succ, order, done);
order.add(cur);
}
public ControlFlowGraph(Block head) public ControlFlowGraph(Block head)
{ {
this.head = head; this.head = head;
@@ -70,91 +153,4 @@ public class ControlFlowGraph
{ {
return head; return head;
} }
public static class Builder
{
private final Map<Label, Block> blocks = new HashMap<>();
private final List<Block> allBlocks = new ArrayList<>();
public ControlFlowGraph build(Code code)
{
int id = 0;
Block head = new Block(),
cur = head;
allBlocks.add(head);
for (Instruction i : code.getInstructions().getInstructions())
{
if (i instanceof Label)
{
// blocks always begin at labels, so create initial blocks
Block block = new Block();
blocks.put((Label) i, block);
allBlocks.add(block);
}
}
for (Instruction i : code.getInstructions().getInstructions())
{
if (i instanceof Label)
{
Block next = blocks.get((Label) i);
assert next != null;
if (next.getId() == -1)
{
next.setId(id++);
}
if (next != cur)
{
Instruction last = cur.getInstructions().isEmpty()
? null
: cur.getInstructions().get(cur.getInstructions().size() - 1);
if (last == null || !last.isTerminal())
{
assert next.getFlowsFrom() == null;
assert cur.getFlowsInto() == null;
// previous block flows directly into next
next.setFlowsFrom(cur);
cur.setFlowsInto(next);
}
cur = next;
}
}
cur.addInstruction(i);
if (i instanceof JumpingInstruction)
{
JumpingInstruction ji = (JumpingInstruction) i;
for (Label l : ji.getJumps())
{
Block next = blocks.get(l);
if (next.getId() == -1)
{
next.setId(id++);
}
cur.addNext(next);
next.addPrev(cur);
}
}
}
assert head != null : "no instructions in code";
assert head.getFlowsFrom() == null;
ControlFlowGraph cfg = new ControlFlowGraph(head);
cfg.blocks = blocks;
cfg.allBlocks = allBlocks;
return cfg;
}
}
} }
@@ -34,10 +34,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.attributes.annotation.SimpleElement;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType; import net.runelite.asm.attributes.code.InstructionType;
import net.runelite.asm.attributes.code.Instructions; import net.runelite.asm.attributes.code.Instructions;
@@ -62,8 +59,8 @@ public class ConstantParameter implements Deobfuscator
{ {
private static final Logger logger = LoggerFactory.getLogger(ConstantParameter.class); private static final Logger logger = LoggerFactory.getLogger(ConstantParameter.class);
private Map<ConstantMethodParameter, ConstantMethodParameter> parameters = new HashMap<>(); private final Map<ConstantMethodParameter, ConstantMethodParameter> parameters = new HashMap<>();
private Multimap<Method, ConstantMethodParameter> mparams = HashMultimap.create(); private final Multimap<Method, ConstantMethodParameter> mparams = HashMultimap.create();
private void checkMethodsAreConsistent(List<Method> methods) private void checkMethodsAreConsistent(List<Method> methods)
{ {
@@ -436,23 +433,18 @@ public class ConstantParameter implements Deobfuscator
{ {
Object value = parameter.values.get(0); Object value = parameter.values.get(0);
Annotations annotations = m.getAnnotations(); Annotation obfuscatedSignature = m.findAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, true);
if (obfuscatedSignature.size() == 2)
Annotation obfuscatedSignature = annotations.find(DeobAnnotations.OBFUSCATED_SIGNATURE);
if (obfuscatedSignature != null && obfuscatedSignature.getElements().size() == 2)
{ {
// already annotated // already annotated
continue; continue;
} }
else if (obfuscatedSignature.size() == 0)
if (obfuscatedSignature == null)
{ {
obfuscatedSignature = annotations.addAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, "signature", m.getDescriptor().toString()); obfuscatedSignature.setElement("descriptor", m.getDescriptor().toString());
} }
// Add garbage value obfuscatedSignature.setElement("garbageValue", String.valueOf(value));
Element element = new SimpleElement("garbageValue", value.toString());
obfuscatedSignature.addElement(element);
} }
} }
@@ -30,8 +30,6 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import net.runelite.mapping.Import; import net.runelite.mapping.Import;
import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSClient;
@@ -65,11 +63,6 @@ public class AnnotationIntegrityChecker
return errors; return errors;
} }
public int getWarnings()
{
return warnings;
}
public void run() public void run()
{ {
for (ClassFile cf : one.getClasses()) for (ClassFile cf : one.getClasses())
@@ -97,11 +90,11 @@ public class AnnotationIntegrityChecker
if (f1.isStatic()) if (f1.isStatic())
{ {
f2 = findExportedFieldStatic(two, DeobAnnotations.getExportedName(f1.getAnnotations())); f2 = findExportedFieldStatic(two, DeobAnnotations.getExportedName(f1));
} }
else else
{ {
f2 = findExportedField(other, DeobAnnotations.getExportedName(f1.getAnnotations())); f2 = findExportedField(other, DeobAnnotations.getExportedName(f1));
} }
if (f2 == null) if (f2 == null)
@@ -110,7 +103,7 @@ public class AnnotationIntegrityChecker
{ {
logger.error("Missing IMPORTED field on {} named {}", logger.error("Missing IMPORTED field on {} named {}",
other, other,
DeobAnnotations.getExportedName(f1.getAnnotations())); DeobAnnotations.getExportedName(f1));
++errors; ++errors;
} }
@@ -118,7 +111,7 @@ public class AnnotationIntegrityChecker
{ {
logger.warn("Missing exported field on {} named {}", logger.warn("Missing exported field on {} named {}",
other, other,
DeobAnnotations.getExportedName(f1.getAnnotations())); DeobAnnotations.getExportedName(f1));
++warnings; ++warnings;
} }
@@ -143,11 +136,11 @@ public class AnnotationIntegrityChecker
if (m1.isStatic()) if (m1.isStatic())
{ {
m2 = findExportedMethodStatic(two, DeobAnnotations.getExportedName(m1.getAnnotations())); m2 = findExportedMethodStatic(two, DeobAnnotations.getExportedName(m1));
} }
else else
{ {
m2 = findExportedMethod(other, DeobAnnotations.getExportedName(m1.getAnnotations())); m2 = findExportedMethod(other, DeobAnnotations.getExportedName(m1));
} }
if (m2 == null) if (m2 == null)
@@ -156,7 +149,7 @@ public class AnnotationIntegrityChecker
{ {
logger.error("Missing IMPORTED method on {} named {} ({})", logger.error("Missing IMPORTED method on {} named {} ({})",
other, other,
DeobAnnotations.getExportedName(m1.getAnnotations()), DeobAnnotations.getExportedName(m1),
m1); m1);
++errors; ++errors;
@@ -165,7 +158,7 @@ public class AnnotationIntegrityChecker
{ {
logger.warn("Missing exported method on {} named {} ({})", logger.warn("Missing exported method on {} named {} ({})",
other, other,
DeobAnnotations.getExportedName(m1.getAnnotations()), DeobAnnotations.getExportedName(m1),
m1); m1);
++warnings; ++warnings;
@@ -173,36 +166,6 @@ public class AnnotationIntegrityChecker
} }
} }
} }
checkAnnotationCounts();
}
private void checkAnnotationCounts()
{
for (ClassFile cf : two.getClasses())
{
for (Field f : cf.getFields())
{
int num = this.getNumberOfExports(f.getAnnotations());
if (num > 1)
{
logger.warn("Field {} has more than 1 export", f);
++errors;
}
}
for (Method m : cf.getMethods())
{
int num = this.getNumberOfExports(m.getAnnotations());
if (num > 1)
{
logger.warn("Method {} has more than 1 export", m);
++errors;
}
}
}
} }
/** /**
@@ -212,7 +175,6 @@ public class AnnotationIntegrityChecker
* @param cf Class file field/method is on * @param cf Class file field/method is on
* @param name Exported name of field/method * @param name Exported name of field/method
* @param isStatic Whether or not field/method is static * @param isStatic Whether or not field/method is static
* @return
*/ */
private boolean isImported(ClassFile cf, String name, boolean isStatic) private boolean isImported(ClassFile cf, String name, boolean isStatic)
{ {
@@ -259,7 +221,7 @@ public class AnnotationIntegrityChecker
List<Field> list = new ArrayList<>(); List<Field> list = new ArrayList<>();
for (Field f : clazz.getFields()) for (Field f : clazz.getFields())
{ {
if (DeobAnnotations.getExportedName(f.getAnnotations()) != null) if (DeobAnnotations.getExportedName(f) != null)
{ {
list.add(f); list.add(f);
} }
@@ -272,7 +234,7 @@ public class AnnotationIntegrityChecker
List<Method> list = new ArrayList<>(); List<Method> list = new ArrayList<>();
for (Method m : clazz.getMethods()) for (Method m : clazz.getMethods())
{ {
if (DeobAnnotations.getExportedName(m.getAnnotations()) != null) if (DeobAnnotations.getExportedName(m) != null)
{ {
list.add(m); list.add(m);
} }
@@ -280,26 +242,11 @@ public class AnnotationIntegrityChecker
return list; return list;
} }
private int getNumberOfExports(Annotations an)
{
int count = 0;
for (Annotation a : an.getAnnotations())
{
if (a.getType().equals(DeobAnnotations.EXPORT))
{
++count;
}
}
return count;
}
private Field findExportedField(ClassFile clazz, String name) private Field findExportedField(ClassFile clazz, String name)
{ {
for (Field f : getExportedFields(clazz)) for (Field f : getExportedFields(clazz))
{ {
if (DeobAnnotations.getExportedName(f.getAnnotations()).equals(name)) if (name.equals(DeobAnnotations.getExportedName(f)))
{ {
return f; return f;
} }
@@ -315,7 +262,7 @@ public class AnnotationIntegrityChecker
{ {
if (f.isStatic()) if (f.isStatic())
{ {
if (name.equals(DeobAnnotations.getExportedName(f.getAnnotations()))) if (name.equals(DeobAnnotations.getExportedName(f)))
{ {
return f; return f;
} }
@@ -333,7 +280,7 @@ public class AnnotationIntegrityChecker
{ {
if (m.isStatic()) if (m.isStatic())
{ {
if (name.equals(DeobAnnotations.getExportedName(m.getAnnotations()))) if (name.equals(DeobAnnotations.getExportedName(m)))
{ {
return m; return m;
} }
@@ -347,7 +294,7 @@ public class AnnotationIntegrityChecker
{ {
for (Method m : getExportedMethods(clazz)) for (Method m : getExportedMethods(clazz))
{ {
if (DeobAnnotations.getExportedName(m.getAnnotations()).equals(name)) if (name.equals(DeobAnnotations.getExportedName(m)))
{ {
return m; return m;
} }
@@ -29,10 +29,8 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.attributes.annotation.SimpleElement;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -69,11 +67,11 @@ public class AnnotationMapper
{ {
int count = 0; int count = 0;
if (hasCopyableAnnotation(from.getAnnotations())) if (hasCopyableAnnotation(from))
{ {
if (to != null) if (to != null)
{ {
count += copyAnnotations(from.getAnnotations(), to.getAnnotations()); count += copyAnnotations(from, to);
} }
else else
{ {
@@ -83,57 +81,49 @@ public class AnnotationMapper
for (Field f : from.getFields()) for (Field f : from.getFields())
{ {
if (!hasCopyableAnnotation(f.getAnnotations())) if (!hasCopyableAnnotation(f))
continue; continue;
Field other = (Field) mapping.get(f); Field other = (Field) mapping.get(f);
if (other == null) if (other == null)
{ {
logger.warn("Unable to map annotated field {} named {}", f, DeobAnnotations.getExportedName(f.getAnnotations())); logger.warn("Unable to map annotated field {} named {}", f, DeobAnnotations.getExportedName(f));
continue; continue;
} }
count += copyAnnotations(f.getAnnotations(), other.getAnnotations()); count += copyAnnotations(f, other);
} }
for (Method m : from.getMethods()) for (Method m : from.getMethods())
{ {
if (!hasCopyableAnnotation(m.getAnnotations())) if (!hasCopyableAnnotation(m))
continue; continue;
Method other = (Method) mapping.get(m); Method other = (Method) mapping.get(m);
if (other == null) if (other == null)
{ {
logger.warn("Unable to map annotated method {} named {}", m, DeobAnnotations.getExportedName(m.getAnnotations())); logger.warn("Unable to map annotated method {} named {}", m, DeobAnnotations.getExportedName(m));
continue; continue;
} }
count += copyAnnotations(m.getAnnotations(), other.getAnnotations()); count += copyAnnotations(m, other);
} }
return count; return count;
} }
private int copyAnnotations(Annotations from, Annotations to) private int copyAnnotations(Annotated from, Annotated to)
{ {
int count = 0; int count = 0;
if (from.getAnnotations() == null) if (from.getAnnotations() == null)
return count; return count;
for (Annotation a : from.getAnnotations()) for (Annotation a : from.getAnnotations().values())
{ {
if (isCopyable(a)) if (isCopyable(a))
{ {
Annotation annotation = new Annotation(a.getType()); to.addAnnotation(a.getType(), a);
to.addAnnotation(annotation);
for (Element e : a.getElements())
{
Element element = new SimpleElement(e.getName(), e.getValue());
annotation.addElement(element);
}
++count; ++count;
} }
} }
@@ -141,13 +131,9 @@ public class AnnotationMapper
return count; return count;
} }
private boolean hasCopyableAnnotation(Annotations a) private boolean hasCopyableAnnotation(Annotated a)
{ {
for (Annotation an : a.getAnnotations()) return a.findAnnotation(DeobAnnotations.EXPORT) != null || a.findAnnotation(DeobAnnotations.IMPLEMENTS) != null;
if (isCopyable(an))
return true;
return false;
} }
private boolean isCopyable(Annotation a) private boolean isCopyable(Annotation a)
@@ -36,7 +36,7 @@ import net.runelite.asm.signature.Signature;
public class StaticMethodSignatureMapper public class StaticMethodSignatureMapper
{ {
private Multimap<Method, Method> map = LinkedHashMultimap.create(); private final Multimap<Method, Method> map = LinkedHashMultimap.create();
private List<Method> getStaticMethods(ClassGroup group) private List<Method> getStaticMethods(ClassGroup group)
{ {
@@ -33,7 +33,6 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.code.Instruction; import net.runelite.asm.attributes.code.Instruction;
import static net.runelite.asm.attributes.code.InstructionType.INVOKEVIRTUAL;
import net.runelite.asm.attributes.code.Instructions; import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.Label; import net.runelite.asm.attributes.code.Label;
import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction; import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction;
@@ -55,6 +54,7 @@ import net.runelite.deob.Deobfuscator;
import net.runelite.deob.c2s.RWOpcodeFinder; import net.runelite.deob.c2s.RWOpcodeFinder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import static net.runelite.asm.attributes.code.InstructionType.INVOKEVIRTUAL;
public class PacketWriteDeobfuscator implements Deobfuscator public class PacketWriteDeobfuscator implements Deobfuscator
{ {
@@ -5,10 +5,8 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Named;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.attributes.annotation.SimpleElement;
import net.runelite.deob.Deob; import net.runelite.deob.Deob;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -24,7 +22,6 @@ public class AnnotationAdder
private final ClassGroup group; private final ClassGroup group;
private final Logger log = LoggerFactory.getLogger(AnnotationAdder.class); private final Logger log = LoggerFactory.getLogger(AnnotationAdder.class);
@SuppressWarnings("unchecked")
public void run() public void run()
{ {
int impl = 0; int impl = 0;
@@ -46,83 +43,43 @@ public class AnnotationAdder
// Still error here cause I don't wanna call classes dumb shit // Still error here cause I don't wanna call classes dumb shit
assert implementingName.equals(c.getClassName()) : c + " implements " + implementingName + " but is called " + c.getClassName(); assert implementingName.equals(c.getClassName()) : c + " implements " + implementingName + " but is called " + c.getClassName();
} }
else else if (!Deob.isObfuscated(c.getClassName()))
{ {
if (!Deob.isObfuscated(c.getClassName())) c.addAnnotation(DeobAnnotations.IMPLEMENTS, c.getClassName());
{ impl++;
Annotations an = c.getAnnotations();
Annotation implAn = new Annotation(DeobAnnotations.IMPLEMENTS);
Element value = new SimpleElement(c.getClassName());
implAn.addElement(value);
an.addAnnotation(implAn);
impl++;
}
} }
for (Field f : c.getFields()) for (Field f : c.getFields())
{ {
Annotations an = f.getAnnotations(); if (addExport(f))
String fieldName = f.getName();
String exportedName = DeobAnnotations.getExportedName(an);
if (exportedName == null && Deob.isObfuscated(fieldName) || fieldName.equals(DeobAnnotations.getObfuscatedName(an)) || DeobAnnotations.getObfuscatedName(an) == null)
{
continue;
}
if (!fieldName.equals(exportedName))
{
log.info("Changed export from {} to {}", exportedName, fieldName);
Annotation a = an.find(DeobAnnotations.EXPORT);
if (a == null)
{
a = new Annotation(DeobAnnotations.EXPORT);
Element value = new SimpleElement(fieldName);
a.addElement(value);
an.addAnnotation(a);
}
a.getElement().setValue(fieldName);
field++; field++;
}
} }
for (Method m : c.getMethods()) for (Method m : c.getMethods())
{ {
Annotations an = m.getAnnotations(); if (addExport(m))
String methodName = m.getName();
String exportedName = DeobAnnotations.getExportedName(an);
if (exportedName == null && Deob.isObfuscated(methodName) || methodName.equals(DeobAnnotations.getObfuscatedName(an)) || DeobAnnotations.getObfuscatedName(an) == null)
{
continue;
}
if (!methodName.equals(exportedName))
{
log.info("Changed export from {} to {}", exportedName, methodName);
Annotation a = an.find(DeobAnnotations.EXPORT);
if (a == null)
{
a = new Annotation(DeobAnnotations.EXPORT);
Element value = new SimpleElement(methodName);
a.addElement(value);
an.addAnnotation(a);
}
a.getElement().setValue(methodName);
meth++; meth++;
}
} }
} }
log.info("Changed {} classes, {} methods, {} fields", impl, meth, field); log.info("Changed {} classes, {} methods, {} fields", impl, meth, field);
} }
private <T extends Annotated & Named> boolean addExport(T m)
{
String methodName = m.getName();
String exportedName = DeobAnnotations.getExportedName(m);
if (exportedName == null && Deob.isObfuscated(methodName)
|| methodName.equals(DeobAnnotations.getObfuscatedName(m))
|| DeobAnnotations.getObfuscatedName(m) == null
|| methodName.equals(exportedName))
{
return false;
}
log.info("Changed export from {} to {}", exportedName, methodName);
m.findAnnotation(DeobAnnotations.EXPORT, true).setElement(methodName);
return true;
}
} }
@@ -26,26 +26,26 @@
package net.runelite.deob.updater; package net.runelite.deob.updater;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.attributes.annotation.SimpleElement;
public class AnnotationCopier public class AnnotationCopier
{ {
private final ClassGroup group1, group2; private final ClassGroup group1, group2;
private final Type[] types; private final Set<Type> types;
public AnnotationCopier(ClassGroup group1, ClassGroup group2, Type... types) public AnnotationCopier(ClassGroup group1, ClassGroup group2, Type... types)
{ {
this.group1 = group1; this.group1 = group1;
this.group2 = group2; this.group2 = group2;
this.types = types; this.types = new HashSet<>(Arrays.asList(types));
} }
public void copy() public void copy()
@@ -56,63 +56,46 @@ public class AnnotationCopier
assert cf2 != null; assert cf2 != null;
copy(cf1.getAnnotations(), cf2.getAnnotations()); copy(cf1, cf2);
for (Field f : cf1.getFields()) for (Field f : cf1.getFields())
{ {
Field f2 = cf2.findField(f.getName(), f.getType()); Field f2 = cf2.findField(f.getName(), f.getType());
assert f2 != null || f.getAnnotations() == null; assert f2 != null || f.getAnnotations().isEmpty();
if (f2 == null) if (f2 == null)
continue; continue;
copy(f.getAnnotations(), f2.getAnnotations()); copy(f, f2);
} }
for (Method m : cf1.getMethods()) for (Method m : cf1.getMethods())
{ {
Method m2 = cf2.findMethod(m.getName(), m.getDescriptor()); Method m2 = cf2.findMethod(m.getName(), m.getDescriptor());
assert m2 != null || m.getAnnotations() == null; assert m2 != null || m == null;
if (m2 == null) if (m2 == null)
continue; continue;
copy(m.getAnnotations(), m2.getAnnotations()); copy(m, m2);
} }
} }
} }
private void copy(Annotations an, Annotations an2) private void copy(Annotated an, Annotated an2)
{ {
for (Annotation a : an2.getAnnotations()) for (Annotation a : an.getAnnotations().values())
{ {
if (isType(a.getType())) final var t = a.getType();
{ if (isType(t))
an2.removeAnnotation(a); an2.getAnnotations().replace(t, a);
}
}
for (Annotation a : an.getAnnotations())
{
if (!isType(a.getType()))
continue;
Annotation a2 = new Annotation(a.getType());
for (Element element : a.getElements())
{
Element element2 = new SimpleElement(element.getName(), element.getValue());
a2.addElement(element2);
}
an2.addAnnotation(a2);
} }
} }
private boolean isType(Type type) private boolean isType(Type type)
{ {
return Arrays.asList(types).contains(type); return types.contains(type);
} }
} }
@@ -29,8 +29,8 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.deobfuscators.Renamer; import net.runelite.deob.deobfuscators.Renamer;
import net.runelite.deob.util.NameMappings; import net.runelite.deob.util.NameMappings;
@@ -58,20 +58,20 @@ public class AnnotationRenamer
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ {
String name = getImplements(cf.getAnnotations()); String name = getImplements(cf);
if (name != null) if (name != null)
mappings.map(cf.getPoolClass(), name); mappings.map(cf.getPoolClass(), name);
for (Field f : cf.getFields()) for (Field f : cf.getFields())
{ {
name = DeobAnnotations.getExportedName(f.getAnnotations()); name = DeobAnnotations.getExportedName(f);
if (name != null) if (name != null)
mappings.map(f.getPoolField(), name); mappings.map(f.getPoolField(), name);
} }
for (Method m : cf.getMethods()) for (Method m : cf.getMethods())
{ {
name = DeobAnnotations.getExportedName(m.getAnnotations()); name = DeobAnnotations.getExportedName(m);
if (name != null) if (name != null)
mappings.map(m.getPoolMethod(), name); mappings.map(m.getPoolMethod(), name);
} }
@@ -80,9 +80,9 @@ public class AnnotationRenamer
return mappings; return mappings;
} }
private String getImplements(Annotations annotations) private String getImplements(Annotated cf)
{ {
Annotation an = annotations.find(DeobAnnotations.IMPLEMENTS); Annotation an = cf.findAnnotation(DeobAnnotations.IMPLEMENTS);
return an != null ? an.getElement().getString() : null; return an == null ? null : an.getValueString();
} }
} }
@@ -27,7 +27,7 @@ public class MappedClass
implementingName = DeobAnnotations.getImplements(c); implementingName = DeobAnnotations.getImplements(c);
obfuscatedName = DeobAnnotations.getObfuscatedName(c.getAnnotations()); obfuscatedName = DeobAnnotations.getObfuscatedName(c);
if (obfuscatedName == null) if (obfuscatedName == null)
{ {
obfuscatedName = c.getName(); obfuscatedName = c.getName();
@@ -36,7 +36,7 @@ public class MappedClass
ClassFile parent = c.getParent(); ClassFile parent = c.getParent();
if (parent != null) if (parent != null)
{ {
superClass = DeobAnnotations.getObfuscatedName(parent.getAnnotations()); superClass = DeobAnnotations.getObfuscatedName(parent);
} }
access = c.getAccess(); access = c.getAccess();
@@ -44,7 +44,6 @@ public class MappedClass
interfaces = c.getInterfaces() interfaces = c.getInterfaces()
.getMyInterfaces() .getMyInterfaces()
.stream() .stream()
.map(ClassFile::getAnnotations)
.map(DeobAnnotations::getObfuscatedName) .map(DeobAnnotations::getObfuscatedName)
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -26,11 +26,11 @@ public class MappedField
{ {
MappingDumper.putMap(f.getPoolField(), this); MappingDumper.putMap(f.getPoolField(), this);
exportedName = DeobAnnotations.getExportedName(f.getAnnotations()); exportedName = DeobAnnotations.getExportedName(f);
owner = MappingDumper.getMap(f.getClassFile()).obfuscatedName; owner = MappingDumper.getMap(f.getClassFile()).obfuscatedName;
obfuscatedName = DeobAnnotations.getObfuscatedName(f.getAnnotations()); obfuscatedName = DeobAnnotations.getObfuscatedName(f);
if (obfuscatedName == null) if (obfuscatedName == null)
{ {
obfuscatedName = f.getName(); obfuscatedName = f.getName();
@@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Code; import net.runelite.asm.attributes.Code;
@@ -37,11 +38,11 @@ public class MappedMethod
public MappedMethod visitMethod(final Method m, final MappingDump dump) public MappedMethod visitMethod(final Method m, final MappingDump dump)
{ {
MappingDumper.putMap(m.getPoolMethod(), this); MappingDumper.putMap(m.getPoolMethod(), this);
exportedName = DeobAnnotations.getExportedName(m.getAnnotations()); exportedName = DeobAnnotations.getExportedName(m);
owner = MappingDumper.getMap(m.getClassFile()).obfuscatedName; owner = MappingDumper.getMap(m.getClassFile()).obfuscatedName;
obfuscatedName = DeobAnnotations.getObfuscatedName(m.getAnnotations()); obfuscatedName = DeobAnnotations.getObfuscatedName(m);
if (obfuscatedName == null) if (obfuscatedName == null)
{ {
obfuscatedName = m.getName(); obfuscatedName = m.getName();
@@ -94,8 +95,8 @@ public class MappedMethod
{ {
Method mme = met.get(0); Method mme = met.get(0);
k = new net.runelite.asm.pool.Method( k = new net.runelite.asm.pool.Method(
new Class(DeobAnnotations.getObfuscatedName(mme.getClassFile().getAnnotations())), new Class(Objects.requireNonNull(DeobAnnotations.getObfuscatedName(mme.getClassFile()))),
DeobAnnotations.getObfuscatedName(mme.getAnnotations()), DeobAnnotations.getObfuscatedName(mme),
mme.getObfuscatedSignature() != null ? mme.getObfuscatedSignature() : mme.getDescriptor() mme.getObfuscatedSignature() != null ? mme.getObfuscatedSignature() : mme.getDescriptor()
); );
} }
@@ -34,7 +34,6 @@ import java.util.Enumeration;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.JarOutputStream; import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.objectwebasm.NonloadingClassWriter; import net.runelite.asm.objectwebasm.NonloadingClassWriter;
@@ -118,11 +117,12 @@ public class JarUtil
public static void saveJar(ClassGroup group, File jarfile) throws IOException public static void saveJar(ClassGroup group, File jarfile) throws IOException
{ {
try (JarOutputStream jout = new JarOutputStream(new FileOutputStream(jarfile), new Manifest())) try (JarOutputStream jout = new JarOutputStream(new FileOutputStream(jarfile)))
{ {
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ {
JarEntry entry = new JarEntry(cf.getName() + ".class"); JarEntry entry = new JarEntry(cf.getName() + ".class");
entry.setTime(-1);
jout.putNextEntry(entry); jout.putNextEntry(entry);
byte[] data = writeClass(group, cf); byte[] data = writeClass(group, cf);
@@ -27,6 +27,8 @@ package net.runelite.deob.util;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import net.runelite.asm.pool.Class; import net.runelite.asm.pool.Class;
import net.runelite.asm.pool.Field; import net.runelite.asm.pool.Field;
import net.runelite.asm.pool.Method; import net.runelite.asm.pool.Method;
@@ -36,7 +38,11 @@ public class NameMappings
private final Map<Object, String> map = new HashMap<>(); private final Map<Object, String> map = new HashMap<>();
private final Map<Object, String[]> paramMap = new HashMap<>(); private final Map<Object, String[]> paramMap = new HashMap<>();
@Getter
@Setter
private int fields, methods, classes;
public void map(Class cf, String name) public void map(Class cf, String name)
{ {
map.put(cf, name); map.put(cf, name);
@@ -27,16 +27,11 @@ package net.runelite.asm.annotations;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List;
import java.util.Optional;
import net.runelite.asm.ClassFile; import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.ClassUtil; import net.runelite.asm.ClassUtil;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.deob.util.JarUtil; import net.runelite.deob.util.JarUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@@ -62,20 +57,14 @@ public class AnnotationTest
Method method = cf.getMethods().get(1); Method method = cf.getMethods().get(1);
Assert.assertEquals("method1", method.getName()); Assert.assertEquals("method1", method.getName());
Annotations annotations = method.getAnnotations(); var annotation = method.findAnnotation(new Type("Lnet/runelite/asm/annotations/MyAnnotation;"));
Assert.assertNotNull(annotations); Assert.assertNotNull(annotation);
Optional<Annotation> annotation = annotations.getAnnotations().stream().filter(a -> a.getType().equals(new Type("Lnet/runelite/asm/annotations/MyAnnotation;"))).findFirst(); Assert.assertEquals(1, annotation.size());
Assert.assertTrue(annotation.isPresent());
Annotation an = annotation.get(); Object element = annotation.getValue();
List<Element> elements = an.getElements(); Object also = annotation.get("value");
Assert.assertEquals(also, element);
Assert.assertEquals(1, elements.size()); Assert.assertEquals("method1", element);
Element element = elements.get(0);
Assert.assertEquals("value", element.getName());
Assert.assertEquals("method1", element.getValue());
} }
} }
@@ -82,7 +82,7 @@ public class MappingDumper
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ {
String implName = cf.getName(); String implName = cf.getName();
String className = DeobAnnotations.getObfuscatedName(cf.getAnnotations()); String className = DeobAnnotations.getObfuscatedName(cf);
if (implName != null) if (implName != null)
{ {
@@ -92,7 +92,7 @@ public class MappingDumper
for (Field f : cf.getFields()) for (Field f : cf.getFields())
{ {
String exportName = DeobAnnotations.getExportedName(f.getAnnotations()); String exportName = DeobAnnotations.getExportedName(f);
if (exportName == null) if (exportName == null)
{ {
@@ -101,7 +101,7 @@ public class MappingDumper
++fields; ++fields;
String fieldName = DeobAnnotations.getObfuscatedName(f.getAnnotations()); String fieldName = DeobAnnotations.getObfuscatedName(f);
Type type = f.getType(); Type type = f.getType();
Number getter = DeobAnnotations.getObfuscatedGetter(f); Number getter = DeobAnnotations.getObfuscatedGetter(f);
@@ -171,7 +171,7 @@ public class MappingDumper
for (Method m : cf.getMethods()) for (Method m : cf.getMethods())
{ {
String exportName = DeobAnnotations.getExportedName(m.getAnnotations()); String exportName = DeobAnnotations.getExportedName(m);
if (exportName == null) if (exportName == null)
{ {
@@ -180,7 +180,7 @@ public class MappingDumper
methods++; methods++;
String methodName = DeobAnnotations.getObfuscatedName(m.getAnnotations()); String methodName = DeobAnnotations.getObfuscatedName(m);
Signature signature = DeobAnnotations.getObfuscatedSignature(m); Signature signature = DeobAnnotations.getObfuscatedSignature(m);
String garbageValue = DeobAnnotations.getDecoder(m); String garbageValue = DeobAnnotations.getDecoder(m);
@@ -329,18 +329,18 @@ public class MappingDumper
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ {
String implName = DeobAnnotations.getImplements(cf); String implName = DeobAnnotations.getImplements(cf);
String className = DeobAnnotations.getObfuscatedName(cf.getAnnotations()); String className = DeobAnnotations.getObfuscatedName(cf);
for (Field f : cf.getFields()) for (Field f : cf.getFields())
{ {
String exportName = DeobAnnotations.getExportedName(f.getAnnotations()); String exportName = DeobAnnotations.getExportedName(f);
if (exportName == null) if (exportName == null)
{ {
continue; continue;
} }
String fieldName = DeobAnnotations.getObfuscatedName(f.getAnnotations()); String fieldName = DeobAnnotations.getObfuscatedName(f);
Type obfType = DeobAnnotations.getObfuscatedType(f); Type obfType = DeobAnnotations.getObfuscatedType(f);
Number getter = DeobAnnotations.getObfuscatedGetter(f); Number getter = DeobAnnotations.getObfuscatedGetter(f);
@@ -351,7 +351,7 @@ public class MappingDumper
jField.addProperty("class", className); jField.addProperty("class", className);
jField.addProperty("field", fieldName); jField.addProperty("field", fieldName);
jField.addProperty("obfSignature", (obfType != null ? obfType.toString() : "")); jField.addProperty("obfSignature", (obfType != null ? obfType.toString() : ""));
jField.addProperty("signature", f.getType().toString()); jField.addProperty("descriptor", f.getType().toString());
jField.addProperty("multiplier", (getter != null ? getter : 0)); jField.addProperty("multiplier", (getter != null ? getter : 0));
jField.addProperty("static", f.isStatic()); jField.addProperty("static", f.isStatic());
@@ -361,14 +361,14 @@ public class MappingDumper
for (Method m : cf.getMethods()) for (Method m : cf.getMethods())
{ {
String exportName = DeobAnnotations.getExportedName(m.getAnnotations()); String exportName = DeobAnnotations.getExportedName(m);
if (exportName == null) if (exportName == null)
{ {
continue; continue;
} }
String methodName = DeobAnnotations.getObfuscatedName(m.getAnnotations()); String methodName = DeobAnnotations.getObfuscatedName(m);
Signature obfSignature = DeobAnnotations.getObfuscatedSignature(m); Signature obfSignature = DeobAnnotations.getObfuscatedSignature(m);
String predicate = DeobAnnotations.getDecoder(m); String predicate = DeobAnnotations.getDecoder(m);
@@ -379,7 +379,7 @@ public class MappingDumper
jMethod.addProperty("class", className); jMethod.addProperty("class", className);
jMethod.addProperty("field", methodName); jMethod.addProperty("field", methodName);
jMethod.addProperty("obfSignature", (obfSignature != null ? obfSignature.toString() : "")); jMethod.addProperty("obfSignature", (obfSignature != null ? obfSignature.toString() : ""));
jMethod.addProperty("signature", m.getDescriptor().toString()); jMethod.addProperty("descriptor", m.getDescriptor().toString());
jMethod.addProperty("predicate", (predicate != null ? predicate : "")); jMethod.addProperty("predicate", (predicate != null ? predicate : ""));
jMethod.addProperty("static", m.isStatic()); jMethod.addProperty("static", m.isStatic());
@@ -8,7 +8,6 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
import net.runelite.deob.Deob; import net.runelite.deob.Deob;
import net.runelite.deob.DeobAnnotations; import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.DeobTestProperties; import net.runelite.deob.DeobTestProperties;
@@ -58,14 +57,12 @@ public class AnnotationCleaner
for (Field f : c.getFields()) for (Field f : c.getFields())
{ {
Annotations an = f.getAnnotations();
String fieldName = f.getName(); String fieldName = f.getName();
String exportedName = DeobAnnotations.getExportedName(an); String exportedName = DeobAnnotations.getExportedName(f);
if (exportedName == null) if (exportedName == null)
{ {
if (!Deob.isObfuscated(fieldName) && DeobAnnotations.getObfuscatedName(an) != null) if (!Deob.isObfuscated(fieldName) && DeobAnnotations.getObfuscatedName(f) != null)
{ {
missing.add("Export: (field) " + className + '.' + fieldName + " == missing"); missing.add("Export: (field) " + className + '.' + fieldName + " == missing");
} }
@@ -78,14 +75,12 @@ public class AnnotationCleaner
for (Method m : c.getMethods()) for (Method m : c.getMethods())
{ {
Annotations an = m.getAnnotations();
String methodName = m.getName(); String methodName = m.getName();
String exportedName = DeobAnnotations.getExportedName(an); String exportedName = DeobAnnotations.getExportedName(m);
if (exportedName == null) if (exportedName == null)
{ {
if (!Deob.isObfuscated(methodName) && DeobAnnotations.getObfuscatedName(an) != null) if (!Deob.isObfuscated(methodName) && DeobAnnotations.getObfuscatedName(m) != null)
{ {
missing.add("Export: (method) " + className + '.' + methodName + " == missing"); missing.add("Export: (method) " + className + '.' + methodName + " == missing");
} }
@@ -124,7 +119,7 @@ public class AnnotationCleaner
JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/niec.jar")); JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/niec.jar"));
} }
private class OhNoException extends Exception private static class OhNoException extends Exception
{ {
private OhNoException() private OhNoException()
{ {
@@ -105,16 +105,16 @@ public class UpdateMappingsTest
{ {
for (ClassFile cf : group.getClasses()) for (ClassFile cf : group.getClasses())
{ {
cf.getAnnotations().clearAnnotations(); cf.getAnnotations().clear();
for (Field f : cf.getFields()) for (Field f : cf.getFields())
{ {
f.getAnnotations().clearAnnotations(); f.getAnnotations().clear();
} }
for (Method m : cf.getMethods()) for (Method m : cf.getMethods())
{ {
m.getAnnotations().clearAnnotations(); m.getAnnotations().clear();
} }
} }
} }
@@ -136,8 +136,8 @@ public class UpdateMappingsTest
assert otherf != null : "unable to find " + f; assert otherf != null : "unable to find " + f;
String name = DeobAnnotations.getExportedName(f.getAnnotations()); String name = DeobAnnotations.getExportedName(f);
String otherName = DeobAnnotations.getExportedName(otherf.getAnnotations()); String otherName = DeobAnnotations.getExportedName(otherf);
Assert.assertEquals(name + " <-> " + otherName, name, otherName); Assert.assertEquals(name + " <-> " + otherName, name, otherName);
} }
@@ -148,8 +148,8 @@ public class UpdateMappingsTest
assert otherm != null : "unable to find " + m; assert otherm != null : "unable to find " + m;
String name = DeobAnnotations.getExportedName(m.getAnnotations()); String name = DeobAnnotations.getExportedName(m);
String otherName = DeobAnnotations.getExportedName(otherm.getAnnotations()); String otherName = DeobAnnotations.getExportedName(otherm);
Assert.assertEquals(name + " <-> " + otherName, name, otherName); Assert.assertEquals(name + " <-> " + otherName, name, otherName);
} }
@@ -36,10 +36,9 @@ import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.signature.Signature; import net.runelite.asm.signature.Signature;
import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.util.JarUtil; import net.runelite.deob.util.JarUtil;
import net.runelite.osb.inject.ClassHook; import net.runelite.osb.inject.ClassHook;
import net.runelite.osb.inject.FieldHook; import net.runelite.osb.inject.FieldHook;
@@ -88,17 +87,17 @@ public class HookImporter
{ {
int classes = 0, fields = 0, methods = 0, callbacks = 0; int classes = 0, fields = 0, methods = 0, callbacks = 0;
for (String deobfuscatedClassName : hooks.keySet()) for (Map.Entry<String, ClassHook> entry : hooks.entrySet())
{ {
ClassHook ch = hooks.get(deobfuscatedClassName); ClassHook ch = entry.getValue();
ClassFile cf = this.findClassWithObfuscatedName(ch.getClazz()); ClassFile cf = this.findClassWithObfuscatedName(ch.getClazz());
assert cf != null; assert cf != null;
String implementsName = getAnnotation(cf.getAnnotations(), IMPLEMENTS); String implementsName = getAnnotation(cf, IMPLEMENTS);
if (implementsName.isEmpty()) if (implementsName.isEmpty())
{ {
cf.getAnnotations().addAnnotation(IMPLEMENTS, "value", deobfuscatedClassName); cf.addAnnotation(IMPLEMENTS, entry.getKey());
++classes; ++classes;
} }
@@ -127,10 +126,10 @@ public class HookImporter
assert f != null; assert f != null;
String exportedName = getAnnotation(f.getAnnotations(), EXPORT); String exportedName = getAnnotation(f, EXPORT);
if (exportedName.isEmpty()) if (exportedName.isEmpty())
{ {
f.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedFieldName); f.addAnnotation(EXPORT, deobfuscatedFieldName);
++fields; ++fields;
} }
} }
@@ -160,10 +159,10 @@ public class HookImporter
assert m != null; assert m != null;
String exportedName = getAnnotation(m.getAnnotations(), EXPORT); String exportedName = getAnnotation(m, EXPORT);
if (exportedName.isEmpty()) if (exportedName.isEmpty())
{ {
m.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedMethodName); m.addAnnotation(EXPORT, deobfuscatedMethodName);
++methods; ++methods;
} }
} }
@@ -193,10 +192,10 @@ public class HookImporter
assert m != null; assert m != null;
String exportedName = getAnnotation(m.getAnnotations(), EXPORT); String exportedName = getAnnotation(m, EXPORT);
if (exportedName.isEmpty()) if (exportedName.isEmpty())
{ {
m.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedMethodName); m.addAnnotation(EXPORT, deobfuscatedMethodName);
++callbacks; ++callbacks;
} }
} }
@@ -214,8 +213,7 @@ public class HookImporter
return c; return c;
} }
Annotations an = c.getAnnotations(); if (getAnnotation(c, OBFUSCATED_NAME).equals(name))
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
{ {
return c; return c;
} }
@@ -227,8 +225,7 @@ public class HookImporter
{ {
for (Field f : c.getFields()) for (Field f : c.getFields())
{ {
Annotations an = f.getAnnotations(); if (name.equals(DeobAnnotations.getObfuscatedName(f)))
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
{ {
return f; return f;
} }
@@ -242,8 +239,7 @@ public class HookImporter
for (Method m : c.getMethods()) for (Method m : c.getMethods())
{ {
Annotations an = m.getAnnotations(); if (getAnnotation(m, OBFUSCATED_NAME).equals(name))
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
{ {
Signature methodSig = getObfuscatedMethodSignature(m); Signature methodSig = getObfuscatedMethodSignature(m);
@@ -261,30 +257,15 @@ public class HookImporter
return null; return null;
} }
private String getAnnotation(Annotations an, Type type) private String getAnnotation(Annotated an, Type type)
{ {
if (an == null) final var s = DeobAnnotations.getStringValue(an, type);
{ return s == null ? "" : s;
return "";
}
for (Annotation a : an.getAnnotations())
{
if (a.getType().equals(type))
{
for (Element e : a.getElements())
{
return (String) e.getValue();
}
}
}
return "";
} }
private Signature getObfuscatedMethodSignature(Method method) private Signature getObfuscatedMethodSignature(Method method)
{ {
String sig = getAnnotation(method.getAnnotations(), OBFUSCATED_SIGNATURE); String sig = getAnnotation(method, OBFUSCATED_SIGNATURE);
if (!sig.isEmpty()) if (!sig.isEmpty())
{ {
return toObSignature(new Signature(sig)); // if it is annoted, use that return toObSignature(new Signature(sig)); // if it is annoted, use that
@@ -310,8 +291,7 @@ public class HookImporter
ClassFile cf = group.findClass(t.getInternalName()); ClassFile cf = group.findClass(t.getInternalName());
assert cf != null; assert cf != null;
Annotations an = cf.getAnnotations(); String obfuscatedName = (String) cf.findAnnotation(OBFUSCATED_NAME).getValue();
String obfuscatedName = an.find(OBFUSCATED_NAME).getElement().getString();
return Type.getType("L" + obfuscatedName + ";", t.getDimensions()); return Type.getType("L" + obfuscatedName + ";", t.getDimensions());
} }
@@ -30,9 +30,9 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup; import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.annotation.Annotation; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.annotation.Element; import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.util.JarUtil; import net.runelite.deob.util.JarUtil;
import net.runelite.runeloader.inject.AddInterfaceInstruction; import net.runelite.runeloader.inject.AddInterfaceInstruction;
import net.runelite.runeloader.inject.GetterInjectInstruction; import net.runelite.runeloader.inject.GetterInjectInstruction;
@@ -73,29 +73,13 @@ public class MappingImporter
JarUtil.saveJar(group, OUT); JarUtil.saveJar(group, OUT);
} }
private boolean hasObfuscatedName(Annotations an, String name) private boolean hasObfuscatedName(Annotated an, String name)
{ {
if (an == null) if (an == null)
{ {
return false; return false;
} }
return name.equals(DeobAnnotations.getStringValue(an, OBFUSCATED_NAME));
for (Annotation a : an.getAnnotations())
{
if (a.getType().equals(OBFUSCATED_NAME))
{
for (Element e : a.getElements())
{
String str = (String) e.getValue();
if (str.equals(name))
{
return true;
}
}
}
}
return false;
} }
private ClassFile findClassWithObfuscatedName(String name) private ClassFile findClassWithObfuscatedName(String name)
@@ -107,8 +91,7 @@ public class MappingImporter
return c; return c;
} }
Annotations an = c.getAnnotations(); if (this.hasObfuscatedName(c, name))
if (this.hasObfuscatedName(an, name))
{ {
return c; return c;
} }
@@ -120,8 +103,7 @@ public class MappingImporter
{ {
for (Field f : c.getFields()) for (Field f : c.getFields())
{ {
Annotations an = f.getAnnotations(); if (this.hasObfuscatedName(f, name))
if (this.hasObfuscatedName(an, name))
{ {
return f; return f;
} }
@@ -131,7 +113,7 @@ public class MappingImporter
@Test @Test
@Ignore @Ignore
public void makeMappings() throws IOException public void makeMappings()
{ {
InjectionModscript mod = Injection.load(MappingImporter.class.getResourceAsStream(RL_INJECTION)); InjectionModscript mod = Injection.load(MappingImporter.class.getResourceAsStream(RL_INJECTION));
int fields = 0, classes = 0; int fields = 0, classes = 0;
@@ -154,12 +136,10 @@ public class MappingImporter
String attrName = gii.getGetterName(); String attrName = gii.getGetterName();
attrName = Utils.toExportedName(attrName); attrName = Utils.toExportedName(attrName);
Annotations an = f.getAnnotations(); Annotation a = f.findAnnotation(EXPORT);
Annotation a = an.find(EXPORT);
if (a != null) if (a != null)
{ {
String exportedName = a.getElement().getString(); String exportedName = a.getValueString();
if (!attrName.equals(exportedName)) if (!attrName.equals(exportedName))
{ {
@@ -168,7 +148,7 @@ public class MappingImporter
} }
else else
{ {
an.addAnnotation(EXPORT, "value", attrName); f.addAnnotation(EXPORT, attrName);
logger.info("Exporting field " + f + " with name " + attrName); logger.info("Exporting field " + f + " with name " + attrName);
++fields; ++fields;
@@ -184,12 +164,10 @@ public class MappingImporter
iface = iface.replace("com/runeloader/api/bridge/os/accessor/", ""); iface = iface.replace("com/runeloader/api/bridge/os/accessor/", "");
Annotations an = cf.getAnnotations(); Annotation a = cf.findAnnotation(IMPLEMENTS);
Annotation a = an.find(IMPLEMENTS);
if (a != null) if (a != null)
{ {
String implementsName = a.getElement().getString(); String implementsName = a.getValueString();
if (!iface.equals(implementsName)) if (!iface.equals(implementsName))
{ {
@@ -198,7 +176,7 @@ public class MappingImporter
} }
else else
{ {
an.addAnnotation(IMPLEMENTS, "value", iface); cf.addAnnotation(IMPLEMENTS, iface);
logger.info("Exporting class " + cf.getName() + " with name " + iface); logger.info("Exporting class " + cf.getName() + " with name " + iface);
++classes; ++classes;
@@ -36,9 +36,7 @@ import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field; import net.runelite.asm.Field;
import net.runelite.asm.Method; import net.runelite.asm.Method;
import net.runelite.asm.Type; import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotations; import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.attributes.code.LocalVariable; import net.runelite.asm.attributes.code.LocalVariable;
import net.runelite.asm.attributes.code.Parameter; import net.runelite.asm.attributes.code.Parameter;
import net.runelite.asm.signature.Signature; import net.runelite.asm.signature.Signature;
@@ -107,11 +105,11 @@ public class HookImporter
assert cf != null; assert cf != null;
String implementsName = getAnnotation(cf.getAnnotations(), IMPLEMENTS); String implementsName = getAnnotation(cf, IMPLEMENTS);
if (implementsName.isEmpty()) if (implementsName.isEmpty())
{ {
String deobfuscatedClassName = hc.clazz; String deobfuscatedClassName = hc.clazz;
cf.getAnnotations().addAnnotation(IMPLEMENTS, "value", deobfuscatedClassName); cf.addAnnotation(IMPLEMENTS, deobfuscatedClassName);
mappings.map(cf.getPoolClass(), deobfuscatedClassName); mappings.map(cf.getPoolClass(), deobfuscatedClassName);
++classes; ++classes;
} }
@@ -138,7 +136,7 @@ public class HookImporter
continue; continue;
} }
String exportedName = getAnnotation(f.getAnnotations(), EXPORT); String exportedName = getAnnotation(f, EXPORT);
if (exportedName.isEmpty()) if (exportedName.isEmpty())
{ {
String deobfuscatedFieldName = fh.field; String deobfuscatedFieldName = fh.field;
@@ -150,7 +148,7 @@ public class HookImporter
continue; continue;
} }
f.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedFieldName); f.addAnnotation(EXPORT, deobfuscatedFieldName);
mappings.map(f.getPoolField(), deobfuscatedFieldName); mappings.map(f.getPoolField(), deobfuscatedFieldName);
++fields; ++fields;
} }
@@ -219,7 +217,7 @@ public class HookImporter
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(m); List<Method> virtualMethods = VirtualMethods.getVirtualMethods(m);
for (Method method : virtualMethods) for (Method method : virtualMethods)
{ {
String exportedName = getAnnotation(method.getAnnotations(), EXPORT); String exportedName = getAnnotation(method, EXPORT);
if (!exportedName.isEmpty()) if (!exportedName.isEmpty())
{ {
if (!exportedName.equals(hm.method)) if (!exportedName.equals(hm.method))
@@ -231,7 +229,7 @@ public class HookImporter
} }
String deobfuscatedMethodName = hm.method; String deobfuscatedMethodName = hm.method;
m.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedMethodName); m.addAnnotation(EXPORT, deobfuscatedMethodName);
mappings.map(m.getPoolMethod(), deobfuscatedMethodName); mappings.map(m.getPoolMethod(), deobfuscatedMethodName);
++methods; ++methods;
} }
@@ -252,8 +250,7 @@ public class HookImporter
return c; return c;
} }
Annotations an = c.getAnnotations(); if (getAnnotation(c, OBFUSCATED_NAME).equals(name))
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
{ {
return c; return c;
} }
@@ -265,8 +262,7 @@ public class HookImporter
{ {
for (Field f : c.getFields()) for (Field f : c.getFields())
{ {
Annotations an = f.getAnnotations(); if (getAnnotation(f, OBFUSCATED_NAME).equals(name))
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
{ {
return f; return f;
} }
@@ -280,8 +276,7 @@ public class HookImporter
for (Method m : c.getMethods()) for (Method m : c.getMethods())
{ {
Annotations an = m.getAnnotations(); if (m.getName().equals(name) || getAnnotation(m, OBFUSCATED_NAME).equals(name))
if (m.getName().equals(name) || getAnnotation(an, OBFUSCATED_NAME).equals(name))
{ {
Signature methodSig = getObfuscatedMethodSignature(m); Signature methodSig = getObfuscatedMethodSignature(m);
@@ -294,15 +289,12 @@ public class HookImporter
return null; return null;
} }
private String getAnnotation(Annotations an, Type type) private String getAnnotation(Annotated an, Type type)
{ {
Annotation a = an.find(type); final var a = an.findAnnotation(type);
if (a != null) if (a != null)
{ {
for (Element e : a.getElements()) return a.getValueString();
{
return (String) e.getValue();
}
} }
return ""; return "";
@@ -310,7 +302,7 @@ public class HookImporter
private Signature getObfuscatedMethodSignature(Method method) private Signature getObfuscatedMethodSignature(Method method)
{ {
String sig = getAnnotation(method.getAnnotations(), OBFUSCATED_SIGNATURE); String sig = getAnnotation(method, OBFUSCATED_SIGNATURE);
if (sig.isEmpty()) if (sig.isEmpty())
{ {
return method.getDescriptor(); return method.getDescriptor();
@@ -36,7 +36,7 @@ import java.lang.annotation.Target;
}) })
public @interface ObfuscatedSignature public @interface ObfuscatedSignature
{ {
String signature(); String descriptor();
String garbageValue() default ""; // valid garbage value for last parameter. can't be an Object because Java. String garbageValue() default ""; // valid garbage value for last parameter. can't be an Object because Java.
} }
+1 -1
View File
@@ -155,7 +155,7 @@ tasks {
register<JavaExec>("RuneLite.main()") { register<JavaExec>("RuneLite.main()") {
group = "openosrs" group = "openosrs"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = sourceSets["main"].runtimeClasspath
enableAssertions = true enableAssertions = true
main = "net.runelite.client.RuneLite" main = "net.runelite.client.RuneLite"
} }
@@ -930,6 +930,11 @@ public class ExternalPluginManager
log.info("Not updating external plugins since there is more than 1 client open"); log.info("Not updating external plugins since there is more than 1 client open");
return; return;
} }
else if (developmentMode)
{
log.info("Not updating because we're running in developer mode");
return;
}
RuneLiteSplashScreen.stage(.59, "Updating external plugins"); RuneLiteSplashScreen.stage(.59, "Updating external plugins");
@@ -100,10 +100,8 @@ public abstract class EntityHiderMixin implements RSScene
private static boolean hideDeadNPCs; private static boolean hideDeadNPCs;
@Copy("newGameObject") @Copy("newGameObject")
abstract boolean addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSEntity entity, int var10, boolean var11, long var12, int var13);
@Replace("newGameObject") @Replace("newGameObject")
boolean rl$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSEntity entity, int var10, boolean var11, long var12, int var13) boolean copy$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSEntity entity, int var10, boolean var11, long var12, int var13)
{ {
final boolean shouldDraw = shouldDraw(entity, false); final boolean shouldDraw = shouldDraw(entity, false);
@@ -119,21 +117,16 @@ public abstract class EntityHiderMixin implements RSScene
} }
return shouldDraw && return shouldDraw &&
addEntityMarker(var1, var2, var3, var4, var5, x, y, var8, entity, var10, var11, var12, var13); copy$addEntityMarker(var1, var2, var3, var4, var5, x, y, var8, entity, var10, var11, var12, var13);
} }
@Copy("drawActor2d") @Copy("drawActor2d")
private static void draw2DExtras(RSActor actor, int var1, int var2, int var3, int var4, int var5)
{
throw new RuntimeException();
}
@Replace("drawActor2d") @Replace("drawActor2d")
private static void rl$draw2DExtras(RSActor actor, int var1, int var2, int var3, int var4, int var5) private static void copy$draw2DExtras(RSActor actor, int var1, int var2, int var3, int var4, int var5)
{ {
if (shouldDraw(actor, true)) if (shouldDraw(actor, true))
{ {
draw2DExtras(actor, var1, var2, var3, var4, var5); copy$draw2DExtras(actor, var1, var2, var3, var4, var5);
} }
} }
@@ -37,7 +37,7 @@ public abstract class ProcessClientErrorMixin implements RSClient
private static RSClient client; private static RSClient client;
@Replace("RunException_sendStackTrace") @Replace("RunException_sendStackTrace")
static void rl$processClientError(String string, Throwable throwable) static void processClientError(String string, Throwable throwable)
{ {
if (throwable != null) if (throwable != null)
{ {
@@ -33,13 +33,12 @@ public abstract class RSAbstractArchiveMixin implements RSAbstractArchive
return overlayOutdated; return overlayOutdated;
} }
@SuppressWarnings("InfiniteRecursion")
@Copy("takeFile") @Copy("takeFile")
abstract byte[] rs$getConfigData(int archiveId, int fileId);
@Replace("takeFile") @Replace("takeFile")
public byte[] rl$getConfigData(int groupId, int fileId) public byte[] copy$getConfigData(int groupId, int fileId)
{ {
final byte[] rsData = rs$getConfigData(groupId, fileId); final byte[] rsData = copy$getConfigData(groupId, fileId);
final int archiveId = ((RSArchive) this).getIndex(); final int archiveId = ((RSArchive) this).getIndex();
if (!OverlayIndex.hasOverlay(archiveId, groupId)) if (!OverlayIndex.hasOverlay(archiveId, groupId))
@@ -42,16 +42,15 @@ public abstract class RSBufferMixin implements RSBuffer
private static BigInteger modulus; private static BigInteger modulus;
@Copy("encryptRsa") @Copy("encryptRsa")
abstract void rs$encryptRsa(BigInteger var1, BigInteger var2);
@Replace("encryptRsa") @Replace("encryptRsa")
public void rl$encryptRsa(BigInteger exp, BigInteger mod) @SuppressWarnings("InfiniteRecursion")
public void copy$encryptRsa(BigInteger exp, BigInteger mod)
{ {
if (modulus != null) if (modulus != null)
{ {
mod = modulus; mod = modulus;
} }
rs$encryptRsa(exp, mod); copy$encryptRsa(exp, mod);
} }
} }
@@ -957,15 +957,11 @@ public abstract class RSClientMixin implements RSClient
} }
@Copy("runWidgetOnLoadListener") @Copy("runWidgetOnLoadListener")
public static void rs$runWidgetOnLoadListener(int groupId)
{
throw new RuntimeException();
}
@Replace("runWidgetOnLoadListener") @Replace("runWidgetOnLoadListener")
public static void rl$runWidgetOnLoadListener(int groupId) @SuppressWarnings("InfiniteRecursion")
public static void copy$runWidgetOnLoadListener(int groupId)
{ {
rs$runWidgetOnLoadListener(groupId); copy$runWidgetOnLoadListener(groupId);
RSWidget[][] widgets = client.getWidgets(); RSWidget[][] widgets = client.getWidgets();
boolean loaded = widgets != null && widgets[groupId] != null; boolean loaded = widgets != null && widgets[groupId] != null;
@@ -1147,19 +1143,14 @@ public abstract class RSClientMixin implements RSClient
} }
@Copy("findItemDefinitions") @Copy("findItemDefinitions")
public static void rs$findItemDefinitions(String var0, boolean var1)
{
throw new RuntimeException();
}
@Replace("findItemDefinitions") @Replace("findItemDefinitions")
public static void rl$findItemDefinitions(String var0, boolean var1) public static void copy$findItemDefinitions(String var0, boolean var1)
{ {
GrandExchangeSearched event = new GrandExchangeSearched(); GrandExchangeSearched event = new GrandExchangeSearched();
client.getCallbacks().post(GrandExchangeSearched.class, event); client.getCallbacks().post(GrandExchangeSearched.class, event);
if (!event.isConsumed()) if (!event.isConsumed())
{ {
rs$findItemDefinitions(var0, var1); copy$findItemDefinitions(var0, var1);
} }
} }
@@ -1379,13 +1370,8 @@ public abstract class RSClientMixin implements RSClient
} }
@Copy("menuAction") @Copy("menuAction")
static void rs$menuAction(int var0, int var1, int var2, int var3, String var4, String var5, int var6, int var7)
{
throw new RuntimeException();
}
@Replace("menuAction") @Replace("menuAction")
static void rl$menuAction(int param0, int param1, int opcode, int id, String option, String target, int canvasX, int canvasY) static void copy$menuAction(int param0, int param1, int opcode, int id, String option, String target, int canvasX, int canvasY)
{ {
boolean authentic = true; boolean authentic = true;
if (target != null && target.startsWith("!AUTHENTIC")) if (target != null && target.startsWith("!AUTHENTIC"))
@@ -1429,7 +1415,7 @@ public abstract class RSClientMixin implements RSClient
return; return;
} }
rs$menuAction(menuOptionClicked.getParam0(), menuOptionClicked.getParam1(), menuOptionClicked.getOpcode(), copy$menuAction(menuOptionClicked.getParam0(), menuOptionClicked.getParam1(), menuOptionClicked.getOpcode(),
menuOptionClicked.getIdentifier(), menuOptionClicked.getOption(), menuOptionClicked.getTarget(), canvasX, canvasY); menuOptionClicked.getIdentifier(), menuOptionClicked.getOption(), menuOptionClicked.getTarget(), canvasX, canvasY);
} }
@@ -1697,15 +1683,11 @@ public abstract class RSClientMixin implements RSClient
} }
@Copy("shouldLeftClickOpenMenu") @Copy("shouldLeftClickOpenMenu")
boolean rs$shouldLeftClickOpenMenu()
{
throw new RuntimeException();
}
@Replace("shouldLeftClickOpenMenu") @Replace("shouldLeftClickOpenMenu")
boolean rl$shouldLeftClickOpenMenu() @SuppressWarnings("InfiniteRecursion")
boolean copy$shouldLeftClickOpenMenu()
{ {
if (rs$shouldLeftClickOpenMenu()) if (copy$shouldLeftClickOpenMenu())
{ {
return true; return true;
} }
@@ -1729,20 +1711,15 @@ public abstract class RSClientMixin implements RSClient
} }
@Copy("menu") @Copy("menu")
void rs$menu()
{
throw new RuntimeException();
}
@Replace("menu") @Replace("menu")
void rl$menu() void copy$menu()
{ {
Menu menu = Menu.MENU; Menu menu = Menu.MENU;
menu.reset(); menu.reset();
getCallbacks().post(Menu.class, menu); getCallbacks().post(Menu.class, menu);
if (menu.shouldRun()) if (menu.shouldRun())
{ {
rs$menu(); copy$menu();
} }
} }
@@ -1810,14 +1787,11 @@ public abstract class RSClientMixin implements RSClient
} }
@Copy("forceDisconnect") @Copy("forceDisconnect")
static void rs$forceDisconnect(int reason)
{
}
@Replace("forceDisconnect") @Replace("forceDisconnect")
static void forceDisconnect(int reason) @SuppressWarnings("InfiniteRecursion")
static void copy$forceDisconnect(int reason)
{ {
rs$forceDisconnect(reason); copy$forceDisconnect(reason);
if (hideDisconnect && reason == 1) if (hideDisconnect && reason == 1)
{ {
@@ -1844,15 +1818,11 @@ public abstract class RSClientMixin implements RSClient
@Copy("changeGameOptions") @Copy("changeGameOptions")
public static void rs$changeGameOptions(int var0)
{
throw new RuntimeException();
}
@Replace("changeGameOptions") @Replace("changeGameOptions")
public static void changeGameOptions(int var0) @SuppressWarnings("InfiniteRecursion")
public static void copy$changeGameOptions(int var0)
{ {
rs$changeGameOptions(var0); copy$changeGameOptions(var0);
int type = client.getVarpDefinition(var0).getType(); int type = client.getVarpDefinition(var0).getType();
if (type == 3 || type == 4 || type == 10) if (type == 3 || type == 4 || type == 10)
@@ -46,11 +46,10 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
@Inject @Inject
public int animationID; public int animationID;
@SuppressWarnings("InfiniteRecursion")
@Copy("getModel") @Copy("getModel")
public abstract RSModel rs$getModel();
@Replace("getModel") @Replace("getModel")
public RSModel rl$getModel() public RSModel copy$getModel()
{ {
try try
{ {
@@ -61,7 +60,7 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
{ {
setAnimFrame((animFrame ^ Integer.MIN_VALUE) & 0xFFFF); setAnimFrame((animFrame ^ Integer.MIN_VALUE) & 0xFFFF);
} }
return rs$getModel(); return copy$getModel();
} }
finally finally
{ {
@@ -52,12 +52,10 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
} }
@Copy("getShiftClickIndex") @Copy("getShiftClickIndex")
abstract int rs$getShiftClickActionIndex();
@Replace("getShiftClickIndex") @Replace("getShiftClickIndex")
public int getShiftClickActionIndex() public int copy$getShiftClickActionIndex()
{ {
return shiftClickActionIndex == DEFAULT_CUSTOM_SHIFT_CLICK_INDEX ? rs$getShiftClickActionIndex() : shiftClickActionIndex; return shiftClickActionIndex == DEFAULT_CUSTOM_SHIFT_CLICK_INDEX ? copy$getShiftClickActionIndex() : shiftClickActionIndex;
} }
@Inject @Inject
@@ -77,14 +75,12 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
} }
@Copy("getModel") @Copy("getModel")
public abstract RSModel rs$getModel(int quantity);
@Replace("getModel") @Replace("getModel")
public RSModel getModel(int quantity) public RSModel copy$getModel(int quantity)
{ {
if (modelOverride == -1) if (modelOverride == -1)
{ {
return rs$getModel(quantity); return copy$getModel(quantity);
} }
return client.getRSItemDefinition(modelOverride).getModel(quantity); return client.getRSItemDefinition(modelOverride).getModel(quantity);
@@ -18,45 +18,39 @@ public abstract class RSKeyHandlerMixin implements RSKeyHandler
@Shadow("client") @Shadow("client")
private static RSClient client; private static RSClient client;
@Copy("keyPressed")
abstract void rs$keyPressed(KeyEvent keyEvent);
@Copy("keyReleased")
abstract void rs$keyReleased(KeyEvent keyEvent);
@Copy("keyTyped")
abstract void rs$keyTyped(KeyEvent keyEvent);
@Override @Override
@Copy("keyPressed")
@Replace("keyPressed") @Replace("keyPressed")
public final synchronized void keyPressed(KeyEvent keyEvent) public final synchronized void keyPressed(KeyEvent keyEvent)
{ {
client.getCallbacks().keyPressed(keyEvent); client.getCallbacks().keyPressed(keyEvent);
if (!keyEvent.isConsumed()) if (!keyEvent.isConsumed())
{ {
rs$keyPressed(keyEvent); keyPressed(keyEvent);
} }
} }
@Override @Override
@Copy("keyReleased")
@Replace("keyReleased") @Replace("keyReleased")
public final synchronized void keyReleased(KeyEvent keyEvent) public final synchronized void keyReleased(KeyEvent keyEvent)
{ {
client.getCallbacks().keyReleased(keyEvent); client.getCallbacks().keyReleased(keyEvent);
if (!keyEvent.isConsumed()) if (!keyEvent.isConsumed())
{ {
rs$keyReleased(keyEvent); keyReleased(keyEvent);
} }
} }
@Override @Override
@Copy("keyTyped")
@Replace("keyTyped") @Replace("keyTyped")
public final void keyTyped(KeyEvent keyEvent) public final void keyTyped(KeyEvent keyEvent)
{ {
client.getCallbacks().keyTyped(keyEvent); client.getCallbacks().keyTyped(keyEvent);
if (!keyEvent.isConsumed()) if (!keyEvent.isConsumed())
{ {
rs$keyTyped(keyEvent); keyTyped(keyEvent);
} }
} }
@@ -38,17 +38,12 @@ public abstract class RSLoginScreenAnimationMixin implements RSLoginScreenAnimat
private static RSClient client; private static RSClient client;
@Copy("draw") @Copy("draw")
void rs$draw(int var1, int var2)
{
throw new RuntimeException();
}
@Replace("draw") @Replace("draw")
void rl$draw(int var1, int var2) void copy$draw(int var1, int var2)
{ {
if (client.shouldRenderLoginScreenFire()) if (client.shouldRenderLoginScreenFire())
{ {
rs$draw(var1, var2); copy$draw(var1, var2);
} }
} }
} }
@@ -47,14 +47,13 @@ public abstract class RSModelDataMixin implements RSModelData
private float[][] faceTextureVCoordinates; private float[][] faceTextureVCoordinates;
@Copy("toModel") @Copy("toModel")
public abstract Model rs$light(int ambient, int contrast, int var3, int var4, int var5);
@Replace("toModel") @Replace("toModel")
public Model rl$light(int ambient, int contrast, int var3, int var4, int var5) @SuppressWarnings("InfiniteRecursion")
public Model copy$light(int ambient, int contrast, int var3, int var4, int var5)
{ {
client.getLogger().trace("Lighting model {}", this); client.getLogger().trace("Lighting model {}", this);
Model model = rs$light(ambient, contrast, var3, var4, var5); Model model = copy$light(ambient, contrast, var3, var4, var5);
if (model == null) if (model == null)
{ {
return null; return null;
@@ -160,13 +160,12 @@ public abstract class RSModelMixin implements RSModel
} }
@Copy("contourGround") @Copy("contourGround")
public abstract Model rs$contourGround(int[][] tileHeights, int packedX, int height, int packedY, boolean copy, int contouredGround);
@Replace("contourGround") @Replace("contourGround")
public Model rl$contourGround(int[][] tileHeights, int packedX, int height, int packedY, boolean copy, int contouredGround) @SuppressWarnings("InfiniteRecursion")
public Model copy$contourGround(int[][] tileHeights, int packedX, int height, int packedY, boolean copy, int contouredGround)
{ {
// With contouredGround >= 0 lighted models are countoured, so we need to copy uvs // With contouredGround >= 0 lighted models are countoured, so we need to copy uvs
Model model = rs$contourGround(tileHeights, packedX, height, packedY, copy, contouredGround); Model model = copy$contourGround(tileHeights, packedX, height, packedY, copy, contouredGround);
if (model != null && model != this) if (model != null && model != this)
{ {
RSModel rsModel = (RSModel) model; RSModel rsModel = (RSModel) model;
@@ -177,15 +176,13 @@ public abstract class RSModelMixin implements RSModel
} }
@Copy("drawFace") @Copy("drawFace")
public abstract void rs$drawFace(int face);
@Replace("drawFace") @Replace("drawFace")
public void rl$drawFace(int face) public void copy$drawFace(int face)
{ {
DrawCallbacks callbacks = client.getDrawCallbacks(); DrawCallbacks callbacks = client.getDrawCallbacks();
if (callbacks == null || !callbacks.drawFace(this, face)) if (callbacks == null || !callbacks.drawFace(this, face))
{ {
rs$drawFace(face); copy$drawFace(face);
} }
} }
@@ -18,28 +18,8 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
@Inject @Inject
private int isInEvent; private int isInEvent;
@Copy("mousePressed")
abstract void rs$mousePressed(MouseEvent mouseEvent);
@Copy("mouseReleased")
abstract void rs$mouseReleased(MouseEvent mouseEvent);
@Copy("mouseClicked")
abstract void rs$mouseClicked(MouseEvent mouseEvent);
@Copy("mouseEntered")
abstract void rs$mouseEntered(MouseEvent mouseEvent);
@Copy("mouseExited")
abstract void rs$mouseExited(MouseEvent mouseEvent);
@Copy("mouseDragged")
abstract void rs$mouseDragged(MouseEvent mouseEvent);
@Copy("mouseMoved")
abstract void rs$mouseMoved(MouseEvent mouseEvent);
@Override @Override
@Copy("mousePressed")
@Replace("mousePressed") @Replace("mousePressed")
public synchronized void mousePressed(MouseEvent mouseEvent) public synchronized void mousePressed(MouseEvent mouseEvent)
{ {
@@ -52,7 +32,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++; isInEvent++;
try try
{ {
rs$mousePressed(mouseEvent); mousePressed(mouseEvent);
} }
finally finally
{ {
@@ -62,6 +42,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
} }
@Override @Override
@Copy("mouseReleased")
@Replace("mouseReleased") @Replace("mouseReleased")
public synchronized void mouseReleased(MouseEvent mouseEvent) public synchronized void mouseReleased(MouseEvent mouseEvent)
{ {
@@ -74,7 +55,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++; isInEvent++;
try try
{ {
rs$mouseReleased(mouseEvent); mouseReleased(mouseEvent);
} }
finally finally
{ {
@@ -84,17 +65,19 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
} }
@Override @Override
@Copy("mouseClicked")
@Replace("mouseClicked") @Replace("mouseClicked")
public void mouseClicked(MouseEvent event) public void mouseClicked(MouseEvent event)
{ {
event = client.getCallbacks().mouseClicked(event); event = client.getCallbacks().mouseClicked(event);
if (!event.isConsumed()) if (!event.isConsumed())
{ {
rs$mouseClicked(event); mouseClicked(event);
} }
} }
@Override @Override
@Copy("mouseEntered")
@Replace("mouseEntered") @Replace("mouseEntered")
public synchronized void mouseEntered(MouseEvent mouseEvent) public synchronized void mouseEntered(MouseEvent mouseEvent)
{ {
@@ -107,7 +90,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++; isInEvent++;
try try
{ {
rs$mouseEntered(mouseEvent); mouseEntered(mouseEvent);
} }
finally finally
{ {
@@ -118,6 +101,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
@Override @Override
@Copy("mouseExited")
@Replace("mouseExited") @Replace("mouseExited")
public synchronized void mouseExited(MouseEvent mouseEvent) public synchronized void mouseExited(MouseEvent mouseEvent)
{ {
@@ -130,7 +114,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++; isInEvent++;
try try
{ {
rs$mouseExited(mouseEvent); mouseExited(mouseEvent);
} }
finally finally
{ {
@@ -140,6 +124,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
} }
@Override @Override
@Copy("mouseDragged")
@Replace("mouseDragged") @Replace("mouseDragged")
public synchronized void mouseDragged(MouseEvent mouseEvent) public synchronized void mouseDragged(MouseEvent mouseEvent)
{ {
@@ -152,7 +137,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++; isInEvent++;
try try
{ {
rs$mouseDragged(mouseEvent); mouseDragged(mouseEvent);
} }
finally finally
{ {
@@ -162,6 +147,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
} }
@Override @Override
@Copy("mouseMoved")
@Replace("mouseMoved") @Replace("mouseMoved")
public synchronized void mouseMoved(MouseEvent mouseEvent) public synchronized void mouseMoved(MouseEvent mouseEvent)
{ {
@@ -174,7 +160,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++; isInEvent++;
try try
{ {
rs$mouseMoved(mouseEvent); mouseMoved(mouseEvent);
} }
finally finally
{ {
@@ -38,17 +38,15 @@ public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
@Shadow("client") @Shadow("client")
private static RSClient client; private static RSClient client;
@Copy("mouseWheelMoved")
abstract void rs$mouseWheelMoved(MouseWheelEvent event);
@Override @Override
@Copy("mouseWheelMoved")
@Replace("mouseWheelMoved") @Replace("mouseWheelMoved")
public void mouseWheelMoved(MouseWheelEvent event) public void mouseWheelMoved(MouseWheelEvent event)
{ {
event = client.getCallbacks().mouseWheelMoved(event); event = client.getCallbacks().mouseWheelMoved(event);
if (!event.isConsumed()) if (!event.isConsumed())
{ {
rs$mouseWheelMoved(event); mouseWheelMoved(event);
} }
} }
} }
@@ -119,15 +119,14 @@ public abstract class RSNPCMixin implements RSNPC
} }
@Copy("getModel") @Copy("getModel")
public abstract RSModel rs$getModel();
@Replace("getModel") @Replace("getModel")
public RSModel rl$getModel() @SuppressWarnings("InfiniteRecursion")
public RSModel copy$getModel()
{ {
if (!client.isInterpolateNpcAnimations() if (!client.isInterpolateNpcAnimations()
|| getAnimation() == AnimationID.HELLHOUND_DEFENCE) || getAnimation() == AnimationID.HELLHOUND_DEFENCE)
{ {
return rs$getModel(); return copy$getModel();
} }
int actionFrame = getActionFrame(); int actionFrame = getActionFrame();
int poseFrame = getPoseFrame(); int poseFrame = getPoseFrame();
@@ -139,7 +138,7 @@ public abstract class RSNPCMixin implements RSNPC
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame); setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame); setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame); setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
return rs$getModel(); return copy$getModel();
} }
finally finally
{ {
@@ -245,15 +245,14 @@ public abstract class RSPlayerMixin implements RSPlayer
return model.getConvexHull(getX(), getY(), getOrientation(), tileHeight); return model.getConvexHull(getX(), getY(), getOrientation(), tileHeight);
} }
@SuppressWarnings("InfiniteRecursion")
@Copy("getModel") @Copy("getModel")
public abstract RSModel rs$getModel();
@Replace("getModel") @Replace("getModel")
public RSModel rl$getModel() public RSModel copy$getModel()
{ {
if (!client.isInterpolatePlayerAnimations()) if (!client.isInterpolatePlayerAnimations())
{ {
return rs$getModel(); return copy$getModel();
} }
int actionFrame = getActionFrame(); int actionFrame = getActionFrame();
int poseFrame = getPoseFrame(); int poseFrame = getPoseFrame();
@@ -265,7 +264,7 @@ public abstract class RSPlayerMixin implements RSPlayer
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame); setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame); setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame); setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
return rs$getModel(); return copy$getModel();
} }
finally finally
{ {
@@ -290,14 +289,13 @@ public abstract class RSPlayerMixin implements RSPlayer
} }
@Copy("read") @Copy("read")
public abstract void rs$read(RSBuffer buffer);
@Replace("read") @Replace("read")
public void rl$read(RSBuffer buffer) @SuppressWarnings("InfiniteRecursion")
public void copy$read(RSBuffer buffer)
{ {
final long appearanceHash = getPlayerAppearance() == null ? 0 : getPlayerAppearance().getHash(); final long appearanceHash = getPlayerAppearance() == null ? 0 : getPlayerAppearance().getHash();
rs$read(buffer); this.copy$read(buffer);
if (getPlayerAppearance().getHash() != appearanceHash) if (getPlayerAppearance().getHash() != appearanceHash)
{ {
@@ -28,13 +28,8 @@ public abstract class RSRasterizer2DMixin implements RSClient
} }
@Copy("Rasterizer2D_fillRectangleGradientAlpha") @Copy("Rasterizer2D_fillRectangleGradientAlpha")
private static void rs$drawGradientAlpha(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7)
{
throw new RuntimeException();
}
@Replace("Rasterizer2D_fillRectangleGradientAlpha") @Replace("Rasterizer2D_fillRectangleGradientAlpha")
private static void rl$drawGradientAlpha(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7) private static void copy$drawGradientAlpha(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7)
{ {
final int width = client.getGraphicsPixelsWidth(); final int width = client.getGraphicsPixelsWidth();
final int startX = client.getStartX(); final int startX = client.getStartX();
@@ -45,7 +40,7 @@ public abstract class RSRasterizer2DMixin implements RSClient
if (!client.isGpu()) if (!client.isGpu())
{ {
rs$drawGradientAlpha(var0, var1, var2, var3, var4, var5, var6, var7); copy$drawGradientAlpha(var0, var1, var2, var3, var4, var5, var6, var7);
return; return;
} }
@@ -110,13 +105,8 @@ public abstract class RSRasterizer2DMixin implements RSClient
} }
@Copy("Rasterizer2D_drawGradientPixels") @Copy("Rasterizer2D_drawGradientPixels")
public static void rs$raster2d7(int var0, int var1, int var2, int var3, int var4, int var5, byte[] var6, int var7)
{
throw new RuntimeException();
}
@Replace("Rasterizer2D_drawGradientPixels") @Replace("Rasterizer2D_drawGradientPixels")
public static void rl$raster2d7(int var0, int var1, int var2, int var3, int var4, int var5, byte[] var6, int var7) public static void copy$raster2d7(int var0, int var1, int var2, int var3, int var4, int var5, byte[] var6, int var7)
{ {
final int width = client.getGraphicsPixelsWidth(); final int width = client.getGraphicsPixelsWidth();
final int height = client.getGraphicsPixelsHeight(); final int height = client.getGraphicsPixelsHeight();
@@ -124,7 +114,7 @@ public abstract class RSRasterizer2DMixin implements RSClient
if (!client.isGpu()) if (!client.isGpu())
{ {
rs$raster2d7(var0, var1, var2, var3, var4, var5, var6, var7); copy$raster2d7(var0, var1, var2, var3, var4, var5, var6, var7);
return; return;
} }
@@ -81,7 +81,7 @@ public abstract class RSSceneMixin implements RSScene
private static int rl$drawDistance; private static int rl$drawDistance;
@Replace("draw") @Replace("draw")
void rl$drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane) void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane)
{ {
final DrawCallbacks drawCallbacks = client.getDrawCallbacks(); final DrawCallbacks drawCallbacks = client.getDrawCallbacks();
if (drawCallbacks != null) if (drawCallbacks != null)
@@ -410,12 +410,11 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("newWallDecoration") @Copy("newWallDecoration")
abstract public void rs$addBoundaryDecoration(int plane, int x, int y, int floor, Entity var5, Entity var6, int var7, int var8, int var9, int var10, long hash, int var12);
@Replace("newWallDecoration") @Replace("newWallDecoration")
public void rl$addBoundaryDecoration(int plane, int x, int y, int floor, Entity var5, Entity var6, int var7, int var8, int var9, int var10, long hash, int var12) @SuppressWarnings("InfiniteRecursion")
public void copy$addBoundaryDecoration(int plane, int x, int y, int floor, Entity var5, Entity var6, int var7, int var8, int var9, int var10, long hash, int var12)
{ {
rs$addBoundaryDecoration(plane, x, y, floor, var5, var6, var7, var8, var9, var10, hash, var12); copy$addBoundaryDecoration(plane, x, y, floor, var5, var6, var7, var8, var9, var10, hash, var12);
Tile tile = getTiles()[plane][x][y]; Tile tile = getTiles()[plane][x][y];
if (tile != null) if (tile != null)
{ {
@@ -428,12 +427,11 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("newGroundItemPile") @Copy("newGroundItemPile")
abstract public void rs$addItemPile(int plane, int x, int y, int hash, Entity var5, long var6, Entity var7, Entity var8);
@Replace("newGroundItemPile") @Replace("newGroundItemPile")
public void rl$addItemPile(int plane, int x, int y, int hash, Entity var5, long var6, Entity var7, Entity var8) @SuppressWarnings("InfiniteRecursion")
public void copy$addItemPile(int plane, int x, int y, int hash, Entity var5, long var6, Entity var7, Entity var8)
{ {
rs$addItemPile(plane, x, y, hash, var5, var6, var7, var8); copy$addItemPile(plane, x, y, hash, var5, var6, var7, var8);
Tile tile = getTiles()[plane][x][y]; Tile tile = getTiles()[plane][x][y];
if (tile != null) if (tile != null)
{ {
@@ -446,12 +444,11 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("newFloorDecoration") @Copy("newFloorDecoration")
abstract public void rs$groundObjectSpawned(int plane, int x, int y, int floor, Entity var5, long hash, int var7);
@Replace("newFloorDecoration") @Replace("newFloorDecoration")
public void rl$groundObjectSpawned(int plane, int x, int y, int floor, Entity var5, long hash, int var7) @SuppressWarnings("InfiniteRecursion")
public void copy$groundObjectSpawned(int plane, int x, int y, int floor, Entity var5, long hash, int var7)
{ {
rs$groundObjectSpawned(plane, x, y, floor, var5, hash, var7); copy$groundObjectSpawned(plane, x, y, floor, var5, hash, var7);
Tile tile = getTiles()[plane][x][y]; Tile tile = getTiles()[plane][x][y];
if (tile != null) if (tile != null)
{ {
@@ -464,12 +461,11 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("newBoundaryObject") @Copy("newBoundaryObject")
abstract public void rs$addBoundary(int plane, int x, int y, int floor, Entity var5, Entity var6, int var7, int var8, long hash, int var10);
@Replace("newBoundaryObject") @Replace("newBoundaryObject")
public void rl$addBoundary(int plane, int x, int y, int floor, Entity var5, Entity var6, int var7, int var8, long hash, int var10) @SuppressWarnings("InfiniteRecursion")
public void copy$addBoundary(int plane, int x, int y, int floor, Entity var5, Entity var6, int var7, int var8, long hash, int var10)
{ {
rs$addBoundary(plane, x, y, floor, var5, var6, var7, var8, hash, var10); copy$addBoundary(plane, x, y, floor, var5, var6, var7, var8, hash, var10);
Tile tile = getTiles()[plane][x][y]; Tile tile = getTiles()[plane][x][y];
if (tile != null) if (tile != null)
{ {
@@ -482,16 +478,14 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("drawTileUnderlay") @Copy("drawTileUnderlay")
abstract public void rs$drawTileUnderlay(TilePaint tile, int z, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y);
@Replace("drawTileUnderlay") @Replace("drawTileUnderlay")
public void rl$drawTileUnderlay(TilePaint tile, int z, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y) public void copy$drawTileUnderlay(TilePaint tile, int z, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y)
{ {
if (!client.isGpu()) if (!client.isGpu())
{ {
try try
{ {
rs$drawTileUnderlay(tile, z, pitchSin, pitchCos, yawSin, yawCos, x, y); copy$drawTileUnderlay(tile, z, pitchSin, pitchCos, yawSin, yawCos, x, y);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -609,14 +603,12 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("drawTileOverlay") @Copy("drawTileOverlay")
abstract public void rs$drawTileOverlay(TileModel tile, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y);
@Replace("drawTileOverlay") @Replace("drawTileOverlay")
public void rl$drawTileOverlay(TileModel tile, int pitchSin, int pitchCos, int yawSin, int yawCos, int tileX, int tileY) public void copy$drawTileOverlay(TileModel tile, int pitchSin, int pitchCos, int yawSin, int yawCos, int tileX, int tileY)
{ {
if (!client.isGpu()) if (!client.isGpu())
{ {
rs$drawTileOverlay(tile, pitchSin, pitchCos, yawSin, yawCos, tileX, tileY); copy$drawTileOverlay(tile, pitchSin, pitchCos, yawSin, yawCos, tileX, tileY);
return; return;
} }
@@ -829,14 +821,12 @@ public abstract class RSSceneMixin implements RSScene
} }
@Copy("drawTileMinimap") @Copy("drawTileMinimap")
abstract void rs$drawTile(int[] pixels, int pixelOffset, int width, int z, int x, int y);
@Replace("drawTileMinimap") @Replace("drawTileMinimap")
public void rl$drawTile(int[] pixels, int pixelOffset, int width, int z, int x, int y) public void copy$drawTile(int[] pixels, int pixelOffset, int width, int z, int x, int y)
{ {
if (!hdMinimapEnabled) if (!hdMinimapEnabled)
{ {
rs$drawTile(pixels, pixelOffset, width, z, x, y); copy$drawTile(pixels, pixelOffset, width, z, x, y);
return; return;
} }
Tile tile = getTiles()[z][x][y]; Tile tile = getTiles()[z][x][y];
@@ -16,10 +16,9 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
private static RSClient client; private static RSClient client;
@Copy("applyTransformations") @Copy("applyTransformations")
public abstract RSModel rs$applyTransformations(RSModel model, int actionFrame, RSSequenceDefinition poseSeq, int poseFrame);
@Replace("applyTransformations") @Replace("applyTransformations")
public RSModel rl$applyTransformations(RSModel model, int actionFrame, RSSequenceDefinition poseSeq, int poseFrame) @SuppressWarnings("InfiniteRecursion")
public RSModel copy$applyTransformations(RSModel model, int actionFrame, RSSequenceDefinition poseSeq, int poseFrame)
{ {
// reset frame ids because we're not interpolating this // reset frame ids because we're not interpolating this
if (actionFrame < 0) if (actionFrame < 0)
@@ -32,19 +31,17 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
int packed = poseFrame ^ Integer.MIN_VALUE; int packed = poseFrame ^ Integer.MIN_VALUE;
poseFrame = packed & 0xFFFF; poseFrame = packed & 0xFFFF;
} }
return rs$applyTransformations(model, actionFrame, poseSeq, poseFrame); return copy$applyTransformations(model, actionFrame, poseSeq, poseFrame);
} }
@Copy("transformActorModel") @Copy("transformActorModel")
public abstract RSModel rs$transformActorModel(RSModel model, int frameIdx);
@Replace("transformActorModel") @Replace("transformActorModel")
public RSModel rl$transformActorModel(RSModel model, int frame) public RSModel copy$transformActorModel(RSModel model, int frame)
{ {
// check if the frame has not been modified // check if the frame has not been modified
if (frame >= 0) if (frame >= 0)
{ {
return rs$transformActorModel(model, frame); return copy$transformActorModel(model, frame);
} }
// remove flag to check if the frame has been modified // remove flag to check if the frame has been modified
@@ -84,15 +81,13 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
} }
@Copy("transformObjectModel") @Copy("transformObjectModel")
public abstract RSModel rs$transformObjectModel(RSModel model, int frame, int rotation);
@Replace("transformObjectModel") @Replace("transformObjectModel")
public RSModel rl$transformObjectModel(RSModel model, int frame, int rotation) public RSModel copy$transformObjectModel(RSModel model, int frame, int rotation)
{ {
// check if the frame has not been modified // check if the frame has not been modified
if (frame >= 0) if (frame >= 0)
{ {
return rs$transformObjectModel(model, frame, rotation); return copy$transformObjectModel(model, frame, rotation);
} }
// remove flag to check if the frame has been modified // remove flag to check if the frame has been modified
@@ -159,15 +154,13 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
} }
@Copy("transformSpotAnimationModel") @Copy("transformSpotAnimationModel")
public abstract RSModel rs$transformSpotAnimationModel(RSModel model, int frame);
@Replace("transformSpotAnimationModel") @Replace("transformSpotAnimationModel")
public RSModel rl$transformSpotAnimationModel(RSModel model, int frame) public RSModel copy$transformSpotAnimationModel(RSModel model, int frame)
{ {
// check if the frame has not been modified // check if the frame has not been modified
if (frame >= 0) if (frame >= 0)
{ {
return rs$transformSpotAnimationModel(model, frame); return copy$transformSpotAnimationModel(model, frame);
} }
// remove flag to check if the frame has been modified // remove flag to check if the frame has been modified
@@ -206,15 +199,13 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
} }
@Copy("transformWidgetModel") @Copy("transformWidgetModel")
public abstract RSModel rs$transformWidgetModel(RSModel model, int frame);
@Replace("transformWidgetModel") @Replace("transformWidgetModel")
public RSModel rl$transformWidgetModel(RSModel model, int frame) public RSModel copy$transformWidgetModel(RSModel model, int frame)
{ {
// check if the frame has not been modified // check if the frame has not been modified
if (frame >= 0) if (frame >= 0)
{ {
return rs$transformWidgetModel(model, frame); return copy$transformWidgetModel(model, frame);
} }
// remove flag to check if the frame has been modified // remove flag to check if the frame has been modified
@@ -147,16 +147,13 @@ public abstract class RSSpriteMixin implements RSSprite
} }
@Copy("drawRotatedMaskedCenteredAround") @Copy("drawRotatedMaskedCenteredAround")
abstract void rs$drawAlphaMapped(int x, int y, int width, int height, int xOffset, int yOffset,
int rotation, int zoom, int[] xOffsets, int[] yOffsets);
@Replace("drawRotatedMaskedCenteredAround") @Replace("drawRotatedMaskedCenteredAround")
public void rl$drawAlphaMapped(int x, int y, int width, int height, int xOffset, int yOffset, int rotation, public void copy$drawAlphaMapped(int x, int y, int width, int height, int xOffset, int yOffset, int rotation,
int zoom, int[] xOffsets, int[] yOffsets) int zoom, int[] xOffsets, int[] yOffsets)
{ {
if (!hdMinimapEnabled) if (!hdMinimapEnabled)
{ {
rs$drawAlphaMapped(x, y, width, height, xOffset, yOffset, rotation, zoom, xOffsets, yOffsets); copy$drawAlphaMapped(x, y, width, height, xOffset, yOffset, rotation, zoom, xOffsets, yOffsets);
return; return;
} }
try try
@@ -45,17 +45,15 @@ public abstract class RSTextureMixin implements RSTexture
private float rl$v; private float rl$v;
@Copy("animate") @Copy("animate")
public abstract void rs$animate(int diff);
@Replace("animate") @Replace("animate")
public void rl$animate(int diff) public void copy$animate(int diff)
{ {
// The client animates textures by cycling the backing pixels of the texture each fram // The client animates textures by cycling the backing pixels of the texture each fram
// based on how long it was since the last tick. On GPU we let the plugin manage this // based on how long it was since the last tick. On GPU we let the plugin manage this
// which will calculate uvs instead. // which will calculate uvs instead.
if (!client.isGpu()) if (!client.isGpu())
{ {
rs$animate(diff); copy$animate(diff);
return; return;
} }
assert client.getDrawCallbacks() != null; assert client.getDrawCallbacks() != null;
@@ -590,16 +590,15 @@ public abstract class RSWidgetMixin implements RSWidget
} }
@Copy("getModel") @Copy("getModel")
public abstract RSModel rs$getModel(RSSequenceDefinition sequence, int frame, boolean alternate, RSPlayerAppearance playerComposition);
@Replace("getModel") @Replace("getModel")
public RSModel rl$getModel(RSSequenceDefinition sequence, int frame, boolean alternate, RSPlayerAppearance playerComposition) @SuppressWarnings("InfiniteRecursion")
public RSModel copy$getModel(RSSequenceDefinition sequence, int frame, boolean alternate, RSPlayerAppearance playerComposition)
{ {
if (frame != -1 && client.isInterpolateWidgetAnimations()) if (frame != -1 && client.isInterpolateWidgetAnimations())
{ {
frame = frame | getModelFrameCycle() << 16 | Integer.MIN_VALUE; frame = frame | getModelFrameCycle() << 16 | Integer.MIN_VALUE;
} }
return rs$getModel(sequence, frame, alternate, playerComposition); return copy$getModel(sequence, frame, alternate, playerComposition);
} }
@Inject @Inject
@@ -138,13 +138,8 @@ public abstract class ScriptVMMixin implements RSClient
} }
@Copy("runScript") @Copy("runScript")
static void rs$runScript(RSScriptEvent event, int maxExecutionTime)
{
throw new RuntimeException();
}
@Replace("runScript") @Replace("runScript")
static void rl$runScript(RSScriptEvent event, int maxExecutionTime) static void copy$runScript(RSScriptEvent event, int maxExecutionTime)
{ {
Object[] arguments = event.getArguments(); Object[] arguments = event.getArguments();
assert arguments != null && arguments.length > 0; assert arguments != null && arguments.length > 0;
@@ -164,7 +159,7 @@ public abstract class ScriptVMMixin implements RSClient
try try
{ {
rootScriptEvent = event; rootScriptEvent = event;
rs$runScript(event, maxExecutionTime); copy$runScript(event, maxExecutionTime);
} }
finally finally
{ {
@@ -57,13 +57,9 @@ public abstract class SoundEffectMixin implements RSClient
private static int lastSoundEffectSourceNPCid; private static int lastSoundEffectSourceNPCid;
@Copy("updateActorSequence") @Copy("updateActorSequence")
public static void rs$updateActorSequence(RSActor actor, int size)
{
throw new RuntimeException();
}
@Replace("updateActorSequence") @Replace("updateActorSequence")
public static void rl$updateActorSequence(RSActor actor, int size) @SuppressWarnings("InfiniteRecursion")
public static void copy$updateActorSequence(RSActor actor, int size)
{ {
if (actor instanceof RSNPC) if (actor instanceof RSNPC)
{ {
@@ -71,7 +67,7 @@ public abstract class SoundEffectMixin implements RSClient
} }
lastSoundEffectSourceActor = actor; lastSoundEffectSourceActor = actor;
rs$updateActorSequence(actor, size); copy$updateActorSequence(actor, size);
lastSoundEffectSourceActor = null; lastSoundEffectSourceActor = null;
} }
@@ -35,13 +35,8 @@ public abstract class SpriteMixin implements RSClient
} }
@Copy("SpriteBuffer_getSprite") @Copy("SpriteBuffer_getSprite")
public static RSSprite rs$loadSprite(RSAbstractArchive var0, int var1, int var2)
{
throw new RuntimeException();
}
@Replace("SpriteBuffer_getSprite") @Replace("SpriteBuffer_getSprite")
public static RSSprite rl$loadSprite(RSAbstractArchive var0, int var1, int var2) public static RSSprite copy$loadSprite(RSAbstractArchive var0, int var1, int var2)
{ {
Sprite sprite = spriteOverrides.get(var1); Sprite sprite = spriteOverrides.get(var1);
@@ -50,6 +45,6 @@ public abstract class SpriteMixin implements RSClient
return (RSSprite) sprite; return (RSSprite) sprite;
} }
return rs$loadSprite(var0, var1, var2); return copy$loadSprite(var0, var1, var2);
} }
} }
@@ -15,10 +15,9 @@ public abstract class StretchedModeMaxSizeMixin implements RSGameShell
private static RSClient client; private static RSClient client;
@Copy("resizeCanvas") @Copy("resizeCanvas")
abstract void rs$resizeCanvas();
@Replace("resizeCanvas") @Replace("resizeCanvas")
public void rl$resizeCanvas() @SuppressWarnings("InfiniteRecursion")
public void copy$resizeCanvas()
{ {
if (client.isStretchedEnabled()) if (client.isStretchedEnabled())
{ {
@@ -33,20 +32,18 @@ public abstract class StretchedModeMaxSizeMixin implements RSGameShell
} }
} }
rs$resizeCanvas(); copy$resizeCanvas();
} }
@Copy("setMaxCanvasSize") @Copy("setMaxCanvasSize")
abstract void rs$setMaxCanvasSize(int width, int height);
@Replace("setMaxCanvasSize") @Replace("setMaxCanvasSize")
public void rl$setMaxCanvasSize(int width, int height) public void copy$setMaxCanvasSize(int width, int height)
{ {
if (client.isStretchedEnabled() && client.isResized()) if (client.isStretchedEnabled() && client.isResized())
{ {
return; return;
} }
rs$setMaxCanvasSize(width, height); copy$setMaxCanvasSize(width, height);
} }
} }
@@ -17,13 +17,8 @@ public abstract class WidgetSpriteMixin implements RSWidget
private static Map<Integer, Sprite> widgetSpriteOverrides; private static Map<Integer, Sprite> widgetSpriteOverrides;
@Copy("getSprite") @Copy("getSprite")
public RSSprite rs$getWidgetSprite(boolean var1)
{
throw new RuntimeException();
}
@Replace("getSprite") @Replace("getSprite")
public RSSprite rl$getWidgetSprite(boolean var1) public RSSprite copy$getWidgetSprite(boolean var1)
{ {
if (getSpriteId() != -1) if (getSpriteId() != -1)
{ {
@@ -35,7 +30,7 @@ public abstract class WidgetSpriteMixin implements RSWidget
} }
} }
return rs$getWidgetSprite(var1); return copy$getWidgetSprite(var1);
} }
@Inject @Inject
@@ -9,7 +9,7 @@ import net.runelite.mapping.ObfuscatedSignature;
public abstract class AbstractArchive { public abstract class AbstractArchive {
@ObfuscatedName("h") @ObfuscatedName("h")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lmu;" descriptor = "Lmu;"
) )
@Export("gzipDecompressor") @Export("gzipDecompressor")
static GZipDecompressor gzipDecompressor; static GZipDecompressor gzipDecompressor;
@@ -32,7 +32,7 @@ public abstract class AbstractArchive {
int[] groupNameHashes; int[] groupNameHashes;
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lmh;" descriptor = "Lmh;"
) )
@Export("groupNameHashTable") @Export("groupNameHashTable")
IntHashTable groupNameHashTable; IntHashTable groupNameHashTable;
@@ -53,7 +53,7 @@ public abstract class AbstractArchive {
int[][] fileNameHashes; int[][] fileNameHashes;
@ObfuscatedName("w") @ObfuscatedName("w")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "[Lmh;" descriptor = "[Lmh;"
) )
@Export("fileNameHashTables") @Export("fileNameHashTables")
IntHashTable[] fileNameHashTables; IntHashTable[] fileNameHashTables;
@@ -88,7 +88,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BB)V", descriptor = "([BB)V",
garbageValue = "-101" garbageValue = "-101"
) )
@Export("decodeIndex") @Export("decodeIndex")
@@ -221,7 +221,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)V", descriptor = "(II)V",
garbageValue = "479482423" garbageValue = "479482423"
) )
@Export("loadRegionFromGroup") @Export("loadRegionFromGroup")
@@ -230,7 +230,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)[B", descriptor = "(III)[B",
garbageValue = "1860640327" garbageValue = "1860640327"
) )
@Export("takeFile") @Export("takeFile")
@@ -240,7 +240,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II[II)[B", descriptor = "(II[II)[B",
garbageValue = "-1226634846" garbageValue = "-1226634846"
) )
@Export("takeFileEncrypted") @Export("takeFileEncrypted")
@@ -270,7 +270,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)Z", descriptor = "(III)Z",
garbageValue = "1957538709" garbageValue = "1957538709"
) )
@Export("tryLoadFile") @Export("tryLoadFile")
@@ -291,7 +291,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("g") @ObfuscatedName("g")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)Z", descriptor = "(II)Z",
garbageValue = "-2058273834" garbageValue = "-2058273834"
) )
public boolean method4359(int var1) { public boolean method4359(int var1) {
@@ -306,7 +306,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("n") @ObfuscatedName("n")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)Z", descriptor = "(II)Z",
garbageValue = "1896348837" garbageValue = "1896348837"
) )
@Export("tryLoadGroup") @Export("tryLoadGroup")
@@ -321,7 +321,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("u") @ObfuscatedName("u")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)Z", descriptor = "(B)Z",
garbageValue = "0" garbageValue = "0"
) )
@Export("isFullyLoaded") @Export("isFullyLoaded")
@@ -343,7 +343,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("a") @ObfuscatedName("a")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)I", descriptor = "(II)I",
garbageValue = "-1350822089" garbageValue = "-1350822089"
) )
@Export("groupLoadPercent") @Export("groupLoadPercent")
@@ -353,7 +353,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("z") @ObfuscatedName("z")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)[B", descriptor = "(II)[B",
garbageValue = "1718789334" garbageValue = "1718789334"
) )
@Export("takeFileFlat") @Export("takeFileFlat")
@@ -369,7 +369,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("w") @ObfuscatedName("w")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)[B", descriptor = "(III)[B",
garbageValue = "490044156" garbageValue = "490044156"
) )
@Export("getFile") @Export("getFile")
@@ -395,7 +395,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("y") @ObfuscatedName("y")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)[B", descriptor = "(II)[B",
garbageValue = "1362853135" garbageValue = "1362853135"
) )
@Export("getFileFlat") @Export("getFileFlat")
@@ -411,7 +411,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("c") @ObfuscatedName("c")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)V", descriptor = "(II)V",
garbageValue = "-1560066319" garbageValue = "-1560066319"
) )
@Export("loadGroup") @Export("loadGroup")
@@ -420,7 +420,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("h") @ObfuscatedName("h")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IB)[I", descriptor = "(IB)[I",
garbageValue = "-56" garbageValue = "-56"
) )
@Export("getGroupFileIds") @Export("getGroupFileIds")
@@ -430,7 +430,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("k") @ObfuscatedName("k")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)I", descriptor = "(II)I",
garbageValue = "-888140327" garbageValue = "-888140327"
) )
@Export("getGroupFileCount") @Export("getGroupFileCount")
@@ -440,7 +440,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("r") @ObfuscatedName("r")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "-763058439" garbageValue = "-763058439"
) )
@Export("getGroupCount") @Export("getGroupCount")
@@ -450,7 +450,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("d") @ObfuscatedName("d")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "-1760033757" garbageValue = "-1760033757"
) )
@Export("clearGroups") @Export("clearGroups")
@@ -463,7 +463,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("e") @ObfuscatedName("e")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)V", descriptor = "(II)V",
garbageValue = "-546235261" garbageValue = "-546235261"
) )
@Export("clearFilesGroup") @Export("clearFilesGroup")
@@ -476,7 +476,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("l") @ObfuscatedName("l")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)V", descriptor = "(B)V",
garbageValue = "1" garbageValue = "1"
) )
@Export("clearFiles") @Export("clearFiles")
@@ -493,7 +493,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("t") @ObfuscatedName("t")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I[II)Z", descriptor = "(I[II)Z",
garbageValue = "-1692394825" garbageValue = "-1692394825"
) )
@Export("buildFiles") @Export("buildFiles")
@@ -618,7 +618,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("x") @ObfuscatedName("x")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;I)I", descriptor = "(Ljava/lang/String;I)I",
garbageValue = "-1113782685" garbageValue = "-1113782685"
) )
@Export("getGroupId") @Export("getGroupId")
@@ -629,7 +629,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ah") @ObfuscatedName("ah")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(ILjava/lang/String;I)I", descriptor = "(ILjava/lang/String;I)I",
garbageValue = "1362853135" garbageValue = "1362853135"
) )
@Export("getFileId") @Export("getFileId")
@@ -640,7 +640,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ai") @ObfuscatedName("ai")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;I)Z", descriptor = "(Ljava/lang/String;Ljava/lang/String;I)Z",
garbageValue = "-1310066556" garbageValue = "-1310066556"
) )
@Export("isValidFileName") @Export("isValidFileName")
@@ -658,7 +658,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ao") @ObfuscatedName("ao")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;I)[B", descriptor = "(Ljava/lang/String;Ljava/lang/String;I)[B",
garbageValue = "-222408314" garbageValue = "-222408314"
) )
@Export("takeFileByNames") @Export("takeFileByNames")
@@ -672,7 +672,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ae") @ObfuscatedName("ae")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;I)Z", descriptor = "(Ljava/lang/String;Ljava/lang/String;I)Z",
garbageValue = "-778364429" garbageValue = "-778364429"
) )
@Export("tryLoadFileByNames") @Export("tryLoadFileByNames")
@@ -686,7 +686,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ax") @ObfuscatedName("ax")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;B)Z", descriptor = "(Ljava/lang/String;B)Z",
garbageValue = "-81" garbageValue = "-81"
) )
@Export("tryLoadGroupByName") @Export("tryLoadGroupByName")
@@ -698,7 +698,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ag") @ObfuscatedName("ag")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;I)V", descriptor = "(Ljava/lang/String;I)V",
garbageValue = "-1143877885" garbageValue = "-1143877885"
) )
@Export("loadRegionFromName") @Export("loadRegionFromName")
@@ -712,7 +712,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ab") @ObfuscatedName("ab")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;I)I", descriptor = "(Ljava/lang/String;I)I",
garbageValue = "-252379742" garbageValue = "-252379742"
) )
@Export("groupLoadPercentByName") @Export("groupLoadPercentByName")
@@ -724,7 +724,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lkn;IIIIIII)V", descriptor = "(Lkn;IIIIIII)V",
garbageValue = "-1571118584" garbageValue = "-1571118584"
) )
@Export("loadTerrain") @Export("loadTerrain")
@@ -790,7 +790,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("gr") @ObfuscatedName("gr")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "682759182" garbageValue = "682759182"
) )
static final int method4411() { static final int method4411() {
@@ -11,7 +11,7 @@ public abstract class AbstractByteArrayCopier {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)[B", descriptor = "(I)[B",
garbageValue = "300747627" garbageValue = "300747627"
) )
@Export("get") @Export("get")
@@ -19,7 +19,7 @@ public abstract class AbstractByteArrayCopier {
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BB)V", descriptor = "([BB)V",
garbageValue = "92" garbageValue = "92"
) )
@Export("set") @Export("set")
@@ -9,7 +9,7 @@ import net.runelite.mapping.ObfuscatedSignature;
public abstract class AbstractFont extends Rasterizer2D { public abstract class AbstractFont extends Rasterizer2D {
@ObfuscatedName("z") @ObfuscatedName("z")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "[Llh;" descriptor = "[Llh;"
) )
@Export("AbstractFont_modIconSprites") @Export("AbstractFont_modIconSprites")
public static IndexedSprite[] AbstractFont_modIconSprites; public static IndexedSprite[] AbstractFont_modIconSprites;
@@ -28,7 +28,7 @@ public abstract class AbstractRasterProvider {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIB)V", descriptor = "(IIB)V",
garbageValue = "-5" garbageValue = "-5"
) )
@Export("drawFull") @Export("drawFull")
@@ -36,7 +36,7 @@ public abstract class AbstractRasterProvider {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIIII)V", descriptor = "(IIIII)V",
garbageValue = "-1334771637" garbageValue = "-1334771637"
) )
@Export("draw") @Export("draw")
@@ -44,7 +44,7 @@ public abstract class AbstractRasterProvider {
@ObfuscatedName("k") @ObfuscatedName("k")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "25855118" garbageValue = "25855118"
) )
@Export("apply") @Export("apply")
@@ -12,7 +12,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "-768493590" garbageValue = "-768493590"
) )
@Export("close") @Export("close")
@@ -20,7 +20,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)I", descriptor = "(B)I",
garbageValue = "-8" garbageValue = "-8"
) )
@Export("readUnsignedByte") @Export("readUnsignedByte")
@@ -28,7 +28,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "-1942767880" garbageValue = "-1942767880"
) )
@Export("available") @Export("available")
@@ -36,7 +36,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)Z", descriptor = "(II)Z",
garbageValue = "1355091335" garbageValue = "1355091335"
) )
@Export("isAvailable") @Export("isAvailable")
@@ -44,7 +44,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BIIB)I", descriptor = "([BIIB)I",
garbageValue = "37" garbageValue = "37"
) )
@Export("read") @Export("read")
@@ -52,7 +52,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("n") @ObfuscatedName("n")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BIIB)V", descriptor = "([BIIB)V",
garbageValue = "-105" garbageValue = "-105"
) )
@Export("write") @Export("write")
@@ -23,7 +23,7 @@ public abstract class AbstractUserComparator implements Comparator {
@ObfuscatedName("u") @ObfuscatedName("u")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/util/Comparator;S)V", descriptor = "(Ljava/util/Comparator;S)V",
garbageValue = "-28900" garbageValue = "-28900"
) )
@Export("addComparator") @Export("addComparator")
@@ -38,7 +38,7 @@ public abstract class AbstractUserComparator implements Comparator {
@ObfuscatedName("a") @ObfuscatedName("a")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljf;Ljf;I)I", descriptor = "(Ljf;Ljf;I)I",
garbageValue = "864234218" garbageValue = "864234218"
) )
@Export("compareUser") @Export("compareUser")
@@ -69,7 +69,7 @@ public abstract class AbstractWorldMapData {
byte[][][] field175; byte[][][] field175;
@ObfuscatedName("c") @ObfuscatedName("c")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "[[[[Lak;" descriptor = "[[[[Lak;"
) )
@Export("decorations") @Export("decorations")
WorldMapDecoration[][][][] decorations; WorldMapDecoration[][][][] decorations;
@@ -88,7 +88,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lkn;I)V", descriptor = "(Lkn;I)V",
garbageValue = "-1774414997" garbageValue = "-1774414997"
) )
@Export("readGeography") @Export("readGeography")
@@ -96,7 +96,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("u") @ObfuscatedName("u")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)Z", descriptor = "(I)Z",
garbageValue = "923610125" garbageValue = "923610125"
) )
@Export("isFullyLoaded") @Export("isFullyLoaded")
@@ -106,7 +106,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("a") @ObfuscatedName("a")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lic;S)V", descriptor = "(Lic;S)V",
garbageValue = "19318" garbageValue = "19318"
) )
@Export("loadGeography") @Export("loadGeography")
@@ -124,7 +124,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("z") @ObfuscatedName("z")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "1097959131" garbageValue = "1097959131"
) )
@Export("reset") @Export("reset")
@@ -140,7 +140,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("w") @ObfuscatedName("w")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IILkn;I)V", descriptor = "(IILkn;I)V",
garbageValue = "929230318" garbageValue = "929230318"
) )
@Export("readTile") @Export("readTile")
@@ -158,7 +158,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("y") @ObfuscatedName("y")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IILkn;II)V", descriptor = "(IILkn;II)V",
garbageValue = "1830113999" garbageValue = "1830113999"
) )
void method319(int var1, int var2, Buffer var3, int var4) { void method319(int var1, int var2, Buffer var3, int var4) {
@@ -172,7 +172,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("c") @ObfuscatedName("c")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IILkn;IB)V", descriptor = "(IILkn;IB)V",
garbageValue = "73" garbageValue = "73"
) )
void method320(int var1, int var2, Buffer var3, int var4) { void method320(int var1, int var2, Buffer var3, int var4) {
@@ -216,7 +216,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("h") @ObfuscatedName("h")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)I", descriptor = "(B)I",
garbageValue = "3" garbageValue = "3"
) )
@Export("getRegionX") @Export("getRegionX")
@@ -226,7 +226,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("k") @ObfuscatedName("k")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)I", descriptor = "(B)I",
garbageValue = "-4" garbageValue = "-4"
) )
@Export("getRegionY") @Export("getRegionY")
@@ -236,7 +236,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/awt/Component;I)V", descriptor = "(Ljava/awt/Component;I)V",
garbageValue = "-1541126292" garbageValue = "-1541126292"
) )
static void method342(Component var0) { static void method342(Component var0) {
@@ -247,7 +247,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("g") @ObfuscatedName("g")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "2015859206" garbageValue = "2015859206"
) )
public static void method343() { public static void method343() {
@@ -257,7 +257,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("a") @ObfuscatedName("a")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "324919704" garbageValue = "324919704"
) )
static final void method328() { static final void method328() {
@@ -9,19 +9,19 @@ import net.runelite.mapping.ObfuscatedSignature;
public abstract class AbstractWorldMapIcon { public abstract class AbstractWorldMapIcon {
@ObfuscatedName("es") @ObfuscatedName("es")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lig;" descriptor = "Lig;"
) )
@Export("archive17") @Export("archive17")
static Archive archive17; static Archive archive17;
@ObfuscatedName("n") @ObfuscatedName("n")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lhg;" descriptor = "Lhg;"
) )
@Export("coord2") @Export("coord2")
public final Coord coord2; public final Coord coord2;
@ObfuscatedName("u") @ObfuscatedName("u")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lhg;" descriptor = "Lhg;"
) )
@Export("coord1") @Export("coord1")
public final Coord coord1; public final Coord coord1;
@@ -39,7 +39,7 @@ public abstract class AbstractWorldMapIcon {
int screenY; int screenY;
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lhg;Lhg;)V" descriptor = "(Lhg;Lhg;)V"
) )
AbstractWorldMapIcon(Coord var1, Coord var2) { AbstractWorldMapIcon(Coord var1, Coord var2) {
this.coord1 = var1; this.coord1 = var1;
@@ -48,7 +48,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)I", descriptor = "(B)I",
garbageValue = "0" garbageValue = "0"
) )
@Export("getElement") @Export("getElement")
@@ -56,7 +56,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)Lar;", descriptor = "(B)Lar;",
garbageValue = "35" garbageValue = "35"
) )
@Export("getLabel") @Export("getLabel")
@@ -64,7 +64,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "1804331962" garbageValue = "1804331962"
) )
@Export("getSubWidth") @Export("getSubWidth")
@@ -72,7 +72,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "-1265869629" garbageValue = "-1265869629"
) )
@Export("getSubHeight") @Export("getSubHeight")
@@ -80,7 +80,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("t") @ObfuscatedName("t")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)Z", descriptor = "(III)Z",
garbageValue = "422348755" garbageValue = "422348755"
) )
@Export("fitsScreen") @Export("fitsScreen")
@@ -94,7 +94,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("x") @ObfuscatedName("x")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)Z", descriptor = "(I)Z",
garbageValue = "807957820" garbageValue = "807957820"
) )
@Export("hasValidElement") @Export("hasValidElement")
@@ -104,7 +104,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("ah") @ObfuscatedName("ah")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)Z", descriptor = "(III)Z",
garbageValue = "872444562" garbageValue = "872444562"
) )
@Export("elementFitsScreen") @Export("elementFitsScreen")
@@ -158,7 +158,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("ai") @ObfuscatedName("ai")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIB)Z", descriptor = "(IIB)Z",
garbageValue = "1" garbageValue = "1"
) )
@Export("labelFitsScreen") @Export("labelFitsScreen")
@@ -175,7 +175,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "-288699605" garbageValue = "-288699605"
) )
public static void method687() { public static void method687() {
@@ -194,7 +194,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("fk") @ObfuscatedName("fk")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIII)V", descriptor = "(IIII)V",
garbageValue = "-886030498" garbageValue = "-886030498"
) )
@Export("queueSoundEffect") @Export("queueSoundEffect")
@@ -58,7 +58,7 @@ public final class AccessFile {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BIII)V", descriptor = "([BIII)V",
garbageValue = "239881906" garbageValue = "239881906"
) )
@Export("write") @Export("write")
@@ -75,7 +75,7 @@ public final class AccessFile {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "-1767391731" garbageValue = "-1767391731"
) )
@Export("close") @Export("close")
@@ -85,7 +85,7 @@ public final class AccessFile {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(ZB)V", descriptor = "(ZB)V",
garbageValue = "-19" garbageValue = "-19"
) )
@Export("closeSync") @Export("closeSync")
@@ -106,7 +106,7 @@ public final class AccessFile {
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)J", descriptor = "(I)J",
garbageValue = "997596889" garbageValue = "997596889"
) )
@Export("length") @Export("length")
@@ -116,7 +116,7 @@ public final class AccessFile {
@ObfuscatedName("g") @ObfuscatedName("g")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BIII)I", descriptor = "([BIII)I",
garbageValue = "-1991806699" garbageValue = "-1991806699"
) )
@Export("read") @Export("read")
+8 -8
View File
@@ -133,7 +133,7 @@ public abstract class Actor extends Entity {
int[] hitSplatValues2; int[] hitSplatValues2;
@ObfuscatedName("bf") @ObfuscatedName("bf")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Ljx;" descriptor = "Ljx;"
) )
@Export("healthBars") @Export("healthBars")
IterableNodeDeque healthBars; IterableNodeDeque healthBars;
@@ -366,7 +366,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("c") @ObfuscatedName("c")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)Z", descriptor = "(B)Z",
garbageValue = "1" garbageValue = "1"
) )
@Export("isVisible") @Export("isVisible")
@@ -376,7 +376,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("bg") @ObfuscatedName("bg")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)V", descriptor = "(B)V",
garbageValue = "78" garbageValue = "78"
) )
final void method1810() { final void method1810() {
@@ -386,7 +386,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("be") @ObfuscatedName("be")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIIIIII)V", descriptor = "(IIIIIII)V",
garbageValue = "-1007174032" garbageValue = "-1007174032"
) )
@Export("addHitSplat") @Export("addHitSplat")
@@ -481,7 +481,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("bf") @ObfuscatedName("bf")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIIIIII)V", descriptor = "(IIIIIII)V",
garbageValue = "-680285813" garbageValue = "-680285813"
) )
@Export("addHealthBar") @Export("addHealthBar")
@@ -543,7 +543,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("ba") @ObfuscatedName("ba")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IB)V", descriptor = "(IB)V",
garbageValue = "43" garbageValue = "43"
) )
@Export("removeHealthBar") @Export("removeHealthBar")
@@ -561,7 +561,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("n") @ObfuscatedName("n")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lch;Lch;IZI)I", descriptor = "(Lch;Lch;IZI)I",
garbageValue = "-1172543926" garbageValue = "-1172543926"
) )
@Export("compareWorlds") @Export("compareWorlds")
@@ -609,7 +609,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("aj") @ObfuscatedName("aj")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BIIB)I", descriptor = "([BIIB)I",
garbageValue = "46" garbageValue = "46"
) )
static int method1822(byte[] var0, int var1, int var2) { static int method1822(byte[] var0, int var1, int var2) {
@@ -16,7 +16,7 @@ public class Animation {
static int[] field1663; static int[] field1663;
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Ler;" descriptor = "Ler;"
) )
@Export("skeleton") @Export("skeleton")
Skeleton skeleton; Skeleton skeleton;
@@ -47,7 +47,7 @@ public class Animation {
} }
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "([BLer;)V" descriptor = "([BLer;)V"
) )
Animation(byte[] var1, Skeleton var2) { Animation(byte[] var1, Skeleton var2) {
this.skeleton = null; this.skeleton = null;
@@ -24,7 +24,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIILfz;I)Z", descriptor = "(IIILfz;I)Z",
garbageValue = "-1966963917" garbageValue = "-1966963917"
) )
@Export("hasArrived") @Export("hasArrived")
@@ -34,7 +34,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("ha") @ObfuscatedName("ha")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lby;IIBI)V", descriptor = "(Lby;IIBI)V",
garbageValue = "-549376931" garbageValue = "-549376931"
) )
static final void method1284(Player var0, int var1, int var2, byte var3) { static final void method1284(Player var0, int var1, int var2, byte var3) {
@@ -56,7 +56,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("hc") @ObfuscatedName("hc")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;IIIIZB)V", descriptor = "(Ljava/lang/String;Ljava/lang/String;IIIIZB)V",
garbageValue = "-63" garbageValue = "-63"
) )
@Export("insertMenuItem") @Export("insertMenuItem")
@@ -78,7 +78,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("id") @ObfuscatedName("id")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljz;IIII)V", descriptor = "(Ljz;IIII)V",
garbageValue = "1974138271" garbageValue = "1974138271"
) )
@Export("addNpcToMenu") @Export("addNpcToMenu")
+15 -15
View File
@@ -13,13 +13,13 @@ public class Archive extends AbstractArchive {
static CRC32 Archive_crc; static CRC32 Archive_crc;
@ObfuscatedName("x") @ObfuscatedName("x")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Llp;" descriptor = "Llp;"
) )
@Export("archiveDisk") @Export("archiveDisk")
ArchiveDisk archiveDisk; ArchiveDisk archiveDisk;
@ObfuscatedName("b") @ObfuscatedName("b")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Llp;" descriptor = "Llp;"
) )
@Export("masterDisk") @Export("masterDisk")
ArchiveDisk masterDisk; ArchiveDisk masterDisk;
@@ -59,7 +59,7 @@ public class Archive extends AbstractArchive {
} }
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Llp;Llp;IZZZ)V" descriptor = "(Llp;Llp;IZZZ)V"
) )
public Archive(ArchiveDisk var1, ArchiveDisk var2, int var3, boolean var4, boolean var5, boolean var6) { public Archive(ArchiveDisk var1, ArchiveDisk var2, int var3, boolean var4, boolean var5, boolean var6) {
super(var4, var5); super(var4, var5);
@@ -75,7 +75,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)V", descriptor = "(II)V",
garbageValue = "479482423" garbageValue = "479482423"
) )
@Export("loadRegionFromGroup") @Export("loadRegionFromGroup")
@@ -91,7 +91,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("a") @ObfuscatedName("a")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)I", descriptor = "(II)I",
garbageValue = "-1350822089" garbageValue = "-1350822089"
) )
@Export("groupLoadPercent") @Export("groupLoadPercent")
@@ -116,7 +116,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("c") @ObfuscatedName("c")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)V", descriptor = "(II)V",
garbageValue = "-1560066319" garbageValue = "-1560066319"
) )
@Export("loadGroup") @Export("loadGroup")
@@ -131,7 +131,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dr") @ObfuscatedName("dr")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)Z", descriptor = "(I)Z",
garbageValue = "6460755" garbageValue = "6460755"
) )
public boolean method4456() { public boolean method4456() {
@@ -140,7 +140,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("di") @ObfuscatedName("di")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "1538719165" garbageValue = "1538719165"
) )
@Export("percentage") @Export("percentage")
@@ -170,7 +170,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dp") @ObfuscatedName("dp")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)V", descriptor = "(III)V",
garbageValue = "-1870441691" garbageValue = "-1870441691"
) )
@Export("loadIndex") @Export("loadIndex")
@@ -187,7 +187,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dc") @ObfuscatedName("dc")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I[BZZI)V", descriptor = "(I[BZZI)V",
garbageValue = "-1362503762" garbageValue = "-1362503762"
) )
@Export("write") @Export("write")
@@ -220,7 +220,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dt") @ObfuscatedName("dt")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Llp;I[BZI)V", descriptor = "(Llp;I[BZI)V",
garbageValue = "416222280" garbageValue = "416222280"
) )
@Export("load") @Export("load")
@@ -311,7 +311,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("ds") @ObfuscatedName("ds")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)V", descriptor = "(I)V",
garbageValue = "1106038504" garbageValue = "1106038504"
) )
@Export("loadAllLocal") @Export("loadAllLocal")
@@ -344,7 +344,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dg") @ObfuscatedName("dg")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)Z", descriptor = "(II)Z",
garbageValue = "1634778176" garbageValue = "1634778176"
) )
public boolean method4460(int var1) { public boolean method4460(int var1) {
@@ -353,7 +353,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("do") @ObfuscatedName("do")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)Z", descriptor = "(II)Z",
garbageValue = "-587516749" garbageValue = "-587516749"
) )
public boolean method4452(int var1) { public boolean method4452(int var1) {
@@ -362,7 +362,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dn") @ObfuscatedName("dn")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "-1037828577" garbageValue = "-1037828577"
) )
@Export("loadPercent") @Export("loadPercent")
@@ -14,13 +14,13 @@ public final class ArchiveDisk {
static byte[] ArchiveDisk_buffer; static byte[] ArchiveDisk_buffer;
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lmn;" descriptor = "Lmn;"
) )
@Export("datFile") @Export("datFile")
BufferedFile datFile; BufferedFile datFile;
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lmn;" descriptor = "Lmn;"
) )
@Export("idxFile") @Export("idxFile")
BufferedFile idxFile; BufferedFile idxFile;
@@ -42,7 +42,7 @@ public final class ArchiveDisk {
} }
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(ILmn;Lmn;I)V" descriptor = "(ILmn;Lmn;I)V"
) )
public ArchiveDisk(int var1, BufferedFile var2, BufferedFile var3, int var4) { public ArchiveDisk(int var1, BufferedFile var2, BufferedFile var3, int var4) {
this.datFile = null; this.datFile = null;
@@ -56,7 +56,7 @@ public final class ArchiveDisk {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)[B", descriptor = "(II)[B",
garbageValue = "475820078" garbageValue = "475820078"
) )
@Export("read") @Export("read")
@@ -153,7 +153,7 @@ public final class ArchiveDisk {
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I[BIB)Z", descriptor = "(I[BIB)Z",
garbageValue = "3" garbageValue = "3"
) )
@Export("write") @Export("write")
@@ -174,7 +174,7 @@ public final class ArchiveDisk {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I[BIZS)Z", descriptor = "(I[BIZS)Z",
garbageValue = "21116" garbageValue = "21116"
) )
@Export("write0") @Export("write0")
@@ -18,13 +18,13 @@ public class ArchiveDiskAction extends Node {
byte[] data; byte[] data;
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Llp;" descriptor = "Llp;"
) )
@Export("archiveDisk") @Export("archiveDisk")
ArchiveDisk archiveDisk; ArchiveDisk archiveDisk;
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lig;" descriptor = "Lig;"
) )
@Export("archive") @Export("archive")
Archive archive; Archive archive;
@@ -34,7 +34,7 @@ public class ArchiveDiskAction extends Node {
@ObfuscatedName("p") @ObfuscatedName("p")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lkb;II)Z", descriptor = "(Lkb;II)Z",
garbageValue = "-1045128194" garbageValue = "-1045128194"
) )
@Export("updateExternalPlayer") @Export("updateExternalPlayer")
@@ -150,7 +150,7 @@ public class ArchiveDiskAction extends Node {
@ObfuscatedName("js") @ObfuscatedName("js")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(II)Z", descriptor = "(II)Z",
garbageValue = "-418956614" garbageValue = "-418956614"
) )
static boolean method4302(int var0) { static boolean method4302(int var0) {
@@ -9,13 +9,13 @@ import net.runelite.mapping.ObfuscatedSignature;
public class ArchiveDiskActionHandler implements Runnable { public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Ljp;" descriptor = "Ljp;"
) )
@Export("ArchiveDiskActionHandler_requestQueue") @Export("ArchiveDiskActionHandler_requestQueue")
static NodeDeque ArchiveDiskActionHandler_requestQueue; static NodeDeque ArchiveDiskActionHandler_requestQueue;
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Ljp;" descriptor = "Ljp;"
) )
@Export("ArchiveDiskActionHandler_responseQueue") @Export("ArchiveDiskActionHandler_responseQueue")
static NodeDeque ArchiveDiskActionHandler_responseQueue; static NodeDeque ArchiveDiskActionHandler_responseQueue;
@@ -92,7 +92,7 @@ public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lic;Lic;I)I", descriptor = "(Lic;Lic;I)I",
garbageValue = "-1395527740" garbageValue = "-1395527740"
) )
static int method4429(AbstractArchive var0, AbstractArchive var1) { static int method4429(AbstractArchive var0, AbstractArchive var1) {
@@ -155,7 +155,7 @@ public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IB)Z", descriptor = "(IB)Z",
garbageValue = "8" garbageValue = "8"
) )
@Export("isWorldMapEvent") @Export("isWorldMapEvent")
@@ -165,7 +165,7 @@ public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("fh") @ObfuscatedName("fh")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Ljava/lang/String;ZB)V", descriptor = "(Ljava/lang/String;ZB)V",
garbageValue = "-20" garbageValue = "-20"
) )
@Export("drawLoadingMessage") @Export("drawLoadingMessage")
@@ -19,7 +19,7 @@ public class ArchiveLoader {
static String userHomeDirectory; static String userHomeDirectory;
@ObfuscatedName("an") @ObfuscatedName("an")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Llo;" descriptor = "Llo;"
) )
@Export("rasterProvider") @Export("rasterProvider")
public static AbstractRasterProvider rasterProvider; public static AbstractRasterProvider rasterProvider;
@@ -28,13 +28,13 @@ public class ArchiveLoader {
static boolean mouseCam; static boolean mouseCam;
@ObfuscatedName("fy") @ObfuscatedName("fy")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lfa;" descriptor = "Lfa;"
) )
@Export("socketTask") @Export("socketTask")
static Task socketTask; static Task socketTask;
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lig;" descriptor = "Lig;"
) )
@Export("archive") @Export("archive")
final Archive archive; final Archive archive;
@@ -52,7 +52,7 @@ public class ArchiveLoader {
int loadedCount; int loadedCount;
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lig;Ljava/lang/String;)V" descriptor = "(Lig;Ljava/lang/String;)V"
) )
ArchiveLoader(Archive var1, String var2) { ArchiveLoader(Archive var1, String var2) {
this.loadedCount = 0; this.loadedCount = 0;
@@ -62,7 +62,7 @@ public class ArchiveLoader {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)Z", descriptor = "(I)Z",
garbageValue = "-1314527591" garbageValue = "-1314527591"
) )
@Export("isLoaded") @Export("isLoaded")
@@ -80,7 +80,7 @@ public class ArchiveLoader {
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(III)I", descriptor = "(III)I",
garbageValue = "1299326622" garbageValue = "1299326622"
) )
static int method1212(int var0, int var1) { static int method1212(int var0, int var1) {
@@ -104,7 +104,7 @@ public class ArchiveLoader {
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(ILcs;ZI)I", descriptor = "(ILcs;ZI)I",
garbageValue = "677134031" garbageValue = "677134031"
) )
static int method1213(int var0, Script var1, boolean var2) { static int method1213(int var0, Script var1, boolean var2) {
@@ -10,38 +10,38 @@ import net.runelite.rs.ScriptOpcodes;
public enum AttackOption implements Enumerated { public enum AttackOption implements Enumerated {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lco;" descriptor = "Lco;"
) )
@Export("AttackOption_dependsOnCombatLevels") @Export("AttackOption_dependsOnCombatLevels")
AttackOption_dependsOnCombatLevels(0), AttackOption_dependsOnCombatLevels(0),
@ObfuscatedName("o") @ObfuscatedName("o")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lco;" descriptor = "Lco;"
) )
@Export("AttackOption_alwaysRightClick") @Export("AttackOption_alwaysRightClick")
AttackOption_alwaysRightClick(1), AttackOption_alwaysRightClick(1),
@ObfuscatedName("q") @ObfuscatedName("q")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lco;" descriptor = "Lco;"
) )
@Export("AttackOption_leftClickWhereAvailable") @Export("AttackOption_leftClickWhereAvailable")
AttackOption_leftClickWhereAvailable(2), AttackOption_leftClickWhereAvailable(2),
@ObfuscatedName("j") @ObfuscatedName("j")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lco;" descriptor = "Lco;"
) )
@Export("AttackOption_hidden") @Export("AttackOption_hidden")
AttackOption_hidden(3); AttackOption_hidden(3);
@ObfuscatedName("of") @ObfuscatedName("of")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lcy;" descriptor = "Lcy;"
) )
@Export("varcs") @Export("varcs")
static Varcs varcs; static Varcs varcs;
@ObfuscatedName("hj") @ObfuscatedName("hj")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "[Llz;" descriptor = "[Llz;"
) )
@Export("mapDotSprites") @Export("mapDotSprites")
static Sprite[] mapDotSprites; static Sprite[] mapDotSprites;
@@ -58,7 +58,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("m") @ObfuscatedName("m")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)I", descriptor = "(I)I",
garbageValue = "-995092303" garbageValue = "-995092303"
) )
@Export("rsOrdinal") @Export("rsOrdinal")
@@ -68,7 +68,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("a") @ObfuscatedName("a")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(I)Llh;", descriptor = "(I)Llh;",
garbageValue = "-1275433341" garbageValue = "-1275433341"
) )
public static IndexedSprite method2173() { public static IndexedSprite method2173() {
@@ -87,7 +87,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("w") @ObfuscatedName("w")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(B)V", descriptor = "(B)V",
garbageValue = "-37" garbageValue = "-37"
) )
public static void method2181() { public static void method2181() {
@@ -97,7 +97,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("ac") @ObfuscatedName("ac")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(ILcs;ZB)I", descriptor = "(ILcs;ZB)I",
garbageValue = "-99" garbageValue = "-99"
) )
static int method2180(int var0, Script var1, boolean var2) { static int method2180(int var0, Script var1, boolean var2) {
@@ -192,7 +192,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("ho") @ObfuscatedName("ho")
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(IIIIB)V", descriptor = "(IIIIB)V",
garbageValue = "-113" garbageValue = "-113"
) )
@Export("selectSpell") @Export("selectSpell")

Some files were not shown because too many files have changed in this diff Show More