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

View File

@@ -34,8 +34,8 @@ buildscript {
}
dependencies {
classpath("org.ajoberstar.grgit:grgit-core:4.0.2")
classpath("com.github.ben-manes:gradle-versions-plugin:0.29.0")
classpath("com.openosrs:injector-plugin:1.1.4")
classpath("com.github.ben-manes:gradle-versions-plugin:0.28.0")
classpath("com.openosrs:injector-plugin:1.1.5")
}
}
@@ -202,6 +202,8 @@ subprojects {
}
}
}
configurations["compileOnly"].extendsFrom(configurations["annotationProcessor"])
}
application {

View File

@@ -35,6 +35,8 @@ dependencies {
deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString())
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.ow2.asm", name = "asm", 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)
filteringCharset = "UTF-8"
}
// TODO: Enable assertions on all 3
register<JavaExec>("Downloader.main()") {
group = "gamepack"
@@ -103,6 +105,7 @@ tasks {
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.deob.Deob"
args = listOf(tokens["vanilla.jar"], "$buildDir/libs/deobfuscated-$version.jar")
}
register<JavaExec>("UpdateMappings.main()") {

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -25,9 +25,11 @@
package net.runelite.asm;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.annotation.Annotation;
import java.util.Map;
import lombok.Getter;
import net.runelite.asm.attributes.Annotated;
import net.runelite.asm.pool.Class;
import net.runelite.asm.signature.Signature;
import static net.runelite.deob.DeobAnnotations.*;
@@ -51,14 +53,14 @@ public class ClassFile implements Annotated, Named
private final Interfaces interfaces;
private final List<Field> fields = 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)
{
this.group = group;
interfaces = new Interfaces(this);
annotations = new Annotations();
}
public ClassFile()
@@ -99,7 +101,7 @@ public class ClassFile implements Annotated, Named
visitor.visit(version, access, name.getName(), null, super_class.getName(), ints);
visitor.visitSource(source, null);
for (Annotation annotation : annotations)
for (Annotation annotation : annotations.values())
{
annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true));
}
@@ -170,11 +172,6 @@ public class ClassFile implements Annotated, Named
methods.remove(method);
}
public Annotations getAnnotations()
{
return annotations;
}
public String getName()
{
return name.getName();
@@ -312,7 +309,7 @@ public class ClassFile implements Annotated, Named
for (Method m : methods)
{
if (m.isStatic() &&
name.equals(getObfuscatedName(m.getAnnotations())) &&
name.equals(getObfuscatedName(m)) &&
type.equals(getObfuscatedSignature(m)))
{
return m;

View File

@@ -151,7 +151,7 @@ public class ClassGroup implements Iterable<ClassFile>
{
for (ClassFile cf : classes)
{
if (name.equals(getObfuscatedName(cf.getAnnotations())))
if (name.equals(getObfuscatedName(cf)))
{
return cf;
}

View File

@@ -24,8 +24,10 @@
*/
package net.runelite.asm;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.annotation.Annotation;
import java.util.LinkedHashMap;
import java.util.Map;
import lombok.Getter;
import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.DeobAnnotations;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes;
@@ -43,20 +45,19 @@ public class Field implements Annotated, Named
private String name;
private Type type;
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)
{
this.classFile = classFile;
this.name = name;
this.type = type;
this.annotations = new Annotations();
}
public void accept(FieldVisitor visitor)
{
for (Annotation annotation : annotations.getAnnotations())
for (Annotation annotation : annotations.values())
{
annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true));
}
@@ -150,15 +151,10 @@ public class Field implements Annotated, Named
this.value = value;
}
public Annotations getAnnotations()
{
return annotations;
}
public net.runelite.asm.pool.Field getPoolField()
{
return new net.runelite.asm.pool.Field(
new net.runelite.asm.pool.Class(classFile.getName()),
classFile.getPoolClass(),
this.getName(),
this.getType()
);

View File

@@ -98,7 +98,7 @@ public class Interfaces implements Iterable<Class>
final List<String> names = new ArrayList<>();
for (ClassFile c : getMyInterfaces())
{
String name = DeobAnnotations.getObfuscatedName(c.getAnnotations());
String name = DeobAnnotations.getObfuscatedName(c);
if (name == null)
{
continue;

View File

@@ -25,11 +25,13 @@
package net.runelite.asm;
import java.util.ArrayList;
import java.util.LinkedHashMap;
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.Exceptions;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.LocalVariable;
import net.runelite.asm.attributes.code.Parameter;
@@ -55,8 +57,9 @@ public class Method implements Annotated, Named
private int accessFlags;
private String name;
private Signature arguments;
private Exceptions exceptions;
private Annotations annotations;
private final Exceptions exceptions;
@Getter
private final Map<Type, Annotation> annotations = new LinkedHashMap<>();
private List<Parameter> parameters;
private Code code;
@@ -66,7 +69,6 @@ public class Method implements Annotated, Named
this.name = name;
this.arguments = signature;
exceptions = new Exceptions();
annotations = new Annotations();
parameters = new ArrayList<>();
}
@@ -89,7 +91,7 @@ public class Method implements Annotated, Named
visitor.visitParameter(p.getName(), p.getAccess());
}
for (Annotation annotation : annotations.getAnnotations())
for (Annotation annotation : annotations.values())
{
annotation.accept(visitor.visitAnnotation(annotation.getType().toString(), true));
}
@@ -277,11 +279,6 @@ public class Method implements Annotated, Named
this.code = code;
}
public Annotations getAnnotations()
{
return annotations;
}
@SuppressWarnings("unchecked")
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()
{
return new net.runelite.asm.pool.Method(
new net.runelite.asm.pool.Class(classFile.getName()),
classFile.getPoolClass(),
name,
arguments
);

View File

@@ -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");
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}

View File

@@ -204,6 +204,18 @@ public class Execution
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()
{
assert !paused;

View File

@@ -28,20 +28,17 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.runelite.asm.Type;
public class Signature
{
private static Pattern paramRetPattern = Pattern.compile("\\((.*)\\)(.*)"),
paramsPattern = Pattern.compile("(\\[*(?:B|C|Z|S|I|J|F|D|(?:L[^;]*;)))");
private static final Pattern RLAPITORSAPI = Pattern.compile("net/runelite/(rs/)?api/(RS)?");
private final List<Type> arguments;
private final Type rv;
private Signature(List<Type> arguments, Type rv)
public Signature(List<Type> arguments, Type rv)
{
this.arguments = new ArrayList<>(arguments);
this.rv = rv;
@@ -49,23 +46,12 @@ public class Signature
public Signature(String str)
{
Matcher m = paramRetPattern.matcher(str);
if (!m.find())
{
throw new IllegalArgumentException("Signature has no arguments");
}
final int rvStart = str.indexOf(')');
if (rvStart == -1)
throw new IllegalArgumentException("Descriptor has no return value!");
String args = m.group(1), ret = m.group(2);
m = paramsPattern.matcher(args);
arguments = new ArrayList<>();
while (m.find())
{
String arg = m.group(1);
arguments.add(new Type(arg));
}
rv = new Type(ret);
rv = new Type(str.substring(rvStart + 1));
arguments = findArgs(str, new ArrayList<>(), str.indexOf('(') + 1, rvStart);
}
public Signature(Signature other)
@@ -74,6 +60,21 @@ public class Signature
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
public boolean equals(Object other)
{
@@ -82,17 +83,13 @@ public class Signature
return false;
}
Signature a = (Signature) other;
return arguments.equals(a.arguments) && rv.equals(a.rv);
return this.toString().equals(other.toString());
}
@Override
public int hashCode()
{
int hash = 5;
hash = 97 * hash + Objects.hashCode(this.arguments);
hash = 97 * hash + Objects.hashCode(this.rv);
return hash;
return this.toString().hashCode();
}
@Override
@@ -176,6 +173,6 @@ public class Signature
public Signature rsApiToRsClient()
{
return new Signature(this.toString().replaceAll("net/runelite/(rs/)?api/(RS)?", ""));
return new Signature(RLAPITORSAPI.matcher(this.toString()).replaceAll(""));
}
}

View File

@@ -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);
}
}

View File

@@ -27,7 +27,7 @@ package net.runelite.asm.visitors;
import net.runelite.asm.ClassFile;
import net.runelite.asm.Field;
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.Attribute;
import org.objectweb.asm.FieldVisitor;
@@ -51,9 +51,9 @@ public class ClassFieldVisitor extends FieldVisitor
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible)
{
Annotation element = new Annotation(new Type(desc));
this.field.getAnnotations().addAnnotation(element);
return new AnnotationElementVisitor(element);
Annotation annotation = new Annotation(new Type(desc), visible);
this.field.addAnnotation(annotation);
return annotation;
}
@Override

View File

@@ -27,7 +27,7 @@ package net.runelite.asm.visitors;
import net.runelite.asm.ClassFile;
import net.runelite.asm.Type;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.Annotation;
import net.runelite.asm.signature.Signature;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;
@@ -71,9 +71,8 @@ public class ClassFileVisitor extends ClassVisitor
public AnnotationVisitor visitAnnotation(String desc, boolean visible)
{
Annotation annotation = new Annotation(new Type(desc));
classFile.getAnnotations().addAnnotation(annotation);
return new AnnotationElementVisitor(annotation);
classFile.addAnnotation(annotation);
return annotation;
}
@Override

View File

@@ -32,7 +32,7 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.Method;
import net.runelite.asm.Type;
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.Instruction;
import net.runelite.asm.attributes.code.InstructionType;
@@ -108,9 +108,9 @@ public class CodeVisitor extends MethodVisitor
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible)
{
Annotation element = new Annotation(new Type(desc));
this.method.getAnnotations().addAnnotation(element);
return new AnnotationElementVisitor(element);
Annotation annotation = new Annotation(new Type(desc), visible);
this.method.addAnnotation(annotation);
return annotation;
}
@Override

View File

@@ -37,7 +37,6 @@ import net.runelite.deob.deobfuscators.Lvt;
import net.runelite.deob.deobfuscators.Order;
import net.runelite.deob.deobfuscators.RenameUnique;
import net.runelite.deob.deobfuscators.RuntimeExceptions;
import net.runelite.deob.deobfuscators.StaticShouldBeInstance;
import net.runelite.deob.deobfuscators.UnreachedCode;
import net.runelite.deob.deobfuscators.UnusedClass;
import net.runelite.deob.deobfuscators.UnusedFields;
@@ -80,10 +79,6 @@ public class Deob
ClassGroup group = JarUtil.loadJar(new File(args[0]));
run(group, new StaticShouldBeInstance());
if (args.length <= 2 || !args[2].equals("rl"))
{
// remove except RuntimeException
run(group, new RuntimeExceptions());
@@ -141,7 +136,6 @@ public class Deob
new ReflectionTransformer().transform(group);
//new MaxMemoryTransformer().transform(group);
//new RuneliteBufferTransformer().transform(group);
}
JarUtil.saveJar(group, new File(args[1]));

View File

