diff --git a/.travis.yml b/.travis.yml
index ada8108a37..76201d94c3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,4 +8,6 @@ jdk:
- openjdk8
- openjdk11
install: true
-script: ./travis/build.sh
\ No newline at end of file
+script: ./travis/build.sh
+before_install:
+- chmod +x ./travis/build.sh
\ No newline at end of file
diff --git a/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java b/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java
index c93edf3611..dc8922535e 100644
--- a/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java
+++ b/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java
@@ -38,19 +38,19 @@ import net.runelite.cache.models.VertexNormal;
public class ItemSpriteFactory
{
public static final BufferedImage createSprite(ItemProvider itemProvider, ModelProvider modelProvider,
- SpriteProvider spriteProvider, TextureProvider textureProvider,
- int itemId, int quantity, int border, int shadowColor,
- boolean noted) throws IOException
+ SpriteProvider spriteProvider, TextureProvider textureProvider,
+ int itemId, int quantity, int border, int shadowColor,
+ boolean noted) throws IOException
{
- SpritePixels spritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
- itemId, quantity, border, shadowColor, noted);
+ Sprite spritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
+ itemId, quantity, border, shadowColor, noted);
return spritePixels == null ? null : spritePixels.toBufferedImage();
}
- private static final SpritePixels createSpritePixels(ItemProvider itemProvider, ModelProvider modelProvider,
- SpriteProvider spriteProvider, TextureProvider textureProvider,
- int itemId, int quantity, int border, int shadowColor,
- boolean noted) throws IOException
+ private static final Sprite createSpritePixels(ItemProvider itemProvider, ModelProvider modelProvider,
+ SpriteProvider spriteProvider, TextureProvider textureProvider,
+ int itemId, int quantity, int border, int shadowColor,
+ boolean noted) throws IOException
{
ItemDefinition item = itemProvider.provide(itemId);
@@ -83,11 +83,11 @@ public class ItemSpriteFactory
return null;
}
- SpritePixels auxSpritePixels = null;
+ Sprite auxSpritePixels = null;
if (item.notedTemplate != -1)
{
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
- item.notedID, 10, 1, 0, true);
+ item.notedID, 10, 1, 0, true);
if (auxSpritePixels == null)
{
return null;
@@ -96,7 +96,7 @@ public class ItemSpriteFactory
else if (item.boughtTemplateId != -1)
{
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
- item.boughtId, quantity, border, shadowColor, false);
+ item.boughtId, quantity, border, shadowColor, false);
if (auxSpritePixels == null)
{
return null;
@@ -105,7 +105,7 @@ public class ItemSpriteFactory
else if (item.placeholderTemplateId != -1)
{
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
- item.placeholderId, quantity, 0, 0, false);
+ item.placeholderId, quantity, 0, 0, false);
if (auxSpritePixels == null)
{
return null;
@@ -114,7 +114,7 @@ public class ItemSpriteFactory
RSTextureProvider rsTextureProvider = new RSTextureProvider(textureProvider, spriteProvider);
- SpritePixels spritePixels = new SpritePixels(36, 32);
+ Sprite spritePixels = new Sprite(36, 32);
Graphics3D graphics = new Graphics3D(rsTextureProvider);
graphics.setBrightness(0.6d);
graphics.setRasterBuffer(spritePixels.pixels, 36, 32);
@@ -142,12 +142,12 @@ public class ItemSpriteFactory
itemModel.calculateBoundsCylinder();
itemModel.rotateAndProject(graphics, 0,
- item.yan2d,
- item.zan2d,
- item.xan2d,
- item.xOffset2d,
- itemModel.modelHeight / 2 + var17 + item.yOffset2d,
- var18 + item.yOffset2d);
+ item.yan2d,
+ item.zan2d,
+ item.xan2d,
+ item.xOffset2d,
+ itemModel.modelHeight / 2 + var17 + item.yOffset2d,
+ var18 + item.yOffset2d);
if (item.boughtTemplateId != -1)
{
auxSpritePixels.drawAtOn(graphics, 0, 0);
@@ -175,8 +175,8 @@ public class ItemSpriteFactory
}
graphics.setRasterBuffer(graphics.graphicsPixels,
- graphics.graphicsPixelsWidth,
- graphics.graphicsPixelsHeight);
+ graphics.graphicsPixelsWidth,
+ graphics.graphicsPixelsHeight);
graphics.setRasterClipping();
graphics.rasterGouraudLowRes = true;
diff --git a/cache/src/main/java/net/runelite/cache/item/SpritePixels.java b/cache/src/main/java/net/runelite/cache/item/SpritePixels.java
index 02079847f7..ed8be85a18 100644
--- a/cache/src/main/java/net/runelite/cache/item/SpritePixels.java
+++ b/cache/src/main/java/net/runelite/cache/item/SpritePixels.java
@@ -26,7 +26,7 @@ package net.runelite.cache.item;
import java.awt.image.BufferedImage;
-class SpritePixels
+class Sprite
{
public int[] pixels;
public int width;
@@ -34,7 +34,7 @@ class SpritePixels
public int offsetX;
int offsetY;
- public SpritePixels(int[] var1, int var2, int var3)
+ public Sprite(int[] var1, int var2, int var3)
{
this.pixels = var1;
this.width = var2;
@@ -43,7 +43,7 @@ class SpritePixels
this.offsetX = 0;
}
- public SpritePixels(int var1, int var2)
+ public Sprite(int var1, int var2)
{
this(new int[var2 * var1], var1, var2);
}
diff --git a/deobfuscator/pom.xml b/deobfuscator/pom.xml
new file mode 100644
index 0000000000..af5e2792b4
--- /dev/null
+++ b/deobfuscator/pom.xml
@@ -0,0 +1,173 @@
+
+
+
+ 4.0.0
+
+
+ net.runelite
+ runelite-parent
+ 1.5.27-SNAPSHOT
+
+
+ deobfuscator
+ Deobfuscator
+
+
+
+ net.runelite
+ runelite-api
+ ${project.version}
+
+
+ net.runelite.rs
+ runescape-api
+ ${project.version}
+
+
+ net.runelite
+ fernflower
+ 20171017
+
+
+
+ com.google.guava
+ guava
+ 27.1-jre
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
+ 1.7.12
+
+
+ com.google.code.gson
+ gson
+ 2.8.5
+
+
+ org.ow2.asm
+ asm-debug-all
+ 5.2
+
+
+
+ net.runelite.rs
+ rs-client
+ ${project.version}
+ test
+
+
+ net.runelite.rs
+ vanilla
+ ${rs.version}
+ test
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ org.mockito
+ mockito-all
+ 1.10.19
+ test
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+ src/test/resources
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.3
+
+
+ generate-sources
+
+
+ properties
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.16
+
+ true
+ -Xmx2048m
+
+
+
+ maven-assembly-plugin
+
+
+ jar-with-dependencies
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
+
+
diff --git a/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java b/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java
new file mode 100644
index 0000000000..dcbbd91bac
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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 net.runelite.asm.attributes.Annotations;
+import net.runelite.asm.attributes.annotation.Annotation;
+import net.runelite.asm.pool.Class;
+import net.runelite.asm.signature.Signature;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+public class ClassFile
+{
+ private ClassGroup group;
+
+ private ClassFile parent; // super class
+ private final List children = new ArrayList<>(); // classes which inherit from this
+
+ private int version;
+ private int access;
+ private Class name;
+ private Class super_class;
+ private String source;
+ private final Interfaces interfaces;
+ private final List fields = new ArrayList<>();
+ private final List methods = new ArrayList<>();
+ private final Annotations annotations;
+
+ public ClassFile(ClassGroup group)
+ {
+ this.group = group;
+
+ interfaces = new Interfaces(this);
+ annotations = new Annotations();
+ }
+
+ public ClassFile()
+ {
+ this(null);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ClassFile{" + "name=" + name + '}';
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(int version)
+ {
+ this.version = version;
+ }
+
+ public int getAccess()
+ {
+ return access;
+ }
+
+ public void setAccess(int access)
+ {
+ this.access = access;
+ }
+
+ public void accept(ClassVisitor visitor)
+ {
+ String[] ints = interfaces.getInterfaces().stream().map(i -> i.getName()).toArray(String[]::new);
+
+ visitor.visit(version, access, name.getName(), null, super_class.getName(), ints);
+ visitor.visitSource(source, null);
+
+ for (Annotation annotation : annotations.getAnnotations())
+ {
+ AnnotationVisitor av = visitor.visitAnnotation(annotation.getType().toString(), true);
+ annotation.accept(av);
+ }
+
+ for (Field field : fields)
+ {
+ FieldVisitor fv = visitor.visitField(field.getAccessFlags(), field.getName(), field.getType().toString(), null, field.getValue());
+ field.accept(fv);
+ }
+
+ for (Method method : methods)
+ {
+ String[] exceptions = method.getExceptions().getExceptions().stream().map(cl -> cl.getName()).toArray(String[]::new);
+ if (exceptions.length == 0)
+ {
+ exceptions = null;
+ }
+
+ MethodVisitor mv = visitor.visitMethod(method.getAccessFlags(), method.getName(), method.getDescriptor().toString(), null, exceptions);
+ method.accept(mv);
+ }
+
+ visitor.visitEnd();
+ }
+
+ public ClassGroup getGroup()
+ {
+ return group;
+ }
+
+ public void setGroup(ClassGroup group)
+ {
+ this.group = group;
+ }
+
+ public Interfaces getInterfaces()
+ {
+ return interfaces;
+ }
+
+ public List getFields()
+ {
+ return fields;
+ }
+
+ public void addField(Field field)
+ {
+ fields.add(field);
+ }
+
+ public void removeField(Field field)
+ {
+ fields.remove(field);
+ }
+
+ public List getMethods()
+ {
+ return methods;
+ }
+
+ public void addMethod(Method method)
+ {
+ methods.add(method);
+ }
+
+ public void removeMethod(Method method)
+ {
+ methods.remove(method);
+ }
+
+ public Annotations getAnnotations()
+ {
+ return annotations;
+ }
+
+ public String getName()
+ {
+ return name.getName();
+ }
+
+ public void setName(String name)
+ {
+ // Must be removed from the class group map first
+ assert group == null || this.name == null || group.findClass(this.name.getName()) == null;
+
+ this.name = new Class(name);
+ }
+
+ public String getClassName()
+ {
+ String n = getName();
+ int i = n.lastIndexOf('/');
+ return n.substring(i + 1);
+ }
+
+ public String getSuperName()
+ {
+ return super_class.getName();
+ }
+
+ public void setSuperName(String name)
+ {
+ super_class = new Class(name);
+ }
+
+ public String getSource()
+ {
+ return source;
+ }
+
+ public void setSource(String source)
+ {
+ this.source = source;
+ }
+
+ public Class getParentClass()
+ {
+ return this.super_class;
+ }
+
+ public void setParentClass(Class c)
+ {
+ super_class = c;
+ }
+
+ public ClassFile getParent()
+ {
+ return parent;
+ }
+
+ public List getChildren()
+ {
+ return children;
+ }
+
+ public Field findField(String name, Type type)
+ {
+ for (Field f : fields)
+ {
+ if (f.getName().equals(name) && f.getType().equals(type))
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public Field findField(String name)
+ {
+ for (Field f : fields)
+ {
+ if (f.getName().equals(name))
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public Class getPoolClass()
+ {
+ return name;
+ }
+
+ public Field findFieldDeep(String name, Type type)
+ {
+ Field f = findField(name, type);
+ if (f != null)
+ {
+ return f;
+ }
+
+ ClassFile parent = getParent();
+ if (parent != null)
+ {
+ return parent.findFieldDeep(name, type);
+ }
+
+ return null;
+ }
+
+ public Method findMethod(String name, Signature type)
+ {
+ for (Method m : methods)
+ {
+ if (m.getName().equals(name) && m.getDescriptor().equals(type))
+ {
+ return m;
+ }
+ }
+ return null;
+ }
+
+ public Method findMethod(String name)
+ {
+ for (Method m : methods)
+ {
+ if (m.getName().equals(name))
+ {
+ return m;
+ }
+ }
+ return null;
+ }
+
+ public Method findMethodDeep(String name, Signature type)
+ {
+ Method m = findMethod(name, type);
+ if (m != null)
+ {
+ return m;
+ }
+
+ ClassFile parent = getParent();
+ if (parent != null)
+ {
+ return parent.findMethodDeep(name, type);
+ }
+
+ return null;
+ }
+
+ public Method findMethodDeepStatic(String name, Signature type)
+ {
+ Method m = findMethod(name, type);
+ if (m != null && m.isStatic())
+ {
+ return m;
+ }
+
+ ClassFile parent = getParent();
+ if (parent != null)
+ {
+ return parent.findMethodDeepStatic(name, type);
+ }
+
+ return null;
+ }
+
+ public Method findMethodDeep(String name)
+ {
+ Method m = findMethod(name);
+ if (m != null)
+ {
+ return m;
+ }
+
+ ClassFile parent = getParent();
+ if (parent != null)
+ {
+ return parent.findMethodDeep(name);
+ }
+
+ return null;
+ }
+
+ public void clearClassGraph()
+ {
+ parent = null;
+ children.clear();
+ }
+
+ public void buildClassGraph()
+ {
+ ClassFile other = group.findClass(super_class.getName());
+ if (other != null)
+ {
+ this.parent = other;
+ parent.children.add(this);
+ }
+
+ for (ClassFile i : interfaces.getMyInterfaces())
+ {
+ i.children.add(this);
+ }
+ }
+
+ public boolean instanceOf(ClassFile other)
+ {
+ return this == other || interfaces.instanceOf(other) || (getParent() != null && getParent().instanceOf(other));
+ }
+
+ public boolean isAbstract()
+ {
+ return (this.access & Opcodes.ACC_ABSTRACT) != 0;
+ }
+
+ public boolean isFinal()
+ {
+ return (this.access & Opcodes.ACC_FINAL) != 0;
+ }
+
+ public boolean isInterface()
+ {
+ return (this.access & Opcodes.ACC_INTERFACE) != 0;
+ }
+
+ public boolean isEnum()
+ {
+ return (this.access & Opcodes.ACC_ENUM) != 0;
+ }
+
+ public void setEnum()
+ {
+ this.access |= Opcodes.ACC_ENUM;
+ }
+
+ public void clearFinal()
+ {
+ this.access &= ~Opcodes.ACC_FINAL;
+ }
+
+ public void clearAbstract()
+ {
+ this.access &= ~Opcodes.ACC_ABSTRACT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java b/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java
new file mode 100644
index 0000000000..2c6ba531a5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import net.runelite.asm.attributes.Code;
+
+public class ClassGroup
+{
+ private final List classes = new ArrayList<>(); // to keep order
+ private final Map classMap = new HashMap<>();
+
+ public void addClass(ClassFile cf)
+ {
+ assert cf.getGroup() == this || cf.getGroup() == null;
+ cf.setGroup(this);
+
+ classes.add(cf);
+ classMap.put(cf.getName(), cf);
+ }
+
+ public void removeClass(ClassFile cf)
+ {
+ classes.remove(cf);
+ classMap.remove(cf.getName());
+ }
+
+ public void renameClass(ClassFile cf, String newName)
+ {
+ assert classes.contains(cf);
+ assert classMap.get(cf.getName()) == cf;
+
+ classMap.remove(cf.getName());
+ cf.setName(newName);
+ classMap.put(cf.getName(), cf);
+ }
+
+ public List getClasses()
+ {
+ return Collections.unmodifiableList(classes);
+ }
+
+ public ClassFile findClass(String name)
+ {
+ return classMap.get(name);
+ }
+
+ public void initialize()
+ {
+ buildClassGraph();
+ lookup();
+ }
+
+ public void buildClassGraph()
+ {
+ for (ClassFile c : classes)
+ {
+ c.clearClassGraph();
+ }
+
+ for (ClassFile c : classes)
+ {
+ c.buildClassGraph();
+ }
+ }
+
+ public void lookup()
+ {
+ for (ClassFile cf : this.getClasses())
+ {
+ for (Method m : cf.getMethods())
+ {
+ Code code = m.getCode();
+
+ if (code == null)
+ {
+ continue;
+ }
+
+ code.getInstructions().lookup();
+ }
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/Field.java b/deobfuscator/src/main/java/net/runelite/asm/Field.java
new file mode 100644
index 0000000000..8d70053adb
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/Field.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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 net.runelite.asm.attributes.Annotations;
+import net.runelite.asm.attributes.annotation.Annotation;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Opcodes;
+
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PROTECTED;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+
+public class Field
+{
+ public static final int ACCESS_MODIFIERS = ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED;
+
+ private final ClassFile classFile;
+
+ private int accessFlags;
+ private String name;
+ private Type type;
+ private Object value; // ConstantValue
+ private final Annotations annotations;
+
+ public Field(ClassFile classFile, String name, Type type)
+ {
+ this.classFile = classFile;
+ this.name = name;
+ this.type = type;
+
+ annotations = new Annotations();
+ }
+
+ public void accept(FieldVisitor visitor)
+ {
+ for (Annotation annotation : annotations.getAnnotations())
+ {
+ AnnotationVisitor av = visitor.visitAnnotation(annotation.getType().toString(), true);
+ annotation.accept(av);
+ }
+
+ visitor.visitEnd();
+ }
+
+ public ClassFile getClassFile()
+ {
+ return classFile;
+ }
+
+ public int getAccessFlags()
+ {
+ return accessFlags;
+ }
+
+ public void setAccessFlags(int accessFlags)
+ {
+ this.accessFlags = accessFlags;
+ }
+
+ public boolean isPublic()
+ {
+ return (accessFlags & Opcodes.ACC_PUBLIC) != 0;
+ }
+
+ public void setPublic()
+ {
+ accessFlags = (short) ((accessFlags & ~ACCESS_MODIFIERS) | ACC_PUBLIC);
+ }
+
+ public boolean isStatic()
+ {
+ return (accessFlags & Opcodes.ACC_STATIC) != 0;
+ }
+
+ public void setStatic()
+ {
+ accessFlags |= Opcodes.ACC_STATIC;
+ }
+
+ public boolean isSynthetic()
+ {
+ return (accessFlags & Opcodes.ACC_SYNTHETIC) != 0;
+ }
+
+ public void setEnum()
+ {
+ accessFlags |= Opcodes.ACC_ENUM;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ 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()),
+ this.getName(),
+ this.getType()
+ );
+ }
+
+ @Override
+ public String toString()
+ {
+ return (this.isStatic() ? "static " : "") + this.type + " " + classFile.getName() + "." + this.getName();
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/Interfaces.java b/deobfuscator/src/main/java/net/runelite/asm/Interfaces.java
new file mode 100644
index 0000000000..a372f9d68c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/Interfaces.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.stream.Collectors;
+import net.runelite.asm.pool.Class;
+
+public class Interfaces
+{
+ private final ClassFile classFile;
+
+ private final List interfaces = new ArrayList<>();
+
+ Interfaces(ClassFile c)
+ {
+ classFile = c;
+ }
+
+ public void addInterface(Class clazz)
+ {
+ if (!interfaces.contains(clazz))
+ {
+ interfaces.add(clazz);
+ }
+ }
+
+ public List getInterfaces()
+ {
+ return interfaces;
+ }
+
+ public void clear()
+ {
+ interfaces.clear();
+ }
+
+ public List getMyInterfaces()
+ {
+ List l = new ArrayList<>();
+ for (Class clazz : interfaces)
+ {
+ ClassFile iface = classFile.getGroup().findClass(clazz.getName());
+ if (iface != null)
+ {
+ l.add(iface);
+ }
+ }
+ return l;
+ }
+
+ public List getNonMyInterfaces()
+ {
+ return interfaces.stream().filter(clazz -> classFile.getGroup().findClass(clazz.getName()) == null).collect(Collectors.toList());
+ }
+
+ public boolean instanceOf(ClassFile cf)
+ {
+ for (Class clazz : interfaces)
+ {
+ ClassFile iface = classFile.getGroup().findClass(clazz.getName());
+ if (iface.instanceOf(cf))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/Method.java b/deobfuscator/src/main/java/net/runelite/asm/Method.java
new file mode 100644
index 0000000000..bc2c8b305b
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/Method.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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 net.runelite.asm.attributes.Annotations;
+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;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.signature.Signature;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import static org.objectweb.asm.Opcodes.ACC_FINAL;
+import static org.objectweb.asm.Opcodes.ACC_NATIVE;
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PROTECTED;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACC_STATIC;
+import static org.objectweb.asm.Opcodes.ACC_SYNCHRONIZED;
+
+public class Method
+{
+ public static final int ACCESS_MODIFIERS = ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED;
+
+ private final ClassFile classFile;
+
+ private int accessFlags;
+ private String name;
+ private Signature arguments;
+ private Exceptions exceptions;
+ private Annotations annotations;
+ private List parameters;
+ private Code code;
+
+ public Method(ClassFile classFile, String name, Signature signature)
+ {
+ this.classFile = classFile;
+ this.name = name;
+ this.arguments = signature;
+ exceptions = new Exceptions();
+ annotations = new Annotations();
+ parameters = new ArrayList<>();
+ }
+
+ public ClassFile getClassFile()
+ {
+ return classFile;
+ }
+
+ @Override
+ public String toString()
+ {
+ return (this.isStatic() ? "static " : "") + classFile.getName() + "." + this.name + this.arguments;
+ }
+
+ public void accept(MethodVisitor visitor)
+ {
+ //This is required to name unused parameters
+ for (Parameter p : parameters)
+ {
+ visitor.visitParameter(p.getName(), p.getAccess());
+ }
+
+ for (Annotation annotation : annotations.getAnnotations())
+ {
+ AnnotationVisitor av = visitor.visitAnnotation(annotation.getType().toString(), true);
+ annotation.accept(av);
+ }
+
+ if (code != null)
+ {
+ code.getInstructions().rebuildLabels();
+
+ visitor.visitCode();
+
+ net.runelite.asm.attributes.code.Exceptions exceptions = code.getExceptions();
+ for (net.runelite.asm.attributes.code.Exception exception : exceptions.getExceptions())
+ {
+ assert exception.getStart().getLabel() != null;
+ assert exception.getEnd().getLabel() != null;
+ assert exception.getHandler().getLabel() != null;
+
+ int idxStart = code.getInstructions().getInstructions().indexOf(exception.getStart());
+ int idxEnd = code.getInstructions().getInstructions().indexOf(exception.getEnd());
+
+ assert idxStart != -1;
+ assert idxEnd != -1;
+ assert code.getInstructions().getInstructions().contains(exception.getHandler());
+
+ assert idxEnd > idxStart;
+
+ visitor.visitTryCatchBlock(
+ exception.getStart().getLabel(),
+ exception.getEnd().getLabel(),
+ exception.getHandler().getLabel(),
+ exception.getCatchType() != null ? exception.getCatchType().getName() : null
+ );
+ }
+
+ for (Instruction i : code.getInstructions().getInstructions())
+ {
+ i.accept(visitor);
+ }
+
+ //Find first and last label for this method
+ if (parameters.size() > 0)
+ {
+ Label startLabel = null;
+ Label endLabel = null;
+ for (Instruction i : code.getInstructions().getInstructions())
+ {
+ if (i instanceof net.runelite.asm.attributes.code.Label)
+ {
+ if (startLabel == null)
+ {
+ startLabel = ((net.runelite.asm.attributes.code.Label) i).getLabel();
+ }
+ endLabel = ((net.runelite.asm.attributes.code.Label) i).getLabel();
+ }
+ }
+
+ for (Parameter p : parameters)
+ {
+ LocalVariable lv = p.getLocalVariable();
+ if (lv != null)
+ {
+ visitor.visitLocalVariable(lv.getName(), lv.getDesc(), lv.getSignature(), startLabel, endLabel, lv.getIndex());
+ }
+ }
+ }
+
+ visitor.visitMaxs(code.getMaxStack(), code.getMaxLocals());
+ }
+
+ visitor.visitEnd();
+ }
+
+ public int getAccessFlags()
+ {
+ return accessFlags;
+ }
+
+ public void setAccessFlags(int accessFlags)
+ {
+ this.accessFlags = accessFlags;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Signature getDescriptor()
+ {
+ return arguments;
+ }
+
+ public void setDescriptor(Signature signature)
+ {
+ this.arguments = signature;
+ }
+
+ public boolean isNative()
+ {
+ return (accessFlags & ACC_NATIVE) != 0;
+ }
+
+ public boolean isStatic()
+ {
+ return (accessFlags & ACC_STATIC) != 0;
+ }
+
+ public void setStatic()
+ {
+ accessFlags |= ACC_STATIC;
+ }
+
+ public boolean isSynchronized()
+ {
+ return (accessFlags & ACC_SYNCHRONIZED) != 0;
+ }
+
+ public boolean isFinal()
+ {
+ return (accessFlags & ACC_FINAL) != 0;
+ }
+
+ public void setFinal(boolean f)
+ {
+ if (f)
+ {
+ accessFlags |= ACC_FINAL;
+ }
+ else
+ {
+ accessFlags &= ~ACC_FINAL;
+ }
+ }
+
+ public boolean isPrivate()
+ {
+ return (accessFlags & ACC_PRIVATE) != 0;
+ }
+
+ public void setPrivate()
+ {
+ accessFlags = (short) ((accessFlags & ~ACCESS_MODIFIERS) | ACC_PRIVATE);
+ }
+
+ public void setPublic()
+ {
+ accessFlags = (short) ((accessFlags & ~ACCESS_MODIFIERS) | ACC_PUBLIC);
+ }
+
+ public Exceptions getExceptions()
+ {
+ return exceptions;
+ }
+
+ public Code getCode()
+ {
+ return code;
+ }
+
+ public void setCode(Code code)
+ {
+ this.code = code;
+ }
+
+ public Annotations getAnnotations()
+ {
+ return annotations;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List findLVTInstructionsForVariable(int index)
+ {
+ List list = new ArrayList<>();
+
+ if (getCode() == null)
+ {
+ return null;
+ }
+
+ for (Instruction ins : getCode().getInstructions().getInstructions())
+ {
+ if (ins instanceof LVTInstruction)
+ {
+ LVTInstruction lv = (LVTInstruction) ins;
+
+ if (lv.getVariableIndex() != index)
+ {
+ continue;
+ }
+
+ list.add((T) ins);
+ }
+ }
+
+ return list;
+ }
+
+ public net.runelite.asm.pool.Method getPoolMethod()
+ {
+ return new net.runelite.asm.pool.Method(
+ new net.runelite.asm.pool.Class(classFile.getName()),
+ name,
+ arguments
+ );
+ }
+
+ public List getParameters()
+ {
+ return parameters;
+ }
+
+ public void setParameters(List parameters)
+ {
+ this.parameters = parameters;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/Type.java b/deobfuscator/src/main/java/net/runelite/asm/Type.java
new file mode 100644
index 0000000000..68ba6960d4
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/Type.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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 net.runelite.asm.pool.Class;
+
+/**
+ * Created by Kyle Fricilone on 8/20/2017
+ */
+public class Type
+{
+
+ public static final Type VOID = new Type("V");
+ public static final Type BOOLEAN = new Type("Z");
+ public static final Type CHAR = new Type("C");
+ public static final Type BYTE = new Type("B");
+ public static final Type SHORT = new Type("S");
+ public static final Type INT = new Type("I");
+ public static final Type FLOAT = new Type("F");
+ public static final Type LONG = new Type("J");
+ public static final Type DOUBLE = new Type("D");
+ public static final Type OBJECT = new Type("Ljava/lang/Object;");
+ public static final Type STRING = new Type("Ljava/lang/String;");
+ public static final Type THROWABLE = new Type("Ljava/lang/Throwable;");
+ public static final Type EXCEPTION = new Type("Ljava/lang/Exception;");
+
+ private final String type;
+
+ public Type(String type)
+ {
+ this.type = type;
+ }
+
+ public boolean isPrimitive()
+ {
+ return this.equals(BOOLEAN) || this.equals(BYTE) || this.equals(SHORT) || this.equals(CHAR) || this.equals(INT)
+ || this.equals(VOID) || this.equals(LONG) || this.equals(FLOAT) || this.equals(DOUBLE);
+ }
+
+ public boolean isObject()
+ {
+ return this.equals(OBJECT);
+ }
+
+ public boolean isArray()
+ {
+ return getDimensions() > 0;
+ }
+
+ public boolean isStackInt()
+ {
+ return this.equals(BOOLEAN) || this.equals(BYTE) || this.equals(SHORT) || this.equals(CHAR) || this.equals(INT);
+ }
+
+ public int getSize()
+ {
+ if (this.equals(LONG) || this.equals(DOUBLE))
+ {
+ return 2;
+ }
+
+ if (this.equals(VOID))
+ {
+ return 0;
+ }
+
+ return 1;
+ }
+
+ public int getDimensions()
+ {
+ return getDimensions(type);
+ }
+
+ public Type getSubtype()
+ {
+ if (!type.startsWith("["))
+ {
+ throw new IllegalStateException(type + " is not an array");
+ }
+ return new Type(type.substring(1));
+ }
+
+ public String getInternalName()
+ {
+ String s = type;
+ while (s.startsWith("["))
+ {
+ s = s.substring(1);
+ }
+ if (s.startsWith("L"))
+ {
+ return s.substring(1, s.length() - 1);
+ }
+ else
+ {
+ return s;
+ }
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof Type))
+ {
+ return false;
+ }
+
+ Type other = (Type) o;
+ return type.equals(other.type);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return type.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return type;
+ }
+
+ public String toAsmString()
+ {
+ if (type.startsWith("L") && type.endsWith(";"))
+ {
+ return type.substring(1, type.length() - 1);
+ }
+ else
+ {
+ return type;
+ }
+ }
+
+ public static Type fromAsmString(String str)
+ {
+ if (str.startsWith("["))
+ {
+ // array type
+ return new Type(str);
+ }
+ else
+ {
+ // object type
+ return new Type("L" + str + ";");
+ }
+ }
+
+ private static int getDimensions(String type)
+ {
+ if (!type.startsWith("["))
+ {
+ return 0;
+ }
+
+ return (int) type.chars().filter(i -> i == '[').count();
+ }
+
+ public static Type getType(String type, int dims)
+ {
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < dims; i++)
+ {
+ builder.append('[');
+ }
+ return new Type(builder.append(type).toString());
+ }
+
+ public static Type getType(Object object)
+ {
+ Type type;
+
+ if (object instanceof Double)
+ {
+ type = DOUBLE;
+ }
+ else if (object instanceof Float)
+ {
+ type = FLOAT;
+ }
+ else if (object instanceof Integer)
+ {
+ type = INT;
+ }
+ else if (object instanceof Long)
+ {
+ type = LONG;
+ }
+ else if (object instanceof String)
+ {
+ type = STRING;
+ }
+ else if (object instanceof Class)
+ {
+ type = new Type("L" + ((Class) object).getName() + ";");
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unexpected object type: " + object.getClass());
+ }
+
+ return type;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java
new file mode 100644
index 0000000000..b14d761c28
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.List;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.annotation.Annotation;
+import net.runelite.asm.attributes.annotation.Element;
+
+public class Annotations
+{
+ private final List annotations = new ArrayList<>();
+
+ public List 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(this);
+ annotation.setType(type);
+ addAnnotation(annotation);
+
+ Element element = new Element(annotation);
+ element.setName(name);
+ element.setValue(value);
+ annotation.addElement(element);
+
+ return annotation;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java
new file mode 100644
index 0000000000..2a3f08126c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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 net.runelite.asm.Method;
+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.instruction.types.LVTInstruction;
+import net.runelite.asm.signature.Signature;
+
+public class Code
+{
+ private Method method;
+ private int maxStack;
+ private Instructions instructions;
+ private final Exceptions exceptions;
+
+ public Code(Method method)
+ {
+ this.method = method;
+
+ exceptions = new Exceptions(this);
+ instructions = new Instructions(this);
+ }
+
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ public int getMaxStack()
+ {
+ return maxStack;
+ }
+
+ public void setMaxStack(int maxStack)
+ {
+ this.maxStack = maxStack;
+ }
+
+ private int getMaxLocalsFromSig()
+ {
+ Method m = getMethod();
+ int num = m.isStatic() ? 0 : 1;
+ Signature sig = m.getDescriptor();
+ for (int i = 0; i < sig.size(); ++i)
+ num += sig.getTypeOfArg(i).getSize();
+ return num;
+ }
+
+ /**
+ * calculates the size of the lvt required for this method
+ * @return
+ */
+ public int getMaxLocals()
+ {
+ int max = -1;
+
+ for (Instruction ins : instructions.getInstructions())
+ {
+ if (ins instanceof LVTInstruction)
+ {
+ LVTInstruction lvt = (LVTInstruction) ins;
+
+ int sizeRequired = lvt.getVariableIndex() + lvt.type().getSlots();
+ if (sizeRequired > max)
+ {
+ max = sizeRequired;
+ }
+ }
+ }
+
+ int fromSig = getMaxLocalsFromSig();
+ if (fromSig > max)
+ max = fromSig;
+
+ return max;
+ }
+
+ public Exceptions getExceptions()
+ {
+ return exceptions;
+ }
+
+ public Instructions getInstructions()
+ {
+ return instructions;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java
new file mode 100644
index 0000000000..0b12c513fd
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.List;
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.pool.Class;
+
+public class Exceptions
+{
+ private final List classes = new ArrayList<>();
+
+ public void addException(Class cl)
+ {
+ classes.add(cl);
+ }
+
+ public List getExceptions()
+ {
+ return classes;
+ }
+
+ public void renameClass(ClassFile cf, String name)
+ {
+ for (Class c : new ArrayList<>(classes))
+ {
+ if (c.getName().equals(cf.getName()))
+ {
+ int idx = classes.indexOf(c);
+ classes.remove(idx);
+ classes.add(idx, new Class(name));
+ }
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java
new file mode 100644
index 0000000000..7c727eb788
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.List;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.Annotations;
+import org.objectweb.asm.AnnotationVisitor;
+
+public class Annotation
+{
+ private final Annotations annotations;
+ private Type type;
+ private final List elements = new ArrayList<>();
+
+ public Annotation(Annotations annotations)
+ {
+ this.annotations = annotations;
+ }
+
+ public Annotations getAnnotations()
+ {
+ return annotations;
+ }
+
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public List getElements()
+ {
+ return elements;
+ }
+
+ public Element getElement()
+ {
+ return elements.get(0);
+ }
+
+ public void addElement(Element element)
+ {
+ elements.add(element);
+ }
+
+ public void accept(AnnotationVisitor visitor)
+ {
+ for (Element element : elements)
+ visitor.visit(element.getName(), element.getValue());
+ visitor.visitEnd();
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java
new file mode 100644
index 0000000000..18fdfa33f4
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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;
+
+public class Element
+{
+ private final Annotation annotation;
+ private String name;
+ private Object value;
+
+ public Element(Annotation annotation)
+ {
+ this.annotation = annotation;
+ }
+
+ public Annotation getAnnotation()
+ {
+ return annotation;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+
+ public String getString()
+ {
+ return value.toString();
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java
new file mode 100644
index 0000000000..b1209a6631
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.pool.Class;
+
+public class Exception implements Cloneable
+{
+ private Exceptions exceptions;
+
+ private Label start, end, handler;
+ private Class catchType;
+
+ public Exception(Exceptions exceptions)
+ {
+ this.exceptions = exceptions;
+ }
+
+ @Override
+ public Exception clone()
+ {
+ try
+ {
+ return (Exception) super.clone();
+ }
+ catch (CloneNotSupportedException ex)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public Exceptions getExceptions()
+ {
+ return exceptions;
+ }
+
+ public void setExceptions(Exceptions exceptions)
+ {
+ this.exceptions = exceptions;
+ }
+
+ public Label getStart()
+ {
+ return start;
+ }
+
+ public void setStart(Label ins)
+ {
+ start = ins;
+ }
+
+ public Label getEnd()
+ {
+ return end;
+ }
+
+ public void setEnd(Label end)
+ {
+ this.end = end;
+ }
+
+ public Label getHandler()
+ {
+ return handler;
+ }
+
+ public void setHandler(Label handler)
+ {
+ this.handler = handler;
+ }
+
+ public Class getCatchType()
+ {
+ return catchType;
+ }
+
+ public void setCatchType(Class catchType)
+ {
+ this.catchType = catchType;
+ }
+
+ public void renameClass(ClassFile cf, String name)
+ {
+ if (catchType != null && cf.getName().equals(catchType.getName()))
+ catchType = new Class(name);
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java
new file mode 100644
index 0000000000..30b00a0115
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.attributes.Code;
+
+public class Exceptions
+{
+ private Code code;
+ private List exceptions = new ArrayList();
+
+ public Exceptions(Code code)
+ {
+ this.code = code;
+ }
+
+ public void add(Exception e)
+ {
+ exceptions.add(e);
+ }
+
+ public void remove(Exception e)
+ {
+ exceptions.remove(e);
+ }
+
+ public void clear()
+ {
+ exceptions.clear();
+ }
+
+ public Code getCode()
+ {
+ return code;
+ }
+
+ public List getExceptions()
+ {
+ return exceptions;
+ }
+
+ public void renameClass(ClassFile cf, String name)
+ {
+ for (Exception e : exceptions)
+ e.renameClass(cf, name);
+ }
+}
\ No newline at end of file
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java
new file mode 100644
index 0000000000..bf8e64535e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code;
+
+import net.runelite.asm.Method;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import org.objectweb.asm.MethodVisitor;
+
+public abstract class Instruction implements Cloneable
+{
+ private Instructions instructions;
+ private InstructionType type;
+
+ public Instruction(Instructions instructions, InstructionType type)
+ {
+ this.instructions = instructions;
+ this.type = type;
+ }
+
+ @Override
+ public String toString()
+ {
+ if (this.getInstructions() != null)
+ {
+ Method m = this.getInstructions().getCode().getMethod();
+ return super.toString() + " in " + m;// + " at pc 0x" + Integer.toHexString(this.getPc());
+ }
+ else
+ {
+ return super.toString() + " ";
+ }
+ }
+
+ @Override
+ public Instruction clone()
+ {
+ Instruction i;
+ try
+ {
+ i = (Instruction) super.clone();
+ }
+ catch (CloneNotSupportedException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ return i;
+ }
+
+ protected void remove()
+ {
+ Exceptions exceptions = instructions.getCode().getExceptions();
+ for (Exception e : exceptions.getExceptions())
+ {
+ assert this != e.getStart();
+ assert this != e.getEnd();
+ assert this != e.getHandler();
+ }
+ }
+
+ public boolean removeStack()
+ {
+ assert instructions != null;
+
+ this.getInstructions().remove(this); // calls remove()
+
+ return true;
+ }
+
+ // resolve jumps
+ public void resolve()
+ {
+ }
+
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitInsn(this.getType().getCode());
+ }
+
+ public Instructions getInstructions()
+ {
+ return instructions;
+ }
+
+ public void setInstructions(Instructions instructions)
+ {
+ this.instructions = instructions;
+ }
+
+ public InstructionType getType()
+ {
+ return type;
+ }
+
+ protected void setType(InstructionType type)
+ {
+ this.type = type;
+ }
+
+ public abstract InstructionContext execute(Frame e);
+
+ /* does this terminate a block? */
+ public boolean isTerminal()
+ {
+ return false;
+ }
+
+ // look up symbols from pool
+ public void lookup()
+ {
+ }
+
+ // instructions keep resolved method/field/class names, this updates the pool value (if the underlying resolved object changes)
+ public void regeneratePool()
+ {
+ }
+
+ public void renameClass(String oldName, String newName)
+ {
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java
new file mode 100644
index 0000000000..0c347d4809
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code;
+
+import net.runelite.asm.attributes.code.instructions.AALoad;
+import net.runelite.asm.attributes.code.instructions.AAStore;
+import net.runelite.asm.attributes.code.instructions.AConstNull;
+import net.runelite.asm.attributes.code.instructions.ALoad;
+import net.runelite.asm.attributes.code.instructions.ANewArray;
+import net.runelite.asm.attributes.code.instructions.AStore;
+import net.runelite.asm.attributes.code.instructions.AThrow;
+import net.runelite.asm.attributes.code.instructions.ArrayLength;
+import net.runelite.asm.attributes.code.instructions.BALoad;
+import net.runelite.asm.attributes.code.instructions.BAStore;
+import net.runelite.asm.attributes.code.instructions.BiPush;
+import net.runelite.asm.attributes.code.instructions.CALoad;
+import net.runelite.asm.attributes.code.instructions.CAStore;
+import net.runelite.asm.attributes.code.instructions.CheckCast;
+import net.runelite.asm.attributes.code.instructions.D2F;
+import net.runelite.asm.attributes.code.instructions.D2I;
+import net.runelite.asm.attributes.code.instructions.D2L;
+import net.runelite.asm.attributes.code.instructions.DALoad;
+import net.runelite.asm.attributes.code.instructions.DAStore;
+import net.runelite.asm.attributes.code.instructions.DAdd;
+import net.runelite.asm.attributes.code.instructions.DCmpG;
+import net.runelite.asm.attributes.code.instructions.DCmpL;
+import net.runelite.asm.attributes.code.instructions.DDiv;
+import net.runelite.asm.attributes.code.instructions.DLoad;
+import net.runelite.asm.attributes.code.instructions.DMul;
+import net.runelite.asm.attributes.code.instructions.DNeg;
+import net.runelite.asm.attributes.code.instructions.DRem;
+import net.runelite.asm.attributes.code.instructions.DStore;
+import net.runelite.asm.attributes.code.instructions.DSub;
+import net.runelite.asm.attributes.code.instructions.Dup;
+import net.runelite.asm.attributes.code.instructions.Dup2;
+import net.runelite.asm.attributes.code.instructions.Dup2_X1;
+import net.runelite.asm.attributes.code.instructions.Dup2_X2;
+import net.runelite.asm.attributes.code.instructions.Dup_X1;
+import net.runelite.asm.attributes.code.instructions.Dup_X2;
+import net.runelite.asm.attributes.code.instructions.F2D;
+import net.runelite.asm.attributes.code.instructions.F2I;
+import net.runelite.asm.attributes.code.instructions.F2L;
+import net.runelite.asm.attributes.code.instructions.FALoad;
+import net.runelite.asm.attributes.code.instructions.FAStore;
+import net.runelite.asm.attributes.code.instructions.FAdd;
+import net.runelite.asm.attributes.code.instructions.FCmpG;
+import net.runelite.asm.attributes.code.instructions.FCmpL;
+import net.runelite.asm.attributes.code.instructions.FDiv;
+import net.runelite.asm.attributes.code.instructions.FLoad;
+import net.runelite.asm.attributes.code.instructions.FMul;
+import net.runelite.asm.attributes.code.instructions.FNeg;
+import net.runelite.asm.attributes.code.instructions.FRem;
+import net.runelite.asm.attributes.code.instructions.FStore;
+import net.runelite.asm.attributes.code.instructions.FSub;
+import net.runelite.asm.attributes.code.instructions.GetField;
+import net.runelite.asm.attributes.code.instructions.GetStatic;
+import net.runelite.asm.attributes.code.instructions.Goto;
+import net.runelite.asm.attributes.code.instructions.GotoW;
+import net.runelite.asm.attributes.code.instructions.I2B;
+import net.runelite.asm.attributes.code.instructions.I2C;
+import net.runelite.asm.attributes.code.instructions.I2D;
+import net.runelite.asm.attributes.code.instructions.I2F;
+import net.runelite.asm.attributes.code.instructions.I2L;
+import net.runelite.asm.attributes.code.instructions.I2S;
+import net.runelite.asm.attributes.code.instructions.IALoad;
+import net.runelite.asm.attributes.code.instructions.IAStore;
+import net.runelite.asm.attributes.code.instructions.IAdd;
+import net.runelite.asm.attributes.code.instructions.IAnd;
+import net.runelite.asm.attributes.code.instructions.IDiv;
+import net.runelite.asm.attributes.code.instructions.IInc;
+import net.runelite.asm.attributes.code.instructions.ILoad;
+import net.runelite.asm.attributes.code.instructions.IMul;
+import net.runelite.asm.attributes.code.instructions.INeg;
+import net.runelite.asm.attributes.code.instructions.IOr;
+import net.runelite.asm.attributes.code.instructions.IRem;
+import net.runelite.asm.attributes.code.instructions.IShL;
+import net.runelite.asm.attributes.code.instructions.IShR;
+import net.runelite.asm.attributes.code.instructions.IStore;
+import net.runelite.asm.attributes.code.instructions.ISub;
+import net.runelite.asm.attributes.code.instructions.IUShR;
+import net.runelite.asm.attributes.code.instructions.IXor;
+import net.runelite.asm.attributes.code.instructions.IfACmpEq;
+import net.runelite.asm.attributes.code.instructions.IfACmpNe;
+import net.runelite.asm.attributes.code.instructions.IfCmpGe;
+import net.runelite.asm.attributes.code.instructions.IfCmpGt;
+import net.runelite.asm.attributes.code.instructions.IfCmpLe;
+import net.runelite.asm.attributes.code.instructions.IfCmpLt;
+import net.runelite.asm.attributes.code.instructions.IfEq;
+import net.runelite.asm.attributes.code.instructions.IfGe;
+import net.runelite.asm.attributes.code.instructions.IfGt;
+import net.runelite.asm.attributes.code.instructions.IfICmpEq;
+import net.runelite.asm.attributes.code.instructions.IfICmpNe;
+import net.runelite.asm.attributes.code.instructions.IfLe;
+import net.runelite.asm.attributes.code.instructions.IfLt;
+import net.runelite.asm.attributes.code.instructions.IfNe;
+import net.runelite.asm.attributes.code.instructions.IfNonNull;
+import net.runelite.asm.attributes.code.instructions.IfNull;
+import net.runelite.asm.attributes.code.instructions.InstanceOf;
+import net.runelite.asm.attributes.code.instructions.InvokeDynamic;
+import net.runelite.asm.attributes.code.instructions.InvokeInterface;
+import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
+import net.runelite.asm.attributes.code.instructions.InvokeStatic;
+import net.runelite.asm.attributes.code.instructions.InvokeVirtual;
+import net.runelite.asm.attributes.code.instructions.L2D;
+import net.runelite.asm.attributes.code.instructions.L2F;
+import net.runelite.asm.attributes.code.instructions.L2I;
+import net.runelite.asm.attributes.code.instructions.LALoad;
+import net.runelite.asm.attributes.code.instructions.LAStore;
+import net.runelite.asm.attributes.code.instructions.LAdd;
+import net.runelite.asm.attributes.code.instructions.LAnd;
+import net.runelite.asm.attributes.code.instructions.LCmp;
+import net.runelite.asm.attributes.code.instructions.LDC;
+import net.runelite.asm.attributes.code.instructions.LDiv;
+import net.runelite.asm.attributes.code.instructions.LLoad;
+import net.runelite.asm.attributes.code.instructions.LMul;
+import net.runelite.asm.attributes.code.instructions.LNeg;
+import net.runelite.asm.attributes.code.instructions.LOr;
+import net.runelite.asm.attributes.code.instructions.LRem;
+import net.runelite.asm.attributes.code.instructions.LShL;
+import net.runelite.asm.attributes.code.instructions.LShR;
+import net.runelite.asm.attributes.code.instructions.LStore;
+import net.runelite.asm.attributes.code.instructions.LSub;
+import net.runelite.asm.attributes.code.instructions.LUShR;
+import net.runelite.asm.attributes.code.instructions.LXor;
+import net.runelite.asm.attributes.code.instructions.LookupSwitch;
+import net.runelite.asm.attributes.code.instructions.MonitorEnter;
+import net.runelite.asm.attributes.code.instructions.MonitorExit;
+import net.runelite.asm.attributes.code.instructions.MultiANewArray;
+import net.runelite.asm.attributes.code.instructions.NOP;
+import net.runelite.asm.attributes.code.instructions.New;
+import net.runelite.asm.attributes.code.instructions.NewArray;
+import net.runelite.asm.attributes.code.instructions.Pop;
+import net.runelite.asm.attributes.code.instructions.Pop2;
+import net.runelite.asm.attributes.code.instructions.PutField;
+import net.runelite.asm.attributes.code.instructions.PutStatic;
+import net.runelite.asm.attributes.code.instructions.Return;
+import net.runelite.asm.attributes.code.instructions.SALoad;
+import net.runelite.asm.attributes.code.instructions.SAStore;
+import net.runelite.asm.attributes.code.instructions.SiPush;
+import net.runelite.asm.attributes.code.instructions.Swap;
+import net.runelite.asm.attributes.code.instructions.TableSwitch;
+import net.runelite.asm.attributes.code.instructions.VReturn;
+
+public enum InstructionType
+{
+ NOP(0x00, "nop", NOP.class),
+ ACONST_NULL(0x01, "aconst_null", AConstNull.class),
+ BIPUSH(0x10, "bipush", BiPush.class),
+ SIPUSH(0x11, "sipush", SiPush.class),
+ LDC(-1, "ldc", LDC.class),
+ ILOAD(0x15, "iload", ILoad.class),
+ LLOAD(0x16, "lload", LLoad.class),
+ FLOAD(0x17, "fload", FLoad.class),
+ DLOAD(0x18, "dload", DLoad.class),
+ ALOAD(0x19, "aload", ALoad.class),
+ IALOAD(0x2e, "iaload", IALoad.class),
+ LALOAD(0x2f, "laload", LALoad.class),
+ FALOAD(0x30, "faload", FALoad.class),
+ DALOAD(0x31, "daload", DALoad.class),
+ AALOAD(0x32, "aaload", AALoad.class),
+ BALOAD(0x33, "baload", BALoad.class),
+ CALOAD(0x34, "caload", CALoad.class),
+ SALOAD(0x35, "saload", SALoad.class),
+ ISTORE(0x36, "istore", IStore.class),
+ LSTORE(0x37, "lstore", LStore.class),
+ FSTORE(0x38, "fstore", FStore.class),
+ DSTORE(0x39, "dstore", DStore.class),
+ ASTORE(0x3a, "astore", AStore.class),
+ IASTORE(0x4f, "iastore", IAStore.class),
+ LASTORE(0x50, "lastore", LAStore.class),
+ FASTORE(0x51, "fastore", FAStore.class),
+ DASTORE(0x52, "dastore", DAStore.class),
+ AASTORE(0x53, "aastore", AAStore.class),
+ BASTORE(0x54, "bastore", BAStore.class),
+ CASTORE(0x55, "castore", CAStore.class),
+ SASTORE(0x56, "sastore", SAStore.class),
+ POP(0x57, "pop", Pop.class),
+ POP2(0x58, "pop2", Pop2.class),
+ DUP(0x59, "dup", Dup.class),
+ DUP_X1(0x5a, "dup_x1", Dup_X1.class),
+ DUP_X2(0x5b, "dup_x2", Dup_X2.class),
+ DUP2(0x5c, "dup2", Dup2.class),
+ DUP2_X1(0x5d, "dup2_x1", Dup2_X1.class),
+ DUP2_X2(0x5e, "dup2_x2", Dup2_X2.class),
+ SWAP(0x5f, "swap", Swap.class),
+ IADD(0x60, "iadd", IAdd.class),
+ LADD(0x61, "ladd", LAdd.class),
+ FADD(0x62, "fadd", FAdd.class),
+ DADD(0x63, "dadd", DAdd.class),
+ ISUB(0x64, "isub", ISub.class),
+ LSUB(0x65, "lsub", LSub.class),
+ FSUB(0x66, "fsub", FSub.class),
+ DSUB(0x67, "dsub", DSub.class),
+ IMUL(0x68, "imul", IMul.class),
+ LMUL(0x69, "lmul", LMul.class),
+ FMUL(0x6a, "fmul", FMul.class),
+ DMUL(0x6b, "dmul", DMul.class),
+ IDIV(0x6c, "idiv", IDiv.class),
+ LDIV(0x6d, "ldiv", LDiv.class),
+ FDIV(0x6e, "fdiv", FDiv.class),
+ DDIV(0x6f, "ddiv", DDiv.class),
+ IREM(0x70, "irem", IRem.class),
+ LREM(0x71, "lrem", LRem.class),
+ FREM(0x72, "frem", FRem.class),
+ DREM(0x73, "drem", DRem.class),
+ INEG(0x74, "ineg", INeg.class),
+ LNEG(0x75, "lneg", LNeg.class),
+ FNEG(0x76, "fneg", FNeg.class),
+ DNEG(0x77, "dneg", DNeg.class),
+ ISHL(0x78, "ishl", IShL.class),
+ LSHL(0x79, "lshl", LShL.class),
+ ISHR(0x7a, "ishr", IShR.class),
+ LSHR(0x7b, "lshr", LShR.class),
+ IUSHR(0x7c, "iushr", IUShR.class),
+ LUSHR(0x7d, "lushr", LUShR.class),
+ IAND(0x7e, "iand", IAnd.class),
+ LAND(0x7f, "land", LAnd.class),
+ IOR(0x80, "ior", IOr.class),
+ LOR(0x81, "lor", LOr.class),
+ IXOR(0x82, "ixor", IXor.class),
+ LXOR(0x83, "lxor", LXor.class),
+ IINC(0x84, "iinc", IInc.class),
+ I2L(0x85, "i2l", I2L.class),
+ I2F(0x86, "i2f", I2F.class),
+ I2D(0x87, "i2d", I2D.class),
+ L2I(0x88, "l2i", L2I.class),
+ L2F(0x89, "l2f", L2F.class),
+ L2D(0x8a, "l2d", L2D.class),
+ F2I(0x8b, "f2i", F2I.class),
+ F2L(0x8c, "f2l", F2L.class),
+ F2D(0x8d, "f2d", F2D.class),
+ D2I(0x8e, "d2i", D2I.class),
+ D2L(0x8f, "d2l", D2L.class),
+ D2F(0x90, "d2f", D2F.class),
+ I2B(0x91, "i2b", I2B.class),
+ I2C(0x92, "i2c", I2C.class),
+ I2S(0x93, "i2s", I2S.class),
+ LCMP(0x94, "lcmp", LCmp.class),
+ FCMPL(0x95, "fcmpl", FCmpL.class),
+ FCMPG(0x96, "fcmpg", FCmpG.class),
+ DCMPL(0x97, "dcmpl", DCmpL.class),
+ DCMPG(0x98, "dcmpg", DCmpG.class),
+ IFEQ(0x99, "ifeq", IfEq.class),
+ IFNE(0x9a, "ifne", IfNe.class),
+ IFLT(0x9b, "iflt", IfLt.class),
+ IFGE(0x9c, "ifge", IfGe.class),
+ IFGT(0x9d, "ifgt", IfGt.class),
+ IFLE(0x9e, "ifle", IfLe.class),
+ IF_ICMPEQ(0x9f, "if_icmpeq", IfICmpEq.class),
+ IF_ICMPNE(0xa0, "if_icmpne", IfICmpNe.class),
+ IF_ICMPLT(0xa1, "if_cmplt", IfCmpLt.class),
+ IF_ICMPGE(0xa2, "if_icmpge", IfCmpGe.class),
+ IF_ICMPGT(0xa3, "if_icmpgt", IfCmpGt.class),
+ IF_ICMPLE(0xa4, "if_icmple", IfCmpLe.class),
+ IF_ACMPEQ(0xa5, "if_acmpeq", IfACmpEq.class),
+ IF_ACMPNE(0xa6, "if_acmpne", IfACmpNe.class),
+ GOTO(0xa7, "goto", Goto.class),
+ TABLESWITCH(0xaa, "tableswitch", TableSwitch.class),
+ LOOKUPSWITCH(0xab, "lookupswitch", LookupSwitch.class),
+ IRETURN(0xac, "ireturn", Return.class),
+ LRETURN(0xad, "lreturn", Return.class),
+ FRETURN(0xae, "freturn", Return.class),
+ DRETURN(0xaf, "dreturn", Return.class),
+ ARETURN(0xb0, "areturn", Return.class),
+ RETURN(0xb1, "return", VReturn.class),
+ GETSTATIC(0xb2, "getstatic", GetStatic.class),
+ PUTSTATIC(0xb3, "putstatic", PutStatic.class),
+ GETFIELD(0xb4, "getfield", GetField.class),
+ PUTFIELD(0xb5, "putfield", PutField.class),
+ INVOKEVIRTUAL(0xb6, "invokevirtual", InvokeVirtual.class),
+ INVOKESPECIAL(0xb7, "invokespecial", InvokeSpecial.class),
+ INVOKESTATIC(0xb8, "invokestatic", InvokeStatic.class),
+ INVOKEINTERFACE(0xb9, "invokeinterface", InvokeInterface.class),
+ INVOKEDYNAMIC(0xba, "invokedynamic", InvokeDynamic.class),
+ NEW(0xbb, "new", New.class),
+ NEWARRAY(0xbc, "newarray", NewArray.class),
+ ANEWARRAY(0xbd, "anewarray", ANewArray.class),
+ ARRAYLENGTH(0xbe, "arraylength", ArrayLength.class),
+ ATHROW(0xbf, "athrow", AThrow.class),
+ CHECKCAST(0xc0, "checkcast", CheckCast.class),
+ INSTANCEOf(0xc1, "instanceof", InstanceOf.class),
+ MONITORENTER(0xc2, "monitorenter", MonitorEnter.class),
+ MONITOREXIT(0xc3, "monitorexit", MonitorExit.class),
+ MULTIANEWARRAY(0xc5, "multianewarray", MultiANewArray.class),
+ IFNULL(0xc6, "ifnull", IfNull.class),
+ IFNONNULL(0xc7, "ifnonnull", IfNonNull.class),
+ GOTO_W(0xc8, "goto_w", GotoW.class);
+
+ private final int code;
+ private final String name;
+ private final Class extends Instruction> clazz;
+
+ InstructionType(int op, String name, Class extends Instruction> clazz)
+ {
+ this.code = op;
+ this.name = name;
+ this.clazz = clazz;
+ }
+
+ public int getCode()
+ {
+ return code;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Class extends Instruction> getInstructionClass()
+ {
+ return clazz;
+ }
+
+ public static InstructionType findInstructionFromCode(int code)
+ {
+ for (InstructionType t : InstructionType.values())
+ {
+ if (t.getCode() == code)
+ {
+ return t;
+ }
+ }
+ return null;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java
new file mode 100644
index 0000000000..a528950d0a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import net.runelite.asm.attributes.Code;
+
+public class Instructions
+{
+ private final Code code;
+ private final List instructions = new ArrayList<>();
+ private final Map labelMap = new HashMap<>();
+
+ public Instructions(Code code)
+ {
+ this.code = code;
+ }
+
+ public Label createLabelFor(Instruction target)
+ {
+ return createLabelFor(target, false);
+ }
+
+ public Label createLabelFor(Instruction target, boolean forceCreate)
+ {
+ assert target.getInstructions() == this;
+ assert instructions.contains(target);
+
+ if (target instanceof Label)
+ {
+ return (Label) target;
+ }
+
+ int i = instructions.indexOf(target);
+ if (i > 0)
+ {
+ Instruction before = instructions.get(i - 1);
+
+ if (!forceCreate && before instanceof Label)
+ {
+ return (Label) before;
+ }
+ }
+
+ Label label = new Label(this);
+ label.setLabel(new org.objectweb.asm.Label());
+ instructions.add(i, label);
+ labelMap.put(label.getLabel(), label);
+ return label;
+ }
+
+ public Label findLabel(org.objectweb.asm.Label l)
+ {
+ Label label = labelMap.get(l);
+ assert label != null;
+ return label;
+ }
+
+ public Label findOrCreateLabel(org.objectweb.asm.Label l)
+ {
+ Label label = labelMap.get(l);
+ if (label != null)
+ {
+ return label;
+ }
+
+ label = new Label(this, l);
+ labelMap.put(l, label);
+
+ return label;
+ }
+
+ public void rebuildLabels()
+ {
+ labelMap.clear();
+
+ // ow2 asm requires new Labels each time you write out a class
+ // with ClassWriter, or else it crytpically fails
+ for (Instruction i : instructions)
+ {
+ if (i instanceof Label)
+ {
+ org.objectweb.asm.Label label = new org.objectweb.asm.Label();
+ ((Label) i).setLabel(label);
+
+ labelMap.put(label, (Label) i);
+ }
+ }
+ }
+
+ public List getInstructions()
+ {
+ return instructions;
+ }
+
+ public void addInstruction(Instruction i)
+ {
+ assert i.getInstructions() == this;
+ instructions.add(i);
+ }
+
+ public void addInstruction(int idx, Instruction i)
+ {
+ assert i.getInstructions() == this;
+ instructions.add(idx, i);
+ }
+
+ public void remove(Instruction ins)
+ {
+ assert ins.getInstructions() == this;
+ ins.remove();
+ instructions.remove(ins);
+ ins.setInstructions(null);
+ }
+
+ public void clear()
+ {
+ for (Instruction ins : instructions)
+ {
+ ins.remove();
+ ins.setInstructions(null);
+ }
+ instructions.clear();
+ }
+
+ public Code getCode()
+ {
+ return code;
+ }
+
+ public void lookup()
+ {
+ for (Instruction i : instructions)
+ {
+ i.lookup();
+ }
+ }
+
+ public void regeneratePool()
+ {
+ for (Instruction i : instructions)
+ {
+ i.regeneratePool();
+ }
+ }
+
+ public int replace(Instruction oldi, Instruction newi)
+ {
+ assert oldi != newi;
+
+ assert oldi.getInstructions() == this;
+ assert newi.getInstructions() == this;
+
+ assert instructions.contains(oldi);
+ assert !instructions.contains(newi);
+
+ int i = instructions.indexOf(oldi);
+ instructions.remove(oldi);
+ oldi.setInstructions(null);
+ instructions.add(i, newi);
+
+ return i;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java
new file mode 100644
index 0000000000..7f2cd70ffd
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code;
+
+import net.runelite.asm.attributes.code.instructions.NOP;
+import org.objectweb.asm.MethodVisitor;
+
+public class Label extends NOP
+{
+ private org.objectweb.asm.Label label;
+ private Integer lineNumber;
+
+ public Label(Instructions instructions)
+ {
+ super(instructions);
+ }
+
+ public Label(Instructions instructions, org.objectweb.asm.Label label)
+ {
+ super(instructions);
+ this.label = label;
+ }
+
+ @Override
+ public String toString()
+ {
+ String string;
+
+ if (this.getInstructions() == null)
+ {
+ string = "label ";
+ }
+ else
+ {
+ Instruction next = next();
+
+ if (next == null)
+ {
+ string = "label with no next instruction";
+ }
+ else
+ {
+ string = "label " + next.toString();
+ }
+ }
+
+ if (lineNumber != null)
+ {
+ string += " on line number " + lineNumber;
+ }
+
+ return string;
+ }
+
+ @Override
+ public Instruction clone()
+ {
+ Label l = (Label) super.clone();
+ l.label = new org.objectweb.asm.Label();
+ l.lineNumber = lineNumber;
+ return l;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitLabel(label);
+
+ if (lineNumber != null)
+ {
+ visitor.visitLineNumber(lineNumber, label);
+ }
+ }
+
+ public org.objectweb.asm.Label getLabel()
+ {
+ return label;
+ }
+
+ public void setLabel(org.objectweb.asm.Label label)
+ {
+ this.label = label;
+ }
+
+ public void setLineNumber(Integer lineNumber)
+ {
+ this.lineNumber = lineNumber;
+ }
+
+ public Instruction next()
+ {
+ Instructions ins = this.getInstructions();
+ int i = ins.getInstructions().indexOf(this);
+ assert i != -1;
+
+ Instruction next;
+ do
+ {
+ next = ins.getInstructions().get(i + 1);
+ ++i;
+ }
+ while (next instanceof Label);
+
+ return next;
+ }
+}
diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemLayerMixin.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java
similarity index 61%
rename from runelite-mixins/src/main/java/net/runelite/mixins/RSItemLayerMixin.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java
index 8b67d4d314..3956b453d1 100644
--- a/runelite-mixins/src/main/java/net/runelite/mixins/RSItemLayerMixin.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, SomeoneWithAnInternetConnection
+ * Copyright (c) 2018 Morgan Lewis
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,37 +22,56 @@
* (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.mixins;
+package net.runelite.asm.attributes.code;
-import java.awt.geom.Area;
-import net.runelite.api.mixins.Inject;
-import net.runelite.api.mixins.Mixin;
-import net.runelite.rs.api.RSItemLayer;
+import org.objectweb.asm.Label;
-@Mixin(RSItemLayer.class)
-public abstract class RSItemLayerMixin implements RSItemLayer
+public class LocalVariable
{
- @Inject
- private int itemLayerPlane;
+ private final String name;
+ private final String desc;
+ private final String signature;
+ private final Label start;
+ private final Label end;
+ private final int index;
- @Inject
- @Override
- public int getPlane()
+ public LocalVariable(String name, String desc, String signature, Label start, Label end, int index)
{
- return itemLayerPlane;
+ this.name = name;
+ this.desc = desc;
+ this.signature = signature;
+ this.start = start;
+ this.end = end;
+ this.index = index;
}
- @Inject
- @Override
- public void setPlane(int plane)
+ public String getName()
{
- this.itemLayerPlane = plane;
+ return name;
}
- @Inject
- @Override
- public Area getClickbox()
+ public String getDesc()
{
- throw new UnsupportedOperationException();
+ return desc;
+ }
+
+ public String getSignature()
+ {
+ return signature;
+ }
+
+ public Label getStart()
+ {
+ return start;
+ }
+
+ public Label getEnd()
+ {
+ return end;
+ }
+
+ public int getIndex()
+ {
+ return index;
}
}
diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoreMixin.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java
similarity index 71%
rename from runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoreMixin.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java
index 98bcd7b3b2..b42a41a4b5 100644
--- a/runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoreMixin.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Adam
+ * Copyright (c) 2018 Morgan Lewis
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,28 +22,37 @@
* (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.mixins;
+package net.runelite.asm.attributes.code;
-import net.runelite.api.mixins.Inject;
-import net.runelite.api.mixins.Mixin;
-import net.runelite.rs.api.RSIgnore;
-import net.runelite.rs.api.RSName;
-
-@Mixin(RSIgnore.class)
-public abstract class RSIgnoreMixin implements RSIgnore
+public class Parameter
{
- @Override
- @Inject
+ private final String name;
+ private final int access;
+ private LocalVariable localVariable;
+
+ public Parameter(String name, int access)
+ {
+ this.name = name;
+ this.access = access;
+ }
+
public String getName()
{
- return getRsName().getName();
+ return name;
}
- @Override
- @Inject
- public String getPrevName()
+ public int getAccess()
{
- RSName prevName = getRsPrevName();
- return prevName == null ? null : prevName.getName();
+ return access;
+ }
+
+ public LocalVariable getLocalVariable()
+ {
+ return localVariable;
+ }
+
+ public void setLocalVariable(LocalVariable localVariable)
+ {
+ this.localVariable = localVariable;
}
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java
new file mode 100644
index 0000000000..0fbb69ab1d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public interface AdditionInstruction extends MappableInstruction
+{
+ default InstructionContext findArrayLoad(InstructionContext ic1, InstructionContext ic2)
+ {
+ Instruction i1 = ic1.getInstruction();
+ Instruction i2 = ic2.getInstruction();
+
+ if (i1 instanceof ArrayLoad && !(i2 instanceof ArrayLoad))
+ {
+ return ic1;
+ }
+ if (i2 instanceof ArrayLoad && !(i1 instanceof ArrayLoad))
+ {
+ return ic2;
+ }
+
+ return null;
+ }
+
+ @Override
+ default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other)
+ {
+ /* lhs/rhs of addition instructions are randomally swapped, but
+ * we still map if each side is recognizable
+ *
+ * N.B. since the lhs/rhs of nested iadds can be swapped, and
+ * the mapper maps the first that it encounters, this can certainly
+ * attempt to map the wrong instructions even when mapping the correct
+ * method, so be careful.
+ */
+ StackContext ctx1 = ctx.getPops().get(0);
+ StackContext ctx2 = ctx.getPops().get(1);
+
+ StackContext other1 = other.getPops().get(0);
+ StackContext other2 = other.getPops().get(1);
+
+ InstructionContext rc1 = ctx1.getPushed().resolve(ctx1);
+ InstructionContext rc2 = ctx2.getPushed().resolve(ctx2); //iaload
+
+ InstructionContext ro1 = other1.getPushed().resolve(other1);
+ InstructionContext ro2 = other2.getPushed().resolve(other2); //iaload
+
+ // There are a couple static final arrays that are only ever read from 1 or 2 places.. and never written
+ InstructionContext al1 = findArrayLoad(rc1, rc2);
+ InstructionContext al2 = findArrayLoad(ro1, ro2);
+
+ if (al1 == null || al2 == null)
+ {
+ return;
+ }
+
+ StackContext array1 = al1.getPops().get(1);
+ StackContext array2 = al2.getPops().get(1);
+
+ InstructionContext field1 = array1.getPushed().resolve(array1);
+ InstructionContext field2 = array2.getPushed().resolve(array2);
+
+ if (!(field1.getInstruction() instanceof GetFieldInstruction) || !(field2.getInstruction() instanceof GetFieldInstruction))
+ {
+ return;
+ }
+
+ GetFieldInstruction gf1 = (GetFieldInstruction) field1.getInstruction();
+ GetFieldInstruction gf2 = (GetFieldInstruction) field2.getInstruction();
+
+ Field f1 = gf1.getMyField();
+ Field f2 = gf2.getMyField();
+
+ if (f1 == null || f2 == null || !MappingExecutorUtil.isMaybeEqual(f1, f2))
+ {
+ return;
+ }
+
+ mappings.map((Instruction) this, f1, f2);
+ }
+
+ @Override
+ default boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ return this.getClass() == otherIc.getInstruction().getClass();
+ }
+
+ @Override
+ default boolean canMap(InstructionContext thisIc)
+ {
+ return true;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java
new file mode 100644
index 0000000000..da196f0056
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public interface ArrayLoad extends MappableInstruction
+{
+ @Override
+ default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other)
+ {
+ StackContext index1 = ctx.getPops().get(0),
+ index2 = other.getPops().get(0);
+
+ InstructionContext ctx1 = MappingExecutorUtil.resolve(index1.getPushed(), index1),
+ ctx2 = MappingExecutorUtil.resolve(index2.getPushed(), index2);
+
+ assert ctx1.getInstruction() instanceof GetFieldInstruction;
+ assert ctx2.getInstruction() instanceof GetFieldInstruction;
+
+ GetFieldInstruction gf1 = (GetFieldInstruction) ctx1.getInstruction();
+ GetFieldInstruction gf2 = (GetFieldInstruction) ctx2.getInstruction();
+ mappings.map((Instruction) this, gf1.getMyField(), gf2.getMyField());
+ }
+
+ @Override
+ default boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getType() != otherIc.getInstruction().getType())
+ {
+ return false;
+ }
+
+ StackContext index1 = thisIc.getPops().get(0),
+ index2 = otherIc.getPops().get(0);
+
+ InstructionContext ctx1 = MappingExecutorUtil.resolve(index1.getPushed(), index1),
+ ctx2 = MappingExecutorUtil.resolve(index2.getPushed(), index2);
+
+ assert ctx1.getInstruction() instanceof GetFieldInstruction;
+ assert ctx2.getInstruction() instanceof GetFieldInstruction;
+
+ GetFieldInstruction gf1 = (GetFieldInstruction) ctx1.getInstruction();
+ GetFieldInstruction gf2 = (GetFieldInstruction) ctx2.getInstruction();
+
+ return MappingExecutorUtil.isMaybeEqual(gf1.getMyField(), gf2.getMyField());
+ }
+
+ @Override
+ default boolean canMap(InstructionContext thisIc)
+ {
+ // assume that obfuscation can't remove a load with a variable
+ // index. map field access.
+ StackContext index = thisIc.getPops().get(0);
+ InstructionContext ctx = MappingExecutorUtil.resolve(index.getPushed(), index);
+ return ctx.getInstruction() instanceof GetFieldInstruction;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java
new file mode 100644
index 0000000000..de019ce9e0
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+public interface ArrayStoreInstruction extends MappableInstruction
+{
+
+}
diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClanMember.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java
similarity index 91%
rename from runescape-api/src/main/java/net/runelite/rs/api/RSClanMember.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java
index ba65238fa4..25e0cdf1da 100644
--- a/runescape-api/src/main/java/net/runelite/rs/api/RSClanMember.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java
@@ -22,10 +22,10 @@
* (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.rs.api;
-import net.runelite.api.ClanMember;
+package net.runelite.asm.attributes.code.instruction.types;
-public interface RSClanMember extends RSChatPlayer, ClanMember
+public interface ComparisonInstruction
{
+
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java
new file mode 100644
index 0000000000..099b281725
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+public interface ConversionInstruction
+{
+
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java
new file mode 100644
index 0000000000..f682748a65
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public interface DivisionInstruction extends MappableInstruction
+{
+ @Override
+ default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other)
+ {
+ StackContext s1 = ctx.getPops().get(0),
+ s2 = ctx.getPops().get(1);
+
+ StackContext o1 = other.getPops().get(0),
+ o2 = other.getPops().get(1);
+
+ InstructionContext i1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext i2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ InstructionContext io1 = MappingExecutorUtil.resolve(o1.getPushed(), o1);
+ InstructionContext io2 = MappingExecutorUtil.resolve(o2.getPushed(), o2);
+
+ if (i1.getInstruction() instanceof GetFieldInstruction && io1.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction f1 = (GetFieldInstruction) i1.getInstruction();
+ GetFieldInstruction f2 = (GetFieldInstruction) io1.getInstruction();
+
+ Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
+
+ if (fi1 != null && fi2 != null)
+ mappings.map((Instruction) this, fi1, fi2);
+ }
+
+ if (i2.getInstruction() instanceof GetFieldInstruction && io2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction f1 = (GetFieldInstruction) i2.getInstruction();
+ GetFieldInstruction f2 = (GetFieldInstruction) io2.getInstruction();
+
+ Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
+
+ if (fi1 != null && fi2 != null)
+ mappings.map((Instruction) this, fi1, fi2);
+ }
+ }
+
+ @Override
+ default boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ return this.getClass() == otherIc.getInstruction().getClass();
+ }
+
+ @Override
+ default boolean canMap(InstructionContext thisIc)
+ {
+ return true;
+ }
+}
diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSObjectComposition.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java
similarity index 67%
rename from runescape-api/src/main/java/net/runelite/rs/api/RSObjectComposition.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java
index 3df00175f5..93ccb70e45 100644
--- a/runescape-api/src/main/java/net/runelite/rs/api/RSObjectComposition.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java
@@ -22,38 +22,30 @@
* (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.rs.api;
-import net.runelite.api.ObjectComposition;
-import net.runelite.mapping.Import;
+package net.runelite.asm.attributes.code.instruction.types;
-public interface RSObjectComposition extends ObjectComposition
+import java.util.List;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+
+public interface DupInstruction
{
- @Import("id")
- @Override
- int getId();
+ StackContext getOriginal(StackContext sctx);
+
+ StackContext getOtherBranch(StackContext sctx);
- @Import("name")
- @Override
- String getName();
+ /**
+ * get the duplicated stackcontexts (which is popped from this)
+ * @param ictx instruction context for this instruction
+ * @return
+ */
+ List getDuplicated(InstructionContext ictx);
- @Import("actions")
- @Override
- String[] getActions();
-
- @Import("mapSceneId")
- @Override
- int getMapSceneId();
-
- @Import("mapIconId")
- @Override
- int getMapIconId();
-
- @Import("impostorIds")
- @Override
- int[] getImpostorIds();
-
- @Import("getImpostor")
- @Override
- RSObjectComposition getImpostor();
+ /**
+ * get the copied stackcontexts (pushed from this)
+ * @param ictx
+ * @return
+ */
+ List getCopies(InstructionContext ictx);
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java
new file mode 100644
index 0000000000..e9ed4999ff
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.pool.Field;
+
+public interface FieldInstruction
+{
+ Field getField();
+
+ void setField(Field field);
+
+ net.runelite.asm.Field getMyField();
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java
new file mode 100644
index 0000000000..f5a5af480a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+public interface GetFieldInstruction extends FieldInstruction
+{
+}
diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSDeque.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java
similarity index 89%
rename from runescape-api/src/main/java/net/runelite/rs/api/RSDeque.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java
index 9a0c2aa303..2bc361ef44 100644
--- a/runescape-api/src/main/java/net/runelite/rs/api/RSDeque.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java
@@ -22,15 +22,12 @@
* (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.rs.api;
-import net.runelite.mapping.Import;
+package net.runelite.asm.attributes.code.instruction.types;
-public interface RSDeque
+public interface IntInstruction
{
- @Import("current")
- RSNode getCurrent();
+ int getOperand();
- @Import("head")
- RSNode getHead();
+ void setOperand(int operand);
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java
new file mode 100644
index 0000000000..9396f974de
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import java.util.List;
+import net.runelite.asm.Method;
+
+public interface InvokeInstruction extends MappableInstruction
+{
+ void removeParameter(int idx);
+
+ net.runelite.asm.pool.Method getMethod();
+
+ void setMethod(net.runelite.asm.pool.Method method);
+
+ List getMethods();
+}
diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSHashTable.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java
similarity index 83%
rename from runescape-api/src/main/java/net/runelite/rs/api/RSHashTable.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java
index e1462ce1dd..fc1dda4b3a 100644
--- a/runescape-api/src/main/java/net/runelite/rs/api/RSHashTable.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java
@@ -22,20 +22,16 @@
* (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.rs.api;
+package net.runelite.asm.attributes.code.instruction.types;
-import net.runelite.api.HashTable;
-import net.runelite.mapping.Import;
+import java.util.List;
+import net.runelite.asm.attributes.code.Label;
-public interface RSHashTable extends HashTable
+public interface JumpingInstruction
{
- @Import("get")
- @Override
- RSNode get(long value);
+ List getJumps();
- @Import("size")
- int getSize();
+ void setJumps(List labels);
- @Import("buckets")
- RSNode[] getBuckets();
+ void setLabel(org.objectweb.asm.Label label);
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstruction.java
new file mode 100644
index 0000000000..3710c1c384
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstruction.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.attributes.code.Instruction;
+
+public interface LVTInstruction
+{
+ int getVariableIndex();
+
+ Instruction setVariableIndex(int idx);
+
+ boolean store();
+
+ LVTInstructionType type();
+}
diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClassInfo.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstructionType.java
similarity index 83%
rename from runescape-api/src/main/java/net/runelite/rs/api/RSClassInfo.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstructionType.java
index 52dbd172d1..d6b4d9c0e7 100644
--- a/runescape-api/src/main/java/net/runelite/rs/api/RSClassInfo.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstructionType.java
@@ -22,20 +22,25 @@
* (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.rs.api;
+package net.runelite.asm.attributes.code.instruction.types;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import net.runelite.mapping.Import;
-
-public interface RSClassInfo
+public enum LVTInstructionType
{
- @Import("methods")
- Method[] getMethods();
+ INT(1),
+ LONG(2),
+ FLOAT(1),
+ DOUBLE(2),
+ OBJECT(1);
- @Import("fields")
- Field[] getFields();
+ private final int slots;
- @Import("args")
- byte[][][] getArgs();
+ private LVTInstructionType(int slots)
+ {
+ this.slots = slots;
+ }
+
+ public int getSlots()
+ {
+ return slots;
+ }
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/MappableInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/MappableInstruction.java
new file mode 100644
index 0000000000..e86faf24df
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/MappableInstruction.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public interface MappableInstruction
+{
+ void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other);
+
+ boolean isSame(InstructionContext thisIc, InstructionContext otherIc);
+
+ boolean canMap(InstructionContext thisIc);
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/PushConstantInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/PushConstantInstruction.java
new file mode 100644
index 0000000000..06da5c52f6
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/PushConstantInstruction.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.attributes.code.Instruction;
+
+public interface PushConstantInstruction
+{
+ Object getConstant();
+
+ Instruction setConstant(Object entry);
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ReturnInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ReturnInstruction.java
new file mode 100644
index 0000000000..c23a0bdfb5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ReturnInstruction.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+public interface ReturnInstruction
+{
+
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SetFieldInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SetFieldInstruction.java
new file mode 100644
index 0000000000..7147d93047
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SetFieldInstruction.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+public interface SetFieldInstruction extends FieldInstruction, MappableInstruction
+{
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SubtractionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SubtractionInstruction.java
new file mode 100644
index 0000000000..a31eb33df2
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SubtractionInstruction.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public interface SubtractionInstruction extends MappableInstruction
+{
+ @Override
+ default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other)
+ {
+ StackContext s1 = ctx.getPops().get(0),
+ s2 = ctx.getPops().get(1);
+
+ StackContext o1 = other.getPops().get(0),
+ o2 = other.getPops().get(1);
+
+ InstructionContext i1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext i2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ InstructionContext io1 = MappingExecutorUtil.resolve(o1.getPushed(), o1);
+ InstructionContext io2 = MappingExecutorUtil.resolve(o2.getPushed(), o2);
+
+ if (i1.getInstruction() instanceof GetFieldInstruction && io1.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction f1 = (GetFieldInstruction) i1.getInstruction();
+ GetFieldInstruction f2 = (GetFieldInstruction) io1.getInstruction();
+
+ Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
+
+ assert MappingExecutorUtil.isMaybeEqual(fi1, fi2);
+
+ if (fi1 != null && fi2 != null)
+ {
+ mappings.map((Instruction) this, fi1, fi2);
+ }
+ }
+
+ if (i2.getInstruction() instanceof GetFieldInstruction && io2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction f1 = (GetFieldInstruction) i2.getInstruction();
+ GetFieldInstruction f2 = (GetFieldInstruction) io2.getInstruction();
+
+ Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
+
+ assert MappingExecutorUtil.isMaybeEqual(fi1, fi2);
+
+ if (fi1 != null && fi2 != null)
+ {
+ mappings.map((Instruction) this, fi1, fi2);
+ }
+ }
+ }
+
+ @Override
+ default boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (this.getClass() != otherIc.getInstruction().getClass())
+ {
+ return false;
+ }
+
+ StackContext s1 = thisIc.getPops().get(0),
+ s2 = thisIc.getPops().get(1);
+
+ StackContext o1 = otherIc.getPops().get(0),
+ o2 = otherIc.getPops().get(1);
+
+ InstructionContext i1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext i2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ InstructionContext io1 = MappingExecutorUtil.resolve(o1.getPushed(), o1);
+ InstructionContext io2 = MappingExecutorUtil.resolve(o2.getPushed(), o2);
+
+ if (i1.getInstruction() instanceof GetFieldInstruction && io1.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction f1 = (GetFieldInstruction) i1.getInstruction();
+ GetFieldInstruction f2 = (GetFieldInstruction) io1.getInstruction();
+
+ Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
+
+ if (!MappingExecutorUtil.isMaybeEqual(fi1, fi2))
+ {
+ return false;
+ }
+ }
+
+ if (i2.getInstruction() instanceof GetFieldInstruction && io2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction f1 = (GetFieldInstruction) i2.getInstruction();
+ GetFieldInstruction f2 = (GetFieldInstruction) io2.getInstruction();
+
+ Field fi1 = f1.getMyField(), fi2 = f2.getMyField();
+
+ if (!MappingExecutorUtil.isMaybeEqual(fi1, fi2))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ default boolean canMap(InstructionContext thisIc)
+ {
+ return true;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/TypeInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/TypeInstruction.java
new file mode 100644
index 0000000000..d4ffb56199
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/TypeInstruction.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instruction.types;
+
+import net.runelite.asm.Type;
+
+public interface TypeInstruction
+{
+ Type getType_();
+
+ void setType(Type type);
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AALoad.java
new file mode 100644
index 0000000000..469cfe50dc
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AALoad.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class AALoad extends Instruction implements ArrayLoad
+{
+ public AALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ Type subtype;
+
+ if (array.getType().isArray())
+ {
+ subtype = array.getType().getSubtype();
+ }
+ else
+ {
+ // This will happen from aaloading from a aconst_null
+ subtype = array.getType();
+ }
+
+ StackContext ctx = new StackContext(ins, subtype, array.getValue().arrayGet(index.getValue()));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AAStore.java
new file mode 100644
index 0000000000..768fe4ba6c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AAStore.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class AAStore extends ArrayStore
+{
+ public AAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AConstNull.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AConstNull.java
new file mode 100644
index 0000000000..88154c647a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AConstNull.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class AConstNull extends Instruction
+{
+ public AConstNull(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public AConstNull(Instructions instructions)
+ {
+ super(instructions, InstructionType.ACONST_NULL);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext ctx = new StackContext(ins, Type.OBJECT, Value.NULL);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ALoad.java
new file mode 100644
index 0000000000..c8a062341b
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ALoad.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class ALoad extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public ALoad(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.ALOAD);
+ this.index = index;
+ }
+
+ public ALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables var = frame.getVariables();
+
+ VariableContext vctx = var.get(index);
+ ins.read(vctx);
+
+ StackContext ctx = new StackContext(ins, vctx);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return false;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.OBJECT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ANewArray.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ANewArray.java
new file mode 100644
index 0000000000..f1b6378a28
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ANewArray.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.TypeInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import org.objectweb.asm.MethodVisitor;
+
+public class ANewArray extends Instruction implements TypeInstruction
+{
+ private Type type;
+ private ClassFile myClass;
+
+ public ANewArray(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitTypeInsn(this.getType().getCode(), type.toAsmString());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext count = stack.pop();
+
+ ins.pop(count);
+
+ StackContext ctx = new StackContext(ins, type, Value.newArray(count.getValue()));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public void lookup()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+ myClass = group.findClass(type.getInternalName());
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myClass != null)
+ {
+ int dimms = type.getDimensions();
+ type = Type.getType("L" + myClass.getName() + ";", dimms);
+ }
+ }
+
+ @Override
+ public Type getType_()
+ {
+ return type;
+ }
+
+ @Override
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AStore.java
new file mode 100644
index 0000000000..dd5436bf8e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AStore.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class AStore extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public AStore(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.ASTORE);
+
+ this.index = index;
+ }
+
+ public AStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ variables.set(index, new VariableContext(ins, object));
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return true;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.OBJECT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AThrow.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AThrow.java
new file mode 100644
index 0000000000..b4cf2f17fe
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AThrow.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class AThrow extends Instruction
+{
+ public AThrow(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ // get exception
+ StackContext exception = stack.pop();
+ ins.pop(exception);
+
+ frame.stop();
+
+ return ins;
+ }
+
+ @Override
+ public boolean isTerminal()
+ {
+ return true;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayLength.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayLength.java
new file mode 100644
index 0000000000..d0e5e65ee7
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayLength.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class ArrayLength extends Instruction
+{
+ public ArrayLength(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext array = stack.pop();
+
+ ins.pop(array);
+
+ StackContext ctx = new StackContext(ins, Type.INT, array.getValue().arrayLength());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayStore.java
new file mode 100644
index 0000000000..266cd7f1b1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayStore.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayStoreInstruction;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public abstract class ArrayStore extends Instruction implements ArrayStoreInstruction
+{
+ public ArrayStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public Field getMyField(InstructionContext thisIc)
+ {
+ StackContext sctx = thisIc.getPops().get(2);
+ InstructionContext pushed = sctx.getPushed();
+
+ InstructionContext r = pushed.resolve(sctx);
+
+ if (r.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf = (GetFieldInstruction) r.getInstruction();
+ Field f = gf.getMyField();
+ return f;
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return getMyField(thisIc) != null;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ assert ctx.getInstruction().getClass() == other.getInstruction().getClass();
+
+ Field myField = this.getMyField(ctx),
+ otherField = ((ArrayStore) other.getInstruction()).getMyField(other);
+
+ mapping.map(this, myField, otherField);
+
+ // map value
+ StackContext object1 = ctx.getPops().get(0), // value set to.
+ object2 = other.getPops().get(0);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ assert MappingExecutorUtil.isMaybeEqual(f1, f2);
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getClass() != otherIc.getInstruction().getClass())
+ {
+ return false;
+ }
+
+ Field myField = this.getMyField(thisIc),
+ otherField = ((ArrayStore) otherIc.getInstruction()).getMyField(otherIc);
+
+ if (!MappingExecutorUtil.isMaybeEqual(myField, otherField))
+ {
+ return false;
+ }
+
+ StackContext object1 = thisIc.getPops().get(0), // value set to.
+ object2 = otherIc.getPops().get(0);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (!MappingExecutorUtil.isMaybeEqual(f1, f2))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BALoad.java
new file mode 100644
index 0000000000..b8d7e7a20c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BALoad.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class BALoad extends Instruction implements ArrayLoad
+{
+ public BALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ StackContext ctx = new StackContext(ins, Type.INT, array.getValue().arrayGet(index.getValue()).cast(int.class)); // sign extend
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BAStore.java
new file mode 100644
index 0000000000..e5b2dd468d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BAStore.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class BAStore extends ArrayStore
+{
+ public BAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BiPush.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BiPush.java
new file mode 100644
index 0000000000..97643bd54e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BiPush.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.IntInstruction;
+import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import org.objectweb.asm.MethodVisitor;
+
+public class BiPush extends Instruction implements PushConstantInstruction, IntInstruction
+{
+ private byte b;
+
+ public BiPush(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public BiPush(Instructions instructions, byte b)
+ {
+ super(instructions, InstructionType.BIPUSH);
+
+ this.b = b;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "bipush " + b;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitIntInsn(this.getType().getCode(), b);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext ctx = new StackContext(ins, Type.INT, new Value((int) b)); // bipush sign extends the value to an int
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public Object getConstant()
+ {
+ return b;
+ }
+
+ @Override
+ public Instruction setConstant(Object entry)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public int getOperand()
+ {
+ return b & 0xFF;
+ }
+
+ @Override
+ public void setOperand(int operand)
+ {
+ b = (byte) operand;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CALoad.java
new file mode 100644
index 0000000000..a26ff32cbf
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CALoad.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class CALoad extends Instruction implements ArrayLoad
+{
+ public CALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ StackContext ctx = new StackContext(ins, Type.INT, array.getValue().arrayGet(index.getValue()).cast(int.class)); // zero extended to int
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CAStore.java
new file mode 100644
index 0000000000..6a39e11329
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CAStore.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class CAStore extends ArrayStore
+{
+ public CAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CheckCast.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CheckCast.java
new file mode 100644
index 0000000000..98326c0972
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CheckCast.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.TypeInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import org.objectweb.asm.MethodVisitor;
+
+public class CheckCast extends Instruction implements TypeInstruction
+{
+ private Type type;
+ private ClassFile myClass;
+
+ public CheckCast(Instructions instructions)
+ {
+ super(instructions, InstructionType.CHECKCAST);
+ }
+
+ public CheckCast(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitTypeInsn(this.getType().getCode(), type.toAsmString());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+
+ ins.pop(value);
+
+ StackContext ctx = new StackContext(ins,
+ type,
+ value.getValue()
+ );
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public void lookup()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+ myClass = group.findClass(type.getInternalName());
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myClass != null)
+ {
+ int dimms = type.getDimensions();
+ type = Type.getType("L" + myClass.getName() + ";", dimms);
+ }
+ }
+
+ @Override
+ public Type getType_()
+ {
+ return type;
+ }
+
+ @Override
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2F.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2F.java
new file mode 100644
index 0000000000..e593be8b0a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2F.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class D2F extends Instruction implements ConversionInstruction
+{
+ public D2F(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+
+ ins.pop(value);
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, value.getValue().cast(float.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2I.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2I.java
new file mode 100644
index 0000000000..02116f2c71
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2I.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class D2I extends Instruction implements ConversionInstruction
+{
+ public D2I(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+
+ ins.pop(value);
+
+ StackContext ctx = new StackContext(ins, Type.INT, value.getValue().cast(int.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2L.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2L.java
new file mode 100644
index 0000000000..2ef3357669
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2L.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class D2L extends Instruction implements ConversionInstruction
+{
+ public D2L(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+
+ ins.pop(value);
+
+ StackContext ctx = new StackContext(ins, Type.LONG, value.getValue().cast(long.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DALoad.java
new file mode 100644
index 0000000000..01632358c5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DALoad.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class DALoad extends Instruction implements ArrayLoad
+{
+ public DALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, array.getValue().arrayGet(index.getValue()).cast(double.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAStore.java
new file mode 100644
index 0000000000..a7ec03fde3
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAStore.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class DAStore extends ArrayStore
+{
+ public DAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAdd.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAdd.java
new file mode 100644
index 0000000000..85e51efaab
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAdd.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.AdditionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DAdd extends Instruction implements AdditionInstruction
+{
+ public DAdd(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ result = new Value(d1 + d2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpG.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpG.java
new file mode 100644
index 0000000000..4847ed75c1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpG.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DCmpG extends Instruction
+{
+ public DCmpG(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ if (d1 > d2)
+ result = new Value(1);
+ else if (d1 == d2)
+ result = new Value(0);
+ else if (d1 < d2)
+ result = new Value(-1);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpL.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpL.java
new file mode 100644
index 0000000000..51c518441e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpL.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DCmpL extends Instruction
+{
+ public DCmpL(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ if (d1 > d2)
+ result = new Value(1);
+ else if (d1 == d2)
+ result = new Value(0);
+ else if (d1 < d2)
+ result = new Value(-1);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DDiv.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DDiv.java
new file mode 100644
index 0000000000..1965b8c2d1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DDiv.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DivisionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DDiv extends Instruction implements DivisionInstruction
+{
+ public DDiv(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ if (d2 != 0.0d)
+ result = new Value(d1 / d2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DLoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DLoad.java
new file mode 100644
index 0000000000..14c336bc06
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DLoad.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class DLoad extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public DLoad(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.DLOAD);
+
+ this.index = index;
+ }
+
+ public DLoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ VariableContext vctx = variables.get(index);
+ assert vctx.getType().equals(Type.DOUBLE);
+ ins.read(vctx);
+
+ StackContext ctx = new StackContext(ins, vctx);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return false;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.DOUBLE;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DMul.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DMul.java
new file mode 100644
index 0000000000..d75f9596b7
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DMul.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DMul extends Instruction
+{
+ public DMul(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ result = new Value(d1 * d2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DNeg.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DNeg.java
new file mode 100644
index 0000000000..bb8cef0424
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DNeg.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DNeg extends Instruction
+{
+ public DNeg(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ Value result = Value.UNKNOWN;
+ if (!value.getValue().isUnknownOrNull())
+ {
+ double d = (double) value.getValue().getValue();
+
+ result = new Value(-d);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DRem.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DRem.java
new file mode 100644
index 0000000000..1d8b9d3b90
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DRem.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DRem extends Instruction
+{
+ public DRem(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ if (d2 != 0.0d)
+ result = new Value(d1 % d2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DStore.java
new file mode 100644
index 0000000000..737ae1b733
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DStore.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class DStore extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public DStore(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.DSTORE);
+
+ this.index = index;
+ }
+
+ public DStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ variables.set(index, new VariableContext(ins, value));
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return true;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.DOUBLE;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DSub.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DSub.java
new file mode 100644
index 0000000000..ef71a1ee84
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DSub.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.SubtractionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class DSub extends Instruction implements SubtractionInstruction
+{
+ public DSub(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ double d2 = (double) two.getValue().getValue(),
+ d1 = (double) one.getValue().getValue();
+
+ result = new Value(d1 - d2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup.java
new file mode 100644
index 0000000000..8281ab838c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DupInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class Dup extends Instruction implements DupInstruction
+{
+ public Dup(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public Dup(Instructions instructions)
+ {
+ super(instructions, InstructionType.DUP);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext obj = stack.pop();
+ ins.pop(obj);
+
+ StackContext ctx = new StackContext(ins, obj.getType(), obj.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ ctx = new StackContext(ins, obj.getType(), obj.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public boolean removeStack()
+ {
+ // removing something from the stack this pushed at index 'idx'
+ // idx = 0 is top of the stack, goes up.
+ //
+ // the stack is relative to post-execute of this instruction
+
+ // for dup, to remove one of the things pushed by it you simply
+ // remove the dup instruction
+ super.removeStack();
+ // do not continue as the other branch still uses what we left
+ // usually this is for new dup invokespecial and we end up with
+ // an unused new/invokesepcial
+ return false;
+ }
+
+ @Override
+ public StackContext getOriginal(StackContext sctx)
+ {
+ // ctx = stack pushed by this instruction, return stack popped by this instruction
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+ assert ctx.getPushes().contains(sctx);
+ return ctx.getPops().get(0);
+ }
+
+ @Override
+ public StackContext getOtherBranch(StackContext sctx)
+ {
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+
+ List pushes = ctx.getPushes();
+ assert pushes.contains(sctx);
+
+ int idx = pushes.indexOf(sctx);
+ assert idx == 0 || idx == 1;
+
+ return pushes.get(~idx & 1);
+ }
+
+ @Override
+ public List getDuplicated(InstructionContext ictx)
+ {
+ assert ictx.getInstruction() == this;
+ return new ArrayList<>(ictx.getPops());
+ }
+
+ @Override
+ public List getCopies(InstructionContext ictx)
+ {
+ return new ArrayList<>(ictx.getPushes());
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2.java
new file mode 100644
index 0000000000..bbfde95d32
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DupInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class Dup2 extends Instruction implements DupInstruction
+{
+ public Dup2(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+ StackContext two = null;
+ if (one.getType().getSize() == 1)
+ two = stack.pop();
+
+ ins.pop(one);
+ if (two != null)
+ ins.pop(two);
+
+ if (two != null)
+ {
+ StackContext ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(one);
+
+ ins.push(ctx);
+
+ if (two != null)
+ {
+ ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(one);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public boolean removeStack()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StackContext getOriginal(StackContext sctx)
+ {
+ // 2 1 -> 2 1 2 1 OR 1 -> 1 1
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getPops().size() == 2 || ctx.getPops().size() == 1;
+
+ assert ctx.getInstruction() == this;
+ assert ctx.getPushes().contains(sctx);
+ int idx = ctx.getPushes().indexOf(sctx);
+
+ if (ctx.getPops().size() == 1)
+ {
+ return ctx.getPops().get(0);
+ }
+
+ switch (idx)
+ {
+ case 0:
+ case 2:
+ return ctx.getPops().get(1);
+ case 1:
+ case 4:
+ return ctx.getPops().get(0);
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public StackContext getOtherBranch(StackContext sctx)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public List getDuplicated(InstructionContext ictx)
+ {
+ return new ArrayList<>(ictx.getPops());
+ }
+
+ @Override
+ public List getCopies(InstructionContext ictx)
+ {
+ return new ArrayList<>(ictx.getPushes());
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X1.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X1.java
new file mode 100644
index 0000000000..22c5c31d87
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X1.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DupInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class Dup2_X1 extends Instruction implements DupInstruction
+{
+ public Dup2_X1(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public Dup2_X1(Instructions instructions)
+ {
+ super(instructions, InstructionType.DUP2_X1);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+ StackContext two = null;
+ if (one.getType().getSize() == 1)
+ two = stack.pop();
+ StackContext three = stack.pop();
+
+ ins.pop(one);
+ if (two != null)
+ ins.pop(two);
+ ins.pop(three);
+
+ if (two != null)
+ {
+ StackContext ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ ctx = new StackContext(ins, three.getType(), three.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ if (two != null)
+ {
+ ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public boolean removeStack()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StackContext getOriginal(StackContext sctx)
+ {
+ InstructionContext ctx = sctx.getPushed();
+
+ assert ctx.getInstruction() == this;
+ assert ctx.getPushes().contains(sctx);
+ int idx = ctx.getPushes().indexOf(sctx);
+
+ // 2 1 0 -> 1 0 2 1 0 OR 1 0 -> 0 1 0
+
+ assert ctx.getPushes().size() == 5 || ctx.getPushes().size() == 3;
+
+ int orig;
+
+ if (ctx.getPushes().size() == 5)
+ {
+ switch (idx)
+ {
+ case 0:
+ orig = 1;
+ break;
+ case 1:
+ orig = 0;
+ break;
+ case 2:
+ orig = 2;
+ break;
+ case 3:
+ orig = 1;
+ break;
+ case 4:
+ orig = 0;
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+ }
+ else if (ctx.getPushes().size() == 3)
+ {
+ switch (idx)
+ {
+ case 0:
+ orig = 0;
+ break;
+ case 1:
+ orig = 1;
+ break;
+ case 2:
+ orig = 0;
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+
+ return ctx.getPops().get(orig);
+ }
+
+ @Override
+ public StackContext getOtherBranch(StackContext sctx)
+ {
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+
+ assert ctx.getPushes().contains(sctx);
+ int idx = ctx.getPushes().indexOf(sctx);
+
+ // 2 1 0 -> 1 0 2 1 0 OR 1 0 -> 0 1 0
+
+ int other;
+
+ if (ctx.getPushes().size() == 5)
+ {
+ switch (idx)
+ {
+ case 0:
+ other = 3;
+ break;
+ case 1:
+ other = 4;
+ break;
+ case 3:
+ other = 0;
+ break;
+ case 4:
+ other = 1;
+ break;
+ default:
+ return null;
+ }
+ }
+ else if (ctx.getPushes().size() == 3)
+ {
+ switch (idx)
+ {
+ case 0:
+ other = 2;
+ break;
+ case 2:
+ other = 0;
+ break;
+ default:
+ return null;
+ }
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+
+ return ctx.getPushes().get(other);
+ }
+
+ @Override
+ public List getDuplicated(InstructionContext ictx)
+ {
+ if (ictx.getPushes().size() == 5)
+ {
+ // 0, 1
+ return Arrays.asList(ictx.getPops().get(0), ictx.getPops().get(1));
+ }
+ else if (ictx.getPushes().size() == 3)
+ {
+ // 0
+ return Arrays.asList(ictx.getPops().get(0));
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public List getCopies(InstructionContext ictx)
+ {
+ if (ictx.getPushes().size() == 5)
+ {
+ return Arrays.asList(ictx.getPushes().get(0), ictx.getPushes().get(1));
+ }
+ else if (ictx.getPushes().size() == 3)
+ {
+ // 0
+ return Arrays.asList(ictx.getPushes().get(0));
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X2.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X2.java
new file mode 100644
index 0000000000..2f4e5ec2e1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X2.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DupInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class Dup2_X2 extends Instruction implements DupInstruction
+{
+ public Dup2_X2(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+ StackContext two = null;
+ if (one.getType().getSize() == 1)
+ two = stack.pop();
+ StackContext three = stack.pop();
+ StackContext four = null;
+ if (one.getType().getSize() == 1)
+ four = stack.pop();
+
+ ins.pop(one);
+ if (two != null)
+ ins.pop(two);
+ ins.pop(three);
+ if (four != null)
+ ins.pop(four);
+
+ if (two != null)
+ {
+ StackContext ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(one);
+
+ ins.push(ctx);
+
+ if (four != null)
+ {
+ ctx = new StackContext(ins, four.getType(), four.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ ctx = new StackContext(ins, three.getType(), three.getValue());
+ stack.push(one);
+
+ ins.push(ctx);
+
+ if (two != null)
+ {
+ ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(one);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public boolean removeStack()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StackContext getOriginal(StackContext ctx)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public StackContext getOtherBranch(StackContext sctx)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public List getDuplicated(InstructionContext ictx)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public List getCopies(InstructionContext ictx)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X1.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X1.java
new file mode 100644
index 0000000000..1efb44232f
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X1.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DupInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class Dup_X1 extends Instruction implements DupInstruction
+{
+ public Dup_X1(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public Dup_X1(Instructions instructions)
+ {
+ super(instructions, InstructionType.DUP_X1);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+ StackContext two = stack.pop();
+
+ ins.pop(one, two);
+
+ StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public boolean removeStack()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StackContext getOriginal(StackContext sctx)
+ {
+ // ctx = stack pushed by this instruction, return stack popped by this instruction
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+
+ assert ctx.getPushes().contains(sctx);
+ int pushedIndex = ctx.getPushes().indexOf(sctx);
+ int poppedIndex;
+
+ // 2 1 -> 1 2 1
+ // index 0 is 0, index 1 is 1, index 2 is 2
+
+ switch (pushedIndex)
+ {
+ case 0:
+ case 2:
+ poppedIndex = 0;
+ break;
+ case 1:
+ poppedIndex = 1;
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+
+ // get popped ctx
+ return ctx.getPops().get(poppedIndex);
+ }
+
+ @Override
+ public StackContext getOtherBranch(StackContext sctx)
+ {
+ // sctx = stack pushed by this instruction, return the other branch
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+
+ assert ctx.getPushes().contains(sctx);
+ int pushedIndex = ctx.getPushes().indexOf(sctx);
+
+ // 2 1 -> 1 2 1
+
+ // if pushed index is 0 or 2, return other, if 1 there is no other side
+ assert pushedIndex >= 0 && pushedIndex <= 2;
+
+ if (pushedIndex == 0)
+ return ctx.getPushes().get(2);
+ else if (pushedIndex == 2)
+ return ctx.getPushes().get(0);
+
+ return null;
+ }
+
+ @Override
+ public List getDuplicated(InstructionContext ictx)
+ {
+ assert ictx.getInstruction() == this;
+ return Arrays.asList(ictx.getPops().get(0));
+ }
+
+ @Override
+ public List getCopies(InstructionContext ictx)
+ {
+ return Arrays.asList(ictx.getPushes().get(0), ictx.getPushes().get(2));
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X2.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X2.java
new file mode 100644
index 0000000000..7d9a181228
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X2.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DupInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class Dup_X2 extends Instruction implements DupInstruction
+{
+ public Dup_X2(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+ StackContext two = stack.pop();
+ StackContext three = null;
+ if (two.getType().getSize() == 1)
+ three = stack.pop();
+
+ ins.pop(one, two);
+ if (three != null)
+ ins.pop(three);
+
+ StackContext ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ if (three != null)
+ {
+ ctx = new StackContext(ins, three.getType(), three.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ ctx = new StackContext(ins, two.getType(), two.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ ctx = new StackContext(ins, one.getType(), one.getValue());
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public boolean removeStack()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StackContext getOriginal(StackContext sctx)
+ {
+ // 3 2 1 -> 1 3 2 1
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+
+ assert ctx.getPushes().contains(sctx);
+ int pushedIndex = ctx.getPushes().indexOf(sctx);
+ int poppedIndex;
+
+ switch (pushedIndex)
+ {
+ case 0:
+ case 3:
+ poppedIndex = 0;
+ break;
+ case 1:
+ poppedIndex = 2;
+ break;
+ case 2:
+ poppedIndex = 1;
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+
+ return ctx.getPops().get(poppedIndex);
+ }
+
+ @Override
+ public StackContext getOtherBranch(StackContext sctx)
+ {
+ // sctx = stack pushed by this instruction, return the other branch
+ InstructionContext ctx = sctx.getPushed();
+ assert ctx.getInstruction() == this;
+
+ assert ctx.getPushes().contains(sctx);
+ int pushedIndex = ctx.getPushes().indexOf(sctx);
+
+ // 3 2 1 -> 1 3 2 1
+
+ if (pushedIndex == 0)
+ return ctx.getPushes().get(3);
+ else if (pushedIndex == 3)
+ return ctx.getPushes().get(0);
+
+ return null;
+ }
+
+ @Override
+ public List getDuplicated(InstructionContext ictx)
+ {
+ return Arrays.asList(ictx.getPops().get(0));
+ }
+
+ @Override
+ public List getCopies(InstructionContext ictx)
+ {
+ return Arrays.asList(ictx.getPushes().get(0));
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2D.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2D.java
new file mode 100644
index 0000000000..68b4fb294d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2D.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class F2D extends Instruction implements ConversionInstruction
+{
+ public F2D(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, object.getValue().cast(double.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2I.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2I.java
new file mode 100644
index 0000000000..69eed60b6f
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2I.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class F2I extends Instruction implements ConversionInstruction
+{
+ public F2I(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.INT, object.getValue().cast(int.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2L.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2L.java
new file mode 100644
index 0000000000..5a78a80e53
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2L.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class F2L extends Instruction implements ConversionInstruction
+{
+ public F2L(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.LONG, object.getValue().cast(long.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FALoad.java
new file mode 100644
index 0000000000..84f7ebe0e0
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FALoad.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class FALoad extends Instruction implements ArrayLoad
+{
+ public FALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, array.getValue().arrayGet(index.getValue()).cast(float.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAStore.java
new file mode 100644
index 0000000000..b11cd04cc1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAStore.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class FAStore extends ArrayStore
+{
+ public FAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAdd.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAdd.java
new file mode 100644
index 0000000000..d258b20ea1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAdd.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.AdditionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FAdd extends Instruction implements AdditionInstruction
+{
+ public FAdd(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ result = new Value(f1 + f2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpG.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpG.java
new file mode 100644
index 0000000000..2ca663cf72
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpG.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FCmpG extends Instruction
+{
+ public FCmpG(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ if (f1 > f2)
+ result = new Value(1);
+ else if (f1 == f2)
+ result = new Value(0);
+ else if (f1 < f2)
+ result = new Value(-1);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpL.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpL.java
new file mode 100644
index 0000000000..e4432ede66
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpL.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FCmpL extends Instruction
+{
+ public FCmpL(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ if (f1 > f2)
+ result = new Value(1);
+ else if (f1 == f2)
+ result = new Value(0);
+ else if (f1 < f2)
+ result = new Value(-1);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FDiv.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FDiv.java
new file mode 100644
index 0000000000..de0e368ddb
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FDiv.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DivisionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FDiv extends Instruction implements DivisionInstruction
+{
+ public FDiv(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ if (f2 != 0.0f)
+ result = new Value(f1 / f2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FLoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FLoad.java
new file mode 100644
index 0000000000..708b065542
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FLoad.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class FLoad extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public FLoad(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.FLOAD);
+
+ this.index = index;
+ }
+
+ public FLoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ VariableContext vctx = variables.get(index);
+ assert vctx.getType().equals(Type.FLOAT);
+ ins.read(vctx);
+
+ StackContext ctx = new StackContext(ins, vctx);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return false;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.FLOAT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FMul.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FMul.java
new file mode 100644
index 0000000000..532c6fca84
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FMul.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FMul extends Instruction
+{
+ public FMul(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ result = new Value(f1 * f2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FNeg.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FNeg.java
new file mode 100644
index 0000000000..f1aec63dfe
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FNeg.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FNeg extends Instruction
+{
+ public FNeg(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ Value result = Value.UNKNOWN;
+ if (!value.getValue().isUnknownOrNull())
+ {
+ float f = (float) value.getValue().getValue();
+
+ result = new Value(-f);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FRem.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FRem.java
new file mode 100644
index 0000000000..61c769809e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FRem.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FRem extends Instruction
+{
+ public FRem(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ if (f2 != 0.0f)
+ result = new Value(f1 % f2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FStore.java
new file mode 100644
index 0000000000..5d7b35a4ab
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FStore.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class FStore extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public FStore(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.FSTORE);
+
+ this.index = index;
+ }
+
+ public FStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ variables.set(index, new VariableContext(ins, value));
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return true;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.FLOAT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FSub.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FSub.java
new file mode 100644
index 0000000000..33f467ed19
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FSub.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.SubtractionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class FSub extends Instruction implements SubtractionInstruction
+{
+ public FSub(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ float f2 = (float) two.getValue().getValue(),
+ f1 = (float) one.getValue().getValue();
+
+ result = new Value(f1 - f2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetField.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetField.java
new file mode 100644
index 0000000000..cf64538c0d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetField.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.Method;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Class;
+import net.runelite.asm.pool.Field;
+import org.objectweb.asm.MethodVisitor;
+
+public class GetField extends Instruction implements GetFieldInstruction
+{
+ private Field field;
+ private net.runelite.asm.Field myField;
+
+ public GetField(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public GetField(Instructions instructions, Field field)
+ {
+ super(instructions, InstructionType.GETFIELD);
+
+ this.field = field;
+ }
+
+ @Override
+ public String toString()
+ {
+ Method m = this.getInstructions().getCode().getMethod();
+ return "getfield " + myField + " in " + m;// + " at pc 0x" + Integer.toHexString(this.getPc());
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitFieldInsn(this.getType().getCode(),
+ field.getClazz().getName(),
+ field.getName(),
+ field.getType().toString()
+ );
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, field.getType(), Value.UNKNOWN);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ if (myField != null)
+ {
+ frame.getExecution().order(frame, myField);
+ }
+
+ return ins;
+ }
+
+ @Override
+ public Field getField()
+ {
+ return field;
+ }
+
+ @Override
+ public net.runelite.asm.Field getMyField()
+ {
+ Class clazz = field.getClazz();
+
+ ClassFile cf = this.getInstructions().getCode().getMethod().getClassFile().getGroup().findClass(clazz.getName());
+ if (cf == null)
+ {
+ return null;
+ }
+
+ net.runelite.asm.Field f2 = cf.findFieldDeep(field.getName(), field.getType());
+ return f2;
+ }
+
+ @Override
+ public void lookup()
+ {
+ myField = getMyField();
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myField != null)
+ {
+ // only rebuild field info if the field has changed.
+ // otherwise it will rewrite the pool field into to something
+ // different if the field was deep
+ if (getMyField() != myField)
+ {
+ field = myField.getPoolField();
+ }
+ }
+ }
+
+ @Override
+ public void setField(Field field)
+ {
+ this.field = field;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetStatic.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetStatic.java
new file mode 100644
index 0000000000..83476e76b1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetStatic.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.Method;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Class;
+import net.runelite.asm.pool.Field;
+import org.objectweb.asm.MethodVisitor;
+
+public class GetStatic extends Instruction implements GetFieldInstruction
+{
+ private Field field;
+ private net.runelite.asm.Field myField;
+
+ public GetStatic(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public GetStatic(Instructions instructions, Field field)
+ {
+ super(instructions, InstructionType.GETSTATIC);
+
+ this.field = field;
+ }
+
+ @Override
+ public String toString()
+ {
+ Method m = this.getInstructions().getCode().getMethod();
+ return "getstatic " + myField + " in " + m;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitFieldInsn(this.getType().getCode(),
+ field.getClazz().getName(),
+ field.getName(),
+ field.getType().toString()
+ );
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext ctx = new StackContext(ins, field.getType(), Value.UNKNOWN);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ if (myField != null)
+ {
+ frame.getExecution().order(frame, myField);
+ }
+
+ return ins;
+ }
+
+ @Override
+ public Field getField()
+ {
+ return field;
+ }
+
+ @Override
+ public net.runelite.asm.Field getMyField()
+ {
+ Class clazz = field.getClazz();
+
+ ClassFile cf = this.getInstructions().getCode().getMethod().getClassFile().getGroup().findClass(clazz.getName());
+ if (cf == null)
+ {
+ return null;
+ }
+
+ net.runelite.asm.Field f2 = cf.findFieldDeep(field.getName(), field.getType());
+ return f2;
+ }
+
+ @Override
+ public void lookup()
+ {
+ myField = this.getMyField();
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myField != null)
+ {
+ if (getMyField() != myField)
+ {
+ field = myField.getPoolField();
+ }
+ }
+ }
+
+ @Override
+ public void setField(Field field)
+ {
+ this.field = field;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Goto.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Goto.java
new file mode 100644
index 0000000000..f0db491ba5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Goto.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import org.objectweb.asm.MethodVisitor;
+
+public class Goto extends Instruction implements JumpingInstruction
+{
+ private org.objectweb.asm.Label asmlabel;
+ private Label to;
+
+ public Goto(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public Goto(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.GOTO);
+
+ assert to != null;
+ this.to = to;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "goto " + to;// + " (at pc " + (this.getPc() + offset) + ")";
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ assert getJumps().size() == 1;
+
+ visitor.visitJumpInsn(this.getType().getCode(), getJumps().get(0).getLabel());
+ }
+
+ @Override
+ public void resolve()
+ {
+ Instructions ins = this.getInstructions();
+
+ to = ins.findLabel(asmlabel);
+ assert to != null;
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ctx = new InstructionContext(this, frame);
+
+ frame.jump(ctx, to);
+
+ return ctx;
+ }
+
+ @Override
+ public boolean isTerminal()
+ {
+ return true;
+ }
+
+ @Override
+ public List getJumps()
+ {
+ return Collections.singletonList(to);
+ }
+
+ @Override
+ public void setJumps(List labels)
+ {
+ assert labels.size() == 1;
+ to = labels.get(0);
+ }
+
+ @Override
+ public void setLabel(org.objectweb.asm.Label label)
+ {
+ assert label != null;
+ asmlabel = label;
+ }
+
+ public Label getTo()
+ {
+ return to;
+ }
+
+ public void setTo(Label to)
+ {
+ this.to = to;
+ }
+}
diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GotoW.java
similarity index 50%
rename from runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java
rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GotoW.java
index da716252e7..ed2d590aa6 100644
--- a/runelite-mixins/src/main/java/net/runelite/mixins/RSMessageNodeMixin.java
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GotoW.java
@@ -22,76 +22,78 @@
* (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.mixins;
+package net.runelite.asm.attributes.code.instructions;
-import net.runelite.api.ChatMessageType;
-import net.runelite.api.mixins.Inject;
-import net.runelite.api.mixins.MethodHook;
-import net.runelite.api.mixins.Mixin;
-import net.runelite.api.mixins.Shadow;
-import net.runelite.rs.api.RSClient;
-import net.runelite.rs.api.RSMessageNode;
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import org.objectweb.asm.MethodVisitor;
-@Mixin(RSMessageNode.class)
-public abstract class RSMessageNodeMixin implements RSMessageNode
+public class GotoW extends Instruction implements JumpingInstruction
{
- @Shadow("clientInstance")
- private static RSClient client;
+ private org.objectweb.asm.Label asmlabel;
+ private Label to;
- @Inject
- private String runeLiteFormatMessage;
-
- @Inject
- private int rl$timestamp;
-
- @Inject
- RSMessageNodeMixin()
+ public GotoW(Instructions instructions, InstructionType type)
{
- rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
+ super(instructions, type);
}
- @Inject
@Override
- public ChatMessageType getType()
+ public void accept(MethodVisitor visitor)
{
- return ChatMessageType.of(getRSType());
+ assert getJumps().size() == 1;
+
+ visitor.visitJumpInsn(this.getType().getCode(), getJumps().get(0).getLabel());
}
- @Inject
@Override
- public String getRuneLiteFormatMessage()
+ public void resolve()
{
- return runeLiteFormatMessage;
+ Instructions ins = this.getInstructions();
+
+ to = ins.findLabel(asmlabel);
+ assert to != null;
}
- @Inject
@Override
- public void setRuneLiteFormatMessage(String runeLiteFormatMessage)
+ public InstructionContext execute(Frame frame)
{
- this.runeLiteFormatMessage = runeLiteFormatMessage;
+ InstructionContext ctx = new InstructionContext(this, frame);
+
+ frame.jump(ctx, to);
+
+ return ctx;
}
- @Inject
@Override
- public int getTimestamp()
+ public boolean isTerminal()
{
- return rl$timestamp;
+ return true;
}
- @Inject
@Override
- public void setTimestamp(int timestamp)
+ public List getJumps()
{
- this.rl$timestamp = timestamp;
+ return Collections.singletonList(to);
}
- @Inject
- @MethodHook(value = "setMessage", end = true)
- public void setMessage(int type, String name, String sender, String value)
+ @Override
+ public void setJumps(List labels)
{
- // Message nodes get reused after a time by calling setMessage.
- // Clear the runelite formatted message then.
- runeLiteFormatMessage = null;
- rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
+ assert labels.size() == 1;
+ to = labels.get(0);
+ }
+
+ @Override
+ public void setLabel(org.objectweb.asm.Label label)
+ {
+ asmlabel = label;
}
}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2B.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2B.java
new file mode 100644
index 0000000000..64c5e1f4db
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2B.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class I2B extends Instruction implements ConversionInstruction
+{
+ public I2B(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.INT, object.getValue().cast(int.class)); // sign extneded
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2C.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2C.java
new file mode 100644
index 0000000000..5549b52ff4
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2C.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class I2C extends Instruction implements ConversionInstruction
+{
+ public I2C(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.INT, object.getValue().cast(int.class)); // sign extended
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2D.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2D.java
new file mode 100644
index 0000000000..042b21477e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2D.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class I2D extends Instruction implements ConversionInstruction
+{
+ public I2D(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, object.getValue().cast(double.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2F.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2F.java
new file mode 100644
index 0000000000..435c30e524
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2F.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class I2F extends Instruction implements ConversionInstruction
+{
+ public I2F(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, object.getValue().cast(float.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2L.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2L.java
new file mode 100644
index 0000000000..adfdf52fe3
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2L.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class I2L extends Instruction implements ConversionInstruction
+{
+ public I2L(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public I2L(Instructions instructions)
+ {
+ super(instructions, InstructionType.I2L);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.LONG, object.getValue().cast(long.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2S.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2S.java
new file mode 100644
index 0000000000..930631d085
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2S.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class I2S extends Instruction implements ConversionInstruction
+{
+ public I2S(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.INT, object.getValue().cast(int.class)); // sign extended
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IALoad.java
new file mode 100644
index 0000000000..5c4cf2807b
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IALoad.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class IALoad extends Instruction implements ArrayLoad
+{
+ public IALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ StackContext ctx = new StackContext(ins, Type.INT, array.getValue().arrayGet(index.getValue()).cast(int.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAStore.java
new file mode 100644
index 0000000000..d23dd4d2b3
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAStore.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class IAStore extends ArrayStore
+{
+ public IAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAdd.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAdd.java
new file mode 100644
index 0000000000..ac497bf932
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAdd.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.AdditionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IAdd extends Instruction implements AdditionInstruction
+{
+ public IAdd(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IAdd(Instructions instructions)
+ {
+ super(instructions, InstructionType.IADD);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 + i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAnd.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAnd.java
new file mode 100644
index 0000000000..6fc645a992
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAnd.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import static net.runelite.asm.attributes.code.InstructionType.IAND;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IAnd extends Instruction
+{
+ public IAnd(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IAnd(Instructions instructions)
+ {
+ this(instructions, IAND);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 & i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IDiv.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IDiv.java
new file mode 100644
index 0000000000..2248c23c9f
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IDiv.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DivisionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IDiv extends Instruction implements DivisionInstruction
+{
+ public IDiv(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IDiv(Instructions instructions)
+ {
+ super(instructions, InstructionType.IDIV);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ if (i2 != 0)
+ result = new Value(i1 / i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IInc.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IInc.java
new file mode 100644
index 0000000000..a423effac8
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IInc.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class IInc extends Instruction implements LVTInstruction
+{
+ private short index;
+ private short inc;
+
+ public IInc(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitIincInsn(index, inc);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Variables var = frame.getVariables();
+
+ VariableContext vctx = var.get(index);
+ assert vctx.getType().isStackInt();
+ ins.read(vctx);
+
+ Value value = vctx.getValue();
+ if (!vctx.getValue().isUnknownOrNull())
+ {
+ int i = (int) vctx.getValue().getValue();
+ i += inc;
+ value = new Value(i);
+ }
+
+ vctx = new VariableContext(ins, Type.INT, value);
+ var.set(index, vctx);
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return false; // This is a get first
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = (short) idx;
+ return this;
+ }
+
+ public void setIncrement(int inc)
+ {
+ this.inc = (short) inc;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.INT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ILoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ILoad.java
new file mode 100644
index 0000000000..80305f4e06
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ILoad.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Method;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class ILoad extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public ILoad(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.ILOAD);
+
+ this.index = index;
+ }
+
+ public ILoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public String toString()
+ {
+ Method m = this.getInstructions().getCode().getMethod();
+ return "iload " + index + " in " + m;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ VariableContext vctx = variables.get(index);
+ assert vctx.getType().isStackInt();
+ ins.read(vctx);
+
+ StackContext ctx = new StackContext(ins, vctx);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return false;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.INT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IMul.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IMul.java
new file mode 100644
index 0000000000..fbdba4dd2c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IMul.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IMul extends Instruction
+{
+ public IMul(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IMul(Instructions instructions)
+ {
+ super(instructions, InstructionType.IMUL);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 * i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/INeg.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/INeg.java
new file mode 100644
index 0000000000..58b597e426
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/INeg.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class INeg extends Instruction
+{
+ public INeg(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ Value result = Value.UNKNOWN;
+ if (!value.getValue().isUnknownOrNull())
+ {
+ int i = (int) value.getValue().getValue();
+
+ result = new Value(-i);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IOr.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IOr.java
new file mode 100644
index 0000000000..535cc03410
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IOr.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IOr extends Instruction
+{
+ public IOr(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 | i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IRem.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IRem.java
new file mode 100644
index 0000000000..6ad180a78e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IRem.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IRem extends Instruction
+{
+ public IRem(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ if (i2 != 0)
+ result = new Value(i1 % i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShL.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShL.java
new file mode 100644
index 0000000000..99ffbe9e04
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShL.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IShL extends Instruction
+{
+ public IShL(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 << i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShR.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShR.java
new file mode 100644
index 0000000000..72a41eefe0
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShR.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IShR extends Instruction
+{
+ public IShR(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 >> i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IStore.java
new file mode 100644
index 0000000000..1e164f071d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IStore.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class IStore extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public IStore(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.ISTORE);
+
+ this.index = index;
+ }
+
+ public IStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ StackContext value = stack.pop();
+ assert value.getType().isStackInt();
+ ins.pop(value);
+
+ variables.set(index, new VariableContext(ins, value));
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return true;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.INT;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ISub.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ISub.java
new file mode 100644
index 0000000000..8956c0da55
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ISub.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.SubtractionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class ISub extends Instruction implements SubtractionInstruction
+{
+ public ISub(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 - i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IUShR.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IUShR.java
new file mode 100644
index 0000000000..a70c062c2d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IUShR.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IUShR extends Instruction
+{
+ public IUShR(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 >>> i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IXor.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IXor.java
new file mode 100644
index 0000000000..fe976ae541
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IXor.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class IXor extends Instruction
+{
+ public IXor(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ int i2 = (int) two.getValue().getValue(),
+ i1 = (int) one.getValue().getValue();
+
+ result = new Value(i1 ^ i2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If.java
new file mode 100644
index 0000000000..483f9ef27f
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If.java
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.ComparisonInstruction;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
+import net.runelite.asm.attributes.code.instruction.types.MappableInstruction;
+import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.MethodVisitor;
+
+public abstract class If extends Instruction implements JumpingInstruction, ComparisonInstruction, MappableInstruction
+{
+ private org.objectweb.asm.Label asmlabel;
+ private Label to;
+
+ public If(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public If(Instructions instructions, InstructionType type, Label to)
+ {
+ super(instructions, type);
+
+ this.to = to;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ assert getJumps().size() == 1;
+
+ visitor.visitJumpInsn(this.getType().getCode(), getJumps().get(0).getLabel());
+ }
+
+ @Override
+ public void resolve()
+ {
+ Instructions ins = this.getInstructions();
+
+ to = ins.findLabel(asmlabel);
+ assert to != null;
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+ StackContext two = stack.pop();
+
+ ins.pop(one, two);
+
+ Frame other = frame.dup();
+ other.jump(ins, to);
+
+ ins.branch(other);
+
+ return ins;
+ }
+
+ @Override
+ public List getJumps()
+ {
+ return Collections.singletonList(to);
+ }
+
+ @Override
+ public void setJumps(List labels)
+ {
+ assert labels.size() == 1;
+ to = labels.get(0);
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ assert ctx.getBranches().size() == other.getBranches().size();
+
+ // can be empty for packet handlers
+ if (!ctx.getBranches().isEmpty())
+ {
+ Frame branch1 = ctx.getBranches().get(0),
+ branch2 = other.getBranches().get(0);
+
+ assert branch1.other == null;
+ assert branch2.other == null;
+
+ branch1.other = branch2;
+ branch2.other = branch1;
+ }
+
+ this.mapArguments(mapping, ctx, other, false);
+ }
+
+ protected void mapOtherBranch(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ Frame f1 = ctx.getFrame(),
+ f2 = other.getFrame(),
+ branch1 = ctx.getBranches().get(0),
+ branch2 = other.getBranches().get(0);
+
+ assert branch1.other == null;
+ assert branch2.other == null;
+
+ // currently f1 <-> f2
+ assert f1.other == f2;
+ assert f2.other == f1;
+
+ // change to f1 <-> branch2, f2 <-> branch1
+ f1.other = branch2;
+ branch2.other = f1;
+
+ f2.other = branch1;
+ branch1.other = f2;
+
+ this.mapArguments(mapping, ctx, other, true);
+ }
+
+ private void mapArguments(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other, boolean inverse)
+ {
+ List f1s = getComparedFields(ctx), f2s = getComparedFields(other);
+
+ if (f1s == null || f2s == null || f1s.size() != f2s.size())
+ {
+ return;
+ }
+
+ if (f1s.size() == 1)
+ {
+ Field f1 = f1s.get(0), f2 = f2s.get(0);
+
+ assert MappingExecutorUtil.isMaybeEqual(f1.getType(), f2.getType());
+
+ mapping.map(this, f1, f2);
+ }
+ else if (f1s.size() == 2)
+ {
+ Field f1 = f1s.get(0), f2 = f2s.get(0);
+ Field j1 = f1s.get(1), j2 = f2s.get(1);
+
+// if (couldBeSame(f1, f2) && couldBeSame(j1, j2) && couldBeSame(f1, j2) && couldBeSame(j1, f2))
+// {
+// mapping.map()
+// return; // ambiguous
+// }
+ if (couldBeSame(f1, f2) && couldBeSame(j1, j2))
+ {
+ mapping.map(this, f1, f2);
+ mapping.map(this, j1, j2);
+ }
+
+ if (couldBeSame(f1, j2) && couldBeSame(j1, f2))
+ {
+ mapping.map(this, f1, j2);
+ mapping.map(this, j1, f2);
+ }
+ }
+ else
+ {
+ assert false;
+ }
+ }
+
+ private List getComparedFields(InstructionContext ctx)
+ {
+ List fields = new ArrayList<>();
+
+ for (StackContext sctx : ctx.getPops())
+ {
+ InstructionContext base = MappingExecutorUtil.resolve(sctx.getPushed(), sctx);
+
+ if (base.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gfi = (GetFieldInstruction) base.getInstruction();
+
+ if (gfi.getMyField() != null)
+ {
+ fields.add(gfi.getMyField());
+ }
+ }
+ }
+
+ return fields.isEmpty() ? null : fields;
+ }
+
+ protected Integer getConstantInstruction(InstructionContext ctx)
+ {
+ PushConstantInstruction gfi = null;
+
+ for (StackContext sctx : ctx.getPops())
+ {
+ InstructionContext base = MappingExecutorUtil.resolve(sctx.getPushed(), sctx);
+
+ if (base.getInstruction() instanceof PushConstantInstruction)
+ {
+ if (gfi != null)
+ {
+ return null;
+ }
+
+ gfi = (PushConstantInstruction) base.getInstruction();
+ }
+ }
+
+ if (gfi == null)
+ {
+ return null;
+ }
+
+ return ((Number) gfi.getConstant()).intValue();
+ }
+
+ private boolean couldBeSame(Field f1, Field f2)
+ {
+ if (f1.isStatic() != f2.isStatic())
+ {
+ return false;
+ }
+
+ if (!f1.isStatic())
+ {
+ if (!MappingExecutorUtil.isMaybeEqual(f1.getClassFile(), f2.getClassFile()))
+ {
+ return false;
+ }
+ }
+
+ return MappingExecutorUtil.isMaybeEqual(f1.getType(), f2.getType());
+ }
+
+ protected boolean isSameField(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ List f1s = getComparedFields(thisIc), f2s = getComparedFields(otherIc);
+
+ if ((f1s != null) != (f2s != null))
+ {
+ return false;
+ }
+
+ if (f1s == null || f2s == null)
+ {
+ return true;
+ }
+
+ if (f1s.size() != f2s.size())
+ {
+ return false;
+ }
+
+ assert f1s.size() == 1 || f1s.size() == 2;
+
+ if (f1s.size() == 2)
+ {
+ Field f1 = f1s.get(0), f2 = f2s.get(0);
+ Field j1 = f1s.get(1), j2 = f2s.get(1);
+
+ if (!f1.isStatic() && !j1.isStatic() && !f2.isStatic() && !j2.isStatic())
+ {
+ if ((f1.getClassFile() == j1.getClassFile()) != (f2.getClassFile() == j2.getClassFile()))
+ {
+ return false;
+ }
+ }
+
+ if (couldBeSame(f1, f2) && couldBeSame(j1, j2) && couldBeSame(f1, j2) && couldBeSame(j1, f2))
+ {
+ return true;
+ }
+
+ if (couldBeSame(f1, f2) && couldBeSame(j1, j2))
+ {
+ return true;
+ }
+
+ if (couldBeSame(f1, j2) && couldBeSame(j1, f2))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ else
+ {
+ Field f1 = f1s.get(0), f2 = f2s.get(0);
+
+ return couldBeSame(f1, f2);
+ }
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return true;
+ }
+
+ @Override
+ public void setLabel(org.objectweb.asm.Label label)
+ {
+ asmlabel = label;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If0.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If0.java
new file mode 100644
index 0000000000..d723d70fbe
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If0.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.ComparisonInstruction;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
+import net.runelite.asm.attributes.code.instruction.types.MappableInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.MethodVisitor;
+
+public abstract class If0 extends Instruction implements JumpingInstruction, ComparisonInstruction, MappableInstruction
+{
+ private org.objectweb.asm.Label asmlabel;
+ private Label to;
+
+ public If0(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public If0(Instructions instructions, InstructionType type, Label to)
+ {
+ super(instructions, type);
+
+ assert to.getInstructions() == this.getInstructions();
+
+ this.to = to;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ assert getJumps().size() == 1;
+
+ visitor.visitJumpInsn(this.getType().getCode(), getJumps().get(0).getLabel());
+ }
+
+ @Override
+ public void resolve()
+ {
+ Instructions ins = this.getInstructions();
+
+ to = ins.findLabel(asmlabel);
+ assert to != null;
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext one = stack.pop();
+
+ ins.pop(one);
+
+ Frame other = frame.dup();
+ other.jump(ins, to);
+
+ ins.branch(other);
+
+ return ins;
+ }
+
+ @Override
+ public List getJumps()
+ {
+ return Collections.singletonList(to);
+ }
+
+ @Override
+ public void setJumps(List labels)
+ {
+ assert labels.size() == 1;
+ to = labels.get(0);
+ }
+
+ // duplicated from If
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ Frame branch1 = ctx.getBranches().get(0),
+ branch2 = other.getBranches().get(0);
+
+ assert branch1.other == null;
+ assert branch2.other == null;
+
+ branch1.setOther(branch2);
+ branch2.setOther(branch1);
+
+ this.mapArguments(mapping, ctx, other);
+ }
+
+ // duplicated from If
+ protected void mapOtherBranch(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ Frame f1 = ctx.getFrame(),
+ f2 = other.getFrame(),
+ branch1 = ctx.getBranches().get(0),
+ branch2 = other.getBranches().get(0);
+
+ assert branch1.other == null;
+ assert branch2.other == null;
+
+ // currently f1 <-> f2
+ assert f1.other == f2;
+ assert f2.other == f1;
+
+ // change to f1 <-> branch2, f2 <-> branch1
+
+ f1.other = branch2;
+ branch2.other = f1;
+
+ f2.other = branch1;
+ branch1.other = f2;
+
+ this.mapArguments(mapping, ctx, other);
+ }
+
+ private void mapArguments(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ Field f1 = getComparedField(ctx), f2 = getComparedField(other);
+ if (f1 == null || f2 == null)
+ return;
+
+ assert MappingExecutorUtil.isMaybeEqual(f1.getType(), f2.getType());
+
+ mapping.map(this, f1, f2);
+ }
+
+ private Field getComparedField(InstructionContext ctx)
+ {
+ GetFieldInstruction gfi = null;
+
+ for (StackContext sctx : ctx.getPops())
+ {
+ InstructionContext base = MappingExecutorUtil.resolve(sctx.getPushed(), sctx);
+
+ if (base.getInstruction() instanceof GetFieldInstruction)
+ {
+ if (gfi != null)
+ return null;
+
+ gfi = (GetFieldInstruction) base.getInstruction();
+ }
+ }
+
+ if (gfi == null)
+ return null;
+
+ return gfi.getMyField();
+ }
+
+ protected boolean isSameField(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ Field f1 = getComparedField(thisIc), f2 = getComparedField(otherIc);
+ if ((f1 != null) != (f2 != null))
+ return false;
+
+ if (f1 == null || f2 == null)
+ return true;
+
+ if (f1.isStatic() != f2.isStatic())
+ return false;
+
+ if (!f1.isStatic())
+ if (!MappingExecutorUtil.isMaybeEqual(f1.getClassFile(), f2.getClassFile()))
+ return false;
+
+ return MappingExecutorUtil.isMaybeEqual(f1.getType(), f2.getType());
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return true;
+ }
+
+ @Override
+ public void setLabel(org.objectweb.asm.Label label)
+ {
+ asmlabel = label;
+ }
+
+ public Label getTo()
+ {
+ return to;
+ }
+
+ public void setTo(Label to)
+ {
+ this.to = to;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpEq.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpEq.java
new file mode 100644
index 0000000000..b3dcfc92d9
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpEq.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfACmpEq extends If
+{
+ public IfACmpEq(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IfACmpEq(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.IF_ACMPEQ, to);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfNull || otherIc.getInstruction() instanceof IfNonNull)
+ {
+ StackContext s1 = thisIc.getPops().get(0),
+ s2 = thisIc.getPops().get(1);
+
+ if (s1.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ if (s2.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ }
+ else if (otherIc.getInstruction() instanceof IfACmpNe)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfACmpNe || other.getInstruction() instanceof IfNonNull)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpNe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpNe.java
new file mode 100644
index 0000000000..e84a9cb48e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpNe.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfACmpNe extends If
+{
+ public IfACmpNe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IfACmpNe(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.IF_ACMPNE, to);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfNonNull || otherIc.getInstruction() instanceof IfNull)
+ {
+ StackContext s1 = thisIc.getPops().get(0),
+ s2 = thisIc.getPops().get(1);
+
+ if (s1.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ if (s2.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ }
+ else if (otherIc.getInstruction() instanceof IfACmpEq)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfACmpEq || other.getInstruction() instanceof IfNull)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGe.java
new file mode 100644
index 0000000000..e95fc63716
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGe.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfCmpGe extends If
+{
+ public IfCmpGe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfCmpLt)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfCmpLt)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGt.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGt.java
new file mode 100644
index 0000000000..71ba0f154c
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGt.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfCmpGt extends If
+{
+ public IfCmpGt(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfCmpLe)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfCmpLe)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLe.java
new file mode 100644
index 0000000000..42656a948a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLe.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfCmpLe extends If
+{
+ public IfCmpLe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfCmpGt)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfCmpGt)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLt.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLt.java
new file mode 100644
index 0000000000..9e0b6ae553
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLt.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfCmpLt extends If
+{
+ public IfCmpLt(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfCmpGe)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfCmpGe)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfEq.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfEq.java
new file mode 100644
index 0000000000..928180fce3
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfEq.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import static net.runelite.asm.attributes.code.instructions.IfICmpEq.isOne;
+import static net.runelite.asm.attributes.code.instructions.IfICmpEq.isZero;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfEq extends If0
+{
+ public IfEq(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IfEq(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.IFEQ, to);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfNe)
+ {
+ return true;
+ }
+ else if (otherIc.getInstruction() instanceof IfICmpEq || otherIc.getInstruction() instanceof IfICmpNe)
+ {
+ StackContext s1 = otherIc.getPops().get(0),
+ s2 = otherIc.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2) || isOne(s1) || isOne(s2))
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfICmpEq)
+ {
+ StackContext s1 = other.getPops().get(0),
+ s2 = other.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2)) // iseq vs ificmpeq 0
+ super.map(mapping, ctx, other);
+ else if (isOne(s1) || isOne(s2)) // ifeq vs isicmpeq 1
+ super.mapOtherBranch(mapping, ctx, other);
+ else
+ assert false;
+ }
+ else if (other.getInstruction() instanceof IfICmpNe)
+ {
+ StackContext s1 = other.getPops().get(0),
+ s2 = other.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2))
+ super.mapOtherBranch(mapping, ctx, other); // ifeq 0 vs ificmpne 0
+ else if (isOne(s1) || isOne(s2))
+ super.map(mapping, ctx, other); // ifeq 0 vs ificmpeq 1
+ else
+ assert false;
+ }
+ else if (other.getInstruction() instanceof IfNe)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGe.java
new file mode 100644
index 0000000000..bde0d29c97
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGe.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfGe extends If0
+{
+ public IfGe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfLt)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfLt)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGt.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGt.java
new file mode 100644
index 0000000000..a44d0aceff
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGt.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfGt extends If0
+{
+ public IfGt(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfLe)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfLe)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpEq.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpEq.java
new file mode 100644
index 0000000000..8c76ab3584
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpEq.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.ComparisonInstruction;
+import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfICmpEq extends If
+{
+ public IfICmpEq(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IfICmpEq(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.IF_ICMPEQ, to);
+ }
+
+ static boolean is(StackContext s, int val)
+ {
+ if (s.getPushed().getInstruction() instanceof PushConstantInstruction)
+ {
+ PushConstantInstruction pc = (PushConstantInstruction) s.getPushed().getInstruction();
+ Object o = pc.getConstant();
+
+ if (o instanceof Integer && (int) o == val)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static boolean isZero(StackContext s)
+ {
+ return is(s, 0);
+ }
+
+ static boolean isOne(StackContext s)
+ {
+ return is(s, 1);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!(otherIc.getInstruction() instanceof ComparisonInstruction))
+ {
+ return false;
+ }
+
+ if (!this.isSameField(thisIc, otherIc))
+ {
+ return false;
+ }
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ {
+ //XXX commented due to packet handlers no longer doing icmps
+// Integer i1 = this.getConstantInstruction(thisIc);
+// Integer i2 = this.getConstantInstruction(otherIc);
+//
+// // this is to help against the scrambling of the icmps. in every case
+// // except for the packet handler ids the constant is the same.
+// // XX it would be better to have the mapper step over ifs and proceed to
+// // the next one instead of halting
+// if (i1 != null && i2 != null && (int) i1 != (int) i2)
+// {
+// return false;
+// }
+ return true;
+ }
+
+ // check for other being ifeq and this has a constant 0
+ if (otherIc.getInstruction() instanceof IfEq || otherIc.getInstruction() instanceof IfNe)
+ {
+ StackContext s1 = thisIc.getPops().get(0),
+ s2 = thisIc.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2) || isOne(s1) || isOne(s2))
+ {
+ return true;
+ }
+ }
+ else if (otherIc.getInstruction() instanceof IfICmpNe)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfNe || other.getInstruction() instanceof IfICmpNe)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpNe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpNe.java
new file mode 100644
index 0000000000..2b45dbd4d7
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpNe.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.ComparisonInstruction;
+import static net.runelite.asm.attributes.code.instructions.IfICmpEq.isOne;
+import static net.runelite.asm.attributes.code.instructions.IfICmpEq.isZero;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfICmpNe extends If
+{
+ public IfICmpNe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public IfICmpNe(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.IF_ICMPNE, to);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!(otherIc.getInstruction() instanceof ComparisonInstruction))
+ {
+ return false;
+ }
+
+ if (!this.isSameField(thisIc, otherIc))
+ {
+ return false;
+ }
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ {
+ // see comment in ificmpeq
+// Integer i1 = this.getConstantInstruction(thisIc);
+// Integer i2 = this.getConstantInstruction(otherIc);
+//
+// if (i1 != null && i2 != null && (int) i1 != (int) i2)
+// {
+// return false;
+// }
+
+ return true;
+ }
+
+ // check for other being ifne and this has a constant 0
+ if (otherIc.getInstruction() instanceof IfNe || otherIc.getInstruction() instanceof IfEq)
+ {
+ StackContext s1 = thisIc.getPops().get(0),
+ s2 = thisIc.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2) || isOne(s1) || isOne(s2))
+ {
+ return true;
+ }
+ }
+ else if (otherIc.getInstruction() instanceof IfICmpEq)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfEq)
+ {
+ StackContext s1 = ctx.getPops().get(0),
+ s2 = ctx.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2)) // ificmpne 0 vs ifeq
+ {
+ super.map(mapping, ctx, other);
+ }
+ else if (isOne(s1) || isOne(s2)) // ificmpne 1 vs ifeq
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ assert false;
+ }
+ }
+ else if (other.getInstruction() instanceof IfNe)
+ {
+ StackContext s1 = ctx.getPops().get(0),
+ s2 = ctx.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2)) // ificmpne 0 vs ifne
+ {
+ super.map(mapping, ctx, other);
+ }
+ else if (isOne(s1) || isOne(s2)) // ificmpne 1 vs ifne
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ assert false;
+ }
+ }
+ else if (other.getInstruction() instanceof IfICmpEq)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLe.java
new file mode 100644
index 0000000000..dbe64c9108
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLe.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfLe extends If0
+{
+ public IfLe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfGt)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfGt)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLt.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLt.java
new file mode 100644
index 0000000000..d1c6c90fa3
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLt.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfLt extends If0
+{
+ public IfLt(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfGe)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfGe)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNe.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNe.java
new file mode 100644
index 0000000000..9001b554b3
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNe.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import static net.runelite.asm.attributes.code.instructions.IfICmpEq.isOne;
+import static net.runelite.asm.attributes.code.instructions.IfICmpEq.isZero;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfNe extends If0
+{
+ public IfNe(Instructions instructions, Label to)
+ {
+ super(instructions, InstructionType.IFNE, to);
+ }
+
+ public IfNe(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ // whether or not it jumps can be negated too, so
+ // ifne vs ificmpne 0
+ // ifne vs ificmpne 1 (invert jump)
+ // ifne vs ificmpeq 1
+ // ifne vs ificmpeq 0 (invert jump)
+ // are all valid
+ if (otherIc.getInstruction() instanceof IfICmpNe || otherIc.getInstruction() instanceof IfICmpEq)
+ {
+ StackContext s1 = otherIc.getPops().get(0),
+ s2 = otherIc.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2) || isOne(s1) || isOne(s2))
+ return true;
+ }
+
+ if (otherIc.getInstruction() instanceof IfEq)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfICmpEq)
+ {
+ StackContext s1 = other.getPops().get(0),
+ s2 = other.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2)) // isne vs ificmpeq 0
+ super.mapOtherBranch(mapping, ctx, other);
+ else if (isOne(s1) || isOne(s2)) // isne vs isicmpeq 1
+ super.map(mapping, ctx, other);
+ else
+ assert false;
+ }
+ else if (other.getInstruction() instanceof IfICmpNe)
+ {
+ StackContext s1 = other.getPops().get(0),
+ s2 = other.getPops().get(1);
+
+ if (isZero(s1) || isZero(s2))
+ super.map(mapping, ctx, other); // ifne 0 vs ificmpne 0
+ else if (isOne(s1) || isOne(s2))
+ super.mapOtherBranch(mapping, ctx, other); // ifne 0 vs ificmpne 1
+ else
+ assert false;
+ }
+ else if (other.getInstruction() instanceof IfEq)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNonNull.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNonNull.java
new file mode 100644
index 0000000000..7f47d550e5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNonNull.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfNonNull extends If0
+{
+ public IfNonNull(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfACmpEq || otherIc.getInstruction() instanceof IfACmpNe)
+ {
+ StackContext s1 = otherIc.getPops().get(0),
+ s2 = otherIc.getPops().get(1);
+
+ if (s1.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ if (s2.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ }
+ else if (otherIc.getInstruction() instanceof IfNull)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfNull || other.getInstruction() instanceof IfACmpEq)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNull.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNull.java
new file mode 100644
index 0000000000..92f48ec4b6
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNull.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class IfNull extends If0
+{
+ public IfNull(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (!this.isSameField(thisIc, otherIc))
+ return false;
+
+ if (thisIc.getInstruction().getClass() == otherIc.getInstruction().getClass())
+ return true;
+
+ if (otherIc.getInstruction() instanceof IfACmpEq || otherIc.getInstruction() instanceof IfACmpNe)
+ {
+ StackContext s1 = otherIc.getPops().get(0),
+ s2 = otherIc.getPops().get(1);
+
+ if (s1.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ if (s2.getPushed().getInstruction() instanceof AConstNull)
+ {
+ return true;
+ }
+ }
+ if (otherIc.getInstruction() instanceof IfNonNull)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ if (other.getInstruction() instanceof IfACmpNe || other.getInstruction() instanceof IfNonNull)
+ {
+ super.mapOtherBranch(mapping, ctx, other);
+ }
+ else
+ {
+ super.map(mapping, ctx, other);
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InstanceOf.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InstanceOf.java
new file mode 100644
index 0000000000..a7053b68a1
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InstanceOf.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.TypeInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import org.objectweb.asm.MethodVisitor;
+
+public class InstanceOf extends Instruction implements TypeInstruction
+{
+ private Type type;
+ private ClassFile myClass;
+
+ public InstanceOf(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitTypeInsn(this.getType().getCode(), type.toAsmString());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext obj = stack.pop();
+ ins.pop(obj);
+
+ StackContext ctx = new StackContext(ins, Type.INT, Value.UNKNOWN);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public void lookup()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+ myClass = group.findClass(type.getInternalName());
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myClass != null)
+ {
+ int dimms = type.getDimensions();
+ type = Type.getType("L" + myClass.getName() + ";", dimms);
+ }
+ }
+
+ @Override
+ public Type getType_()
+ {
+ return type;
+ }
+
+ @Override
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java
new file mode 100644
index 0000000000..6edced53b5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017, Adam
+ * 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.code.instructions;
+
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.pool.Method;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.Handle;
+import org.objectweb.asm.MethodVisitor;
+
+public class InvokeDynamic extends Instruction implements InvokeInstruction
+{
+ private String name;
+ private String desc;
+ private Handle bsm;
+ private Object[] bsmArgs;
+
+ public InvokeDynamic(Instructions instructions, String name, String desc, Handle bsm, Object[] bsmArgs)
+ {
+ super(instructions, InstructionType.INVOKEDYNAMIC);
+ this.name = name;
+ this.desc = desc;
+ this.bsm = bsm;
+ this.bsmArgs = bsmArgs;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "invokedynamic in " + this.getInstructions().getCode().getMethod();
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
+ }
+
+ @Override
+ public List getMethods()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ throw new UnsupportedOperationException("invokedynamic not supported");
+ }
+
+ @Override
+ public void removeParameter(int idx)
+ {
+ throw new UnsupportedOperationException("invokedynamic not supported");
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ return null;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ throw new UnsupportedOperationException("invokedynamic not supported");
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ throw new UnsupportedOperationException("invokedynamic not supported");
+ }
+
+ @Override
+ public void setMethod(Method method)
+ {
+ throw new UnsupportedOperationException("invokedynamic not supported");
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeInterface.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeInterface.java
new file mode 100644
index 0000000000..6272cf7853
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeInterface.java
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.List;
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction;
+import net.runelite.asm.execution.Execution;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Method;
+import net.runelite.asm.signature.Signature;
+import net.runelite.asm.signature.util.VirtualMethods;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.MethodVisitor;
+
+public class InvokeInterface extends Instruction implements InvokeInstruction
+{
+ private Method method;
+ private List myMethods;
+
+ public InvokeInterface(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "invokeinterface " + method + " in " + this.getInstructions().getCode().getMethod();// + " at pc 0x" + Integer.toHexString(this.getPc());
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitMethodInsn(this.getType().getCode(),
+ method.getClazz().getName(),
+ method.getName(),
+ method.getType().toString(),
+ true);
+ }
+
+ @Override
+ public List getMethods()
+ {
+ return myMethods != null ? myMethods : Arrays.asList();
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ int count = method.getType().size();
+
+ for (int i = 0; i < count; ++i)
+ {
+ StackContext arg = stack.pop();
+ ins.pop(arg);
+ }
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ if (!method.getType().isVoid())
+ {
+ StackContext ctx = new StackContext(ins,
+ method.getType().getReturnValue(),
+ Value.UNKNOWN
+ );
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ for (net.runelite.asm.Method method : getMethods())
+ {
+ ins.invoke(method);
+
+ if (method.getCode() == null)
+ {
+ continue;
+ }
+
+ // add possible method call to execution
+ Execution execution = frame.getExecution();
+ execution.invoke(ins, method);
+ }
+
+ if (myMethods != null)
+ {
+ for (net.runelite.asm.Method method : myMethods)
+ {
+ frame.getExecution().order(frame, method);
+ }
+ }
+
+ return ins;
+ }
+
+ @Override
+ public void removeParameter(int idx)
+ {
+ net.runelite.asm.pool.Class clazz = method.getClazz();
+
+ // create new signature
+ Signature sig = new Signature(method.getType());
+ sig.remove(idx);
+
+ // create new method pool object
+ method = new Method(clazz, method.getName(), sig);
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ private List lookupMethods()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+
+ ClassFile otherClass = group.findClass(method.getClazz().getName());
+ if (otherClass == null)
+ {
+ return null; // not our class
+ }
+ net.runelite.asm.Method m = otherClass.findMethod(method.getName(), method.getType());
+ if (m == null)
+ {
+ return null;
+ }
+
+ return VirtualMethods.getVirtualMethods(m);
+ }
+
+ @Override
+ public void lookup()
+ {
+ myMethods = lookupMethods();
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myMethods != null && !myMethods.isEmpty())
+ {
+ if (!myMethods.equals(lookupMethods()))
+ {
+ method = myMethods.get(0).getPoolMethod(); // is this right?
+ }
+ }
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ InvokeInterface otherIv = (InvokeInterface) other.getInstruction();
+
+ List myMethods = this.getMethods(),
+ otherMethods = otherIv.getMethods();
+
+ assert myMethods.size() == otherMethods.size();
+
+ for (int i = 0; i < myMethods.size(); ++i)
+ {
+ net.runelite.asm.Method m1 = myMethods.get(i), otherMethod = null;
+ ClassFile c1 = m1.getClassFile();
+
+ if (myMethods.size() == 1)
+ {
+ otherMethod = otherMethods.get(0);
+ }
+ else
+ {
+ for (int j = 0; j < myMethods.size(); ++j)
+ {
+ net.runelite.asm.Method m2 = otherMethods.get(j);
+ ClassFile c2 = m2.getClassFile();
+
+ if (MappingExecutorUtil.isMaybeEqual(c1, c2))
+ {
+ if (otherMethod != null)
+ {
+ otherMethod = null;
+ break;
+ }
+
+ otherMethod = m2;
+ }
+ }
+ }
+
+ if (otherMethod != null)
+ {
+ mapping.map(this, m1, otherMethod);
+ }
+ }
+
+ for (int i = 0; i < ctx.getPops().size(); ++i)
+ {
+ StackContext s1 = ctx.getPops().get(i),
+ s2 = other.getPops().get(i);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ /* map field that was invoked on */
+ StackContext object1 = ctx.getPops().get(method.getType().size()),
+ object2 = other.getPops().get(otherIv.method.getType().size());
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getClass() != otherIc.getInstruction().getClass())
+ {
+ return false;
+ }
+
+ InvokeInterface thisIi = (InvokeInterface) thisIc.getInstruction(),
+ otherIi = (InvokeInterface) otherIc.getInstruction();
+
+ if (!MappingExecutorUtil.isMaybeEqual(thisIi.method.getType(), otherIi.method.getType()))
+ {
+ return false;
+ }
+
+ List thisMethods = thisIi.getMethods(),
+ otherMethods = otherIi.getMethods();
+
+ if (thisMethods.size() != otherMethods.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < thisMethods.size(); ++i)
+ {
+ net.runelite.asm.Method m1 = thisMethods.get(i);
+ net.runelite.asm.Method m2 = otherMethods.get(i);
+
+ if (!MappingExecutorUtil.isMaybeEqual(m1.getDescriptor(), m2.getDescriptor()))
+ {
+ return false;
+ }
+
+ break;
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return MappingExecutorUtil.isMappable(this);
+ }
+
+ @Override
+ public void setMethod(Method method)
+ {
+ this.method = method;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java
new file mode 100644
index 0000000000..12befd9f0b
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction;
+import net.runelite.asm.execution.Execution;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Method;
+import net.runelite.asm.signature.Signature;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.MethodVisitor;
+
+public class InvokeSpecial extends Instruction implements InvokeInstruction
+{
+ private Method method;
+ private net.runelite.asm.Method myMethod;
+
+ public InvokeSpecial(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public InvokeSpecial(Instructions instructions, Method method)
+ {
+ super(instructions, InstructionType.INVOKESPECIAL);
+
+ this.method = method;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitMethodInsn(this.getType().getCode(),
+ method.getClazz().getName(),
+ method.getName(),
+ method.getType().toString(),
+ false);
+ }
+
+ @Override
+ public List getMethods()
+ {
+ return myMethod != null ? Arrays.asList(myMethod) : Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ int count = method.getType().size();
+
+ for (int i = 0; i < count; ++i)
+ {
+ StackContext arg = stack.pop();
+ ins.pop(arg);
+ }
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ if (!method.getType().isVoid())
+ {
+ StackContext ctx = new StackContext(ins,
+ method.getType().getReturnValue(),
+ Value.UNKNOWN
+ );
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ if (myMethod != null)
+ {
+ ins.invoke(myMethod);
+
+ assert myMethod.getCode() != null;
+
+ // add possible method call to execution
+ Execution execution = frame.getExecution();
+ execution.invoke(ins, myMethod);
+
+ frame.getExecution().order(frame, myMethod);
+ }
+
+ return ins;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "invokespecial " + method + " in " + this.getInstructions().getCode().getMethod();
+ }
+
+ @Override
+ public void removeParameter(int idx)
+ {
+ net.runelite.asm.pool.Class clazz = method.getClazz();
+
+ // create new signature
+ Signature sig = new Signature(method.getType());
+ sig.remove(idx);
+
+ // create new method pool object
+ method = new Method(clazz, method.getName(), sig);
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ @Override
+ public void setMethod(Method method)
+ {
+ this.method = method;
+ }
+
+ @Override
+ public void lookup()
+ {
+ myMethod = null;
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+
+ ClassFile otherClass = group.findClass(method.getClazz().getName());
+ if (otherClass == null)
+ {
+ return; // not our class
+ }
+
+ net.runelite.asm.Method other = otherClass.findMethod(method.getName(), method.getType());
+ if (other == null)
+ {
+ return;
+ }
+
+ myMethod = other;
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myMethod != null)
+ {
+ method = myMethod.getPoolMethod();
+ }
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ InvokeSpecial otherIv = (InvokeSpecial) other.getInstruction();
+
+ List myMethods = this.getMethods(),
+ otherMethods = otherIv.getMethods();
+
+ assert myMethods.size() == otherMethods.size();
+
+ for (int i = 0; i < myMethods.size(); ++i)
+ {
+ mapping.map(this, myMethods.get(i), otherMethods.get(i));
+ }
+
+ for (int i = 0; i < ctx.getPops().size(); ++i)
+ {
+ StackContext s1 = ctx.getPops().get(i),
+ s2 = other.getPops().get(i);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ /* map field that was invoked on */
+ StackContext object1 = ctx.getPops().get(method.getType().size()),
+ object2 = other.getPops().get(otherIv.method.getType().size());
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getClass() != otherIc.getInstruction().getClass())
+ {
+ return false;
+ }
+
+ InvokeSpecial thisIi = (InvokeSpecial) thisIc.getInstruction(),
+ otherIi = (InvokeSpecial) otherIc.getInstruction();
+
+ if (!MappingExecutorUtil.isMaybeEqual(thisIi.method.getType(), otherIi.method.getType()))
+ {
+ return false;
+ }
+
+ List thisMethods = thisIi.getMethods(),
+ otherMethods = otherIi.getMethods();
+
+ if (thisMethods.size() != otherMethods.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < thisMethods.size(); ++i)
+ {
+ net.runelite.asm.Method m1 = thisMethods.get(i);
+ net.runelite.asm.Method m2 = otherMethods.get(i);
+
+ if (!MappingExecutorUtil.isMaybeEqual(m1.getClassFile(), m2.getClassFile()))
+ {
+ return false;
+ }
+
+ if (!MappingExecutorUtil.isMaybeEqual(m1.getDescriptor(), m2.getDescriptor()))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return MappingExecutorUtil.isMappable(this);
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java
new file mode 100644
index 0000000000..d1420adba5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction;
+import net.runelite.asm.execution.Execution;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import static net.runelite.asm.execution.StaticStep.stepInto;
+
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Method;
+import net.runelite.asm.signature.Signature;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.MethodVisitor;
+
+public class InvokeStatic extends Instruction implements InvokeInstruction
+{
+ private Method method;
+ private net.runelite.asm.Method myMethod;
+
+ public InvokeStatic(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public InvokeStatic(Instructions instructions, Method method)
+ {
+ super(instructions, InstructionType.INVOKESTATIC);
+
+ this.method = method;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitMethodInsn(this.getType().getCode(),
+ method.getClazz().getName(),
+ method.getName(),
+ method.getType().toString(),
+ false);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "invokestatic " + method + " in " + this.getInstructions().getCode().getMethod();// + " at pc 0x" + Integer.toHexString(this.getPc());
+ }
+
+ @Override
+ public List getMethods()
+ {
+ return myMethod != null ? Arrays.asList(myMethod) : Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ int count = method.getType().size();
+
+ for (int i = 0; i < count; ++i)
+ {
+ StackContext arg = stack.pop();
+ ins.pop(arg);
+ }
+
+ if (!method.getType().isVoid())
+ {
+ StackContext ctx = new StackContext(ins,
+ method.getType().getReturnValue(),
+ Value.UNKNOWN
+ );
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ if (myMethod != null)
+ {
+ ins.invoke(myMethod);
+
+ assert myMethod.getCode() != null;
+
+ Execution execution = frame.getExecution();
+
+ if (execution.staticStep)
+ {
+ Frame staticFrame = stepInto(frame, ins);
+
+ if (staticFrame != null)
+ {
+ // this invokestatic instruction hasn't been added to this frame yet.. so it
+ // is not yet in the return frame
+ staticFrame.returnTo.addInstructionContext(ins);
+ staticFrame.returnTo.nextInstruction();
+
+ // returnTo has already be duped from frame which is why executing remains
+ // true and it is able to resume later
+ frame.stop();
+ }
+ }
+ else
+ {
+ // add possible method call to execution
+ execution.invoke(ins, myMethod);
+ }
+
+ frame.getExecution().order(frame, myMethod);
+ }
+
+ return ins;
+ }
+
+ @Override
+ public void removeParameter(int idx)
+ {
+ net.runelite.asm.pool.Class clazz = method.getClazz();
+
+ // create new signature
+ Signature sig = new Signature(method.getType());
+ sig.remove(idx);
+
+ // create new method pool object
+ method = new Method(clazz, method.getName(), sig);
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ private net.runelite.asm.Method lookupMethod()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+
+ ClassFile otherClass = group.findClass(method.getClazz().getName());
+ if (otherClass == null)
+ {
+ return null; // not our class
+ }
+ net.runelite.asm.Method other = otherClass.findMethodDeepStatic(method.getName(), method.getType());
+ if (other == null)
+ {
+ return null; // when regenerating the pool after renaming the method this can be null.
+ }
+ return other;
+ }
+
+ @Override
+ public void lookup()
+ {
+ myMethod = lookupMethod();
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myMethod != null)
+ {
+ if (myMethod != lookupMethod())
+ {
+ method = myMethod.getPoolMethod();
+ }
+ }
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ List myMethods = this.getMethods(),
+ otherMethods = ((InvokeStatic) other.getInstruction()).getMethods();
+
+ assert myMethods.size() == otherMethods.size();
+
+ for (int i = 0; i < myMethods.size(); ++i)
+ {
+ mapping.map(this, myMethods.get(i), otherMethods.get(i));
+ }
+
+ for (int i = 0; i < ctx.getPops().size(); ++i)
+ {
+ StackContext s1 = ctx.getPops().get(i),
+ s2 = other.getPops().get(i);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getClass() != otherIc.getInstruction().getClass())
+ {
+ return false;
+ }
+
+ InvokeStatic thisIi = (InvokeStatic) thisIc.getInstruction(),
+ otherIi = (InvokeStatic) otherIc.getInstruction();
+
+ if (!MappingExecutorUtil.isMaybeEqual(thisIi.method.getType(), otherIi.method.getType()))
+ {
+ return false;
+ }
+
+ List thisMethods = thisIi.getMethods(),
+ otherMethods = otherIi.getMethods();
+
+ if (thisMethods.size() != otherMethods.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < thisMethods.size(); ++i)
+ {
+ net.runelite.asm.Method m1 = thisMethods.get(i);
+ net.runelite.asm.Method m2 = otherMethods.get(i);
+
+ /* The class names are random */
+ if (!MappingExecutorUtil.isMaybeEqual(m1.getDescriptor(), m2.getDescriptor()))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return MappingExecutorUtil.isMappable(this);
+ }
+
+ @Override
+ public void setMethod(Method method)
+ {
+ this.method = method;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeVirtual.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeVirtual.java
new file mode 100644
index 0000000000..d9c9abb998
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeVirtual.java
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.Arrays;
+import java.util.List;
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Field;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.InvokeInstruction;
+import net.runelite.asm.execution.Execution;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Class;
+import net.runelite.asm.pool.Method;
+import net.runelite.asm.signature.Signature;
+import net.runelite.asm.signature.util.VirtualMethods;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+import org.objectweb.asm.MethodVisitor;
+
+public class InvokeVirtual extends Instruction implements InvokeInstruction
+{
+ private Method method;
+ private net.runelite.asm.Method myMethod;
+ private List myMethods;
+
+ public InvokeVirtual(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public InvokeVirtual(Instructions instructions, Method method)
+ {
+ super(instructions, InstructionType.INVOKEVIRTUAL);
+
+ this.method = method;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitMethodInsn(this.getType().getCode(),
+ method.getClazz().getName(),
+ method.getName(),
+ method.getType().toString(),
+ false);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "invokevirtual " + method + " in " + this.getInstructions().getCode().getMethod();// + " at pc 0x" + Integer.toHexString(this.getPc());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ int count = method.getType().size();
+
+ for (int i = 0; i < count; ++i)
+ {
+ StackContext arg = stack.pop();
+ ins.pop(arg);
+ }
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ if (!method.getType().isVoid())
+ {
+ StackContext ctx = new StackContext(ins,
+ method.getType().getReturnValue(),
+ Value.UNKNOWN
+ );
+ stack.push(ctx);
+
+ ins.push(ctx);
+ }
+
+ for (net.runelite.asm.Method method : getMethods())
+ {
+ ins.invoke(method);
+
+ if (method.getCode() == null)
+ {
+ continue;
+ }
+
+ // add possible method call to execution
+ Execution execution = frame.getExecution();
+ execution.invoke(ins, method);
+ }
+
+ if (myMethods != null)
+ {
+ for (net.runelite.asm.Method method : myMethods)
+ {
+ frame.getExecution().order(frame, method);
+ }
+ }
+
+ return ins;
+ }
+
+ @Override
+ public List getMethods()
+ {
+ return myMethods != null ? myMethods : Arrays.asList();
+ }
+
+ @Override
+ public void removeParameter(int idx)
+ {
+ net.runelite.asm.pool.Class clazz = method.getClazz();
+
+ // create new signature
+ Signature sig = new Signature(method.getType());
+ sig.remove(idx);
+
+ // create new method pool object
+ method = new Method(clazz, method.getName(), sig);
+ }
+
+ @Override
+ public Method getMethod()
+ {
+ return method;
+ }
+
+ private List lookupMethods()
+ {
+ net.runelite.asm.Method m = lookupMethod();
+ if (m == null)
+ {
+ return null;
+ }
+
+ return VirtualMethods.getVirtualMethods(m);
+ }
+
+ private net.runelite.asm.Method lookupMethod()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+
+ ClassFile otherClass = group.findClass(method.getClazz().getName());
+ if (otherClass == null)
+ {
+ return null; // not our class
+ }
+
+ net.runelite.asm.Method m = otherClass.findMethodDeep(method.getName(), method.getType());
+ return m;
+ }
+
+ @Override
+ public void lookup()
+ {
+ myMethods = lookupMethods();
+ myMethod = lookupMethod();
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myMethods == null)
+ {
+ return;
+ }
+
+ method = myMethod.getPoolMethod();
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mapping, InstructionContext ctx, InstructionContext other)
+ {
+ InvokeVirtual otherIv = (InvokeVirtual) other.getInstruction();
+
+ List myMethods = this.getMethods(),
+ otherMethods = otherIv.getMethods();
+
+ assert MappingExecutorUtil.isMaybeEqual(method.getType(), otherIv.method.getType());
+ assert myMethods.size() == otherMethods.size();
+
+ for (int i = 0; i < myMethods.size(); ++i)
+ {
+ net.runelite.asm.Method m1 = myMethods.get(i), otherMethod = null;
+ ClassFile c1 = m1.getClassFile();
+
+ if (myMethods.size() == 1)
+ {
+ otherMethod = otherMethods.get(0);
+ }
+ else
+ {
+ for (int j = 0; j < myMethods.size(); ++j)
+ {
+ net.runelite.asm.Method m2 = otherMethods.get(j);
+ ClassFile c2 = m2.getClassFile();
+
+ if (MappingExecutorUtil.isMaybeEqual(c1, c2))
+ {
+ if (otherMethod != null)
+ {
+ otherMethod = null;
+ break;
+ }
+
+ otherMethod = m2;
+ }
+ }
+ }
+
+ if (otherMethod != null)
+ {
+ mapping.map(this, m1, otherMethod);
+ }
+ }
+
+ /* map arguments */
+ assert ctx.getPops().size() == other.getPops().size();
+
+ for (int i = 0; i < ctx.getPops().size(); ++i)
+ {
+ StackContext s1 = ctx.getPops().get(i),
+ s2 = other.getPops().get(i);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ /* map field that was invoked on */
+ StackContext object1 = ctx.getPops().get(method.getType().size()),
+ object2 = other.getPops().get(otherIv.method.getType().size());
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (f1 != null && f2 != null)
+ {
+ mapping.map(this, f1, f2);
+ }
+ }
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getClass() != otherIc.getInstruction().getClass())
+ {
+ return false;
+ }
+
+ InvokeVirtual thisIi = (InvokeVirtual) thisIc.getInstruction(),
+ otherIi = (InvokeVirtual) otherIc.getInstruction();
+
+ if (!MappingExecutorUtil.isMaybeEqual(thisIi.method.getType(), otherIi.method.getType()))
+ {
+ return false;
+ }
+
+ List thisMethods = thisIi.getMethods(),
+ otherMethods = otherIi.getMethods();
+
+ if (thisMethods.size() != otherMethods.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < thisMethods.size(); ++i)
+ {
+ net.runelite.asm.Method m1 = thisMethods.get(i);
+ net.runelite.asm.Method m2 = otherMethods.get(i);
+
+ // order of methods in thisMethods/otherMethods depends on order classes
+ // were loaded, which might not be the same
+ if (!MappingExecutorUtil.isMaybeEqual(m1.getDescriptor(), m2.getDescriptor()))
+ {
+ return false;
+ }
+
+ break; // descriptors for all methods must be the same
+ }
+
+ /* check arguments */
+ assert thisIc.getPops().size() == otherIc.getPops().size();
+
+ for (int i = 0; i < thisIc.getPops().size(); ++i)
+ {
+ StackContext s1 = thisIc.getPops().get(i),
+ s2 = otherIc.getPops().get(i);
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(s1.getPushed(), s1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(s2.getPushed(), s2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (!MappingExecutorUtil.isMaybeEqual(f1, f2))
+ {
+ return false;
+ }
+ }
+ }
+
+ /* check field that was invoked on */
+ StackContext object1 = thisIc.getPops().get(thisIi.method.getType().size()),
+ object2 = otherIc.getPops().get(otherIi.method.getType().size());
+
+ InstructionContext base1 = MappingExecutorUtil.resolve(object1.getPushed(), object1);
+ InstructionContext base2 = MappingExecutorUtil.resolve(object2.getPushed(), object2);
+
+ if (base1.getInstruction() instanceof GetFieldInstruction && base2.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gf1 = (GetFieldInstruction) base1.getInstruction(),
+ gf2 = (GetFieldInstruction) base2.getInstruction();
+
+ Field f1 = gf1.getMyField(),
+ f2 = gf2.getMyField();
+
+ if (!MappingExecutorUtil.isMaybeEqual(f1, f2))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return MappingExecutorUtil.isMappable(this);
+ }
+
+ @Override
+ public void setMethod(Method method)
+ {
+ this.method = method;
+ }
+
+ @Override
+ public void renameClass(String oldName, String newName)
+ {
+ if (myMethods != null)
+ {
+ return;
+ }
+
+ if (method.getClazz().getName().equals(oldName))
+ {
+ method = new Method(new Class(newName), method.getName(), method.getType());
+ }
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2D.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2D.java
new file mode 100644
index 0000000000..6a7d554f96
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2D.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class L2D extends Instruction implements ConversionInstruction
+{
+ public L2D(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.DOUBLE, object.getValue().cast(double.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2F.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2F.java
new file mode 100644
index 0000000000..aaa1f3434e
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2F.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class L2F extends Instruction implements ConversionInstruction
+{
+ public L2F(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.FLOAT, object.getValue().cast(float.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2I.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2I.java
new file mode 100644
index 0000000000..1997e8ab17
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2I.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ConversionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+
+public class L2I extends Instruction implements ConversionInstruction
+{
+ public L2I(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ StackContext ctx = new StackContext(ins, Type.INT, object.getValue().cast(int.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LALoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LALoad.java
new file mode 100644
index 0000000000..db031f271d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LALoad.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.ArrayLoad;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class LALoad extends Instruction implements ArrayLoad
+{
+ public LALoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(index, array);
+
+ StackContext ctx = new StackContext(ins, Type.LONG, array.getValue().arrayGet(index.getValue()).cast(long.class));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAStore.java
new file mode 100644
index 0000000000..827255575a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAStore.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class LAStore extends ArrayStore
+{
+ public LAStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ StackContext index = stack.pop();
+ StackContext array = stack.pop();
+
+ ins.pop(value, index, array);
+
+ array.getValue().arraySet(index.getValue(), value.getValue());
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAdd.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAdd.java
new file mode 100644
index 0000000000..cf00f99b2a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAdd.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.AdditionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LAdd extends Instruction implements AdditionInstruction
+{
+ public LAdd(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ result = new Value(l1 + l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAnd.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAnd.java
new file mode 100644
index 0000000000..aae069eb78
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAnd.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LAnd extends Instruction
+{
+ public LAnd(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ result = new Value(l1 & l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LCmp.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LCmp.java
new file mode 100644
index 0000000000..8b03ef6f1f
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LCmp.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.runelite.asm.Field;
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;
+import net.runelite.asm.attributes.code.instruction.types.MappableInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil;
+import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping;
+
+public class LCmp extends Instruction implements MappableInstruction
+{
+ public LCmp(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ if (l1 > l2)
+ {
+ result = new Value(1);
+ }
+ else if (l1 == l2)
+ {
+ result = new Value(0);
+ }
+ else if (l1 < l2)
+ {
+ result = new Value(-1);
+ }
+ }
+
+ StackContext ctx = new StackContext(ins, Type.INT, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other)
+ {
+ List f1s = getComparedFields(ctx), f2s = getComparedFields(other);
+
+ if (f1s == null || f2s == null || f1s.size() != f2s.size())
+ {
+ return;
+ }
+
+ for (int i = 0; i < f1s.size(); ++i)
+ {
+ Field f1 = f1s.get(i), f2 = f2s.get(i);
+
+ mappings.map(this, f1, f2);
+ }
+ }
+
+ private List getComparedFields(InstructionContext ctx)
+ {
+ List fields = new ArrayList<>();
+
+ for (StackContext sctx : ctx.getPops())
+ {
+ InstructionContext base = MappingExecutorUtil.resolve(sctx.getPushed(), sctx);
+
+ if (base.getInstruction() instanceof GetFieldInstruction)
+ {
+ GetFieldInstruction gfi = (GetFieldInstruction) base.getInstruction();
+
+ if (gfi.getMyField() != null)
+ {
+ fields.add(gfi.getMyField());
+ }
+ }
+ }
+
+ return fields.isEmpty() ? null : fields;
+ }
+
+ @Override
+ public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)
+ {
+ if (thisIc.getInstruction().getType() != otherIc.getInstruction().getType())
+ {
+ return false;
+ }
+
+ List f1s = getComparedFields(thisIc),
+ f2s = getComparedFields(otherIc);
+
+ if ((f1s == null) != (f2s == null))
+ {
+ return false;
+ }
+
+ if (f1s == null || f2s == null)
+ {
+ return true;
+ }
+
+ if (f1s.size() != f2s.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < f1s.size(); ++i)
+ {
+ Field f1 = f1s.get(i), f2 = f2s.get(i);
+
+ if (!MappingExecutorUtil.isMaybeEqual(f1.getClassFile(), f2.getClassFile())
+ || !MappingExecutorUtil.isMaybeEqual(f1.getType(), f2.getType())
+ || f1.isStatic() != f2.isStatic())
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean canMap(InstructionContext thisIc)
+ {
+ return true;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDC.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDC.java
new file mode 100644
index 0000000000..a78160c4b2
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDC.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import org.objectweb.asm.MethodVisitor;
+import static org.objectweb.asm.Opcodes.DCONST_0;
+import static org.objectweb.asm.Opcodes.DCONST_1;
+import static org.objectweb.asm.Opcodes.FCONST_0;
+import static org.objectweb.asm.Opcodes.FCONST_1;
+import static org.objectweb.asm.Opcodes.FCONST_2;
+import static org.objectweb.asm.Opcodes.ICONST_0;
+import static org.objectweb.asm.Opcodes.ICONST_1;
+import static org.objectweb.asm.Opcodes.ICONST_2;
+import static org.objectweb.asm.Opcodes.ICONST_3;
+import static org.objectweb.asm.Opcodes.ICONST_4;
+import static org.objectweb.asm.Opcodes.ICONST_5;
+import static org.objectweb.asm.Opcodes.ICONST_M1;
+import static org.objectweb.asm.Opcodes.LCONST_0;
+import static org.objectweb.asm.Opcodes.LCONST_1;
+
+public class LDC extends Instruction implements PushConstantInstruction
+{
+ private Object value;
+
+ public LDC(Instructions instructions, Object value)
+ {
+ super(instructions, InstructionType.LDC);
+
+ this.value = value;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ Object object = getConstant();
+ if (object instanceof net.runelite.asm.pool.Class)
+ {
+ net.runelite.asm.pool.Class cl = (net.runelite.asm.pool.Class) object;
+ org.objectweb.asm.Type type = org.objectweb.asm.Type.getType("L" + cl.getName() + ";");
+ visitor.visitLdcInsn(type);
+ }
+ else if (object.equals(0d))
+ {
+ visitor.visitInsn(DCONST_0);
+ }
+ else if (object.equals(1d))
+ {
+ visitor.visitInsn(DCONST_1);
+ }
+ else if (object.equals(0f))
+ {
+ visitor.visitInsn(FCONST_0);
+ }
+ else if (object.equals(1f))
+ {
+ visitor.visitInsn(FCONST_1);
+ }
+ else if (object.equals(2f))
+ {
+ visitor.visitInsn(FCONST_2);
+ }
+ else if (object.equals(-1))
+ {
+ visitor.visitInsn(ICONST_M1);
+ }
+ else if (object.equals(0))
+ {
+ visitor.visitInsn(ICONST_0);
+ }
+ else if (object.equals(1))
+ {
+ visitor.visitInsn(ICONST_1);
+ }
+ else if (object.equals(2))
+ {
+ visitor.visitInsn(ICONST_2);
+ }
+ else if (object.equals(3))
+ {
+ visitor.visitInsn(ICONST_3);
+ }
+ else if (object.equals(4))
+ {
+ visitor.visitInsn(ICONST_4);
+ }
+ else if (object.equals(5))
+ {
+ visitor.visitInsn(ICONST_5);
+ }
+ else if (object.equals(0L))
+ {
+ visitor.visitInsn(LCONST_0);
+ }
+ else if (object.equals(1L))
+ {
+ visitor.visitInsn(LCONST_1);
+ }
+ else
+ {
+ visitor.visitLdcInsn(object);
+ }
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext ctx = new StackContext(ins, Type.getType(value), new Value(value));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ldc " + value;
+ }
+
+ @Override
+ public Object getConstant()
+ {
+ return value;
+ }
+
+ @Override
+ public Instruction setConstant(Object entry)
+ {
+ value = entry;
+
+ return this;
+ }
+
+ public int getConstantAsInt()
+ {
+ return (int) value;
+ }
+
+ public long getConstantAsLong()
+ {
+ return (long) value;
+ }
+
+ public Number getNumber()
+ {
+ return (Number) value;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDiv.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDiv.java
new file mode 100644
index 0000000000..29008a9a1d
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDiv.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.DivisionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LDiv extends Instruction implements DivisionInstruction
+{
+ public LDiv(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ if (l2 != 0L)
+ result = new Value(l1 / l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LLoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LLoad.java
new file mode 100644
index 0000000000..4b665705c8
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LLoad.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class LLoad extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public LLoad(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.LLOAD);
+
+ this.index = index;
+ }
+
+ public LLoad(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ VariableContext vctx = variables.get(index);
+ assert vctx.getType().equals(Type.LONG);
+ ins.read(vctx);
+
+ StackContext ctx = new StackContext(ins, vctx);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return false;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.LONG;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LMul.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LMul.java
new file mode 100644
index 0000000000..676b1bd0a5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LMul.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LMul extends Instruction
+{
+ public LMul(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public LMul(Instructions instructions)
+ {
+ super(instructions, InstructionType.LMUL);
+ }
+
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ result = new Value(l1 * l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LNeg.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LNeg.java
new file mode 100644
index 0000000000..7e5f68eaf5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LNeg.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LNeg extends Instruction
+{
+ public LNeg(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ Value result = Value.UNKNOWN;
+ if (!value.getValue().isUnknownOrNull())
+ {
+ long l = (long) value.getValue().getValue();
+
+ result = new Value(-l);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LOr.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LOr.java
new file mode 100644
index 0000000000..d4e304f85b
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LOr.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LOr extends Instruction
+{
+ public LOr(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ result = new Value(l1 | l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LRem.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LRem.java
new file mode 100644
index 0000000000..a99bdf4ba6
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LRem.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LRem extends Instruction
+{
+ public LRem(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ if (l2 != 0L)
+ result = new Value(l1 % l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShL.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShL.java
new file mode 100644
index 0000000000..5246f95122
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShL.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LShL extends Instruction
+{
+ public LShL(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().as(long.class),
+ l1 = (long) two.getValue().as(long.class);
+
+ result = new Value(l1 << l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShR.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShR.java
new file mode 100644
index 0000000000..67dc075dd2
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShR.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LShR extends Instruction
+{
+ public LShR(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().as(long.class),
+ l1 = (long) two.getValue().as(long.class);
+
+ result = new Value(l1 >> l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LStore.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LStore.java
new file mode 100644
index 0000000000..41df1f2452
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LStore.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
+import net.runelite.asm.attributes.code.instruction.types.LVTInstructionType;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.VariableContext;
+import net.runelite.asm.execution.Variables;
+import org.objectweb.asm.MethodVisitor;
+
+public class LStore extends Instruction implements LVTInstruction
+{
+ private int index;
+
+ public LStore(Instructions instructions, int index)
+ {
+ super(instructions, InstructionType.LSTORE);
+
+ this.index = index;
+ }
+
+ public LStore(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitVarInsn(this.getType().getCode(), this.getVariableIndex());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+ Variables variables = frame.getVariables();
+
+ StackContext value = stack.pop();
+ assert value.getType().equals(Type.LONG);
+ ins.pop(value);
+
+ variables.set(index, new VariableContext(ins, value));
+
+ return ins;
+ }
+
+ @Override
+ public int getVariableIndex()
+ {
+ return index;
+ }
+
+ @Override
+ public boolean store()
+ {
+ return true;
+ }
+
+ @Override
+ public Instruction setVariableIndex(int idx)
+ {
+ index = idx;
+ return this;
+ }
+
+ @Override
+ public LVTInstructionType type()
+ {
+ return LVTInstructionType.LONG;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LSub.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LSub.java
new file mode 100644
index 0000000000..1ff4db85d5
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LSub.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.SubtractionInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LSub extends Instruction implements SubtractionInstruction
+{
+ public LSub(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ result = new Value(l1 - l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LUShR.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LUShR.java
new file mode 100644
index 0000000000..97a1132b4f
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LUShR.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LUShR extends Instruction
+{
+ public LUShR(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().as(long.class),
+ l1 = (long) two.getValue().as(long.class);
+
+ result = new Value(l1 >>> l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LXor.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LXor.java
new file mode 100644
index 0000000000..c6a131720a
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LXor.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+
+public class LXor extends Instruction
+{
+ public LXor(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext two = stack.pop();
+ StackContext one = stack.pop();
+
+ ins.pop(two, one);
+
+ Value result = Value.UNKNOWN;
+ if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull())
+ {
+ long l2 = (long) two.getValue().getValue(),
+ l1 = (long) one.getValue().getValue();
+
+ result = new Value(l1 ^ l2);
+ }
+
+ StackContext ctx = new StackContext(ins, Type.LONG, result);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LookupSwitch.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LookupSwitch.java
new file mode 100644
index 0000000000..4a5300a573
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LookupSwitch.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.Label;
+import net.runelite.asm.attributes.code.instruction.types.JumpingInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import org.objectweb.asm.MethodVisitor;
+
+public class LookupSwitch extends Instruction implements JumpingInstruction
+{
+ private List branchi = new ArrayList<>();
+ private Label defi;
+
+ private int[] match;
+
+ public LookupSwitch(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public Instruction clone()
+ {
+ LookupSwitch i = (LookupSwitch) super.clone();
+ i.branchi = new ArrayList<>(branchi);
+ return i;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitLookupSwitchInsn(defi.getLabel(), match,
+ branchi.stream().map(l -> l.getLabel()).toArray(org.objectweb.asm.Label[]::new));
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext value = stack.pop();
+ ins.pop(value);
+
+ // N.B. lookupswitch isn't mappable, so frame.other is never mapped
+ // (the frames it creates are dropped from the pending execution list
+ // for other == null) - so the step executor won't map instructions
+ // from the non-default branch
+ for (Label i : branchi)
+ {
+ Frame other = frame.dup();
+ other.jump(ins, i);
+
+ ins.branch(other);
+ }
+
+ frame.jump(ins, defi);
+
+ return ins;
+ }
+
+ @Override
+ public boolean isTerminal()
+ {
+ return true;
+ }
+
+ @Override
+ public List getJumps()
+ {
+ List list = new ArrayList<>();
+ for (Label i : branchi)
+ {
+ list.add(i);
+ }
+ list.add(defi);
+ return list.stream().distinct().collect(Collectors.toList());
+ }
+
+ @Override
+ public void setJumps(List labels)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void setLabel(org.objectweb.asm.Label label)
+ {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public List getBranchi()
+ {
+ return branchi;
+ }
+
+ public void setBranchi(List branchi)
+ {
+ this.branchi = branchi;
+ }
+
+ public Label getDefi()
+ {
+ return defi;
+ }
+
+ public void setDefi(Label defi)
+ {
+ this.defi = defi;
+ }
+
+ public int[] getMatch()
+ {
+ return match;
+ }
+
+ public void setMatch(int[] match)
+ {
+ this.match = match;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorEnter.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorEnter.java
new file mode 100644
index 0000000000..999b314323
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorEnter.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class MonitorEnter extends Instruction
+{
+ public MonitorEnter(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorExit.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorExit.java
new file mode 100644
index 0000000000..4ead4595d0
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorExit.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+
+public class MonitorExit extends Instruction
+{
+ public MonitorExit(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext object = stack.pop();
+ ins.pop(object);
+
+ return ins;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MultiANewArray.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MultiANewArray.java
new file mode 100644
index 0000000000..4ab071c5b2
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MultiANewArray.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import org.objectweb.asm.MethodVisitor;
+
+public class MultiANewArray extends Instruction
+{
+ private Type type;
+ private int dimensions;
+ private ClassFile myClass;
+
+ public MultiANewArray(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitMultiANewArrayInsn(type.toString(), dimensions);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ Value[] lenghts = new Value[dimensions];
+ for (int i = 0; i < dimensions; ++i)
+ {
+ StackContext ctx = stack.pop();
+ ins.pop(ctx);
+
+ lenghts[i] = ctx.getValue();
+ }
+
+ StackContext ctx = new StackContext(ins, type, Value.newArray(lenghts));
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ @Override
+ public void lookup()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+ myClass = group.findClass(type.getInternalName());
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myClass != null)
+ {
+ type = Type.getType("L" + myClass.getName() + ";", type.getDimensions());
+ }
+ }
+
+ public Type getArrayType()
+ {
+ return type;
+ }
+
+ public void setArrayType(Type type)
+ {
+ this.type = type;
+ }
+
+ public int getDimensions()
+ {
+ return this.dimensions;
+ }
+
+ public void setDimensions(int dimensions)
+ {
+ this.dimensions = dimensions;
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NOP.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NOP.java
new file mode 100644
index 0000000000..21fa7e6fe6
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NOP.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import org.objectweb.asm.MethodVisitor;
+
+public class NOP extends Instruction
+{
+ public NOP(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public NOP(Instructions instructions)
+ {
+ super(instructions, InstructionType.NOP);
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ return new InstructionContext(this, frame);
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/New.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/New.java
new file mode 100644
index 0000000000..2479696ca9
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/New.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2016-2017, Adam
+ * 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.code.instructions;
+
+import net.runelite.asm.ClassFile;
+import net.runelite.asm.ClassGroup;
+import net.runelite.asm.Type;
+import net.runelite.asm.attributes.code.Instruction;
+import net.runelite.asm.attributes.code.InstructionType;
+import net.runelite.asm.attributes.code.Instructions;
+import net.runelite.asm.attributes.code.instruction.types.TypeInstruction;
+import net.runelite.asm.execution.Frame;
+import net.runelite.asm.execution.InstructionContext;
+import net.runelite.asm.execution.Stack;
+import net.runelite.asm.execution.StackContext;
+import net.runelite.asm.execution.Value;
+import net.runelite.asm.pool.Class;
+import org.objectweb.asm.MethodVisitor;
+
+public class New extends Instruction implements TypeInstruction
+{
+ private Class clazz;
+ private ClassFile myClass;
+
+ public New(Instructions instructions, InstructionType type)
+ {
+ super(instructions, type);
+ }
+
+ public New(Instructions instructions, Class clazz)
+ {
+ super(instructions, InstructionType.NEW);
+ this.clazz = clazz;
+ }
+
+ @Override
+ public void accept(MethodVisitor visitor)
+ {
+ visitor.visitTypeInsn(this.getType().getCode(), this.getType_().getInternalName());
+ }
+
+ @Override
+ public InstructionContext execute(Frame frame)
+ {
+ InstructionContext ins = new InstructionContext(this, frame);
+ Stack stack = frame.getStack();
+
+ StackContext ctx = new StackContext(ins, Type.getType(clazz), Value.UNKNOWN);
+ stack.push(ctx);
+
+ ins.push(ctx);
+
+ return ins;
+ }
+
+ public Class getNewClass()
+ {
+ return clazz;
+ }
+
+ public void setNewClass(Class clazz)
+ {
+ this.clazz = clazz;
+ lookup();
+ }
+
+ @Override
+ public void lookup()
+ {
+ ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
+ myClass = group.findClass(clazz.getName());
+ }
+
+ @Override
+ public void regeneratePool()
+ {
+ if (myClass != null)
+ clazz = myClass.getPoolClass();
+ }
+
+ @Override
+ public Type getType_()
+ {
+ return Type.getType(clazz);
+ }
+
+ @Override
+ public void setType(Type type)
+ {
+ clazz = new Class(type.getInternalName());
+ }
+}
diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NewArray.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NewArray.java
new file mode 100644
index 0000000000..eb227d9233
--- /dev/null
+++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NewArray.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016-2017, Adam