@@ -24,15 +24,15 @@
*/
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.Field;
import net.runelite.asm.Method;
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.asm.Annotation;
import net.runelite.asm.signature.Signature;
import org.jetbrains.annotations.NotNull;
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 OBFUSCATED_GETTER = new Type("Lnet/runelite/mapping/ObfuscatedGetter;");
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)
{
String str = getAnnotationValue(m.getAnnotations(), OBFUSCATED_SIGNATURE);
Object val = get(m, OBFUSCATED_SIGNATURE, "descriptor");
if (str == null)
{
if (val == null)
return null;
}
return new Signature(str);
return new Signature((String) val);
}
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 new Type((String) val);
}
return new Type(str);
}
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)
{
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);
final var a = field.findAnnotation(OBFUSCATED_GETTER);
if (a == null)
{
return null;
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?");
}
return a.getElement().getString();
@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();
}
}

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.deob.deobfuscators;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,7 +31,7 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
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.deob.DeobAnnotations;
import net.runelite.deob.Deobfuscator;
@@ -64,7 +63,7 @@ public class Order implements Deobfuscator
for (int i = 0; i < group.getClasses().size(); i++)
{
ClassFile cf = group.getClasses().get(i);
String className = DeobAnnotations.getObfuscatedName(cf.getAnnotations());
String className = DeobAnnotations.getObfuscatedName(cf);
nameIndices.put(className, i);
}
@@ -73,7 +72,7 @@ public class Order implements Deobfuscator
for (ClassFile cf : group.getClasses())
{
List<Method> m = cf.getMethods();
Collections.sort(m, this::compareMethod);
m.sort(this::compare);
sortedMethods += m.size();
@@ -81,7 +80,7 @@ public class Order implements Deobfuscator
if (!cf.isEnum())
{
List<Field> f = cf.getFields();
Collections.sort(f, this::compareFields);
f.sort(this::compare);
sortedFields += f.size();
}
@@ -91,47 +90,27 @@ public class Order implements Deobfuscator
}
// 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)
{
return Integer.compare(i1, i2);
}
int nameIdx1 = getNameIdx(m1.getAnnotations());
int nameIdx2 = getNameIdx(m2.getAnnotations());
int nameIdx1 = getNameIdx(a);
int nameIdx2 = getNameIdx(b);
if (nameIdx1 != nameIdx2)
{
return Integer.compare(nameIdx1, nameIdx2);
}
return compareOrder(m1, m2);
return compareOrder(a, b);
}
private int compareFields(Field f1, Field f2)
{
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)
private int getNameIdx(Annotated annotations)
{
String name = DeobAnnotations.getObfuscatedName(annotations);
@@ -140,6 +119,15 @@ public class Order implements Deobfuscator
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)
{
if (m.getName().equals("<clinit>"))

View File

@@ -151,7 +151,7 @@ public class PacketHandlerOrder implements Deobfuscator
// check if the invoke is on buffer/packetbuffer classes
boolean matches = ii.getMethods().stream()
.filter(m -> m.getDescriptor().size() == 0)
.map(method -> method.getClassFile())
.map(Method::getClassFile)
.anyMatch(cf -> cf == bf.getBuffer() || cf == bf.getPacketBuffer());
if (matches)
{
@@ -269,7 +269,7 @@ public class PacketHandlerOrder implements Deobfuscator
logger.warn("Unable to differentiate {} from {}", p1, p2);
return 0;
})
.map(s -> s.clone())
.map(PacketHandler::clone)
.collect(Collectors.toList());
assert sortedHandlers.size() == handlers.getHandlers().size();
@@ -277,7 +277,7 @@ public class PacketHandlerOrder implements Deobfuscator
for (PacketHandler handler : sortedHandlers)
{
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 l2 = (LVTInstruction) p2.getStore();
@@ -350,7 +350,7 @@ public class PacketHandlerOrder implements Deobfuscator
// Find unique methods
List<Method> methods = unsortedHandlers.stream()
.map(ph -> ph.getMethod())
.map(PacketHandler::getMethod)
.distinct()
.collect(Collectors.toList());
@@ -439,10 +439,6 @@ public class PacketHandlerOrder implements Deobfuscator
}
List<Instruction> follow = follow(instructions, handler.getStart(), afterRead);
if (follow == null)
{
continue;
}
for (Instruction i : follow)
{
@@ -559,11 +555,11 @@ public class PacketHandlerOrder implements Deobfuscator
private int compareReads(List<PacketRead> r1, List<PacketRead> r2)
{
List<Type> t1 = r1.stream()
.map(pr -> pr.getType())
.map(PacketRead::getType)
.sorted(this::compareType)
.collect(Collectors.toList());
List<Type> t2 = r2.stream()
.map(pr -> pr.getType())
.map(PacketRead::getType)
.sorted(this::compareType)
.collect(Collectors.toList());
if (t1.size() != t2.size())

View File

@@ -38,50 +38,33 @@ import net.runelite.deob.util.NameMappings;
public class RenameUnique implements Deobfuscator
{
private Renamer renamer;
private void generateClassNames(NameMappings map, ClassGroup group)
{
int i = 0;
for (ClassFile cf : group.getClasses())
{
if (cf.getName().length() > Deob.OBFUSCATED_NAME_MAX_LEN)
{
continue;
}
if (cf.getName().length() <= Deob.OBFUSCATED_NAME_MAX_LEN)
map.map(cf.getPoolClass(), "class" + i++);
}
map.setClasses(i);
}
private void generateFieldNames(NameMappings map, ClassGroup group)
{
int i = 0;
for (ClassFile cf : group.getClasses())
for (Field field : cf.getFields())
{
if (!Deob.isObfuscated(field.getName()) || field.getName().equals(DeobAnnotations.getExportedName(field.getAnnotations())))
{
continue;
}
if (Deob.isObfuscated(field.getName()) && !field.getName().equals(DeobAnnotations.getExportedName(field)))
map.map(field.getPoolField(), "field" + i++);
}
map.setFields(i);
}
private void generateMethodNames(NameMappings map, ClassGroup group)
{
int i = 0;
for (ClassFile cf : group.getClasses())
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;
}
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(method);
assert !virtualMethods.isEmpty();
@@ -95,6 +78,7 @@ public class RenameUnique implements Deobfuscator
for (Method m : virtualMethods)
map.map(m.getPoolMethod(), name);
}
map.setMethods(i);
}
@Override
@@ -109,7 +93,7 @@ public class RenameUnique implements Deobfuscator
this.generateFieldNames(mappings, group);
this.generateMethodNames(mappings, group);
renamer = new Renamer(mappings);
Renamer renamer = new Renamer(mappings);
renamer.run(group);
}
}

View File

@@ -31,9 +31,10 @@ import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Interfaces;
import net.runelite.asm.Method;
import net.runelite.asm.Named;
import net.runelite.asm.Type;
import net.runelite.asm.attributes.Annotated;
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.Instruction;
import net.runelite.asm.attributes.code.LocalVariable;
@@ -45,6 +46,8 @@ import net.runelite.deob.Deobfuscator;
import net.runelite.deob.util.NameMappings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static net.runelite.deob.DeobAnnotations.OBFUSCATED_NAME;
import static net.runelite.deob.DeobAnnotations.OBFUSCATED_SIGNATURE;
public class Renamer implements Deobfuscator
{
@@ -134,12 +137,7 @@ public class Renamer implements Deobfuscator
if (!method.getDescriptor().equals(newSignature))
{
//Signature was updated. Annotate it
if (method.getAnnotations().find(DeobAnnotations.OBFUSCATED_SIGNATURE) == null)
{
//Signature was not previously renamed
method.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, "signature", method.getDescriptor().toString());
}
method.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement( "descriptor", method.getDescriptor().toString());
}
method.setDescriptor(newSignature);
@@ -156,21 +154,13 @@ public class Renamer implements Deobfuscator
{
if (field.getType().getInternalName().equals(cf.getName()))
{
if (field.getAnnotations().find(DeobAnnotations.OBFUSCATED_SIGNATURE) == null)
{
//Signature was updated. Annotate it
field.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, "signature", field.getType().toString());
}
field.findAnnotation(OBFUSCATED_SIGNATURE, true).setElement("descriptor", field.getType().toString());
field.setType(Type.getType("L" + name + ";", field.getType().getDimensions()));
}
}
}
if (cf.getAnnotations().find(DeobAnnotations.OBFUSCATED_NAME) == null)
{
cf.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", cf.getName());
}
addObfuscatedName(cf);
group.renameClass(cf, name);
}
@@ -178,22 +168,13 @@ public class Renamer implements Deobfuscator
private void regeneratePool(ClassGroup group)
{
for (ClassFile cf : group.getClasses())
{
for (Method m : cf.getMethods())
{
Code c = m.getCode();
if (c == null)
{
continue;
}
c.getInstructions().regeneratePool();
}
}
if (m.getCode() != null)
m.getCode().getInstructions()
.regeneratePool();
}
@Override
@SuppressWarnings("unchecked")
public void run(ClassGroup group)
{
group.buildClassGraph();
@@ -212,12 +193,9 @@ public class Renamer implements Deobfuscator
continue;
}
if (field.getAnnotations().find(DeobAnnotations.OBFUSCATED_NAME) == null)
{
field.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", field.getName());
}
addObfuscatedName(field);
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);
++fields;
@@ -232,15 +210,6 @@ public class Renamer implements Deobfuscator
String newName = mappings.get(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)
{
continue;
@@ -279,10 +248,7 @@ public class Renamer implements Deobfuscator
++parameters;
}
if (m.getAnnotations().find(DeobAnnotations.OBFUSCATED_NAME) == null)
{
m.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_NAME, "value", m.getName());
}
addObfuscatedName(m);
m.setName(newName);
}
@@ -308,35 +274,8 @@ public class Renamer implements Deobfuscator
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())
{
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();
object.findAnnotation(OBFUSCATED_NAME, true).setElement(object.getName());
}
}

View File

@@ -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;
}
}

View File

@@ -97,22 +97,22 @@ public class UnusedParameters implements Deobfuscator
private boolean shouldRemove(Method m, int parameter)
{
Signature obSig = DeobAnnotations.getObfuscatedSignature(m);
if (obSig == null)
{
final var a = m.findAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE);
if (a == null)
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)
{
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;
@@ -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.reverse(l);
return l;
@@ -218,7 +218,7 @@ public class UnusedParameters implements Deobfuscator
InvokeInstruction ii = (InvokeInstruction) i;
if (!ii.getMethods().stream().anyMatch(me -> methods.contains(me)))
if (ii.getMethods().stream().noneMatch(methods::contains))
{
continue;
}
@@ -227,8 +227,6 @@ public class UnusedParameters implements Deobfuscator
Collection<InstructionContext> ics = invokes.get(i);
assert ics != null;
if (ics != null)
{
for (InstructionContext ins : ics)
{
int pops = signature.size() - paramIndex - 1; // index from top of stack of parameter. 0 is the last parameter
@@ -244,7 +242,6 @@ public class UnusedParameters implements Deobfuscator
}
}
}
}
for (Method method : methods)
{
@@ -286,25 +283,20 @@ public class UnusedParameters implements Deobfuscator
public void run(ClassGroup group)
{
int i;
int pnum = 1;
do
{
group.buildClassGraph();
invokes.clear();
this.buildUnused(group);
Execution execution = new Execution(group);
execution.addExecutionVisitor(ictx -> visit(ictx));
execution.addExecutionVisitor(this::visit);
execution.populateInitialMethods();
execution.run();
i = this.processUnused(execution, group);
count += i;
break;
}
while (i > 0);
logger.info("Removed {} unused parameters", count);
}

View File

@@ -783,7 +783,7 @@ public class ModArith implements Deobfuscator
String ename = pair.getType() == Long.class
? "longValue"
: "intValue";
f.getAnnotations().addAnnotation(DeobAnnotations.OBFUSCATED_GETTER, ename, pair.getter);
f.addAnnotation(DeobAnnotations.OBFUSCATED_GETTER, ename, pair.getter);
}
}
}

View File

@@ -26,8 +26,13 @@ package net.runelite.deob.deobfuscators.cfg;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Label;
@Getter
@Setter
public class Block
{
private int id = -1;
@@ -36,64 +41,44 @@ public class Block
/**
* blocks which jump here
*/
private final List<Block> prev = new ArrayList<>();
private final List<Block> preds = new ArrayList<>();
/**
* 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
*/
private Block flowsFrom;
private Block pred;
/**
* block which this directly flows into
*/
private Block flowsInto;
private Block succ;
/**
* instructions in this block
*/
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
public String toString()
{
StringBuilder sb = new StringBuilder();
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)
{
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");
return sb.toString();
@@ -111,54 +96,37 @@ public class Block
instructions.add(i);
}
public List<Instruction> getInstructions()
{
return instructions;
}
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)
{
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;
}
public void setFlowsFrom(Block flowsFrom)
{
this.flowsFrom = flowsFrom;
}
public Block getFlowsInto()
{
return flowsInto;
}
public void setFlowsInto(Block flowsInto)
{
this.flowsInto = flowsInto;
for (Instruction i : instructions)
if (i instanceof Label)
if (((Label) i).getLineNumber() != null)
return ((Label) i).getLineNumber();
return -1;
}
}

View File

@@ -24,16 +24,11 @@
*/
package net.runelite.deob.deobfuscators.cfg;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Method;
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.Instructions;
import net.runelite.asm.attributes.code.Label;
@@ -64,7 +59,6 @@ public class ControlFlowDeobfuscator implements Deobfuscator
continue;
}
split(code);
run(code);
runJumpLabel(code);
}
@@ -74,167 +68,49 @@ public class ControlFlowDeobfuscator implements Deobfuscator
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)
{
Instructions ins = code.getInstructions();
Exceptions exceptions = code.getExceptions();
ControlFlowGraph graph = new ControlFlowGraph.Builder().build(code);
for (Block block : graph.getBlocks())
{
assert block.getFlowsFrom() == null;
assert block.getFlowsInto() == null;
}
ControlFlowGraph graph = new ControlFlowGraph(code);
if (logger.isDebugEnabled()) // graph.toString() is expensive
{
logger.debug(graph.toString());
}
List<Exception> originalExceptions = new ArrayList<>(exceptions.getExceptions());
// Clear existing exceptions and instructions as we are going to
// rebuild them
exceptions.clear();
// Clear existing instructions as we are going to rebuild them
ins.clear();
List<Block> done = new ArrayList<>();
Queue<Block> queue = new PriorityQueue<>(this::compareBlock);
// add initial code block
queue.add(graph.getHead());
while (!queue.isEmpty())
final List<Block> sorted = graph.topologicalSort();
for (Block b : sorted)
{
Block block = queue.remove();
if (done.contains(block))
{
continue;
}
done.add(block);
++placedBlocks;
logger.debug("Placed block {}", block.getId());
List<Block> next = block.getNext();
if (next.isEmpty() == false)
for (Instruction i : b.getInstructions())
{
// 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);
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
*
* @param code
*/
private void runJumpLabel(Code code)
{

View File

@@ -26,9 +26,12 @@ package net.runelite.deob.deobfuscators.cfg;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Label;
@@ -36,10 +39,90 @@ import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
public class ControlFlowGraph
{
private Map<Label, Block> blocks = new HashMap<>();
private List<Block> allBlocks = new ArrayList<>();
private final Map<Label, Block> blocks = new HashMap<>();
private final List<Block> allBlocks = new ArrayList<>();
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)
{
this.head = head;
@@ -70,91 +153,4 @@ public class ControlFlowGraph
{
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;
}
}
}

View File

@@ -34,10 +34,7 @@ import java.util.List;
import java.util.Map;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
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.Annotation;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType;
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 Map<ConstantMethodParameter, ConstantMethodParameter> parameters = new HashMap<>();
private Multimap<Method, ConstantMethodParameter> mparams = HashMultimap.create();
private final Map<ConstantMethodParameter, ConstantMethodParameter> parameters = new HashMap<>();
private final Multimap<Method, ConstantMethodParameter> mparams = HashMultimap.create();
private void checkMethodsAreConsistent(List<Method> methods)
{
@@ -436,23 +433,18 @@ public class ConstantParameter implements Deobfuscator
{
Object value = parameter.values.get(0);
Annotations annotations = m.getAnnotations();
Annotation obfuscatedSignature = annotations.find(DeobAnnotations.OBFUSCATED_SIGNATURE);
if (obfuscatedSignature != null && obfuscatedSignature.getElements().size() == 2)
Annotation obfuscatedSignature = m.findAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, true);
if (obfuscatedSignature.size() == 2)
{
// already annotated
continue;
}
if (obfuscatedSignature == null)
else if (obfuscatedSignature.size() == 0)
{
obfuscatedSignature = annotations.addAnnotation(DeobAnnotations.OBFUSCATED_SIGNATURE, "signature", m.getDescriptor().toString());
obfuscatedSignature.setElement("descriptor", m.getDescriptor().toString());
}
// Add garbage value
Element element = new SimpleElement("garbageValue", value.toString());
obfuscatedSignature.addElement(element);
obfuscatedSignature.setElement("garbageValue", String.valueOf(value));
}
}

View File

@@ -30,8 +30,6 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
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.mapping.Import;
import net.runelite.rs.api.RSClient;
@@ -65,11 +63,6 @@ public class AnnotationIntegrityChecker
return errors;
}
public int getWarnings()
{
return warnings;
}
public void run()
{
for (ClassFile cf : one.getClasses())
@@ -97,11 +90,11 @@ public class AnnotationIntegrityChecker
if (f1.isStatic())
{
f2 = findExportedFieldStatic(two, DeobAnnotations.getExportedName(f1.getAnnotations()));
f2 = findExportedFieldStatic(two, DeobAnnotations.getExportedName(f1));
}
else
{
f2 = findExportedField(other, DeobAnnotations.getExportedName(f1.getAnnotations()));
f2 = findExportedField(other, DeobAnnotations.getExportedName(f1));
}
if (f2 == null)
@@ -110,7 +103,7 @@ public class AnnotationIntegrityChecker
{
logger.error("Missing IMPORTED field on {} named {}",
other,
DeobAnnotations.getExportedName(f1.getAnnotations()));
DeobAnnotations.getExportedName(f1));
++errors;
}
@@ -118,7 +111,7 @@ public class AnnotationIntegrityChecker
{
logger.warn("Missing exported field on {} named {}",
other,
DeobAnnotations.getExportedName(f1.getAnnotations()));
DeobAnnotations.getExportedName(f1));
++warnings;
}
@@ -143,11 +136,11 @@ public class AnnotationIntegrityChecker
if (m1.isStatic())
{
m2 = findExportedMethodStatic(two, DeobAnnotations.getExportedName(m1.getAnnotations()));
m2 = findExportedMethodStatic(two, DeobAnnotations.getExportedName(m1));
}
else
{
m2 = findExportedMethod(other, DeobAnnotations.getExportedName(m1.getAnnotations()));
m2 = findExportedMethod(other, DeobAnnotations.getExportedName(m1));
}
if (m2 == null)
@@ -156,7 +149,7 @@ public class AnnotationIntegrityChecker
{
logger.error("Missing IMPORTED method on {} named {} ({})",
other,
DeobAnnotations.getExportedName(m1.getAnnotations()),
DeobAnnotations.getExportedName(m1),
m1);
++errors;
@@ -165,7 +158,7 @@ public class AnnotationIntegrityChecker
{
logger.warn("Missing exported method on {} named {} ({})",
other,
DeobAnnotations.getExportedName(m1.getAnnotations()),
DeobAnnotations.getExportedName(m1),
m1);
++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 name Exported name of field/method
* @param isStatic Whether or not field/method is static
* @return
*/
private boolean isImported(ClassFile cf, String name, boolean isStatic)
{
@@ -259,7 +221,7 @@ public class AnnotationIntegrityChecker
List<Field> list = new ArrayList<>();
for (Field f : clazz.getFields())
{
if (DeobAnnotations.getExportedName(f.getAnnotations()) != null)
if (DeobAnnotations.getExportedName(f) != null)
{
list.add(f);
}
@@ -272,7 +234,7 @@ public class AnnotationIntegrityChecker
List<Method> list = new ArrayList<>();
for (Method m : clazz.getMethods())
{
if (DeobAnnotations.getExportedName(m.getAnnotations()) != null)
if (DeobAnnotations.getExportedName(m) != null)
{
list.add(m);
}
@@ -280,26 +242,11 @@ public class AnnotationIntegrityChecker
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)
{
for (Field f : getExportedFields(clazz))
{
if (DeobAnnotations.getExportedName(f.getAnnotations()).equals(name))
if (name.equals(DeobAnnotations.getExportedName(f)))
{
return f;
}
@@ -315,7 +262,7 @@ public class AnnotationIntegrityChecker
{
if (f.isStatic())
{
if (name.equals(DeobAnnotations.getExportedName(f.getAnnotations())))
if (name.equals(DeobAnnotations.getExportedName(f)))
{
return f;
}
@@ -333,7 +280,7 @@ public class AnnotationIntegrityChecker
{
if (m.isStatic())
{
if (name.equals(DeobAnnotations.getExportedName(m.getAnnotations())))
if (name.equals(DeobAnnotations.getExportedName(m)))
{
return m;
}
@@ -347,7 +294,7 @@ public class AnnotationIntegrityChecker
{
for (Method m : getExportedMethods(clazz))
{
if (DeobAnnotations.getExportedName(m.getAnnotations()).equals(name))
if (name.equals(DeobAnnotations.getExportedName(m)))
{
return m;
}

View File

@@ -29,10 +29,8 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
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.Annotation;
import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.DeobAnnotations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,11 +67,11 @@ public class AnnotationMapper
{
int count = 0;
if (hasCopyableAnnotation(from.getAnnotations()))
if (hasCopyableAnnotation(from))
{
if (to != null)
{
count += copyAnnotations(from.getAnnotations(), to.getAnnotations());
count += copyAnnotations(from, to);
}
else
{
@@ -83,57 +81,49 @@ public class AnnotationMapper
for (Field f : from.getFields())
{
if (!hasCopyableAnnotation(f.getAnnotations()))
if (!hasCopyableAnnotation(f))
continue;
Field other = (Field) mapping.get(f);
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;
}
count += copyAnnotations(f.getAnnotations(), other.getAnnotations());
count += copyAnnotations(f, other);
}
for (Method m : from.getMethods())
{
if (!hasCopyableAnnotation(m.getAnnotations()))
if (!hasCopyableAnnotation(m))
continue;
Method other = (Method) mapping.get(m);
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;
}
count += copyAnnotations(m.getAnnotations(), other.getAnnotations());
count += copyAnnotations(m, other);
}
return count;
}
private int copyAnnotations(Annotations from, Annotations to)
private int copyAnnotations(Annotated from, Annotated to)
{
int count = 0;
if (from.getAnnotations() == null)
return count;
for (Annotation a : from.getAnnotations())
for (Annotation a : from.getAnnotations().values())
{
if (isCopyable(a))
{
Annotation annotation = new Annotation(a.getType());
to.addAnnotation(annotation);
for (Element e : a.getElements())
{
Element element = new SimpleElement(e.getName(), e.getValue());
annotation.addElement(element);
}
to.addAnnotation(a.getType(), a);
++count;
}
}
@@ -141,13 +131,9 @@ public class AnnotationMapper
return count;
}
private boolean hasCopyableAnnotation(Annotations a)
private boolean hasCopyableAnnotation(Annotated a)
{
for (Annotation an : a.getAnnotations())
if (isCopyable(an))
return true;
return false;
return a.findAnnotation(DeobAnnotations.EXPORT) != null || a.findAnnotation(DeobAnnotations.IMPLEMENTS) != null;
}
private boolean isCopyable(Annotation a)

View File

@@ -36,7 +36,7 @@ import net.runelite.asm.signature.Signature;
public class StaticMethodSignatureMapper
{
private Multimap<Method, Method> map = LinkedHashMultimap.create();
private final Multimap<Method, Method> map = LinkedHashMultimap.create();
private List<Method> getStaticMethods(ClassGroup group)
{

View File

@@ -33,7 +33,6 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Type;
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.Label;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static net.runelite.asm.attributes.code.InstructionType.INVOKEVIRTUAL;
public class PacketWriteDeobfuscator implements Deobfuscator
{

View File

@@ -5,10 +5,8 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
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.Named;
import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.Deob;
import net.runelite.deob.DeobAnnotations;
import org.slf4j.Logger;
@@ -24,7 +22,6 @@ public class AnnotationAdder
private final ClassGroup group;
private final Logger log = LoggerFactory.getLogger(AnnotationAdder.class);
@SuppressWarnings("unchecked")
public void run()
{
int impl = 0;
@@ -46,83 +43,43 @@ public class AnnotationAdder
// 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();
}
else
else if (!Deob.isObfuscated(c.getClassName()))
{
if (!Deob.isObfuscated(c.getClassName()))
{
Annotations an = c.getAnnotations();
Annotation implAn = new Annotation(DeobAnnotations.IMPLEMENTS);
Element value = new SimpleElement(c.getClassName());
implAn.addElement(value);
an.addAnnotation(implAn);
c.addAnnotation(DeobAnnotations.IMPLEMENTS, c.getClassName());
impl++;
}
}
for (Field f : c.getFields())
{
Annotations an = f.getAnnotations();
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);
if (addExport(f))
field++;
}
}
for (Method m : c.getMethods())
{
Annotations an = m.getAnnotations();
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);
if (addExport(m))
meth++;
}
}
}
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;
}
}

View File

@@ -26,26 +26,26 @@
package net.runelite.deob.updater;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
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.asm.attributes.annotation.SimpleElement;
import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.Annotated;
public class AnnotationCopier
{
private final ClassGroup group1, group2;
private final Type[] types;
private final Set<Type> types;
public AnnotationCopier(ClassGroup group1, ClassGroup group2, Type... types)
{
this.group1 = group1;
this.group2 = group2;
this.types = types;
this.types = new HashSet<>(Arrays.asList(types));
}
public void copy()
@@ -56,63 +56,46 @@ public class AnnotationCopier
assert cf2 != null;
copy(cf1.getAnnotations(), cf2.getAnnotations());
copy(cf1, cf2);
for (Field f : cf1.getFields())
{
Field f2 = cf2.findField(f.getName(), f.getType());
assert f2 != null || f.getAnnotations() == null;
assert f2 != null || f.getAnnotations().isEmpty();
if (f2 == null)
continue;
copy(f.getAnnotations(), f2.getAnnotations());
copy(f, f2);
}
for (Method m : cf1.getMethods())
{
Method m2 = cf2.findMethod(m.getName(), m.getDescriptor());
assert m2 != null || m.getAnnotations() == null;
assert m2 != null || m == null;
if (m2 == null)
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()))
{
an2.removeAnnotation(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);
final var t = a.getType();
if (isType(t))
an2.getAnnotations().replace(t, a);
}
}
private boolean isType(Type type)
{
return Arrays.asList(types).contains(type);
return types.contains(type);
}
}

View File

@@ -29,8 +29,8 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
import net.runelite.asm.attributes.annotation.Annotation;
import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.deobfuscators.Renamer;
import net.runelite.deob.util.NameMappings;
@@ -58,20 +58,20 @@ public class AnnotationRenamer
for (ClassFile cf : group.getClasses())
{
String name = getImplements(cf.getAnnotations());
String name = getImplements(cf);
if (name != null)
mappings.map(cf.getPoolClass(), name);
for (Field f : cf.getFields())
{
name = DeobAnnotations.getExportedName(f.getAnnotations());
name = DeobAnnotations.getExportedName(f);
if (name != null)
mappings.map(f.getPoolField(), name);
}
for (Method m : cf.getMethods())
{
name = DeobAnnotations.getExportedName(m.getAnnotations());
name = DeobAnnotations.getExportedName(m);
if (name != null)
mappings.map(m.getPoolMethod(), name);
}
@@ -80,9 +80,9 @@ public class AnnotationRenamer
return mappings;
}
private String getImplements(Annotations annotations)
private String getImplements(Annotated cf)
{
Annotation an = annotations.find(DeobAnnotations.IMPLEMENTS);
return an != null ? an.getElement().getString() : null;
Annotation an = cf.findAnnotation(DeobAnnotations.IMPLEMENTS);
return an == null ? null : an.getValueString();
}
}

View File

@@ -27,7 +27,7 @@ public class MappedClass
implementingName = DeobAnnotations.getImplements(c);
obfuscatedName = DeobAnnotations.getObfuscatedName(c.getAnnotations());
obfuscatedName = DeobAnnotations.getObfuscatedName(c);
if (obfuscatedName == null)
{
obfuscatedName = c.getName();
@@ -36,7 +36,7 @@ public class MappedClass
ClassFile parent = c.getParent();
if (parent != null)
{
superClass = DeobAnnotations.getObfuscatedName(parent.getAnnotations());
superClass = DeobAnnotations.getObfuscatedName(parent);
}
access = c.getAccess();
@@ -44,7 +44,6 @@ public class MappedClass
interfaces = c.getInterfaces()
.getMyInterfaces()
.stream()
.map(ClassFile::getAnnotations)
.map(DeobAnnotations::getObfuscatedName)
.collect(Collectors.toList());

View File

@@ -26,11 +26,11 @@ public class MappedField
{
MappingDumper.putMap(f.getPoolField(), this);
exportedName = DeobAnnotations.getExportedName(f.getAnnotations());
exportedName = DeobAnnotations.getExportedName(f);
owner = MappingDumper.getMap(f.getClassFile()).obfuscatedName;
obfuscatedName = DeobAnnotations.getObfuscatedName(f.getAnnotations());
obfuscatedName = DeobAnnotations.getObfuscatedName(f);
if (obfuscatedName == null)
{
obfuscatedName = f.getName();

View File

@@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Code;
@@ -37,11 +38,11 @@ public class MappedMethod
public MappedMethod visitMethod(final Method m, final MappingDump dump)
{
MappingDumper.putMap(m.getPoolMethod(), this);
exportedName = DeobAnnotations.getExportedName(m.getAnnotations());
exportedName = DeobAnnotations.getExportedName(m);
owner = MappingDumper.getMap(m.getClassFile()).obfuscatedName;
obfuscatedName = DeobAnnotations.getObfuscatedName(m.getAnnotations());
obfuscatedName = DeobAnnotations.getObfuscatedName(m);
if (obfuscatedName == null)
{
obfuscatedName = m.getName();
@@ -94,8 +95,8 @@ public class MappedMethod
{
Method mme = met.get(0);
k = new net.runelite.asm.pool.Method(
new Class(DeobAnnotations.getObfuscatedName(mme.getClassFile().getAnnotations())),
DeobAnnotations.getObfuscatedName(mme.getAnnotations()),
new Class(Objects.requireNonNull(DeobAnnotations.getObfuscatedName(mme.getClassFile()))),
DeobAnnotations.getObfuscatedName(mme),
mme.getObfuscatedSignature() != null ? mme.getObfuscatedSignature() : mme.getDescriptor()
);
}

View File

@@ -34,7 +34,6 @@ import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.objectwebasm.NonloadingClassWriter;
@@ -118,11 +117,12 @@ public class JarUtil
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())
{
JarEntry entry = new JarEntry(cf.getName() + ".class");
entry.setTime(-1);
jout.putNextEntry(entry);
byte[] data = writeClass(group, cf);

View File

@@ -27,6 +27,8 @@ package net.runelite.deob.util;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import net.runelite.asm.pool.Class;
import net.runelite.asm.pool.Field;
import net.runelite.asm.pool.Method;
@@ -37,6 +39,10 @@ public class NameMappings
private final Map<Object, String[]> paramMap = new HashMap<>();
@Getter
@Setter
private int fields, methods, classes;
public void map(Class cf, String name)
{
map.put(cf, name);

View File

@@ -27,16 +27,11 @@ package net.runelite.asm.annotations;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Optional;
import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.ClassUtil;
import net.runelite.asm.Method;
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 org.junit.Assert;
import org.junit.Test;
@@ -62,20 +57,14 @@ public class AnnotationTest
Method method = cf.getMethods().get(1);
Assert.assertEquals("method1", method.getName());
Annotations annotations = method.getAnnotations();
Assert.assertNotNull(annotations);
var annotation = method.findAnnotation(new Type("Lnet/runelite/asm/annotations/MyAnnotation;"));
Assert.assertNotNull(annotation);
Optional<Annotation> annotation = annotations.getAnnotations().stream().filter(a -> a.getType().equals(new Type("Lnet/runelite/asm/annotations/MyAnnotation;"))).findFirst();
Assert.assertTrue(annotation.isPresent());
Assert.assertEquals(1, annotation.size());
Annotation an = annotation.get();
List<Element> elements = an.getElements();
Assert.assertEquals(1, elements.size());
Element element = elements.get(0);
Assert.assertEquals("value", element.getName());
Assert.assertEquals("method1", element.getValue());
Object element = annotation.getValue();
Object also = annotation.get("value");
Assert.assertEquals(also, element);
Assert.assertEquals("method1", element);
}
}

View File

@@ -82,7 +82,7 @@ public class MappingDumper
for (ClassFile cf : group.getClasses())
{
String implName = cf.getName();
String className = DeobAnnotations.getObfuscatedName(cf.getAnnotations());
String className = DeobAnnotations.getObfuscatedName(cf);
if (implName != null)
{
@@ -92,7 +92,7 @@ public class MappingDumper
for (Field f : cf.getFields())
{
String exportName = DeobAnnotations.getExportedName(f.getAnnotations());
String exportName = DeobAnnotations.getExportedName(f);
if (exportName == null)
{
@@ -101,7 +101,7 @@ public class MappingDumper
++fields;
String fieldName = DeobAnnotations.getObfuscatedName(f.getAnnotations());
String fieldName = DeobAnnotations.getObfuscatedName(f);
Type type = f.getType();
Number getter = DeobAnnotations.getObfuscatedGetter(f);
@@ -171,7 +171,7 @@ public class MappingDumper
for (Method m : cf.getMethods())
{
String exportName = DeobAnnotations.getExportedName(m.getAnnotations());
String exportName = DeobAnnotations.getExportedName(m);
if (exportName == null)
{
@@ -180,7 +180,7 @@ public class MappingDumper
methods++;
String methodName = DeobAnnotations.getObfuscatedName(m.getAnnotations());
String methodName = DeobAnnotations.getObfuscatedName(m);
Signature signature = DeobAnnotations.getObfuscatedSignature(m);
String garbageValue = DeobAnnotations.getDecoder(m);
@@ -329,18 +329,18 @@ public class MappingDumper
for (ClassFile cf : group.getClasses())
{
String implName = DeobAnnotations.getImplements(cf);
String className = DeobAnnotations.getObfuscatedName(cf.getAnnotations());
String className = DeobAnnotations.getObfuscatedName(cf);
for (Field f : cf.getFields())
{
String exportName = DeobAnnotations.getExportedName(f.getAnnotations());
String exportName = DeobAnnotations.getExportedName(f);
if (exportName == null)
{
continue;
}
String fieldName = DeobAnnotations.getObfuscatedName(f.getAnnotations());
String fieldName = DeobAnnotations.getObfuscatedName(f);
Type obfType = DeobAnnotations.getObfuscatedType(f);
Number getter = DeobAnnotations.getObfuscatedGetter(f);
@@ -351,7 +351,7 @@ public class MappingDumper
jField.addProperty("class", className);
jField.addProperty("field", fieldName);
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("static", f.isStatic());
@@ -361,14 +361,14 @@ public class MappingDumper
for (Method m : cf.getMethods())
{
String exportName = DeobAnnotations.getExportedName(m.getAnnotations());
String exportName = DeobAnnotations.getExportedName(m);
if (exportName == null)
{
continue;
}
String methodName = DeobAnnotations.getObfuscatedName(m.getAnnotations());
String methodName = DeobAnnotations.getObfuscatedName(m);
Signature obfSignature = DeobAnnotations.getObfuscatedSignature(m);
String predicate = DeobAnnotations.getDecoder(m);
@@ -379,7 +379,7 @@ public class MappingDumper
jMethod.addProperty("class", className);
jMethod.addProperty("field", methodName);
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("static", m.isStatic());

View File

@@ -8,7 +8,6 @@ import net.runelite.asm.ClassFile;
import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Annotations;
import net.runelite.deob.Deob;
import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.DeobTestProperties;
@@ -58,14 +57,12 @@ public class AnnotationCleaner
for (Field f : c.getFields())
{
Annotations an = f.getAnnotations();
String fieldName = f.getName();
String exportedName = DeobAnnotations.getExportedName(an);
String exportedName = DeobAnnotations.getExportedName(f);
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");
}
@@ -78,14 +75,12 @@ public class AnnotationCleaner
for (Method m : c.getMethods())
{
Annotations an = m.getAnnotations();
String methodName = m.getName();
String exportedName = DeobAnnotations.getExportedName(an);
String exportedName = DeobAnnotations.getExportedName(m);
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");
}
@@ -124,7 +119,7 @@ public class AnnotationCleaner
JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/niec.jar"));
}
private class OhNoException extends Exception
private static class OhNoException extends Exception
{
private OhNoException()
{

View File

@@ -105,16 +105,16 @@ public class UpdateMappingsTest
{
for (ClassFile cf : group.getClasses())
{
cf.getAnnotations().clearAnnotations();
cf.getAnnotations().clear();
for (Field f : cf.getFields())
{
f.getAnnotations().clearAnnotations();
f.getAnnotations().clear();
}
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;
String name = DeobAnnotations.getExportedName(f.getAnnotations());
String otherName = DeobAnnotations.getExportedName(otherf.getAnnotations());
String name = DeobAnnotations.getExportedName(f);
String otherName = DeobAnnotations.getExportedName(otherf);
Assert.assertEquals(name + " <-> " + otherName, name, otherName);
}
@@ -148,8 +148,8 @@ public class UpdateMappingsTest
assert otherm != null : "unable to find " + m;
String name = DeobAnnotations.getExportedName(m.getAnnotations());
String otherName = DeobAnnotations.getExportedName(otherm.getAnnotations());
String name = DeobAnnotations.getExportedName(m);
String otherName = DeobAnnotations.getExportedName(otherm);
Assert.assertEquals(name + " <-> " + otherName, name, otherName);
}

View File

@@ -36,10 +36,9 @@ import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
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.asm.attributes.Annotated;
import net.runelite.asm.signature.Signature;
import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.util.JarUtil;
import net.runelite.osb.inject.ClassHook;
import net.runelite.osb.inject.FieldHook;
@@ -88,17 +87,17 @@ public class HookImporter
{
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());
assert cf != null;
String implementsName = getAnnotation(cf.getAnnotations(), IMPLEMENTS);
String implementsName = getAnnotation(cf, IMPLEMENTS);
if (implementsName.isEmpty())
{
cf.getAnnotations().addAnnotation(IMPLEMENTS, "value", deobfuscatedClassName);
cf.addAnnotation(IMPLEMENTS, entry.getKey());
++classes;
}
@@ -127,10 +126,10 @@ public class HookImporter
assert f != null;
String exportedName = getAnnotation(f.getAnnotations(), EXPORT);
String exportedName = getAnnotation(f, EXPORT);
if (exportedName.isEmpty())
{
f.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedFieldName);
f.addAnnotation(EXPORT, deobfuscatedFieldName);
++fields;
}
}
@@ -160,10 +159,10 @@ public class HookImporter
assert m != null;
String exportedName = getAnnotation(m.getAnnotations(), EXPORT);
String exportedName = getAnnotation(m, EXPORT);
if (exportedName.isEmpty())
{
m.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedMethodName);
m.addAnnotation(EXPORT, deobfuscatedMethodName);
++methods;
}
}
@@ -193,10 +192,10 @@ public class HookImporter
assert m != null;
String exportedName = getAnnotation(m.getAnnotations(), EXPORT);
String exportedName = getAnnotation(m, EXPORT);
if (exportedName.isEmpty())
{
m.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedMethodName);
m.addAnnotation(EXPORT, deobfuscatedMethodName);
++callbacks;
}
}
@@ -214,8 +213,7 @@ public class HookImporter
return c;
}
Annotations an = c.getAnnotations();
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
if (getAnnotation(c, OBFUSCATED_NAME).equals(name))
{
return c;
}
@@ -227,8 +225,7 @@ public class HookImporter
{
for (Field f : c.getFields())
{
Annotations an = f.getAnnotations();
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
if (name.equals(DeobAnnotations.getObfuscatedName(f)))
{
return f;
}
@@ -242,8 +239,7 @@ public class HookImporter
for (Method m : c.getMethods())
{
Annotations an = m.getAnnotations();
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
if (getAnnotation(m, OBFUSCATED_NAME).equals(name))
{
Signature methodSig = getObfuscatedMethodSignature(m);
@@ -261,30 +257,15 @@ public class HookImporter
return null;
}
private String getAnnotation(Annotations an, Type type)
private String getAnnotation(Annotated an, Type type)
{
if (an == null)
{
return "";
}
for (Annotation a : an.getAnnotations())
{
if (a.getType().equals(type))
{
for (Element e : a.getElements())
{
return (String) e.getValue();
}
}
}
return "";
final var s = DeobAnnotations.getStringValue(an, type);
return s == null ? "" : s;
}
private Signature getObfuscatedMethodSignature(Method method)
{
String sig = getAnnotation(method.getAnnotations(), OBFUSCATED_SIGNATURE);
String sig = getAnnotation(method, OBFUSCATED_SIGNATURE);
if (!sig.isEmpty())
{
return toObSignature(new Signature(sig)); // if it is annoted, use that
@@ -310,8 +291,7 @@ public class HookImporter
ClassFile cf = group.findClass(t.getInternalName());
assert cf != null;
Annotations an = cf.getAnnotations();
String obfuscatedName = an.find(OBFUSCATED_NAME).getElement().getString();
String obfuscatedName = (String) cf.findAnnotation(OBFUSCATED_NAME).getValue();
return Type.getType("L" + obfuscatedName + ";", t.getDimensions());
}

View File

@@ -30,9 +30,9 @@ 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.annotation.Annotation;
import net.runelite.asm.attributes.annotation.Element;
import net.runelite.asm.Annotation;
import net.runelite.asm.attributes.Annotated;
import net.runelite.deob.DeobAnnotations;
import net.runelite.deob.util.JarUtil;
import net.runelite.runeloader.inject.AddInterfaceInstruction;
import net.runelite.runeloader.inject.GetterInjectInstruction;
@@ -73,29 +73,13 @@ public class MappingImporter
JarUtil.saveJar(group, OUT);
}
private boolean hasObfuscatedName(Annotations an, String name)
private boolean hasObfuscatedName(Annotated an, String name)
{
if (an == null)
{
return false;
}
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;
return name.equals(DeobAnnotations.getStringValue(an, OBFUSCATED_NAME));
}
private ClassFile findClassWithObfuscatedName(String name)
@@ -107,8 +91,7 @@ public class MappingImporter
return c;
}
Annotations an = c.getAnnotations();
if (this.hasObfuscatedName(an, name))
if (this.hasObfuscatedName(c, name))
{
return c;
}
@@ -120,8 +103,7 @@ public class MappingImporter
{
for (Field f : c.getFields())
{
Annotations an = f.getAnnotations();
if (this.hasObfuscatedName(an, name))
if (this.hasObfuscatedName(f, name))
{
return f;
}
@@ -131,7 +113,7 @@ public class MappingImporter
@Test
@Ignore
public void makeMappings() throws IOException
public void makeMappings()
{
InjectionModscript mod = Injection.load(MappingImporter.class.getResourceAsStream(RL_INJECTION));
int fields = 0, classes = 0;
@@ -154,12 +136,10 @@ public class MappingImporter
String attrName = gii.getGetterName();
attrName = Utils.toExportedName(attrName);
Annotations an = f.getAnnotations();
Annotation a = an.find(EXPORT);
Annotation a = f.findAnnotation(EXPORT);
if (a != null)
{
String exportedName = a.getElement().getString();
String exportedName = a.getValueString();
if (!attrName.equals(exportedName))
{
@@ -168,7 +148,7 @@ public class MappingImporter
}
else
{
an.addAnnotation(EXPORT, "value", attrName);
f.addAnnotation(EXPORT, attrName);
logger.info("Exporting field " + f + " with name " + attrName);
++fields;
@@ -184,12 +164,10 @@ public class MappingImporter
iface = iface.replace("com/runeloader/api/bridge/os/accessor/", "");
Annotations an = cf.getAnnotations();
Annotation a = an.find(IMPLEMENTS);
Annotation a = cf.findAnnotation(IMPLEMENTS);
if (a != null)
{
String implementsName = a.getElement().getString();
String implementsName = a.getValueString();
if (!iface.equals(implementsName))
{
@@ -198,7 +176,7 @@ public class MappingImporter
}
else
{
an.addAnnotation(IMPLEMENTS, "value", iface);
cf.addAnnotation(IMPLEMENTS, iface);
logger.info("Exporting class " + cf.getName() + " with name " + iface);
++classes;

View File

@@ -36,9 +36,7 @@ import net.runelite.asm.ClassGroup;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
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.asm.attributes.Annotated;
import net.runelite.asm.attributes.code.LocalVariable;
import net.runelite.asm.attributes.code.Parameter;
import net.runelite.asm.signature.Signature;
@@ -107,11 +105,11 @@ public class HookImporter
assert cf != null;
String implementsName = getAnnotation(cf.getAnnotations(), IMPLEMENTS);
String implementsName = getAnnotation(cf, IMPLEMENTS);
if (implementsName.isEmpty())
{
String deobfuscatedClassName = hc.clazz;
cf.getAnnotations().addAnnotation(IMPLEMENTS, "value", deobfuscatedClassName);
cf.addAnnotation(IMPLEMENTS, deobfuscatedClassName);
mappings.map(cf.getPoolClass(), deobfuscatedClassName);
++classes;
}
@@ -138,7 +136,7 @@ public class HookImporter
continue;
}
String exportedName = getAnnotation(f.getAnnotations(), EXPORT);
String exportedName = getAnnotation(f, EXPORT);
if (exportedName.isEmpty())
{
String deobfuscatedFieldName = fh.field;
@@ -150,7 +148,7 @@ public class HookImporter
continue;
}
f.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedFieldName);
f.addAnnotation(EXPORT, deobfuscatedFieldName);
mappings.map(f.getPoolField(), deobfuscatedFieldName);
++fields;
}
@@ -219,7 +217,7 @@ public class HookImporter
List<Method> virtualMethods = VirtualMethods.getVirtualMethods(m);
for (Method method : virtualMethods)
{
String exportedName = getAnnotation(method.getAnnotations(), EXPORT);
String exportedName = getAnnotation(method, EXPORT);
if (!exportedName.isEmpty())
{
if (!exportedName.equals(hm.method))
@@ -231,7 +229,7 @@ public class HookImporter
}
String deobfuscatedMethodName = hm.method;
m.getAnnotations().addAnnotation(EXPORT, "value", deobfuscatedMethodName);
m.addAnnotation(EXPORT, deobfuscatedMethodName);
mappings.map(m.getPoolMethod(), deobfuscatedMethodName);
++methods;
}
@@ -252,8 +250,7 @@ public class HookImporter
return c;
}
Annotations an = c.getAnnotations();
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
if (getAnnotation(c, OBFUSCATED_NAME).equals(name))
{
return c;
}
@@ -265,8 +262,7 @@ public class HookImporter
{
for (Field f : c.getFields())
{
Annotations an = f.getAnnotations();
if (getAnnotation(an, OBFUSCATED_NAME).equals(name))
if (getAnnotation(f, OBFUSCATED_NAME).equals(name))
{
return f;
}
@@ -280,8 +276,7 @@ public class HookImporter
for (Method m : c.getMethods())
{
Annotations an = m.getAnnotations();
if (m.getName().equals(name) || getAnnotation(an, OBFUSCATED_NAME).equals(name))
if (m.getName().equals(name) || getAnnotation(m, OBFUSCATED_NAME).equals(name))
{
Signature methodSig = getObfuscatedMethodSignature(m);
@@ -294,15 +289,12 @@ public class HookImporter
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)
{
for (Element e : a.getElements())
{
return (String) e.getValue();
}
return a.getValueString();
}
return "";
@@ -310,7 +302,7 @@ public class HookImporter
private Signature getObfuscatedMethodSignature(Method method)
{
String sig = getAnnotation(method.getAnnotations(), OBFUSCATED_SIGNATURE);
String sig = getAnnotation(method, OBFUSCATED_SIGNATURE);
if (sig.isEmpty())
{
return method.getDescriptor();

View File

@@ -36,7 +36,7 @@ import java.lang.annotation.Target;
})
public @interface ObfuscatedSignature
{
String signature();
String descriptor();
String garbageValue() default ""; // valid garbage value for last parameter. can't be an Object because Java.
}

View File

@@ -155,7 +155,7 @@ tasks {
register<JavaExec>("RuneLite.main()") {
group = "openosrs"
classpath = project.sourceSets.main.get().runtimeClasspath
classpath = sourceSets["main"].runtimeClasspath
enableAssertions = true
main = "net.runelite.client.RuneLite"
}

View File

@@ -930,6 +930,11 @@ public class ExternalPluginManager
log.info("Not updating external plugins since there is more than 1 client open");
return;
}
else if (developmentMode)
{
log.info("Not updating because we're running in developer mode");
return;
}
RuneLiteSplashScreen.stage(.59, "Updating external plugins");

View File

@@ -100,10 +100,8 @@ public abstract class EntityHiderMixin implements RSScene
private static boolean hideDeadNPCs;
@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")
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);
@@ -119,21 +117,16 @@ public abstract class EntityHiderMixin implements RSScene
}
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")
private static void draw2DExtras(RSActor actor, int var1, int var2, int var3, int var4, int var5)
{
throw new RuntimeException();
}
@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))
{
draw2DExtras(actor, var1, var2, var3, var4, var5);
copy$draw2DExtras(actor, var1, var2, var3, var4, var5);
}
}

View File

@@ -37,7 +37,7 @@ public abstract class ProcessClientErrorMixin implements RSClient
private static RSClient client;
@Replace("RunException_sendStackTrace")
static void rl$processClientError(String string, Throwable throwable)
static void processClientError(String string, Throwable throwable)
{
if (throwable != null)
{

View File

@@ -33,13 +33,12 @@ public abstract class RSAbstractArchiveMixin implements RSAbstractArchive
return overlayOutdated;
}
@SuppressWarnings("InfiniteRecursion")
@Copy("takeFile")
abstract byte[] rs$getConfigData(int archiveId, int fileId);
@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();
if (!OverlayIndex.hasOverlay(archiveId, groupId))

View File

@@ -42,16 +42,15 @@ public abstract class RSBufferMixin implements RSBuffer
private static BigInteger modulus;
@Copy("encryptRsa")
abstract void rs$encryptRsa(BigInteger var1, BigInteger var2);
@Replace("encryptRsa")
public void rl$encryptRsa(BigInteger exp, BigInteger mod)
@SuppressWarnings("InfiniteRecursion")
public void copy$encryptRsa(BigInteger exp, BigInteger mod)
{
if (modulus != null)
{
mod = modulus;
}
rs$encryptRsa(exp, mod);
copy$encryptRsa(exp, mod);
}
}

View File

@@ -957,15 +957,11 @@ public abstract class RSClientMixin implements RSClient
}
@Copy("runWidgetOnLoadListener")
public static void rs$runWidgetOnLoadListener(int groupId)
{
throw new RuntimeException();
}
@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();
boolean loaded = widgets != null && widgets[groupId] != null;
@@ -1147,19 +1143,14 @@ public abstract class RSClientMixin implements RSClient
}
@Copy("findItemDefinitions")
public static void rs$findItemDefinitions(String var0, boolean var1)
{
throw new RuntimeException();
}
@Replace("findItemDefinitions")
public static void rl$findItemDefinitions(String var0, boolean var1)
public static void copy$findItemDefinitions(String var0, boolean var1)
{
GrandExchangeSearched event = new GrandExchangeSearched();
client.getCallbacks().post(GrandExchangeSearched.class, event);
if (!event.isConsumed())
{
rs$findItemDefinitions(var0, var1);
copy$findItemDefinitions(var0, var1);
}
}
@@ -1379,13 +1370,8 @@ public abstract class RSClientMixin implements RSClient
}
@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")
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;
if (target != null && target.startsWith("!AUTHENTIC"))
@@ -1429,7 +1415,7 @@ public abstract class RSClientMixin implements RSClient
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);
}
@@ -1697,15 +1683,11 @@ public abstract class RSClientMixin implements RSClient
}
@Copy("shouldLeftClickOpenMenu")
boolean rs$shouldLeftClickOpenMenu()
{
throw new RuntimeException();
}
@Replace("shouldLeftClickOpenMenu")
boolean rl$shouldLeftClickOpenMenu()
@SuppressWarnings("InfiniteRecursion")
boolean copy$shouldLeftClickOpenMenu()
{
if (rs$shouldLeftClickOpenMenu())
if (copy$shouldLeftClickOpenMenu())
{
return true;
}
@@ -1729,20 +1711,15 @@ public abstract class RSClientMixin implements RSClient
}
@Copy("menu")
void rs$menu()
{
throw new RuntimeException();
}
@Replace("menu")
void rl$menu()
void copy$menu()
{
Menu menu = Menu.MENU;
menu.reset();
getCallbacks().post(Menu.class, menu);
if (menu.shouldRun())
{
rs$menu();
copy$menu();
}
}
@@ -1810,14 +1787,11 @@ public abstract class RSClientMixin implements RSClient
}
@Copy("forceDisconnect")
static void rs$forceDisconnect(int reason)
{
}
@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)
{
@@ -1844,15 +1818,11 @@ public abstract class RSClientMixin implements RSClient
@Copy("changeGameOptions")
public static void rs$changeGameOptions(int var0)
{
throw new RuntimeException();
}
@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();
if (type == 3 || type == 4 || type == 10)

View File

@@ -46,11 +46,10 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
@Inject
public int animationID;
@SuppressWarnings("InfiniteRecursion")
@Copy("getModel")
public abstract RSModel rs$getModel();
@Replace("getModel")
public RSModel rl$getModel()
public RSModel copy$getModel()
{
try
{
@@ -61,7 +60,7 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
{
setAnimFrame((animFrame ^ Integer.MIN_VALUE) & 0xFFFF);
}
return rs$getModel();
return copy$getModel();
}
finally
{

View File

@@ -52,12 +52,10 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
}
@Copy("getShiftClickIndex")
abstract int rs$getShiftClickActionIndex();
@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
@@ -77,14 +75,12 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
}
@Copy("getModel")
public abstract RSModel rs$getModel(int quantity);
@Replace("getModel")
public RSModel getModel(int quantity)
public RSModel copy$getModel(int quantity)
{
if (modelOverride == -1)
{
return rs$getModel(quantity);
return copy$getModel(quantity);
}
return client.getRSItemDefinition(modelOverride).getModel(quantity);

View File

@@ -18,45 +18,39 @@ public abstract class RSKeyHandlerMixin implements RSKeyHandler
@Shadow("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
@Copy("keyPressed")
@Replace("keyPressed")
public final synchronized void keyPressed(KeyEvent keyEvent)
{
client.getCallbacks().keyPressed(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyPressed(keyEvent);
keyPressed(keyEvent);
}
}
@Override
@Copy("keyReleased")
@Replace("keyReleased")
public final synchronized void keyReleased(KeyEvent keyEvent)
{
client.getCallbacks().keyReleased(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyReleased(keyEvent);
keyReleased(keyEvent);
}
}
@Override
@Copy("keyTyped")
@Replace("keyTyped")
public final void keyTyped(KeyEvent keyEvent)
{
client.getCallbacks().keyTyped(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyTyped(keyEvent);
keyTyped(keyEvent);
}
}

View File

@@ -38,17 +38,12 @@ public abstract class RSLoginScreenAnimationMixin implements RSLoginScreenAnimat
private static RSClient client;
@Copy("draw")
void rs$draw(int var1, int var2)
{
throw new RuntimeException();
}
@Replace("draw")
void rl$draw(int var1, int var2)
void copy$draw(int var1, int var2)
{
if (client.shouldRenderLoginScreenFire())
{
rs$draw(var1, var2);
copy$draw(var1, var2);
}
}
}

View File

@@ -47,14 +47,13 @@ public abstract class RSModelDataMixin implements RSModelData
private float[][] faceTextureVCoordinates;
@Copy("toModel")
public abstract Model rs$light(int ambient, int contrast, int var3, int var4, int var5);
@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);
Model model = rs$light(ambient, contrast, var3, var4, var5);
Model model = copy$light(ambient, contrast, var3, var4, var5);
if (model == null)
{
return null;

View File

@@ -160,13 +160,12 @@ public abstract class RSModelMixin implements RSModel
}
@Copy("contourGround")
public abstract Model rs$contourGround(int[][] tileHeights, int packedX, int height, int packedY, boolean copy, int contouredGround);
@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
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)
{
RSModel rsModel = (RSModel) model;
@@ -177,15 +176,13 @@ public abstract class RSModelMixin implements RSModel
}
@Copy("drawFace")
public abstract void rs$drawFace(int face);
@Replace("drawFace")
public void rl$drawFace(int face)
public void copy$drawFace(int face)
{
DrawCallbacks callbacks = client.getDrawCallbacks();
if (callbacks == null || !callbacks.drawFace(this, face))
{
rs$drawFace(face);
copy$drawFace(face);
}
}

View File

@@ -18,28 +18,8 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
@Inject
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
@Copy("mousePressed")
@Replace("mousePressed")
public synchronized void mousePressed(MouseEvent mouseEvent)
{
@@ -52,7 +32,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++;
try
{
rs$mousePressed(mouseEvent);
mousePressed(mouseEvent);
}
finally
{
@@ -62,6 +42,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
}
@Override
@Copy("mouseReleased")
@Replace("mouseReleased")
public synchronized void mouseReleased(MouseEvent mouseEvent)
{
@@ -74,7 +55,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++;
try
{
rs$mouseReleased(mouseEvent);
mouseReleased(mouseEvent);
}
finally
{
@@ -84,17 +65,19 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
}
@Override
@Copy("mouseClicked")
@Replace("mouseClicked")
public void mouseClicked(MouseEvent event)
{
event = client.getCallbacks().mouseClicked(event);
if (!event.isConsumed())
{
rs$mouseClicked(event);
mouseClicked(event);
}
}
@Override
@Copy("mouseEntered")
@Replace("mouseEntered")
public synchronized void mouseEntered(MouseEvent mouseEvent)
{
@@ -107,7 +90,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++;
try
{
rs$mouseEntered(mouseEvent);
mouseEntered(mouseEvent);
}
finally
{
@@ -118,6 +101,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
@Override
@Copy("mouseExited")
@Replace("mouseExited")
public synchronized void mouseExited(MouseEvent mouseEvent)
{
@@ -130,7 +114,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++;
try
{
rs$mouseExited(mouseEvent);
mouseExited(mouseEvent);
}
finally
{
@@ -140,6 +124,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
}
@Override
@Copy("mouseDragged")
@Replace("mouseDragged")
public synchronized void mouseDragged(MouseEvent mouseEvent)
{
@@ -152,7 +137,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++;
try
{
rs$mouseDragged(mouseEvent);
mouseDragged(mouseEvent);
}
finally
{
@@ -162,6 +147,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
}
@Override
@Copy("mouseMoved")
@Replace("mouseMoved")
public synchronized void mouseMoved(MouseEvent mouseEvent)
{
@@ -174,7 +160,7 @@ public abstract class RSMouseHandlerMixin implements RSMouseHandler
isInEvent++;
try
{
rs$mouseMoved(mouseEvent);
mouseMoved(mouseEvent);
}
finally
{

View File

@@ -38,17 +38,15 @@ public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
@Shadow("client")
private static RSClient client;
@Copy("mouseWheelMoved")
abstract void rs$mouseWheelMoved(MouseWheelEvent event);
@Override
@Copy("mouseWheelMoved")
@Replace("mouseWheelMoved")
public void mouseWheelMoved(MouseWheelEvent event)
{
event = client.getCallbacks().mouseWheelMoved(event);
if (!event.isConsumed())
{
rs$mouseWheelMoved(event);
mouseWheelMoved(event);
}
}
}

View File

@@ -119,15 +119,14 @@ public abstract class RSNPCMixin implements RSNPC
}
@Copy("getModel")
public abstract RSModel rs$getModel();
@Replace("getModel")
public RSModel rl$getModel()
@SuppressWarnings("InfiniteRecursion")
public RSModel copy$getModel()
{
if (!client.isInterpolateNpcAnimations()
|| getAnimation() == AnimationID.HELLHOUND_DEFENCE)
{
return rs$getModel();
return copy$getModel();
}
int actionFrame = getActionFrame();
int poseFrame = getPoseFrame();
@@ -139,7 +138,7 @@ public abstract class RSNPCMixin implements RSNPC
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
return rs$getModel();
return copy$getModel();
}
finally
{

View File

@@ -245,15 +245,14 @@ public abstract class RSPlayerMixin implements RSPlayer
return model.getConvexHull(getX(), getY(), getOrientation(), tileHeight);
}
@SuppressWarnings("InfiniteRecursion")
@Copy("getModel")
public abstract RSModel rs$getModel();
@Replace("getModel")
public RSModel rl$getModel()
public RSModel copy$getModel()
{
if (!client.isInterpolatePlayerAnimations())
{
return rs$getModel();
return copy$getModel();
}
int actionFrame = getActionFrame();
int poseFrame = getPoseFrame();
@@ -265,7 +264,7 @@ public abstract class RSPlayerMixin implements RSPlayer
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
return rs$getModel();
return copy$getModel();
}
finally
{
@@ -290,14 +289,13 @@ public abstract class RSPlayerMixin implements RSPlayer
}
@Copy("read")
public abstract void rs$read(RSBuffer buffer);
@Replace("read")
public void rl$read(RSBuffer buffer)
@SuppressWarnings("InfiniteRecursion")
public void copy$read(RSBuffer buffer)
{
final long appearanceHash = getPlayerAppearance() == null ? 0 : getPlayerAppearance().getHash();
rs$read(buffer);
this.copy$read(buffer);
if (getPlayerAppearance().getHash() != appearanceHash)
{

View File

@@ -28,13 +28,8 @@ public abstract class RSRasterizer2DMixin implements RSClient
}
@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")
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 startX = client.getStartX();
@@ -45,7 +40,7 @@ public abstract class RSRasterizer2DMixin implements RSClient
if (!client.isGpu())
{
rs$drawGradientAlpha(var0, var1, var2, var3, var4, var5, var6, var7);
copy$drawGradientAlpha(var0, var1, var2, var3, var4, var5, var6, var7);
return;
}
@@ -110,13 +105,8 @@ public abstract class RSRasterizer2DMixin implements RSClient
}
@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")
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 height = client.getGraphicsPixelsHeight();
@@ -124,7 +114,7 @@ public abstract class RSRasterizer2DMixin implements RSClient
if (!client.isGpu())
{
rs$raster2d7(var0, var1, var2, var3, var4, var5, var6, var7);
copy$raster2d7(var0, var1, var2, var3, var4, var5, var6, var7);
return;
}

View File

@@ -81,7 +81,7 @@ public abstract class RSSceneMixin implements RSScene
private static int rl$drawDistance;
@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();
if (drawCallbacks != null)
@@ -410,12 +410,11 @@ public abstract class RSSceneMixin implements RSScene
}
@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")
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];
if (tile != null)
{
@@ -428,12 +427,11 @@ public abstract class RSSceneMixin implements RSScene
}
@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")
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];
if (tile != null)
{
@@ -446,12 +444,11 @@ public abstract class RSSceneMixin implements RSScene
}
@Copy("newFloorDecoration")
abstract public void rs$groundObjectSpawned(int plane, int x, int y, int floor, Entity var5, long hash, int var7);
@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];
if (tile != null)
{
@@ -464,12 +461,11 @@ public abstract class RSSceneMixin implements RSScene
}
@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")
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];
if (tile != null)
{
@@ -482,16 +478,14 @@ public abstract class RSSceneMixin implements RSScene
}
@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")
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())
{
try
{
rs$drawTileUnderlay(tile, z, pitchSin, pitchCos, yawSin, yawCos, x, y);
copy$drawTileUnderlay(tile, z, pitchSin, pitchCos, yawSin, yawCos, x, y);
}
catch (Exception ex)
{
@@ -609,14 +603,12 @@ public abstract class RSSceneMixin implements RSScene
}
@Copy("drawTileOverlay")
abstract public void rs$drawTileOverlay(TileModel tile, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y);
@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())
{
rs$drawTileOverlay(tile, pitchSin, pitchCos, yawSin, yawCos, tileX, tileY);
copy$drawTileOverlay(tile, pitchSin, pitchCos, yawSin, yawCos, tileX, tileY);
return;
}
@@ -829,14 +821,12 @@ public abstract class RSSceneMixin implements RSScene
}
@Copy("drawTileMinimap")
abstract void rs$drawTile(int[] pixels, int pixelOffset, int width, int z, int x, int y);
@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)
{
rs$drawTile(pixels, pixelOffset, width, z, x, y);
copy$drawTile(pixels, pixelOffset, width, z, x, y);
return;
}
Tile tile = getTiles()[z][x][y];

View File

@@ -16,10 +16,9 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
private static RSClient client;
@Copy("applyTransformations")
public abstract RSModel rs$applyTransformations(RSModel model, int actionFrame, RSSequenceDefinition poseSeq, int poseFrame);
@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
if (actionFrame < 0)
@@ -32,19 +31,17 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
int packed = poseFrame ^ Integer.MIN_VALUE;
poseFrame = packed & 0xFFFF;
}
return rs$applyTransformations(model, actionFrame, poseSeq, poseFrame);
return copy$applyTransformations(model, actionFrame, poseSeq, poseFrame);
}
@Copy("transformActorModel")
public abstract RSModel rs$transformActorModel(RSModel model, int frameIdx);
@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
if (frame >= 0)
{
return rs$transformActorModel(model, frame);
return copy$transformActorModel(model, frame);
}
// remove flag to check if the frame has been modified
@@ -84,15 +81,13 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
}
@Copy("transformObjectModel")
public abstract RSModel rs$transformObjectModel(RSModel model, int frame, int rotation);
@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
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
@@ -159,15 +154,13 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
}
@Copy("transformSpotAnimationModel")
public abstract RSModel rs$transformSpotAnimationModel(RSModel model, int frame);
@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
if (frame >= 0)
{
return rs$transformSpotAnimationModel(model, frame);
return copy$transformSpotAnimationModel(model, frame);
}
// remove flag to check if the frame has been modified
@@ -206,15 +199,13 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
}
@Copy("transformWidgetModel")
public abstract RSModel rs$transformWidgetModel(RSModel model, int frame);
@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
if (frame >= 0)
{
return rs$transformWidgetModel(model, frame);
return copy$transformWidgetModel(model, frame);
}
// remove flag to check if the frame has been modified

View File

@@ -147,16 +147,13 @@ public abstract class RSSpriteMixin implements RSSprite
}
@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")
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)
{
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;
}
try

View File

@@ -45,17 +45,15 @@ public abstract class RSTextureMixin implements RSTexture
private float rl$v;
@Copy("animate")
public abstract void rs$animate(int diff);
@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
// based on how long it was since the last tick. On GPU we let the plugin manage this
// which will calculate uvs instead.
if (!client.isGpu())
{
rs$animate(diff);
copy$animate(diff);
return;
}
assert client.getDrawCallbacks() != null;

View File

@@ -590,16 +590,15 @@ public abstract class RSWidgetMixin implements RSWidget
}
@Copy("getModel")
public abstract RSModel rs$getModel(RSSequenceDefinition sequence, int frame, boolean alternate, RSPlayerAppearance playerComposition);
@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())
{
frame = frame | getModelFrameCycle() << 16 | Integer.MIN_VALUE;
}
return rs$getModel(sequence, frame, alternate, playerComposition);
return copy$getModel(sequence, frame, alternate, playerComposition);
}
@Inject

View File

@@ -138,13 +138,8 @@ public abstract class ScriptVMMixin implements RSClient
}
@Copy("runScript")
static void rs$runScript(RSScriptEvent event, int maxExecutionTime)
{
throw new RuntimeException();
}
@Replace("runScript")
static void rl$runScript(RSScriptEvent event, int maxExecutionTime)
static void copy$runScript(RSScriptEvent event, int maxExecutionTime)
{
Object[] arguments = event.getArguments();
assert arguments != null && arguments.length > 0;
@@ -164,7 +159,7 @@ public abstract class ScriptVMMixin implements RSClient
try
{
rootScriptEvent = event;
rs$runScript(event, maxExecutionTime);
copy$runScript(event, maxExecutionTime);
}
finally
{

View File

@@ -57,13 +57,9 @@ public abstract class SoundEffectMixin implements RSClient
private static int lastSoundEffectSourceNPCid;
@Copy("updateActorSequence")
public static void rs$updateActorSequence(RSActor actor, int size)
{
throw new RuntimeException();
}
@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)
{
@@ -71,7 +67,7 @@ public abstract class SoundEffectMixin implements RSClient
}
lastSoundEffectSourceActor = actor;
rs$updateActorSequence(actor, size);
copy$updateActorSequence(actor, size);
lastSoundEffectSourceActor = null;
}

View File

@@ -35,13 +35,8 @@ public abstract class SpriteMixin implements RSClient
}
@Copy("SpriteBuffer_getSprite")
public static RSSprite rs$loadSprite(RSAbstractArchive var0, int var1, int var2)
{
throw new RuntimeException();
}
@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);
@@ -50,6 +45,6 @@ public abstract class SpriteMixin implements RSClient
return (RSSprite) sprite;
}
return rs$loadSprite(var0, var1, var2);
return copy$loadSprite(var0, var1, var2);
}
}

View File

@@ -15,10 +15,9 @@ public abstract class StretchedModeMaxSizeMixin implements RSGameShell
private static RSClient client;
@Copy("resizeCanvas")
abstract void rs$resizeCanvas();
@Replace("resizeCanvas")
public void rl$resizeCanvas()
@SuppressWarnings("InfiniteRecursion")
public void copy$resizeCanvas()
{
if (client.isStretchedEnabled())
{
@@ -33,20 +32,18 @@ public abstract class StretchedModeMaxSizeMixin implements RSGameShell
}
}
rs$resizeCanvas();
copy$resizeCanvas();
}
@Copy("setMaxCanvasSize")
abstract void rs$setMaxCanvasSize(int width, int height);
@Replace("setMaxCanvasSize")
public void rl$setMaxCanvasSize(int width, int height)
public void copy$setMaxCanvasSize(int width, int height)
{
if (client.isStretchedEnabled() && client.isResized())
{
return;
}
rs$setMaxCanvasSize(width, height);
copy$setMaxCanvasSize(width, height);
}
}

View File

@@ -17,13 +17,8 @@ public abstract class WidgetSpriteMixin implements RSWidget
private static Map<Integer, Sprite> widgetSpriteOverrides;
@Copy("getSprite")
public RSSprite rs$getWidgetSprite(boolean var1)
{
throw new RuntimeException();
}
@Replace("getSprite")
public RSSprite rl$getWidgetSprite(boolean var1)
public RSSprite copy$getWidgetSprite(boolean var1)
{
if (getSpriteId() != -1)
{
@@ -35,7 +30,7 @@ public abstract class WidgetSpriteMixin implements RSWidget
}
}
return rs$getWidgetSprite(var1);
return copy$getWidgetSprite(var1);
}
@Inject

View File

@@ -9,7 +9,7 @@ import net.runelite.mapping.ObfuscatedSignature;
public abstract class AbstractArchive {
@ObfuscatedName("h")
@ObfuscatedSignature(
signature = "Lmu;"
descriptor = "Lmu;"
)
@Export("gzipDecompressor")
static GZipDecompressor gzipDecompressor;
@@ -32,7 +32,7 @@ public abstract class AbstractArchive {
int[] groupNameHashes;
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "Lmh;"
descriptor = "Lmh;"
)
@Export("groupNameHashTable")
IntHashTable groupNameHashTable;
@@ -53,7 +53,7 @@ public abstract class AbstractArchive {
int[][] fileNameHashes;
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "[Lmh;"
descriptor = "[Lmh;"
)
@Export("fileNameHashTables")
IntHashTable[] fileNameHashTables;
@@ -88,7 +88,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "([BB)V",
descriptor = "([BB)V",
garbageValue = "-101"
)
@Export("decodeIndex")
@@ -221,7 +221,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(II)V",
descriptor = "(II)V",
garbageValue = "479482423"
)
@Export("loadRegionFromGroup")
@@ -230,7 +230,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(III)[B",
descriptor = "(III)[B",
garbageValue = "1860640327"
)
@Export("takeFile")
@@ -240,7 +240,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(II[II)[B",
descriptor = "(II[II)[B",
garbageValue = "-1226634846"
)
@Export("takeFileEncrypted")
@@ -270,7 +270,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "(III)Z",
descriptor = "(III)Z",
garbageValue = "1957538709"
)
@Export("tryLoadFile")
@@ -291,7 +291,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("g")
@ObfuscatedSignature(
signature = "(II)Z",
descriptor = "(II)Z",
garbageValue = "-2058273834"
)
public boolean method4359(int var1) {
@@ -306,7 +306,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("n")
@ObfuscatedSignature(
signature = "(II)Z",
descriptor = "(II)Z",
garbageValue = "1896348837"
)
@Export("tryLoadGroup")
@@ -321,7 +321,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "(B)Z",
descriptor = "(B)Z",
garbageValue = "0"
)
@Export("isFullyLoaded")
@@ -343,7 +343,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("a")
@ObfuscatedSignature(
signature = "(II)I",
descriptor = "(II)I",
garbageValue = "-1350822089"
)
@Export("groupLoadPercent")
@@ -353,7 +353,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("z")
@ObfuscatedSignature(
signature = "(II)[B",
descriptor = "(II)[B",
garbageValue = "1718789334"
)
@Export("takeFileFlat")
@@ -369,7 +369,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "(III)[B",
descriptor = "(III)[B",
garbageValue = "490044156"
)
@Export("getFile")
@@ -395,7 +395,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("y")
@ObfuscatedSignature(
signature = "(II)[B",
descriptor = "(II)[B",
garbageValue = "1362853135"
)
@Export("getFileFlat")
@@ -411,7 +411,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("c")
@ObfuscatedSignature(
signature = "(II)V",
descriptor = "(II)V",
garbageValue = "-1560066319"
)
@Export("loadGroup")
@@ -420,7 +420,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("h")
@ObfuscatedSignature(
signature = "(IB)[I",
descriptor = "(IB)[I",
garbageValue = "-56"
)
@Export("getGroupFileIds")
@@ -430,7 +430,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("k")
@ObfuscatedSignature(
signature = "(II)I",
descriptor = "(II)I",
garbageValue = "-888140327"
)
@Export("getGroupFileCount")
@@ -440,7 +440,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("r")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "-763058439"
)
@Export("getGroupCount")
@@ -450,7 +450,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("d")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "-1760033757"
)
@Export("clearGroups")
@@ -463,7 +463,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("e")
@ObfuscatedSignature(
signature = "(II)V",
descriptor = "(II)V",
garbageValue = "-546235261"
)
@Export("clearFilesGroup")
@@ -476,7 +476,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("l")
@ObfuscatedSignature(
signature = "(B)V",
descriptor = "(B)V",
garbageValue = "1"
)
@Export("clearFiles")
@@ -493,7 +493,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("t")
@ObfuscatedSignature(
signature = "(I[II)Z",
descriptor = "(I[II)Z",
garbageValue = "-1692394825"
)
@Export("buildFiles")
@@ -618,7 +618,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("x")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;I)I",
descriptor = "(Ljava/lang/String;I)I",
garbageValue = "-1113782685"
)
@Export("getGroupId")
@@ -629,7 +629,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ah")
@ObfuscatedSignature(
signature = "(ILjava/lang/String;I)I",
descriptor = "(ILjava/lang/String;I)I",
garbageValue = "1362853135"
)
@Export("getFileId")
@@ -640,7 +640,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ai")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;I)Z",
descriptor = "(Ljava/lang/String;Ljava/lang/String;I)Z",
garbageValue = "-1310066556"
)
@Export("isValidFileName")
@@ -658,7 +658,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ao")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;I)[B",
descriptor = "(Ljava/lang/String;Ljava/lang/String;I)[B",
garbageValue = "-222408314"
)
@Export("takeFileByNames")
@@ -672,7 +672,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ae")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;I)Z",
descriptor = "(Ljava/lang/String;Ljava/lang/String;I)Z",
garbageValue = "-778364429"
)
@Export("tryLoadFileByNames")
@@ -686,7 +686,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ax")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;B)Z",
descriptor = "(Ljava/lang/String;B)Z",
garbageValue = "-81"
)
@Export("tryLoadGroupByName")
@@ -698,7 +698,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ag")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;I)V",
descriptor = "(Ljava/lang/String;I)V",
garbageValue = "-1143877885"
)
@Export("loadRegionFromName")
@@ -712,7 +712,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("ab")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;I)I",
descriptor = "(Ljava/lang/String;I)I",
garbageValue = "-252379742"
)
@Export("groupLoadPercentByName")
@@ -724,7 +724,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(Lkn;IIIIIII)V",
descriptor = "(Lkn;IIIIIII)V",
garbageValue = "-1571118584"
)
@Export("loadTerrain")
@@ -790,7 +790,7 @@ public abstract class AbstractArchive {
@ObfuscatedName("gr")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "682759182"
)
static final int method4411() {

View File

@@ -11,7 +11,7 @@ public abstract class AbstractByteArrayCopier {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(I)[B",
descriptor = "(I)[B",
garbageValue = "300747627"
)
@Export("get")
@@ -19,7 +19,7 @@ public abstract class AbstractByteArrayCopier {
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "([BB)V",
descriptor = "([BB)V",
garbageValue = "92"
)
@Export("set")

View File

@@ -9,7 +9,7 @@ import net.runelite.mapping.ObfuscatedSignature;
public abstract class AbstractFont extends Rasterizer2D {
@ObfuscatedName("z")
@ObfuscatedSignature(
signature = "[Llh;"
descriptor = "[Llh;"
)
@Export("AbstractFont_modIconSprites")
public static IndexedSprite[] AbstractFont_modIconSprites;

View File

@@ -28,7 +28,7 @@ public abstract class AbstractRasterProvider {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(IIB)V",
descriptor = "(IIB)V",
garbageValue = "-5"
)
@Export("drawFull")
@@ -36,7 +36,7 @@ public abstract class AbstractRasterProvider {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(IIIII)V",
descriptor = "(IIIII)V",
garbageValue = "-1334771637"
)
@Export("draw")
@@ -44,7 +44,7 @@ public abstract class AbstractRasterProvider {
@ObfuscatedName("k")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "25855118"
)
@Export("apply")

View File

@@ -12,7 +12,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "-768493590"
)
@Export("close")
@@ -20,7 +20,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(B)I",
descriptor = "(B)I",
garbageValue = "-8"
)
@Export("readUnsignedByte")
@@ -28,7 +28,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "-1942767880"
)
@Export("available")
@@ -36,7 +36,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(II)Z",
descriptor = "(II)Z",
garbageValue = "1355091335"
)
@Export("isAvailable")
@@ -44,7 +44,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "([BIIB)I",
descriptor = "([BIIB)I",
garbageValue = "37"
)
@Export("read")
@@ -52,7 +52,7 @@ public abstract class AbstractSocket {
@ObfuscatedName("n")
@ObfuscatedSignature(
signature = "([BIIB)V",
descriptor = "([BIIB)V",
garbageValue = "-105"
)
@Export("write")

View File

@@ -23,7 +23,7 @@ public abstract class AbstractUserComparator implements Comparator {
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "(Ljava/util/Comparator;S)V",
descriptor = "(Ljava/util/Comparator;S)V",
garbageValue = "-28900"
)
@Export("addComparator")
@@ -38,7 +38,7 @@ public abstract class AbstractUserComparator implements Comparator {
@ObfuscatedName("a")
@ObfuscatedSignature(
signature = "(Ljf;Ljf;I)I",
descriptor = "(Ljf;Ljf;I)I",
garbageValue = "864234218"
)
@Export("compareUser")

View File

@@ -69,7 +69,7 @@ public abstract class AbstractWorldMapData {
byte[][][] field175;
@ObfuscatedName("c")
@ObfuscatedSignature(
signature = "[[[[Lak;"
descriptor = "[[[[Lak;"
)
@Export("decorations")
WorldMapDecoration[][][][] decorations;
@@ -88,7 +88,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(Lkn;I)V",
descriptor = "(Lkn;I)V",
garbageValue = "-1774414997"
)
@Export("readGeography")
@@ -96,7 +96,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "(I)Z",
descriptor = "(I)Z",
garbageValue = "923610125"
)
@Export("isFullyLoaded")
@@ -106,7 +106,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("a")
@ObfuscatedSignature(
signature = "(Lic;S)V",
descriptor = "(Lic;S)V",
garbageValue = "19318"
)
@Export("loadGeography")
@@ -124,7 +124,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("z")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "1097959131"
)
@Export("reset")
@@ -140,7 +140,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "(IILkn;I)V",
descriptor = "(IILkn;I)V",
garbageValue = "929230318"
)
@Export("readTile")
@@ -158,7 +158,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("y")
@ObfuscatedSignature(
signature = "(IILkn;II)V",
descriptor = "(IILkn;II)V",
garbageValue = "1830113999"
)
void method319(int var1, int var2, Buffer var3, int var4) {
@@ -172,7 +172,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("c")
@ObfuscatedSignature(
signature = "(IILkn;IB)V",
descriptor = "(IILkn;IB)V",
garbageValue = "73"
)
void method320(int var1, int var2, Buffer var3, int var4) {
@@ -216,7 +216,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("h")
@ObfuscatedSignature(
signature = "(B)I",
descriptor = "(B)I",
garbageValue = "3"
)
@Export("getRegionX")
@@ -226,7 +226,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("k")
@ObfuscatedSignature(
signature = "(B)I",
descriptor = "(B)I",
garbageValue = "-4"
)
@Export("getRegionY")
@@ -236,7 +236,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(Ljava/awt/Component;I)V",
descriptor = "(Ljava/awt/Component;I)V",
garbageValue = "-1541126292"
)
static void method342(Component var0) {
@@ -247,7 +247,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("g")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "2015859206"
)
public static void method343() {
@@ -257,7 +257,7 @@ public abstract class AbstractWorldMapData {
@ObfuscatedName("a")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "324919704"
)
static final void method328() {

View File

@@ -9,19 +9,19 @@ import net.runelite.mapping.ObfuscatedSignature;
public abstract class AbstractWorldMapIcon {
@ObfuscatedName("es")
@ObfuscatedSignature(
signature = "Lig;"
descriptor = "Lig;"
)
@Export("archive17")
static Archive archive17;
@ObfuscatedName("n")
@ObfuscatedSignature(
signature = "Lhg;"
descriptor = "Lhg;"
)
@Export("coord2")
public final Coord coord2;
@ObfuscatedName("u")
@ObfuscatedSignature(
signature = "Lhg;"
descriptor = "Lhg;"
)
@Export("coord1")
public final Coord coord1;
@@ -39,7 +39,7 @@ public abstract class AbstractWorldMapIcon {
int screenY;
@ObfuscatedSignature(
signature = "(Lhg;Lhg;)V"
descriptor = "(Lhg;Lhg;)V"
)
AbstractWorldMapIcon(Coord var1, Coord var2) {
this.coord1 = var1;
@@ -48,7 +48,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(B)I",
descriptor = "(B)I",
garbageValue = "0"
)
@Export("getElement")
@@ -56,7 +56,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(B)Lar;",
descriptor = "(B)Lar;",
garbageValue = "35"
)
@Export("getLabel")
@@ -64,7 +64,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "1804331962"
)
@Export("getSubWidth")
@@ -72,7 +72,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "-1265869629"
)
@Export("getSubHeight")
@@ -80,7 +80,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("t")
@ObfuscatedSignature(
signature = "(III)Z",
descriptor = "(III)Z",
garbageValue = "422348755"
)
@Export("fitsScreen")
@@ -94,7 +94,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("x")
@ObfuscatedSignature(
signature = "(I)Z",
descriptor = "(I)Z",
garbageValue = "807957820"
)
@Export("hasValidElement")
@@ -104,7 +104,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("ah")
@ObfuscatedSignature(
signature = "(III)Z",
descriptor = "(III)Z",
garbageValue = "872444562"
)
@Export("elementFitsScreen")
@@ -158,7 +158,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("ai")
@ObfuscatedSignature(
signature = "(IIB)Z",
descriptor = "(IIB)Z",
garbageValue = "1"
)
@Export("labelFitsScreen")
@@ -175,7 +175,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "-288699605"
)
public static void method687() {
@@ -194,7 +194,7 @@ public abstract class AbstractWorldMapIcon {
@ObfuscatedName("fk")
@ObfuscatedSignature(
signature = "(IIII)V",
descriptor = "(IIII)V",
garbageValue = "-886030498"
)
@Export("queueSoundEffect")

View File

@@ -58,7 +58,7 @@ public final class AccessFile {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "([BIII)V",
descriptor = "([BIII)V",
garbageValue = "239881906"
)
@Export("write")
@@ -75,7 +75,7 @@ public final class AccessFile {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "-1767391731"
)
@Export("close")
@@ -85,7 +85,7 @@ public final class AccessFile {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(ZB)V",
descriptor = "(ZB)V",
garbageValue = "-19"
)
@Export("closeSync")
@@ -106,7 +106,7 @@ public final class AccessFile {
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "(I)J",
descriptor = "(I)J",
garbageValue = "997596889"
)
@Export("length")
@@ -116,7 +116,7 @@ public final class AccessFile {
@ObfuscatedName("g")
@ObfuscatedSignature(
signature = "([BIII)I",
descriptor = "([BIII)I",
garbageValue = "-1991806699"
)
@Export("read")

View File

@@ -133,7 +133,7 @@ public abstract class Actor extends Entity {
int[] hitSplatValues2;
@ObfuscatedName("bf")
@ObfuscatedSignature(
signature = "Ljx;"
descriptor = "Ljx;"
)
@Export("healthBars")
IterableNodeDeque healthBars;
@@ -366,7 +366,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("c")
@ObfuscatedSignature(
signature = "(B)Z",
descriptor = "(B)Z",
garbageValue = "1"
)
@Export("isVisible")
@@ -376,7 +376,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("bg")
@ObfuscatedSignature(
signature = "(B)V",
descriptor = "(B)V",
garbageValue = "78"
)
final void method1810() {
@@ -386,7 +386,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("be")
@ObfuscatedSignature(
signature = "(IIIIIII)V",
descriptor = "(IIIIIII)V",
garbageValue = "-1007174032"
)
@Export("addHitSplat")
@@ -481,7 +481,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("bf")
@ObfuscatedSignature(
signature = "(IIIIIII)V",
descriptor = "(IIIIIII)V",
garbageValue = "-680285813"
)
@Export("addHealthBar")
@@ -543,7 +543,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("ba")
@ObfuscatedSignature(
signature = "(IB)V",
descriptor = "(IB)V",
garbageValue = "43"
)
@Export("removeHealthBar")
@@ -561,7 +561,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("n")
@ObfuscatedSignature(
signature = "(Lch;Lch;IZI)I",
descriptor = "(Lch;Lch;IZI)I",
garbageValue = "-1172543926"
)
@Export("compareWorlds")
@@ -609,7 +609,7 @@ public abstract class Actor extends Entity {
@ObfuscatedName("aj")
@ObfuscatedSignature(
signature = "([BIIB)I",
descriptor = "([BIIB)I",
garbageValue = "46"
)
static int method1822(byte[] var0, int var1, int var2) {

View File

@@ -16,7 +16,7 @@ public class Animation {
static int[] field1663;
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "Ler;"
descriptor = "Ler;"
)
@Export("skeleton")
Skeleton skeleton;
@@ -47,7 +47,7 @@ public class Animation {
}
@ObfuscatedSignature(
signature = "([BLer;)V"
descriptor = "([BLer;)V"
)
Animation(byte[] var1, Skeleton var2) {
this.skeleton = null;

View File

@@ -24,7 +24,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(IIILfz;I)Z",
descriptor = "(IIILfz;I)Z",
garbageValue = "-1966963917"
)
@Export("hasArrived")
@@ -34,7 +34,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("ha")
@ObfuscatedSignature(
signature = "(Lby;IIBI)V",
descriptor = "(Lby;IIBI)V",
garbageValue = "-549376931"
)
static final void method1284(Player var0, int var1, int var2, byte var3) {
@@ -56,7 +56,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("hc")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;Ljava/lang/String;IIIIZB)V",
descriptor = "(Ljava/lang/String;Ljava/lang/String;IIIIZB)V",
garbageValue = "-63"
)
@Export("insertMenuItem")
@@ -78,7 +78,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
@ObfuscatedName("id")
@ObfuscatedSignature(
signature = "(Ljz;IIII)V",
descriptor = "(Ljz;IIII)V",
garbageValue = "1974138271"
)
@Export("addNpcToMenu")

View File

@@ -13,13 +13,13 @@ public class Archive extends AbstractArchive {
static CRC32 Archive_crc;
@ObfuscatedName("x")
@ObfuscatedSignature(
signature = "Llp;"
descriptor = "Llp;"
)
@Export("archiveDisk")
ArchiveDisk archiveDisk;
@ObfuscatedName("b")
@ObfuscatedSignature(
signature = "Llp;"
descriptor = "Llp;"
)
@Export("masterDisk")
ArchiveDisk masterDisk;
@@ -59,7 +59,7 @@ public class Archive extends AbstractArchive {
}
@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) {
super(var4, var5);
@@ -75,7 +75,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(II)V",
descriptor = "(II)V",
garbageValue = "479482423"
)
@Export("loadRegionFromGroup")
@@ -91,7 +91,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("a")
@ObfuscatedSignature(
signature = "(II)I",
descriptor = "(II)I",
garbageValue = "-1350822089"
)
@Export("groupLoadPercent")
@@ -116,7 +116,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("c")
@ObfuscatedSignature(
signature = "(II)V",
descriptor = "(II)V",
garbageValue = "-1560066319"
)
@Export("loadGroup")
@@ -131,7 +131,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dr")
@ObfuscatedSignature(
signature = "(I)Z",
descriptor = "(I)Z",
garbageValue = "6460755"
)
public boolean method4456() {
@@ -140,7 +140,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("di")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "1538719165"
)
@Export("percentage")
@@ -170,7 +170,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dp")
@ObfuscatedSignature(
signature = "(III)V",
descriptor = "(III)V",
garbageValue = "-1870441691"
)
@Export("loadIndex")
@@ -187,7 +187,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dc")
@ObfuscatedSignature(
signature = "(I[BZZI)V",
descriptor = "(I[BZZI)V",
garbageValue = "-1362503762"
)
@Export("write")
@@ -220,7 +220,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dt")
@ObfuscatedSignature(
signature = "(Llp;I[BZI)V",
descriptor = "(Llp;I[BZI)V",
garbageValue = "416222280"
)
@Export("load")
@@ -311,7 +311,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("ds")
@ObfuscatedSignature(
signature = "(I)V",
descriptor = "(I)V",
garbageValue = "1106038504"
)
@Export("loadAllLocal")
@@ -344,7 +344,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dg")
@ObfuscatedSignature(
signature = "(II)Z",
descriptor = "(II)Z",
garbageValue = "1634778176"
)
public boolean method4460(int var1) {
@@ -353,7 +353,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("do")
@ObfuscatedSignature(
signature = "(II)Z",
descriptor = "(II)Z",
garbageValue = "-587516749"
)
public boolean method4452(int var1) {
@@ -362,7 +362,7 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("dn")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "-1037828577"
)
@Export("loadPercent")

View File

@@ -14,13 +14,13 @@ public final class ArchiveDisk {
static byte[] ArchiveDisk_buffer;
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "Lmn;"
descriptor = "Lmn;"
)
@Export("datFile")
BufferedFile datFile;
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "Lmn;"
descriptor = "Lmn;"
)
@Export("idxFile")
BufferedFile idxFile;
@@ -42,7 +42,7 @@ public final class ArchiveDisk {
}
@ObfuscatedSignature(
signature = "(ILmn;Lmn;I)V"
descriptor = "(ILmn;Lmn;I)V"
)
public ArchiveDisk(int var1, BufferedFile var2, BufferedFile var3, int var4) {
this.datFile = null;
@@ -56,7 +56,7 @@ public final class ArchiveDisk {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(II)[B",
descriptor = "(II)[B",
garbageValue = "475820078"
)
@Export("read")
@@ -153,7 +153,7 @@ public final class ArchiveDisk {
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "(I[BIB)Z",
descriptor = "(I[BIB)Z",
garbageValue = "3"
)
@Export("write")
@@ -174,7 +174,7 @@ public final class ArchiveDisk {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(I[BIZS)Z",
descriptor = "(I[BIZS)Z",
garbageValue = "21116"
)
@Export("write0")

View File

@@ -18,13 +18,13 @@ public class ArchiveDiskAction extends Node {
byte[] data;
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "Llp;"
descriptor = "Llp;"
)
@Export("archiveDisk")
ArchiveDisk archiveDisk;
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "Lig;"
descriptor = "Lig;"
)
@Export("archive")
Archive archive;
@@ -34,7 +34,7 @@ public class ArchiveDiskAction extends Node {
@ObfuscatedName("p")
@ObfuscatedSignature(
signature = "(Lkb;II)Z",
descriptor = "(Lkb;II)Z",
garbageValue = "-1045128194"
)
@Export("updateExternalPlayer")
@@ -150,7 +150,7 @@ public class ArchiveDiskAction extends Node {
@ObfuscatedName("js")
@ObfuscatedSignature(
signature = "(II)Z",
descriptor = "(II)Z",
garbageValue = "-418956614"
)
static boolean method4302(int var0) {

View File

@@ -9,13 +9,13 @@ import net.runelite.mapping.ObfuscatedSignature;
public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "Ljp;"
descriptor = "Ljp;"
)
@Export("ArchiveDiskActionHandler_requestQueue")
static NodeDeque ArchiveDiskActionHandler_requestQueue;
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "Ljp;"
descriptor = "Ljp;"
)
@Export("ArchiveDiskActionHandler_responseQueue")
static NodeDeque ArchiveDiskActionHandler_responseQueue;
@@ -92,7 +92,7 @@ public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(Lic;Lic;I)I",
descriptor = "(Lic;Lic;I)I",
garbageValue = "-1395527740"
)
static int method4429(AbstractArchive var0, AbstractArchive var1) {
@@ -155,7 +155,7 @@ public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(IB)Z",
descriptor = "(IB)Z",
garbageValue = "8"
)
@Export("isWorldMapEvent")
@@ -165,7 +165,7 @@ public class ArchiveDiskActionHandler implements Runnable {
@ObfuscatedName("fh")
@ObfuscatedSignature(
signature = "(Ljava/lang/String;ZB)V",
descriptor = "(Ljava/lang/String;ZB)V",
garbageValue = "-20"
)
@Export("drawLoadingMessage")

View File

@@ -19,7 +19,7 @@ public class ArchiveLoader {
static String userHomeDirectory;
@ObfuscatedName("an")
@ObfuscatedSignature(
signature = "Llo;"
descriptor = "Llo;"
)
@Export("rasterProvider")
public static AbstractRasterProvider rasterProvider;
@@ -28,13 +28,13 @@ public class ArchiveLoader {
static boolean mouseCam;
@ObfuscatedName("fy")
@ObfuscatedSignature(
signature = "Lfa;"
descriptor = "Lfa;"
)
@Export("socketTask")
static Task socketTask;
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "Lig;"
descriptor = "Lig;"
)
@Export("archive")
final Archive archive;
@@ -52,7 +52,7 @@ public class ArchiveLoader {
int loadedCount;
@ObfuscatedSignature(
signature = "(Lig;Ljava/lang/String;)V"
descriptor = "(Lig;Ljava/lang/String;)V"
)
ArchiveLoader(Archive var1, String var2) {
this.loadedCount = 0;
@@ -62,7 +62,7 @@ public class ArchiveLoader {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(I)Z",
descriptor = "(I)Z",
garbageValue = "-1314527591"
)
@Export("isLoaded")
@@ -80,7 +80,7 @@ public class ArchiveLoader {
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "(III)I",
descriptor = "(III)I",
garbageValue = "1299326622"
)
static int method1212(int var0, int var1) {
@@ -104,7 +104,7 @@ public class ArchiveLoader {
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "(ILcs;ZI)I",
descriptor = "(ILcs;ZI)I",
garbageValue = "677134031"
)
static int method1213(int var0, Script var1, boolean var2) {

View File

@@ -10,38 +10,38 @@ import net.runelite.rs.ScriptOpcodes;
public enum AttackOption implements Enumerated {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "Lco;"
descriptor = "Lco;"
)
@Export("AttackOption_dependsOnCombatLevels")
AttackOption_dependsOnCombatLevels(0),
@ObfuscatedName("o")
@ObfuscatedSignature(
signature = "Lco;"
descriptor = "Lco;"
)
@Export("AttackOption_alwaysRightClick")
AttackOption_alwaysRightClick(1),
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "Lco;"
descriptor = "Lco;"
)
@Export("AttackOption_leftClickWhereAvailable")
AttackOption_leftClickWhereAvailable(2),
@ObfuscatedName("j")
@ObfuscatedSignature(
signature = "Lco;"
descriptor = "Lco;"
)
@Export("AttackOption_hidden")
AttackOption_hidden(3);
@ObfuscatedName("of")
@ObfuscatedSignature(
signature = "Lcy;"
descriptor = "Lcy;"
)
@Export("varcs")
static Varcs varcs;
@ObfuscatedName("hj")
@ObfuscatedSignature(
signature = "[Llz;"
descriptor = "[Llz;"
)
@Export("mapDotSprites")
static Sprite[] mapDotSprites;
@@ -58,7 +58,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("m")
@ObfuscatedSignature(
signature = "(I)I",
descriptor = "(I)I",
garbageValue = "-995092303"
)
@Export("rsOrdinal")
@@ -68,7 +68,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("a")
@ObfuscatedSignature(
signature = "(I)Llh;",
descriptor = "(I)Llh;",
garbageValue = "-1275433341"
)
public static IndexedSprite method2173() {
@@ -87,7 +87,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "(B)V",
descriptor = "(B)V",
garbageValue = "-37"
)
public static void method2181() {
@@ -97,7 +97,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("ac")
@ObfuscatedSignature(
signature = "(ILcs;ZB)I",
descriptor = "(ILcs;ZB)I",
garbageValue = "-99"
)
static int method2180(int var0, Script var1, boolean var2) {
@@ -192,7 +192,7 @@ public enum AttackOption implements Enumerated {
@ObfuscatedName("ho")
@ObfuscatedSignature(
signature = "(IIIIB)V",
descriptor = "(IIIIB)V",
garbageValue = "-113"
)
@Export("selectSpell")

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