diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..0c53255148 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +patreon: RuneLitePlus diff --git a/.gitignore b/.gitignore index 177b1d7858..8d06d7383a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,10 @@ runelite-client/src/main/resources/META-INF/MANIFEST.MF git classes/artifacts/client_jar/run.bat classes/artifacts/client_jar/client.jar +*.jar +.live/ +*/build/ +*/out/ +.gradle/ +runelite-client/src/main/resources/runelite/* +.staging/ \ No newline at end of file diff --git a/.mvn/jvm.config b/.mvn/jvm.config deleted file mode 100644 index 67bd169f31..0000000000 --- a/.mvn/jvm.config +++ /dev/null @@ -1 +0,0 @@ --Xmx512m diff --git a/.travis.yml b/.travis.yml index ada8108a37..b723f6b1dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,13 @@ +install: gradle wrapper --gradle-version 4.2 language: java sudo: false -dist: xenial +dist: trusty cache: directories: - $HOME/.m2 jdk: -- openjdk8 -- openjdk11 -install: true -script: ./travis/build.sh \ No newline at end of file +- oraclejdk8 +script: ./travis/build.sh +before_install: +- chmod +x ./travis/build.sh + diff --git a/README.md b/README.md index 7ff563d196..53e24c5ca6 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,45 @@ -# RuneLitePlus [![Build Status](https://travis-ci.org/runelite-extended/runelite.svg?branch=master)](https://travis-ci.org/runelite-extended/runelite) [![Discord](https://img.shields.io/discord/373382904769675265.svg)](https://discord.gg/HN5gf3m) +# RuneLitePlus +[![Build Status](https://travis-ci.org/runelite-extended/runelite.svg?branch=master)](https://travis-ci.org/runelite-extended/runelite) +[![HitCount](http://hits.dwyl.io/runelite-extended/runelite.svg)](http://hits.dwyl.io/runelite-extended/runelite) +[RuneLitePlus](https://runelitepl.us) is an extended version of [RuneLite](https://github.com/runelite/runelite) that provides more functionality and less restrictions while staying more open-source. We are not affiliated with RuneLite. -[RuneLitePlus](https://runelitepl.us) is a fork of [RuneLite](https://github.com/runelite/runelite) that provides more functionality and less restrictions while staying open source. This is meant to directly compete with 3rd party RL clients that are trying to sell their code. +## Discord +[![Discord](https://img.shields.io/discord/373382904769675265.svg)](https://discord.gg/HN5gf3m) ## Project Layout - [cache](cache/src/main/java/net/runelite/cache) - Libraries used for reading/writing cache files, as well as the data in it -- [http-api](http-api/src/main/java/net/runelite/http/api) - API for api.runelite.net -- [http-service](http-service/src/main/java/net/runelite/http/service) - Service for api.runelite.net +- [deobfuscator](deobfuscator/src/main/java/net/runelite/deob) - Can decompile and cleanup gamepacks as well as map updates to newer revs +- [http-api](http-api/src/main/java/net/runelite/http/api) - API for runelite and runeliteplus +- [http-service](http-service/src/main/java/net/runelite/http/service) - Service for https://api.runelitepl.us +- [injector-plugin](injector-plugin/src/main/java/net/runelite/injector) - Tool for implementing our modifications to the gamepack - [runelite-api](runelite-api/src/main/java/net/runelite/api) - RuneLite API, interfaces for accessing the client -- [runelite-mixins](runelite-mixins/src/main/java/net/runelite) - Mixins which are injected into the injected client's classes +- [runelite-mixins](runelite-mixins/src/main/java/net/runelite) - Classes containing the Objects to be injected using the injector-plugin - [runescape-api](runescape-api/src/main/java/net/runelite) - Mappings correspond to these interfaces, runelite-api is a subset of this - [runelite-client](runelite-client/src/main/java/net/runelite/client) - Game client with plugins +## Private Servers +Currently we support RSMod which can be found at: https://github.com/Tomm0017/rsmod but should work with any server that follows osrs protocol. +``` +Jar/IntelliJ +Use -private-server arg. + +Exe +Use --clientargs="--private-server" arg. + +Using modified mixins is possible using -local-injected arg, but it looks in a very specific location. +(./injected-client/target/injected-client-X.X.XX-SNAPSHOT.jar) (X.X.XX must match current API version) + +----- + +Set codebase in ./codebase or in Private Server plugin and restart. +Update modulus in Private Server plugin. + +Disable Default World plugin if you have it enabled, this causes issues with codebase. +``` ## License RuneLitePlus is licensed under the BSD 2-clause license. See the license header in the respective file to be sure. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..75acf95849 --- /dev/null +++ b/build.gradle @@ -0,0 +1,34 @@ +allprojects { + apply plugin: 'maven' + apply plugin: 'checkstyle' + + group = 'net.runelite' +version = '1.5.30-SNAPSHOT' +} + +subprojects { + apply plugin: 'java' + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } + + + repositories { + mavenLocal() + + maven { url "http://repo1.maven.org/maven2" } + maven { url "http://repo.runelite.net" } + maven { url "http://repo.maven.apache.org/maven2" } + maven { url "https://raw.githubusercontent.com/runelite-extended/maven-repo/master" } + } + + checkstyle { + toolVersion = '6.4.1' + sourceSets = [sourceSets.main] + configFile = rootProject.file("./checkstyle/checkstyle.xml"); + showViolations = true + ignoreFailures = false + } +} diff --git a/cache-client/build.gradle b/cache-client/build.gradle new file mode 100644 index 0000000000..a0a33cd5e9 --- /dev/null +++ b/cache-client/build.gradle @@ -0,0 +1,9 @@ + +description = 'Cache Client' +dependencies { + compile project(':cache') + compile project(':protocol') + testCompile group: 'junit', name: 'junit', version:'4.12' + testCompile group: 'org.slf4j', name: 'slf4j-simple', version:'1.7.26' + testCompile project(':cache') +} diff --git a/cache-client/pom.xml b/cache-client/pom.xml deleted file mode 100644 index 691bb1d95c..0000000000 --- a/cache-client/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - 4.0.0 - - - net.runelite - runelite-parent - 1.5.23-SNAPSHOT - - - cache-client - Cache Client - - - - net.runelite - cache - ${project.version} - - - net.runelite - protocol - ${project.version} - - - - junit - junit - 4.12 - test - - - org.slf4j - slf4j-simple - 1.7.12 - test - - - net.runelite - cache - ${project.version} - test-jar - test - - - diff --git a/cache-updater/build.gradle b/cache-updater/build.gradle new file mode 100644 index 0000000000..c437e8062e --- /dev/null +++ b/cache-updater/build.gradle @@ -0,0 +1,12 @@ + +description = 'Cache Updater' +dependencies { + compile group: 'org.springframework.boot', name: 'spring-boot-starter', version:'1.5.6.RELEASE' + compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version:'1.5.6.RELEASE' + compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version:'1.5.6.RELEASE' + compile group: 'mysql', name: 'mysql-connector-java', version:'8.0.16' + compile project(':cache-client') + compile group: 'org.sql2o', name: 'sql2o', version:'1.6.0' + compile group: 'io.minio', name: 'minio', version:'3.0.6' + compileOnly group: 'org.projectlombok', name: 'lombok', version:'1.18.8' +} diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml deleted file mode 100644 index 9c925c8cb4..0000000000 --- a/cache-updater/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - 4.0.0 - - net.runelite - runelite-parent - 1.5.23-SNAPSHOT - - - Cache Updater - cache-updater - - - 1.5.6.RELEASE - - - - - org.springframework.boot - spring-boot-starter - ${spring.boot.version} - - - org.springframework.boot - spring-boot-starter-jdbc - ${spring.boot.version} - - - org.springframework.boot - spring-boot-devtools - ${spring.boot.version} - true - - - mysql - mysql-connector-java - 5.1.45 - - - net.runelite - cache-client - ${project.version} - - - org.sql2o - sql2o - 1.5.4 - - - io.minio - minio - 3.0.6 - - - org.projectlombok - lombok - provided - - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring.boot.version} - - - - repackage - - - spring-boot - net.runelite.cache.updater.CacheUpdater - - - - - - - \ No newline at end of file diff --git a/cache-updater/src/main/java/net/runelite/cache/updater/CacheUploader.java b/cache-updater/src/main/java/net/runelite/cache/updater/CacheUploader.java index baad6971e0..ed685a9034 100644 --- a/cache-updater/src/main/java/net/runelite/cache/updater/CacheUploader.java +++ b/cache-updater/src/main/java/net/runelite/cache/updater/CacheUploader.java @@ -69,7 +69,7 @@ public class CacheUploader implements Runnable archive.setHash(hash); String path = new StringBuilder() - .append(hashStr.substring(0, 2)) + .append(hashStr, 0, 2) .append('/') .append(hashStr.substring(2)) .toString(); diff --git a/cache/build.gradle b/cache/build.gradle new file mode 100644 index 0000000000..01e6abc89c --- /dev/null +++ b/cache/build.gradle @@ -0,0 +1,22 @@ + +description = 'Cache' +dependencies { + compile project(':http-api') + compile group: 'com.google.guava', name: 'guava', version:'28.0-jre' + compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25' + compile group: 'org.apache.commons', name: 'commons-compress', version:'1.18' + compile group: 'com.google.code.gson', name: 'gson', version:'2.8.5' + compile group: 'io.netty', name: 'netty-buffer', version:'4.1.37.Final' + compile group: 'org.antlr', name: 'antlr4-runtime', version:'4.6' + compile group: 'commons-cli', name: 'commons-cli', version:'1.4' + testCompile group: 'junit', name: 'junit', version:'4.12' + testCompile group: 'org.slf4j', name: 'slf4j-simple', version:'1.7.26' + testCompile group: 'net.runelite.rs', name: 'cache', version:'165' + compileOnly group: 'org.projectlombok', name: 'lombok', version:'1.18.8' +} + +task packageTests(type: Jar) { + from sourceSets.test.output + classifier = 'tests' +} +artifacts.archives packageTests diff --git a/cache/pom.xml b/cache/pom.xml deleted file mode 100644 index efb80c0240..0000000000 --- a/cache/pom.xml +++ /dev/null @@ -1,171 +0,0 @@ - - - - 4.0.0 - - - net.runelite - runelite-parent - 1.5.23-SNAPSHOT - - - cache - Cache - - - 165 - - 4.6 - - - - - net.runelite - http-api - ${project.version} - - - - com.google.guava - guava - - - org.slf4j - slf4j-api - - - org.apache.commons - commons-compress - 1.10 - - - com.google.code.gson - gson - - - io.netty - netty-buffer - 4.1.0.Final - - - org.antlr - antlr4-runtime - ${antlr4.version} - - - commons-cli - commons-cli - 1.3.1 - - - org.projectlombok - lombok - provided - - - - junit - junit - 4.12 - test - - - org.slf4j - slf4j-simple - 1.7.12 - test - - - net.runelite.rs - cache - ${cache.version} - test - - - - - - - src/test/resources - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - -Xmx2048m - - ${cache.tmpdir} - - - - - maven-assembly-plugin - - - jar-with-dependencies - - - - - make-assembly - package - - single - - - - - - org.antlr - antlr4-maven-plugin - ${antlr4.version} - - - process-resources - - antlr4 - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - - - - - diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/AudioEnvelopeLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/AudioEnvelopeLoader.java new file mode 100644 index 0000000000..084a8a9a86 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/AudioEnvelopeLoader.java @@ -0,0 +1,62 @@ +/* + * 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.cache.definitions.loaders.sound; + +import net.runelite.cache.definitions.sound.AudioEnvelopeDefinition; +import net.runelite.cache.io.InputStream; + +public class AudioEnvelopeLoader +{ + public AudioEnvelopeDefinition load(InputStream in) + { + AudioEnvelopeDefinition audioEnvelope = new AudioEnvelopeDefinition(); + + load(audioEnvelope, in); + + return audioEnvelope; + } + + private void load(AudioEnvelopeDefinition audioEnvelope, InputStream in) + { + audioEnvelope.form = in.readUnsignedByte(); + audioEnvelope.start = in.readInt(); + audioEnvelope.end = in.readInt(); + this.loadSegments(audioEnvelope, in); + } + + final void loadSegments(AudioEnvelopeDefinition audioEnvelope, InputStream in) + { + audioEnvelope.segments = in.readUnsignedByte(); + audioEnvelope.durations = new int[audioEnvelope.segments]; + audioEnvelope.phases = new int[audioEnvelope.segments]; + + for (int i = 0; i < audioEnvelope.segments; ++i) + { + audioEnvelope.durations[i] = in.readUnsignedShort(); + audioEnvelope.phases[i] = in.readUnsignedShort(); + } + + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/InstrumentLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/InstrumentLoader.java new file mode 100644 index 0000000000..f3d2326760 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/InstrumentLoader.java @@ -0,0 +1,93 @@ +/* + * 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.cache.definitions.loaders.sound; + +import net.runelite.cache.definitions.sound.InstrumentDefinition; +import net.runelite.cache.definitions.sound.AudioEnvelopeDefinition; +import net.runelite.cache.io.InputStream; + +public class InstrumentLoader +{ + private final AudioEnvelopeLoader aeLoader = new AudioEnvelopeLoader(); + private final SoundEffectLoader seLoader = new SoundEffectLoader(); + + public InstrumentDefinition load(InputStream in) + { + InstrumentDefinition instrument = new InstrumentDefinition(); + + load(instrument, in); + + return instrument; + } + + private void load(InstrumentDefinition instrument, InputStream in) + { + instrument.pitch = aeLoader.load(in); + instrument.volume = aeLoader.load(in); + int volume = in.readUnsignedByte(); + if (volume != 0) + { + in.setOffset(in.getOffset() - 1); + instrument.pitchModifier = aeLoader.load(in); + instrument.pitchModifierAmplitude = aeLoader.load(in); + } + + volume = in.readUnsignedByte(); + if (volume != 0) + { + in.setOffset(in.getOffset() - 1); + instrument.volumeMultiplier = aeLoader.load(in); + instrument.volumeMultiplierAmplitude = aeLoader.load(in); + } + + volume = in.readUnsignedByte(); + if (volume != 0) + { + in.setOffset(in.getOffset() - 1); + instrument.release = aeLoader.load(in); + instrument.field1175 = aeLoader.load(in); + } + + for (int i = 0; i < 10; ++i) + { + int vol = in.readUnsignedShortSmart(); + if (vol == 0) + { + break; + } + + instrument.oscillatorVolume[i] = vol; + instrument.oscillatorPitch[i] = in.readShortSmart(); + instrument.oscillatorDelays[i] = in.readUnsignedShortSmart(); + } + + instrument.delayTime = in.readUnsignedShortSmart(); + instrument.delayDecay = in.readUnsignedShortSmart(); + instrument.duration = in.readUnsignedShort(); + instrument.offset = in.readUnsignedShort(); + instrument.filterEnvelope = new AudioEnvelopeDefinition(); + instrument.filter = seLoader.load(in, instrument.filterEnvelope); + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect1Loader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect1Loader.java deleted file mode 100644 index a5c8f16f78..0000000000 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect1Loader.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.cache.definitions.loaders.sound; - -import net.runelite.cache.definitions.sound.SoundEffect1Definition; -import net.runelite.cache.definitions.sound.SoundEffect2Definition; -import net.runelite.cache.io.InputStream; - -public class SoundEffect1Loader -{ - private final SoundEffect2Loader se2Loader = new SoundEffect2Loader(); - private final SoundEffect3Loader se3Loader = new SoundEffect3Loader(); - - public SoundEffect1Definition load(InputStream in) - { - SoundEffect1Definition se = new SoundEffect1Definition(); - - load(se, in); - - return se; - } - - private void load(SoundEffect1Definition se, InputStream var1) - { - se.field1181 = se2Loader.load(var1); - se.field1173 = se2Loader.load(var1); - int var2 = var1.readUnsignedByte(); - if (var2 != 0) - { - var1.setOffset(var1.getOffset() - 1); - se.field1174 = se2Loader.load(var1); - se.field1193 = se2Loader.load(var1); - } - - var2 = var1.readUnsignedByte(); - if (var2 != 0) - { - var1.setOffset(var1.getOffset() - 1); - se.field1183 = se2Loader.load(var1); - se.field1192 = se2Loader.load(var1); - } - - var2 = var1.readUnsignedByte(); - if (var2 != 0) - { - var1.setOffset(var1.getOffset() - 1); - se.field1178 = se2Loader.load(var1); - se.field1175 = se2Loader.load(var1); - } - - for (int var3 = 0; var3 < 10; ++var3) - { - int var4 = var1.readUnsignedShortSmart(); - if (var4 == 0) - { - break; - } - - se.field1180[var3] = var4; - se.field1179[var3] = var1.readShortSmart(); - se.field1177[var3] = var1.readUnsignedShortSmart(); - } - - se.field1187 = var1.readUnsignedShortSmart(); - se.field1184 = var1.readUnsignedShortSmart(); - se.field1176 = var1.readUnsignedShort(); - se.field1188 = var1.readUnsignedShort(); - se.field1186 = new SoundEffect2Definition(); - se.field1182 = se3Loader.load(var1, se.field1186); - } -} diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect3Loader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect3Loader.java deleted file mode 100644 index ad7f733efb..0000000000 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect3Loader.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.cache.definitions.loaders.sound; - -import net.runelite.cache.definitions.sound.SoundEffect2Definition; -import net.runelite.cache.definitions.sound.SoundEffect3Definition; -import net.runelite.cache.io.InputStream; - -public class SoundEffect3Loader -{ - private final SoundEffect2Loader se2Loader = new SoundEffect2Loader(); - - public SoundEffect3Definition load(InputStream in, SoundEffect2Definition var2) - { - SoundEffect3Definition se = new SoundEffect3Definition(); - - load(se, in, var2); - - return se; - } - - private void load(SoundEffect3Definition se, InputStream var1, SoundEffect2Definition var2) - { - int var3 = var1.readUnsignedByte(); - se.field1155[0] = var3 >> 4; - se.field1155[1] = var3 & 15; - if (var3 != 0) - { - se.field1156[0] = var1.readUnsignedShort(); - se.field1156[1] = var1.readUnsignedShort(); - int var4 = var1.readUnsignedByte(); - - int var5; - int var6; - for (var5 = 0; var5 < 2; ++var5) - { - for (var6 = 0; var6 < se.field1155[var5]; ++var6) - { - se.field1154[var5][0][var6] = var1.readUnsignedShort(); - se.field1159[var5][0][var6] = var1.readUnsignedShort(); - } - } - - for (var5 = 0; var5 < 2; ++var5) - { - for (var6 = 0; var6 < se.field1155[var5]; ++var6) - { - if ((var4 & 1 << var5 * 4 << var6) != 0) - { - se.field1154[var5][1][var6] = var1.readUnsignedShort(); - se.field1159[var5][1][var6] = var1.readUnsignedShort(); - } - else - { - se.field1154[var5][1][var6] = se.field1154[var5][0][var6]; - se.field1159[var5][1][var6] = se.field1159[var5][0][var6]; - } - } - } - - if (var4 != 0 || se.field1156[1] != se.field1156[0]) - { - se2Loader.method1144(var2, var1); - } - } - else - { - int[] var7 = se.field1156; - se.field1156[1] = 0; - var7[0] = 0; - } - } -} diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectLoader.java index ddb6a4d9fc..2ee518d4ee 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectLoader.java @@ -24,39 +24,70 @@ */ package net.runelite.cache.definitions.loaders.sound; +import net.runelite.cache.definitions.sound.AudioEnvelopeDefinition; import net.runelite.cache.definitions.sound.SoundEffectDefinition; -import net.runelite.cache.definitions.sound.SoundEffect1Definition; import net.runelite.cache.io.InputStream; public class SoundEffectLoader { - public SoundEffectDefinition load(byte[] b) + private final AudioEnvelopeLoader audioEnvelopeLoader = new AudioEnvelopeLoader(); + + public SoundEffectDefinition load(InputStream in, AudioEnvelopeDefinition audioEnvelope) { - SoundEffectDefinition se = new SoundEffectDefinition(); - InputStream in = new InputStream(b); + SoundEffectDefinition soundEffect = new SoundEffectDefinition(); - load(se, in); + load(soundEffect, audioEnvelope, in); - return se; + return soundEffect; } - private void load(SoundEffectDefinition se, InputStream var1) + private void load(SoundEffectDefinition soundEffect, AudioEnvelopeDefinition audioEnvelope, InputStream in) { - for (int var2 = 0; var2 < 10; ++var2) + int id = in.readUnsignedByte(); + soundEffect.pairs[0] = id >> 4; + soundEffect.pairs[1] = id & 15; + if (id != 0) { - int var3 = var1.readUnsignedByte(); - if (var3 != 0) + soundEffect.unity[0] = in.readUnsignedShort(); + soundEffect.unity[1] = in.readUnsignedShort(); + int track = in.readUnsignedByte(); + + for (int i = 0; i < 2; ++i) { - var1.setOffset(var1.getOffset() - 1); + for (int j = 0; j < soundEffect.pairs[i]; ++j) + { + soundEffect.phases[i][0][j] = in.readUnsignedShort(); + soundEffect.magnitudes[i][0][j] = in.readUnsignedShort(); + } + } - SoundEffect1Loader se1Loader = new SoundEffect1Loader(); - SoundEffect1Definition se1 = se1Loader.load(var1); + for (int i = 0; i < 2; ++i) + { + for (int j = 0; j < soundEffect.pairs[i]; ++j) + { + if ((track & 1 << i * 4 << j) != 0) + { + soundEffect.phases[i][1][j] = in.readUnsignedShort(); + soundEffect.magnitudes[i][1][j] = in.readUnsignedShort(); + } + else + { + soundEffect.phases[i][1][j] = soundEffect.phases[i][0][j]; + soundEffect.magnitudes[i][1][j] = soundEffect.magnitudes[i][0][j]; + } + } + } - se.field1008[var2] = se1; + if (track != 0 || soundEffect.unity[1] != soundEffect.unity[0]) + { + audioEnvelopeLoader.loadSegments(audioEnvelope, in); } } - - se.field1006 = var1.readUnsignedShort(); - se.field1009 = var1.readUnsignedShort(); + else + { + int[] clean = soundEffect.unity; + soundEffect.unity[1] = 0; + clean[0] = 0; + } } -} +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect2Loader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectTrackLoader.java similarity index 63% rename from cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect2Loader.java rename to cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectTrackLoader.java index d9ae3d3abb..3b991fdc70 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffect2Loader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/sound/SoundEffectTrackLoader.java @@ -24,39 +24,39 @@ */ package net.runelite.cache.definitions.loaders.sound; -import net.runelite.cache.definitions.sound.SoundEffect2Definition; +import net.runelite.cache.definitions.sound.SoundEffectTrackDefinition; +import net.runelite.cache.definitions.sound.InstrumentDefinition; import net.runelite.cache.io.InputStream; -public class SoundEffect2Loader +public class SoundEffectTrackLoader { - public SoundEffect2Definition load(InputStream in) + public SoundEffectTrackDefinition load(byte[] b) { - SoundEffect2Definition se = new SoundEffect2Definition(); + SoundEffectTrackDefinition soundEffect = new SoundEffectTrackDefinition(); + InputStream in = new InputStream(b); - load(se, in); + load(soundEffect, in); - return se; + return soundEffect; } - private void load(SoundEffect2Definition se, InputStream var1) + private void load(SoundEffectTrackDefinition soundEffect, InputStream in) { - se.field1087 = var1.readUnsignedByte(); - se.field1088 = var1.readInt(); - se.field1089 = var1.readInt(); - this.method1144(se, var1); - } - - final void method1144(SoundEffect2Definition se, InputStream var1) - { - se.field1092 = var1.readUnsignedByte(); - se.field1086 = new int[se.field1092]; - se.field1090 = new int[se.field1092]; - - for (int var2 = 0; var2 < se.field1092; ++var2) + for (int i = 0; i < 10; ++i) { - se.field1086[var2] = var1.readUnsignedShort(); - se.field1090[var2] = var1.readUnsignedShort(); + int volume = in.readUnsignedByte(); + if (volume != 0) + { + in.setOffset(in.getOffset() - 1); + + InstrumentLoader instrumentLoader = new InstrumentLoader(); + InstrumentDefinition instrument = instrumentLoader.load(in); + + soundEffect.instruments[i] = instrument; + } } + soundEffect.start = in.readUnsignedShort(); + soundEffect.end = in.readUnsignedShort(); } -} +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect1Definition.java b/cache/src/main/java/net/runelite/cache/definitions/sound/AudioEnvelopeDefinition.java similarity index 56% rename from cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect1Definition.java rename to cache/src/main/java/net/runelite/cache/definitions/sound/AudioEnvelopeDefinition.java index ecd9854892..46d709f6a4 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect1Definition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/sound/AudioEnvelopeDefinition.java @@ -24,32 +24,58 @@ */ package net.runelite.cache.definitions.sound; -public class SoundEffect1Definition +public class AudioEnvelopeDefinition { - public SoundEffect2Definition field1173; - public SoundEffect2Definition field1174; - public SoundEffect2Definition field1175; - public int field1176 = 500; - public int[] field1177 = new int[] + public int segments = 2; + public int[] durations = new int[2]; + public int[] phases = new int[2]; + public int start; + public int end; + public int form; + public int ticks; + public int phaseIndex; + public int step; + public int amplitude; + public int max; + + public AudioEnvelopeDefinition() { - 0, 0, 0, 0, 0 - }; - public SoundEffect2Definition field1178; - public int[] field1179 = new int[] + this.durations[0] = 0; + this.durations[1] = '\uffff'; + this.phases[0] = 0; + this.phases[1] = '\uffff'; + } + + public final int step(int var1) { - 0, 0, 0, 0, 0 - }; - public int[] field1180 = new int[] + if (this.max >= this.ticks) + { + this.amplitude = this.phases[this.phaseIndex++] << 15; + + if (this.phaseIndex >= this.segments) + { + this.phaseIndex = this.segments - 1; + } + + this.ticks = (int) ((double) this.durations[this.phaseIndex] / 65536.0 * (double) var1); + + if (this.ticks > this.max) + { + this.step = ((this.phases[this.phaseIndex] << 15) - this.amplitude) / (this.ticks - this.max); + } + } + this.amplitude += this.step; + ++this.max; + + return this.amplitude - this.step >> 15; + } + + public final void reset() { - 0, 0, 0, 0, 0 - }; - public SoundEffect2Definition field1181; - public SoundEffect3Definition field1182; - public SoundEffect2Definition field1183; - public int field1184 = 100; - public SoundEffect2Definition field1186; - public int field1187 = 0; - public int field1188 = 0; - public SoundEffect2Definition field1192; - public SoundEffect2Definition field1193; -} + this.ticks = 0; + this.phaseIndex = 0; + this.step = 0; + this.amplitude = 0; + this.max = 0; + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/definitions/sound/InstrumentDefinition.java b/cache/src/main/java/net/runelite/cache/definitions/sound/InstrumentDefinition.java new file mode 100644 index 0000000000..fafaa7b8f8 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/definitions/sound/InstrumentDefinition.java @@ -0,0 +1,356 @@ +/* + * 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.cache.definitions.sound; + +import java.util.Random; + +public class InstrumentDefinition +{ + public AudioEnvelopeDefinition volume; + public AudioEnvelopeDefinition pitchModifier; + public AudioEnvelopeDefinition field1175; + public AudioEnvelopeDefinition release; + public AudioEnvelopeDefinition volumeMultiplier; + public AudioEnvelopeDefinition volumeMultiplierAmplitude; + public AudioEnvelopeDefinition pitchModifierAmplitude; + public AudioEnvelopeDefinition pitch; + + public int[] oscillatorDelays = new int[] + { + 0, 0, 0, 0, 0 + }; + public int[] oscillatorPitch = new int[] + { + 0, 0, 0, 0, 0 + }; + public int[] oscillatorVolume = new int[] + { + 0, 0, 0, 0, 0 + }; + + public SoundEffectDefinition filter; + public AudioEnvelopeDefinition filterEnvelope; + + static int[] samples = new int[220500]; + + static int[] NOISE = new int[32768]; + static int[] AUDIO_SINE = new int[32768]; + + static int[] phases = new int[5]; + static int[] delays = new int[5]; + + static int[] volumeSteps = new int[5]; + static int[] pitchSteps = new int[5]; + static int[] pitchBaseSteps = new int[5]; + + public int duration = 500; + public int delayDecay = 100; + public int delayTime = 0; + public int offset = 0; + + static + { + Random random = new Random(0); + + for (int i = 0; i < 32768; ++i) + { + InstrumentDefinition.NOISE[i] = (random.nextInt() & 2) - 1; + InstrumentDefinition.AUDIO_SINE[i] = (int) (Math.sin((double) i / 5215.1903) * 16384.0); + } + } + + public final int[] synthesize(int var1, int var2) + { + int var16; + int var15; + int var14; + int var11; + int var12; + int var13; + + InstrumentDefinition.method3854(samples, 0, var1); + + if (var2 < 10) + { + return samples; + } + + double var3 = (double) var1 / ((double) var2 + 0.0); + + this.pitch.reset(); + this.volume.reset(); + + int var5 = 0; + int var6 = 0; + int var7 = 0; + + if (this.pitchModifier != null) + { + this.pitchModifier.reset(); + this.pitchModifierAmplitude.reset(); + + var5 = (int) ((double) (this.pitchModifier.end - this.pitchModifier.start) * 32.768 / var3); + var6 = (int) ((double) this.pitchModifier.start * 32.768 / var3); + } + + int var8 = 0; + int var9 = 0; + int var10 = 0; + + if (this.volumeMultiplier != null) + { + this.volumeMultiplier.reset(); + this.volumeMultiplierAmplitude.reset(); + + var8 = (int) ((double) (this.volumeMultiplier.end - this.volumeMultiplier.start) * 32.768 / var3); + var9 = (int) ((double) this.volumeMultiplier.start * 32.768 / var3); + } + + for (var11 = 0; var11 < 5; ++var11) + { + if (this.oscillatorVolume[var11] == 0) + { + continue; + } + + InstrumentDefinition.phases[var11] = 0; + InstrumentDefinition.delays[var11] = (int) ((double) this.oscillatorDelays[var11] * var3); + InstrumentDefinition.volumeSteps[var11] = (this.oscillatorVolume[var11] << 14) / 100; + InstrumentDefinition.pitchSteps[var11] = (int) ((double) (this.pitch.end - this.pitch.start) * 32.768 * Math.pow(1.0057929410678534, this.oscillatorPitch[var11]) / var3); + InstrumentDefinition.pitchBaseSteps[var11] = (int) ((double) this.pitch.start * 32.768 / var3); + } + + for (var11 = 0; var11 < var1; ++var11) + { + var12 = this.pitch.step(var1); + var13 = this.volume.step(var1); + + if (this.pitchModifier != null) + { + var14 = this.pitchModifier.step(var1); + var15 = this.pitchModifierAmplitude.step(var1); + var12 += this.evaluateWave(var7, var15, this.pitchModifier.form) >> 1; + var7 = var7 + var6 + (var14 * var5 >> 16); + } + + if (this.volumeMultiplier != null) + { + var14 = this.volumeMultiplier.step(var1); + var15 = this.volumeMultiplierAmplitude.step(var1); + var13 = var13 * ((this.evaluateWave(var10, var15, this.volumeMultiplier.form) >> 1) + 32768) >> 15; + var10 = var10 + var9 + (var14 * var8 >> 16); + } + + for (var14 = 0; var14 < 5; ++var14) + { + if (this.oscillatorVolume[var14] == 0 || (var15 = delays[var14] + var11) >= var1) + { + continue; + } + + int[] arrn = samples; + int n = var15; + arrn[n] = arrn[n] + this.evaluateWave(phases[var14], var13 * volumeSteps[var14] >> 15, this.pitch.form); + int[] arrn2 = phases; + int n2 = var14; + arrn2[n2] = arrn2[n2] + ((var12 * pitchSteps[var14] >> 16) + pitchBaseSteps[var14]); + } + } + + if (this.release != null) + { + this.release.reset(); + this.field1175.reset(); + + var11 = 0; + boolean var20 = true; + + for (var14 = 0; var14 < var1; ++var14) + { + var15 = this.release.step(var1); + var16 = this.field1175.step(var1); + var12 = var20 ? (var15 * (this.release.end - this.release.start) >> 8) + this.release.start : (var16 * (this.release.end - this.release.start) >> 8) + this.release.start; + if ((var11 += 256) >= var12) + { + var11 = 0; + } + if (!var20) + { + continue; + } + InstrumentDefinition.samples[var14] = 0; + } + } + if (this.delayTime > 0 && this.delayDecay > 0) + { + for (var12 = var11 = (int) ((double) this.delayTime * var3); var12 < var1; ++var12) + { + int[] arrn = samples; + int n = var12; + + arrn[n] = arrn[n] + samples[var12 - var11] * this.delayDecay / 100; + } + } + if (this.filter.pairs[0] > 0 || this.filter.pairs[1] > 0) + { + this.filterEnvelope.reset(); + + var11 = this.filterEnvelope.step(var1 + 1); + var12 = this.filter.compute(0, (float) var11 / 65536.0f); + var13 = this.filter.compute(1, (float) var11 / 65536.0f); + + if (var1 >= var12 + var13) + { + int var17; + + var14 = 0; + var15 = var13; + + if (var13 > var1 - var12) + { + var15 = var1 - var12; + } + + while (var14 < var15) + { + var16 = (int) ((long) samples[var14 + var12] * (long) SoundEffectDefinition.fowardMultiplier >> 16); + + for (var17 = 0; var17 < var12; ++var17) + { + var16 += (int) ((long) samples[var14 + var12 - 1 - var17] * (long) SoundEffectDefinition.coefficients[0][var17] >> 16); + } + + for (var17 = 0; var17 < var14; ++var17) + { + var16 -= (int) ((long) samples[var14 - 1 - var17] * (long) SoundEffectDefinition.coefficients[1][var17] >> 16); + } + + InstrumentDefinition.samples[var14] = var16; + var11 = this.filterEnvelope.step(var1 + 1); + ++var14; + } + var15 = 128; + + do + { + int var18; + + if (var15 > var1 - var12) + { + var15 = var1 - var12; + } + + while (var14 < var15) + { + var17 = (int) ((long) samples[var14 + var12] * (long) SoundEffectDefinition.fowardMultiplier >> 16); + + for (var18 = 0; var18 < var12; ++var18) + { + var17 += (int) ((long) samples[var14 + var12 - 1 - var18] * (long) SoundEffectDefinition.coefficients[0][var18] >> 16); + } + + for (var18 = 0; var18 < var13; ++var18) + { + var17 -= (int) ((long) samples[var14 - 1 - var18] * (long) SoundEffectDefinition.coefficients[1][var18] >> 16); + } + + InstrumentDefinition.samples[var14] = var17; + var11 = this.filterEnvelope.step(var1 + 1); + ++var14; + } + if (var14 >= var1 - var12) + { + while (var14 < var1) + { + var17 = 0; + for (var18 = var14 + var12 - var1; var18 < var12; ++var18) + { + var17 += (int) ((long) samples[var14 + var12 - 1 - var18] + * (long) SoundEffectDefinition.coefficients[0][var18] >> 16); + } + for (var18 = 0; var18 < var13; ++var18) + { + var17 -= (int) ((long) samples[var14 - 1 - var18] + * (long) SoundEffectDefinition.coefficients[1][var18] >> 16); + } + InstrumentDefinition.samples[var14] = var17; + this.filterEnvelope.step(var1 + 1); + ++var14; + } + break; + } + var12 = this.filter.compute(0, (float) var11 / 65536.0f); + var13 = this.filter.compute(1, (float) var11 / 65536.0f); + var15 += 128; + } + while (true); + } + } + for (var11 = 0; var11 < var1; ++var11) + { + if (samples[var11] < -32768) + { + InstrumentDefinition.samples[var11] = -32768; + } + + if (samples[var11] <= 32767) + { + continue; + } + + InstrumentDefinition.samples[var11] = 32767; + } + + return samples; + } + + private static void method3854(int[] var1, int var2, int var3) + { + var3 = var3 + var2 - 7; + + while (var2 < var3) + { + var1[var2++] = 0; + var1[var2++] = 0; + var1[var2++] = 0; + var1[var2++] = 0; + var1[var2++] = 0; + var1[var2++] = 0; + var1[var2++] = 0; + var1[var2++] = 0; + } + + while (var2 < (var3 += 7)) + { + var1[var2++] = 0; + } + } + + public final int evaluateWave(int var1, int var2, int var3) + { + return var3 == 1 ? ((var1 & 32767) < 16384 ? var2 : -var2) : (var3 == 2 ? AUDIO_SINE[var1 & 32767] * var2 >> 14 : (var3 == 3 ? (var2 * (var1 & 32767) >> 14) - var2 : (var3 == 4 ? var2 * NOISE[var1 / 2607 & 32767] : 0))); + } +} + diff --git a/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectDefinition.java b/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectDefinition.java index 0eda10254e..7f6d71dc17 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectDefinition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectDefinition.java @@ -26,7 +26,102 @@ package net.runelite.cache.definitions.sound; public class SoundEffectDefinition { - public int field1006; - public SoundEffect1Definition[] field1008 = new SoundEffect1Definition[10]; - public int field1009; -} + public int[][][] phases = new int[2][2][4]; + public int[] pairs = new int[2]; + public int[] unity = new int[2]; + public int[][][] magnitudes = new int[2][2][4]; + + public static float[][] minCoefficients = new float[2][8]; + public static int[][] coefficients = new int[2][8]; + public static float fowardMinCoefficientMultiplier; + public static int fowardMultiplier; + + public int compute(int var1, float var2) + { + float var3; + int var4; + + if (var1 == 0) + { + var3 = (float) this.unity[0] + (float) (this.unity[1] - this.unity[0]) * var2; + + fowardMinCoefficientMultiplier = (float) Math.pow(0.1, (var3 *= 0.0030517578f) / 20.0f); + fowardMultiplier = (int) (fowardMinCoefficientMultiplier * 65536.0f); + } + + if (this.pairs[var1] == 0) + { + return 0; + } + + var3 = this.interpolateMagniture(var1, 0, var2); + + minCoefficients[var1][0] = -2.0f * var3 * (float) Math.cos(this.interpolatePhase(var1, 0, var2)); + minCoefficients[var1][1] = var3 * var3; + + for (var4 = 1; var4 < this.pairs[var1]; ++var4) + { + var3 = this.interpolateMagniture(var1, var4, var2); + + float var5 = -2.0f * var3 * (float) Math.cos(this.interpolatePhase(var1, var4, var2)); + float var6 = var3 * var3; + + minCoefficients[var1][var4 * 2 + 1] = minCoefficients[var1][var4 * 2 - 1] * var6; + minCoefficients[var1][var4 * 2] = minCoefficients[var1][var4 * 2 - 1] * var5 + minCoefficients[var1][var4 * 2 - 2] * var6; + + for (int var7 = var4 * 2 - 1; var7 >= 2; --var7) + { + float[] arrf = minCoefficients[var1]; + int n = var7; + + arrf[n] = arrf[n] + (minCoefficients[var1][var7 - 1] * var5 + minCoefficients[var1][var7 - 2] * var6); + } + + float[] arrf = minCoefficients[var1]; + arrf[1] = arrf[1] + (minCoefficients[var1][0] * var5 + var6); + + float[] arrf2 = minCoefficients[var1]; + arrf2[0] = arrf2[0] + var5; + } + + if (var1 == 0) + { + var4 = 0; + while (var4 < this.pairs[0] * 2) + { + float[] arrf = minCoefficients[0]; + int n = var4++; + + arrf[n] = arrf[n] * fowardMinCoefficientMultiplier; + } + } + + for (var4 = 0; var4 < this.pairs[var1] * 2; ++var4) + { + coefficients[var1][var4] = (int) (minCoefficients[var1][var4] * 65536.0f); + } + + return this.pairs[var1] * 2; + } + + public float interpolateMagniture(int var1, int var2, float var3) + { + float var4 = (float) this.magnitudes[var1][0][var2] + var3 * (float) (this.magnitudes[var1][1][var2] - this.magnitudes[var1][0][var2]); + + return 1.0f - (float) Math.pow(10.0, (-(var4 *= 0.0015258789f)) / 20.0f); + } + + public float interpolatePhase(int var1, int var2, float var3) + { + float var4 = (float) this.phases[var1][0][var2] + var3 * (float) (this.phases[var1][1][var2] - this.phases[var1][0][var2]); + + return normalise(var4 *= 1.2207031E-4f); + } + + public static float normalise(float var1) + { + float var2 = 32.703197f * (float) Math.pow(2.0, var1); + + return var2 * 3.1415927f / 11025.0f; + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect2Definition.java b/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectTrackDefinition.java similarity index 56% rename from cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect2Definition.java rename to cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectTrackDefinition.java index 358d462f50..6cbbbcc2cf 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffect2Definition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/sound/SoundEffectTrackDefinition.java @@ -24,25 +24,61 @@ */ package net.runelite.cache.definitions.sound; -public class SoundEffect2Definition +public class SoundEffectTrackDefinition { - public int field1085; - public int[] field1086 = new int[2]; - public int field1087; - public int field1088; - public int field1089; - public int[] field1090 = new int[2]; - public int field1091; - public int field1092 = 2; - public int field1093; - public int field1094; - public int field1095; + public int start; + public InstrumentDefinition[] instruments = new InstrumentDefinition[10]; + public int end; - public SoundEffect2Definition() + public final byte[] mix() { - this.field1086[0] = 0; - this.field1086[1] = '\uffff'; - this.field1090[0] = 0; - this.field1090[1] = '\uffff'; + int var2; + int var1 = 0; + + for (var2 = 0; var2 < 10; ++var2) + { + if (this.instruments[var2] == null || this.instruments[var2].duration + this.instruments[var2].offset <= var1) + { + continue; + } + + var1 = this.instruments[var2].duration + this.instruments[var2].offset; + } + + if (var1 == 0) + { + return new byte[0]; + } + + var2 = var1 * 22050 / 1000; + + byte[] var3 = new byte[var2]; + + for (int i = 0; i < 10; ++i) + { + if (this.instruments[i] == null) + { + continue; + } + + int var5 = this.instruments[i].duration * 22050 / 1000; + int var6 = this.instruments[i].offset * 22050 / 1000; + + int[] var7 = this.instruments[i].synthesize(var5, this.instruments[i].duration); + + for (int j = 0; j < var5; ++j) + { + int var9 = (var7[j] >> 8) + var3[j + var6]; + + if ((var9 + 128 & -256) != 0) + { + var9 = var9 >> 31 ^ 127; + } + + var3[j + var6] = (byte) var9; + } + } + + return var3; } -} +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/fs/flat/FlatStorage.java b/cache/src/main/java/net/runelite/cache/fs/flat/FlatStorage.java index fdcdadeb75..8c5d7e77a7 100644 --- a/cache/src/main/java/net/runelite/cache/fs/flat/FlatStorage.java +++ b/cache/src/main/java/net/runelite/cache/fs/flat/FlatStorage.java @@ -116,7 +116,7 @@ public class FlatStorage implements Storage { int lidx = line.indexOf('='); String key = line.substring(0, lidx); - String value = line.substring(lidx + 1, line.length()); + String value = line.substring(lidx + 1); if ("file".equals(key)) { @@ -128,7 +128,7 @@ public class FlatStorage implements Storage int vidx = value.indexOf('='); FileData fd = new FileData(); fd.setId(Integer.parseInt(value.substring(0, vidx))); - fd.setNameHash(Integer.parseInt(value.substring(vidx + 1, value.length()))); + fd.setNameHash(Integer.parseInt(value.substring(vidx + 1))); fileData.add(fd); continue; } diff --git a/cache/src/main/java/net/runelite/cache/io/OutputStream.java b/cache/src/main/java/net/runelite/cache/io/OutputStream.java index 751905f4fb..537c6bb0ba 100644 --- a/cache/src/main/java/net/runelite/cache/io/OutputStream.java +++ b/cache/src/main/java/net/runelite/cache/io/OutputStream.java @@ -26,8 +26,10 @@ package net.runelite.cache.io; import com.google.common.base.Preconditions; import java.io.IOException; -import java.io.UnsupportedEncodingException; +import java.nio.Buffer; import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; public final class OutputStream extends java.io.OutputStream { @@ -181,22 +183,23 @@ public final class OutputStream extends java.io.OutputStream public void writeString(String str) { - byte[] b; - try - { - b = str.getBytes("ISO-8859-1"); - } - catch (UnsupportedEncodingException ex) - { - throw new RuntimeException(ex); - } - writeBytes(b); + Charset utf8charset = Charset.forName("UTF-8"); + Charset cp1252charset = Charset.forName("Cp1252"); + + ByteBuffer inputBuffer = ByteBuffer.wrap(str.getBytes()); + + CharBuffer data = utf8charset.decode(inputBuffer); + + ByteBuffer outputBuffer = cp1252charset.encode(data); + byte[] outputData = outputBuffer.array(); + + writeBytes(outputData); writeByte(0); } public byte[] flip() { - buffer.flip(); + ((Buffer) buffer).flip(); byte[] b = new byte[buffer.limit()]; buffer.get(b); return b; @@ -208,4 +211,4 @@ public final class OutputStream extends java.io.OutputStream buffer.put((byte) b); } -} +} \ 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/cache/src/main/java/net/runelite/cache/script/Instructions.java b/cache/src/main/java/net/runelite/cache/script/Instructions.java index 17dfabfcd1..6c611d7df1 100644 --- a/cache/src/main/java/net/runelite/cache/script/Instructions.java +++ b/cache/src/main/java/net/runelite/cache/script/Instructions.java @@ -78,6 +78,7 @@ public class Instructions add(CC_SETSIZE, "cc_setsize"); add(CC_SETHIDE, "cc_sethide"); add(CC_SETNOCLICKTHROUGH, "cc_setnoclickthrough"); + add(CC_SETNOSCROLLTHROUGH, "cc_setnoscrollthrough"); add(CC_SETSCROLLPOS, "cc_setscrollpos"); add(CC_SETCOLOUR, "cc_setcolour"); add(CC_SETFILL, "cc_setfill"); @@ -102,6 +103,7 @@ public class Instructions add(CC_RESUME_PAUSEBUTTON, "cc_resume_pausebutton"); add(CC_SETFILLCOLOUR, "cc_setfillcolour"); add(CC_SETLINEDIRECTION, "cc_setlinedirection"); + add(CC_SETMODELTRANSPARENT, "cc_setmodeltransparent"); add(CC_SETOBJECT, "cc_setobject"); add(CC_SETNPCHEAD, "cc_setnpchead"); add(CC_SETPLAYERHEAD_SELF, "cc_setplayerhead_self"); @@ -115,6 +117,12 @@ public class Instructions add(CC_SETOPBASE, "cc_setopbase"); add(CC_SETTARGETVERB, "cc_settargetverb"); add(CC_CLEAROPS, "cc_clearops"); + add(CC_SETOPKEY, "cc_setopkey"); + add(CC_SETOPTKEY, "cc_setoptkey"); + add(CC_SETOPKEYRATE, "cc_setopkeyrate"); + add(CC_SETOPTKEYRATE, "cc_setoptkeyrate"); + add(CC_SETOPKEYIGNOREHELD, "cc_setopkeyignoreheld"); + add(CC_SETOPTKEYIGNOREHELD, "cc_setoptkeyignoreheld"); add(CC_SETONCLICK, "cc_setonclick"); add(CC_SETONHOLD, "cc_setonhold"); add(CC_SETONRELEASE, "cc_setonrelease"); @@ -159,6 +167,7 @@ public class Instructions add(CC_GETTRANS, "cc_gettrans"); add(CC_GETCOLOUR, "cc_getcolour"); add(CC_GETFILLCOLOUR, "cc_getfillcolour"); + add(CC_GETMODELTRANSPARENT, "cc_getmodeltransparent"); add(CC_GETINVOBJECT, "cc_getinvobject"); add(CC_GETINVCOUNT, "cc_getinvcount"); add(CC_GETID, "cc_getid"); @@ -194,6 +203,7 @@ public class Instructions add(IF_RESUME_PAUSEBUTTON, "if_resume_pausebutton"); add(IF_SETFILLCOLOUR, "if_setfillcolour"); add(IF_SETLINEDIRECTION, "if_setlinedirection"); + add(IF_SETMODELTRANSPARENT, "if_setmodeltransparent"); add(IF_SETOBJECT, "if_setobject"); add(IF_SETNPCHEAD, "if_setnpchead"); add(IF_SETPLAYERHEAD_SELF, "if_setplayerhead_self"); @@ -257,6 +267,7 @@ public class Instructions add(IF_GETTRANS, "if_gettrans"); add(IF_GETCOLOUR, "if_getcolour"); add(IF_GETFILLCOLOUR, "if_getfillcolour"); + add(IF_GETMODELTRANSPARENT, "if_getmodeltransparent"); add(IF_GETINVOBJECT, "if_getinvobject"); add(IF_GETINVCOUNT, "if_getinvcount"); add(IF_HASSUB, "if_hassub"); @@ -287,11 +298,17 @@ public class Instructions add(SETSHOWLOADINGMESSAGES, "setshowloadingmessages"); add(SETTAPTODROP, "settaptodrop"); add(GETTAPTODROP, "gettaptodrop"); + add(SETOCULUSORBSPEED, "setoculusorbspeed"); add(GETCANVASSIZE, "getcanvassize"); + add(MOBILE_SETFPS, "mobile_setfps"); + add(MOBILE_OPENSTORE, "mobile_openstore"); + add(MOBILE_OPENSTORECATEGORY, "mobile_openstorecategory"); add(SETHIDEUSERNAME, "sethideusername"); add(GETHIDEUSERNAME, "gethideusername"); add(SETREMEMBERUSERNAME, "setrememberusername"); add(GETREMEMBERUSERNAME, "getrememberusername"); + add(SETTITLEMUSICENABLED, "settitlemusicenabled"); + add(GETTITLEMUSICENABLED, "gettitlemusicenabled"); add(SOUND_SYNTH, "sound_synth"); add(SOUND_SONG, "sound_song"); add(SOUND_JINGLE, "sound_jingle"); @@ -411,6 +428,7 @@ public class Instructions add(REMOVETAGS, "removetags"); add(STRING_INDEXOF_CHAR, "string_indexof_char"); add(STRING_INDEXOF_STRING, "string_indexof_string"); + add(UPPERCASE, "uppercase"); add(OC_NAME, "oc_name"); add(OC_OP, "oc_op"); add(OC_IOP, "oc_iop"); @@ -461,6 +479,7 @@ public class Instructions add(WORLDLIST_NEXT, "worldlist_next"); add(WORLDLIST_SPECIFIC, "worldlist_specific"); add(WORLDLIST_SORT, "worldlist_sort"); + add(GETWORLDINFO, "getworldinfo"); add(SETFOLLOWEROPSLOWPRIORITY, "setfolloweropslowpriority"); add(NC_PARAM, "nc_param"); add(LC_PARAM, "lc_param"); @@ -468,6 +487,7 @@ public class Instructions add(STRUCT_PARAM, "struct_param"); add(ON_MOBILE, "on_mobile"); add(CLIENTTYPE, "clienttype"); + add(MOBILE_KEYBOARDHIDE, "mobile_keyboardhide"); add(BATTERYLEVEL, "batterylevel"); add(BATTERYCHARGING, "batterycharging"); add(WIFIAVAILABLE, "wifiavailable"); @@ -505,6 +525,8 @@ public class Instructions add(MEC_TEXTSIZE, "mec_textsize"); add(MEC_CATEGORY, "mec_category"); add(MEC_SPRITE, "mec_sprite"); + add(WORLDMAP_ELEMENT, "worldmap_element"); + add(WORLDMAP_ELEMENTCOORD, "worldmap_elementcoord"); } protected void add(int opcode, String name) diff --git a/cache/src/main/java/net/runelite/cache/script/Opcodes.java b/cache/src/main/java/net/runelite/cache/script/Opcodes.java index e69a1ef5ef..1485b9982e 100644 --- a/cache/src/main/java/net/runelite/cache/script/Opcodes.java +++ b/cache/src/main/java/net/runelite/cache/script/Opcodes.java @@ -69,6 +69,7 @@ public class Opcodes public static final int CC_SETSIZE = 1001; public static final int CC_SETHIDE = 1003; public static final int CC_SETNOCLICKTHROUGH = 1005; + public static final int CC_SETNOSCROLLTHROUGH = 1006; public static final int CC_SETSCROLLPOS = 1100; public static final int CC_SETCOLOUR = 1101; public static final int CC_SETFILL = 1102; @@ -93,6 +94,7 @@ public class Opcodes public static final int CC_RESUME_PAUSEBUTTON = 1121; public static final int CC_SETFILLCOLOUR = 1123; public static final int CC_SETLINEDIRECTION = 1126; + public static final int CC_SETMODELTRANSPARENT = 1127; public static final int CC_SETOBJECT = 1200; public static final int CC_SETNPCHEAD = 1201; public static final int CC_SETPLAYERHEAD_SELF = 1202; @@ -106,6 +108,12 @@ public class Opcodes public static final int CC_SETOPBASE = 1305; public static final int CC_SETTARGETVERB = 1306; public static final int CC_CLEAROPS = 1307; + public static final int CC_SETOPKEY = 1350; + public static final int CC_SETOPTKEY = 1351; + public static final int CC_SETOPKEYRATE = 1352; + public static final int CC_SETOPTKEYRATE = 1353; + public static final int CC_SETOPKEYIGNOREHELD = 1354; + public static final int CC_SETOPTKEYIGNOREHELD = 1355; public static final int CC_SETONCLICK = 1400; public static final int CC_SETONHOLD = 1401; public static final int CC_SETONRELEASE = 1402; @@ -150,6 +158,7 @@ public class Opcodes public static final int CC_GETTRANS = 1609; public static final int CC_GETCOLOUR = 1611; public static final int CC_GETFILLCOLOUR = 1612; + public static final int CC_GETMODELTRANSPARENT = 1614; public static final int CC_GETINVOBJECT = 1700; public static final int CC_GETINVCOUNT = 1701; public static final int CC_GETID = 1702; @@ -185,6 +194,7 @@ public class Opcodes public static final int IF_RESUME_PAUSEBUTTON = 2121; public static final int IF_SETFILLCOLOUR = 2123; public static final int IF_SETLINEDIRECTION = 2126; + public static final int IF_SETMODELTRANSPARENT = 2127; public static final int IF_SETOBJECT = 2200; public static final int IF_SETNPCHEAD = 2201; public static final int IF_SETPLAYERHEAD_SELF = 2202; @@ -248,6 +258,7 @@ public class Opcodes public static final int IF_GETTRANS = 2609; public static final int IF_GETCOLOUR = 2611; public static final int IF_GETFILLCOLOUR = 2612; + public static final int IF_GETMODELTRANSPARENT = 2614; public static final int IF_GETINVOBJECT = 2700; public static final int IF_GETINVCOUNT = 2701; public static final int IF_HASSUB = 2702; @@ -278,11 +289,17 @@ public class Opcodes public static final int SETSHOWLOADINGMESSAGES = 3126; public static final int SETTAPTODROP = 3127; public static final int GETTAPTODROP = 3128; + public static final int SETOCULUSORBSPEED = 3129; public static final int GETCANVASSIZE = 3132; + public static final int MOBILE_SETFPS = 3133; + public static final int MOBILE_OPENSTORE = 3134; + public static final int MOBILE_OPENSTORECATEGORY = 3135; public static final int SETHIDEUSERNAME = 3141; public static final int GETHIDEUSERNAME = 3142; public static final int SETREMEMBERUSERNAME = 3143; public static final int GETREMEMBERUSERNAME = 3144; + public static final int SETTITLEMUSICENABLED = 3146; + public static final int GETTITLEMUSICENABLED = 3147; public static final int SOUND_SYNTH = 3200; public static final int SOUND_SONG = 3201; public static final int SOUND_JINGLE = 3202; @@ -402,6 +419,7 @@ public class Opcodes public static final int REMOVETAGS = 4119; public static final int STRING_INDEXOF_CHAR = 4120; public static final int STRING_INDEXOF_STRING = 4121; + public static final int UPPERCASE = 4122; public static final int OC_NAME = 4200; public static final int OC_OP = 4201; public static final int OC_IOP = 4202; @@ -452,6 +470,7 @@ public class Opcodes public static final int WORLDLIST_NEXT = 6502; public static final int WORLDLIST_SPECIFIC = 6506; public static final int WORLDLIST_SORT = 6507; + public static final int GETWORLDINFO = 6511; public static final int SETFOLLOWEROPSLOWPRIORITY = 6512; public static final int NC_PARAM = 6513; public static final int LC_PARAM = 6514; @@ -459,6 +478,7 @@ public class Opcodes public static final int STRUCT_PARAM = 6516; public static final int ON_MOBILE = 6518; public static final int CLIENTTYPE = 6519; + public static final int MOBILE_KEYBOARDHIDE = 6521; public static final int BATTERYLEVEL = 6524; public static final int BATTERYCHARGING = 6525; public static final int WIFIAVAILABLE = 6526; @@ -496,4 +516,6 @@ public class Opcodes public static final int MEC_TEXTSIZE = 6694; public static final int MEC_CATEGORY = 6695; public static final int MEC_SPRITE = 6696; + public static final int WORLDMAP_ELEMENT = 6697; + public static final int WORLDMAP_ELEMENTCOORD = 6699; } diff --git a/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmBaseListener.java b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmBaseListener.java new file mode 100644 index 0000000000..b793e66c65 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmBaseListener.java @@ -0,0 +1,554 @@ +// Generated from net\runelite\cache\script\assembler\rs2asm.g4 by ANTLR 4.6 +package net.runelite.cache.script.assembler; + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link rs2asmListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +public class rs2asmBaseListener implements rs2asmListener +{ + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterProg(rs2asmParser.ProgContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitProg(rs2asmParser.ProgContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterHeader(rs2asmParser.HeaderContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitHeader(rs2asmParser.HeaderContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterId(rs2asmParser.IdContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitId(rs2asmParser.IdContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInt_stack_count(rs2asmParser.Int_stack_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInt_stack_count(rs2asmParser.Int_stack_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterString_stack_count(rs2asmParser.String_stack_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitString_stack_count(rs2asmParser.String_stack_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInt_var_count(rs2asmParser.Int_var_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInt_var_count(rs2asmParser.Int_var_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterString_var_count(rs2asmParser.String_var_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitString_var_count(rs2asmParser.String_var_countContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterId_value(rs2asmParser.Id_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitId_value(rs2asmParser.Id_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInt_stack_value(rs2asmParser.Int_stack_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInt_stack_value(rs2asmParser.Int_stack_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterString_stack_value(rs2asmParser.String_stack_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitString_stack_value(rs2asmParser.String_stack_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInt_var_value(rs2asmParser.Int_var_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInt_var_value(rs2asmParser.Int_var_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterString_var_value(rs2asmParser.String_var_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitString_var_value(rs2asmParser.String_var_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLine(rs2asmParser.LineContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLine(rs2asmParser.LineContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInstruction(rs2asmParser.InstructionContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInstruction(rs2asmParser.InstructionContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLabel(rs2asmParser.LabelContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLabel(rs2asmParser.LabelContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInstruction_name(rs2asmParser.Instruction_nameContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInstruction_name(rs2asmParser.Instruction_nameContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterName_string(rs2asmParser.Name_stringContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitName_string(rs2asmParser.Name_stringContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterName_opcode(rs2asmParser.Name_opcodeContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitName_opcode(rs2asmParser.Name_opcodeContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInstruction_operand(rs2asmParser.Instruction_operandContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInstruction_operand(rs2asmParser.Instruction_operandContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOperand_int(rs2asmParser.Operand_intContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOperand_int(rs2asmParser.Operand_intContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOperand_qstring(rs2asmParser.Operand_qstringContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOperand_qstring(rs2asmParser.Operand_qstringContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOperand_label(rs2asmParser.Operand_labelContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOperand_label(rs2asmParser.Operand_labelContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_lookup(rs2asmParser.Switch_lookupContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_lookup(rs2asmParser.Switch_lookupContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_key(rs2asmParser.Switch_keyContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_key(rs2asmParser.Switch_keyContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_value(rs2asmParser.Switch_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_value(rs2asmParser.Switch_valueContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void visitTerminal(TerminalNode node) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void visitErrorNode(ErrorNode node) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEveryRule(ParserRuleContext ctx) + { + } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEveryRule(ParserRuleContext ctx) + { + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmLexer.java b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmLexer.java new file mode 100644 index 0000000000..15055397fd --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmLexer.java @@ -0,0 +1,171 @@ +// Generated from net\runelite\cache\script\assembler\rs2asm.g4 by ANTLR 4.6 +package net.runelite.cache.script.assembler; + +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.LexerATNSimulator; +import org.antlr.v4.runtime.atn.PredictionContextCache; +import org.antlr.v4.runtime.dfa.DFA; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class rs2asmLexer extends Lexer +{ + public static final int + T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, NEWLINE = 7, INT = 8, QSTRING = 9, + IDENTIFIER = 10, COMMENT = 11, WS = 12; + public static final String[] ruleNames = { + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "NEWLINE", "INT", "QSTRING", + "IDENTIFIER", "COMMENT", "WS" + }; + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + public static final String _serializedATN = + "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\16\u0099\b\1\4\2" + + "\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4" + + "\13\t\13\4\f\t\f\4\r\t\r\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3" + + "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4" + + "\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3" + + "\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6" + + "\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3" + + "\b\6\bn\n\b\r\b\16\bo\3\t\5\ts\n\t\3\t\6\tv\n\t\r\t\16\tw\3\n\3\n\3\n" + + "\3\n\7\n~\n\n\f\n\16\n\u0081\13\n\3\n\3\n\3\13\6\13\u0086\n\13\r\13\16" + + "\13\u0087\3\f\3\f\7\f\u008c\n\f\f\f\16\f\u008f\13\f\3\f\3\f\3\r\6\r\u0094" + + "\n\r\r\r\16\r\u0095\3\r\3\r\2\2\16\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n" + + "\23\13\25\f\27\r\31\16\3\2\b\4\2\f\f\17\17\3\2\62;\6\2\f\f\17\17$$^^\4" + + "\2$$^^\6\2\62;C\\aac|\4\2\13\13\"\"\u00a0\2\3\3\2\2\2\2\5\3\2\2\2\2\7" + + "\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2" + + "\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\3\33\3\2\2\2\5" + + " \3\2\2\2\7\62\3\2\2\2\tG\3\2\2\2\13W\3\2\2\2\rj\3\2\2\2\17m\3\2\2\2\21" + + "r\3\2\2\2\23y\3\2\2\2\25\u0085\3\2\2\2\27\u0089\3\2\2\2\31\u0093\3\2\2" + + "\2\33\34\7\60\2\2\34\35\7k\2\2\35\36\7f\2\2\36\37\7\"\2\2\37\4\3\2\2\2" + + " !\7\60\2\2!\"\7k\2\2\"#\7p\2\2#$\7v\2\2$%\7a\2\2%&\7u\2\2&\'\7v\2\2\'" + + "(\7c\2\2()\7e\2\2)*\7m\2\2*+\7a\2\2+,\7e\2\2,-\7q\2\2-.\7w\2\2./\7p\2" + + "\2/\60\7v\2\2\60\61\7\"\2\2\61\6\3\2\2\2\62\63\7\60\2\2\63\64\7u\2\2\64" + + "\65\7v\2\2\65\66\7t\2\2\66\67\7k\2\2\678\7p\2\289\7i\2\29:\7a\2\2:;\7" + + "u\2\2;<\7v\2\2<=\7c\2\2=>\7e\2\2>?\7m\2\2?@\7a\2\2@A\7e\2\2AB\7q\2\2B" + + "C\7w\2\2CD\7p\2\2DE\7v\2\2EF\7\"\2\2F\b\3\2\2\2GH\7\60\2\2HI\7k\2\2IJ" + + "\7p\2\2JK\7v\2\2KL\7a\2\2LM\7x\2\2MN\7c\2\2NO\7t\2\2OP\7a\2\2PQ\7e\2\2" + + "QR\7q\2\2RS\7w\2\2ST\7p\2\2TU\7v\2\2UV\7\"\2\2V\n\3\2\2\2WX\7\60\2\2X" + + "Y\7u\2\2YZ\7v\2\2Z[\7t\2\2[\\\7k\2\2\\]\7p\2\2]^\7i\2\2^_\7a\2\2_`\7x" + + "\2\2`a\7c\2\2ab\7t\2\2bc\7a\2\2cd\7e\2\2de\7q\2\2ef\7w\2\2fg\7p\2\2gh" + + "\7v\2\2hi\7\"\2\2i\f\3\2\2\2jk\7<\2\2k\16\3\2\2\2ln\t\2\2\2ml\3\2\2\2" + + "no\3\2\2\2om\3\2\2\2op\3\2\2\2p\20\3\2\2\2qs\7/\2\2rq\3\2\2\2rs\3\2\2" + + "\2su\3\2\2\2tv\t\3\2\2ut\3\2\2\2vw\3\2\2\2wu\3\2\2\2wx\3\2\2\2x\22\3\2" + + "\2\2y\177\7$\2\2z~\n\4\2\2{|\7^\2\2|~\t\5\2\2}z\3\2\2\2}{\3\2\2\2~\u0081" + + "\3\2\2\2\177}\3\2\2\2\177\u0080\3\2\2\2\u0080\u0082\3\2\2\2\u0081\177" + + "\3\2\2\2\u0082\u0083\7$\2\2\u0083\24\3\2\2\2\u0084\u0086\t\6\2\2\u0085" + + "\u0084\3\2\2\2\u0086\u0087\3\2\2\2\u0087\u0085\3\2\2\2\u0087\u0088\3\2" + + "\2\2\u0088\26\3\2\2\2\u0089\u008d\7=\2\2\u008a\u008c\n\2\2\2\u008b\u008a" + + "\3\2\2\2\u008c\u008f\3\2\2\2\u008d\u008b\3\2\2\2\u008d\u008e\3\2\2\2\u008e" + + "\u0090\3\2\2\2\u008f\u008d\3\2\2\2\u0090\u0091\b\f\2\2\u0091\30\3\2\2" + + "\2\u0092\u0094\t\7\2\2\u0093\u0092\3\2\2\2\u0094\u0095\3\2\2\2\u0095\u0093" + + "\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u0097\3\2\2\2\u0097\u0098\b\r\2\2\u0098" + + "\32\3\2\2\2\13\2orw}\177\u0087\u008d\u0095\3\2\3\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + private static final String[] _LITERAL_NAMES = { + null, "'.id '", "'.int_stack_count '", "'.string_stack_count '", "'.int_var_count '", + "'.string_var_count '", "':'" + }; + private static final String[] _SYMBOLIC_NAMES = { + null, null, null, null, null, null, null, "NEWLINE", "INT", "QSTRING", + "IDENTIFIER", "COMMENT", "WS" + }; + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + static + { + RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); + } + + static + { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) + { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) + { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) + { + tokenNames[i] = ""; + } + } + } + + static + { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) + { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } + + public rs2asmLexer(CharStream input) + { + super(input); + _interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } + + @Override + public String[] getRuleNames() + { + return ruleNames; + } + + @Override + + public Vocabulary getVocabulary() + { + return VOCABULARY; + } + + @Override + public String getSerializedATN() + { + return _serializedATN; + } + + @Override + public String getGrammarFileName() + { + return "rs2asm.g4"; + } + + @Override + public ATN getATN() + { + return _ATN; + } + + @Override + public String[] getModeNames() + { + return modeNames; + } + + @Override + @Deprecated + public String[] getTokenNames() + { + return tokenNames; + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmListener.java b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmListener.java new file mode 100644 index 0000000000..d4d8e39ab0 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmListener.java @@ -0,0 +1,361 @@ +// Generated from net\runelite\cache\script\assembler\rs2asm.g4 by ANTLR 4.6 +package net.runelite.cache.script.assembler; + +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link rs2asmParser}. + */ +public interface rs2asmListener extends ParseTreeListener +{ + /** + * Enter a parse tree produced by {@link rs2asmParser#prog}. + * + * @param ctx the parse tree + */ + void enterProg(rs2asmParser.ProgContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#prog}. + * + * @param ctx the parse tree + */ + void exitProg(rs2asmParser.ProgContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#header}. + * + * @param ctx the parse tree + */ + void enterHeader(rs2asmParser.HeaderContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#header}. + * + * @param ctx the parse tree + */ + void exitHeader(rs2asmParser.HeaderContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#id}. + * + * @param ctx the parse tree + */ + void enterId(rs2asmParser.IdContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#id}. + * + * @param ctx the parse tree + */ + void exitId(rs2asmParser.IdContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#int_stack_count}. + * + * @param ctx the parse tree + */ + void enterInt_stack_count(rs2asmParser.Int_stack_countContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#int_stack_count}. + * + * @param ctx the parse tree + */ + void exitInt_stack_count(rs2asmParser.Int_stack_countContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#string_stack_count}. + * + * @param ctx the parse tree + */ + void enterString_stack_count(rs2asmParser.String_stack_countContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#string_stack_count}. + * + * @param ctx the parse tree + */ + void exitString_stack_count(rs2asmParser.String_stack_countContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#int_var_count}. + * + * @param ctx the parse tree + */ + void enterInt_var_count(rs2asmParser.Int_var_countContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#int_var_count}. + * + * @param ctx the parse tree + */ + void exitInt_var_count(rs2asmParser.Int_var_countContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#string_var_count}. + * + * @param ctx the parse tree + */ + void enterString_var_count(rs2asmParser.String_var_countContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#string_var_count}. + * + * @param ctx the parse tree + */ + void exitString_var_count(rs2asmParser.String_var_countContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#id_value}. + * + * @param ctx the parse tree + */ + void enterId_value(rs2asmParser.Id_valueContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#id_value}. + * + * @param ctx the parse tree + */ + void exitId_value(rs2asmParser.Id_valueContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#int_stack_value}. + * + * @param ctx the parse tree + */ + void enterInt_stack_value(rs2asmParser.Int_stack_valueContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#int_stack_value}. + * + * @param ctx the parse tree + */ + void exitInt_stack_value(rs2asmParser.Int_stack_valueContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#string_stack_value}. + * + * @param ctx the parse tree + */ + void enterString_stack_value(rs2asmParser.String_stack_valueContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#string_stack_value}. + * + * @param ctx the parse tree + */ + void exitString_stack_value(rs2asmParser.String_stack_valueContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#int_var_value}. + * + * @param ctx the parse tree + */ + void enterInt_var_value(rs2asmParser.Int_var_valueContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#int_var_value}. + * + * @param ctx the parse tree + */ + void exitInt_var_value(rs2asmParser.Int_var_valueContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#string_var_value}. + * + * @param ctx the parse tree + */ + void enterString_var_value(rs2asmParser.String_var_valueContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#string_var_value}. + * + * @param ctx the parse tree + */ + void exitString_var_value(rs2asmParser.String_var_valueContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#line}. + * + * @param ctx the parse tree + */ + void enterLine(rs2asmParser.LineContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#line}. + * + * @param ctx the parse tree + */ + void exitLine(rs2asmParser.LineContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#instruction}. + * + * @param ctx the parse tree + */ + void enterInstruction(rs2asmParser.InstructionContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#instruction}. + * + * @param ctx the parse tree + */ + void exitInstruction(rs2asmParser.InstructionContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#label}. + * + * @param ctx the parse tree + */ + void enterLabel(rs2asmParser.LabelContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#label}. + * + * @param ctx the parse tree + */ + void exitLabel(rs2asmParser.LabelContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#instruction_name}. + * + * @param ctx the parse tree + */ + void enterInstruction_name(rs2asmParser.Instruction_nameContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#instruction_name}. + * + * @param ctx the parse tree + */ + void exitInstruction_name(rs2asmParser.Instruction_nameContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#name_string}. + * + * @param ctx the parse tree + */ + void enterName_string(rs2asmParser.Name_stringContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#name_string}. + * + * @param ctx the parse tree + */ + void exitName_string(rs2asmParser.Name_stringContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#name_opcode}. + * + * @param ctx the parse tree + */ + void enterName_opcode(rs2asmParser.Name_opcodeContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#name_opcode}. + * + * @param ctx the parse tree + */ + void exitName_opcode(rs2asmParser.Name_opcodeContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#instruction_operand}. + * + * @param ctx the parse tree + */ + void enterInstruction_operand(rs2asmParser.Instruction_operandContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#instruction_operand}. + * + * @param ctx the parse tree + */ + void exitInstruction_operand(rs2asmParser.Instruction_operandContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#operand_int}. + * + * @param ctx the parse tree + */ + void enterOperand_int(rs2asmParser.Operand_intContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#operand_int}. + * + * @param ctx the parse tree + */ + void exitOperand_int(rs2asmParser.Operand_intContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#operand_qstring}. + * + * @param ctx the parse tree + */ + void enterOperand_qstring(rs2asmParser.Operand_qstringContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#operand_qstring}. + * + * @param ctx the parse tree + */ + void exitOperand_qstring(rs2asmParser.Operand_qstringContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#operand_label}. + * + * @param ctx the parse tree + */ + void enterOperand_label(rs2asmParser.Operand_labelContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#operand_label}. + * + * @param ctx the parse tree + */ + void exitOperand_label(rs2asmParser.Operand_labelContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#switch_lookup}. + * + * @param ctx the parse tree + */ + void enterSwitch_lookup(rs2asmParser.Switch_lookupContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#switch_lookup}. + * + * @param ctx the parse tree + */ + void exitSwitch_lookup(rs2asmParser.Switch_lookupContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#switch_key}. + * + * @param ctx the parse tree + */ + void enterSwitch_key(rs2asmParser.Switch_keyContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#switch_key}. + * + * @param ctx the parse tree + */ + void exitSwitch_key(rs2asmParser.Switch_keyContext ctx); + + /** + * Enter a parse tree produced by {@link rs2asmParser#switch_value}. + * + * @param ctx the parse tree + */ + void enterSwitch_value(rs2asmParser.Switch_valueContext ctx); + + /** + * Exit a parse tree produced by {@link rs2asmParser#switch_value}. + * + * @param ctx the parse tree + */ + void exitSwitch_value(rs2asmParser.Switch_valueContext ctx); +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmParser.java b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmParser.java new file mode 100644 index 0000000000..29058065e0 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/script/assembler/rs2asmParser.java @@ -0,0 +1,2000 @@ +// Generated from net\runelite\cache\script\assembler\rs2asm.g4 by ANTLR 4.6 +package net.runelite.cache.script.assembler; + +import java.util.List; +import org.antlr.v4.runtime.NoViableAltException; +import org.antlr.v4.runtime.Parser; +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.RecognitionException; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.ParserATNSimulator; +import org.antlr.v4.runtime.atn.PredictionContextCache; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.tree.ParseTreeListener; +import org.antlr.v4.runtime.tree.TerminalNode; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class rs2asmParser extends Parser +{ + public static final int + T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, NEWLINE = 7, INT = 8, QSTRING = 9, + IDENTIFIER = 10, COMMENT = 11, WS = 12; + public static final int + RULE_prog = 0, RULE_header = 1, RULE_id = 2, RULE_int_stack_count = 3, + RULE_string_stack_count = 4, RULE_int_var_count = 5, RULE_string_var_count = 6, + RULE_id_value = 7, RULE_int_stack_value = 8, RULE_string_stack_value = 9, + RULE_int_var_value = 10, RULE_string_var_value = 11, RULE_line = 12, RULE_instruction = 13, + RULE_label = 14, RULE_instruction_name = 15, RULE_name_string = 16, RULE_name_opcode = 17, + RULE_instruction_operand = 18, RULE_operand_int = 19, RULE_operand_qstring = 20, + RULE_operand_label = 21, RULE_switch_lookup = 22, RULE_switch_key = 23, + RULE_switch_value = 24; + public static final String[] ruleNames = { + "prog", "header", "id", "int_stack_count", "string_stack_count", "int_var_count", + "string_var_count", "id_value", "int_stack_value", "string_stack_value", + "int_var_value", "string_var_value", "line", "instruction", "label", "instruction_name", + "name_string", "name_opcode", "instruction_operand", "operand_int", "operand_qstring", + "operand_label", "switch_lookup", "switch_key", "switch_value" + }; + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + public static final String _serializedATN = + "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\16\u0097\4\2\t\2" + + "\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13" + + "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22" + + "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31" + + "\4\32\t\32\3\2\7\2\66\n\2\f\2\16\29\13\2\3\2\3\2\6\2=\n\2\r\2\16\2>\7" + + "\2A\n\2\f\2\16\2D\13\2\3\2\3\2\6\2H\n\2\r\2\16\2I\6\2L\n\2\r\2\16\2M\3" + + "\3\3\3\3\3\3\3\3\3\5\3U\n\3\3\4\3\4\3\4\3\5\3\5\3\5\3\6\3\6\3\6\3\7\3" + + "\7\3\7\3\b\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16" + + "\3\16\5\16s\n\16\3\17\3\17\3\17\3\20\3\20\3\20\3\21\3\21\5\21}\n\21\3" + + "\22\3\22\3\23\3\23\3\24\3\24\3\24\3\24\5\24\u0087\n\24\3\25\3\25\3\26" + + "\3\26\3\27\3\27\3\30\3\30\3\30\3\30\3\31\3\31\3\32\3\32\3\32\2\2\33\2" + + "\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\2\2\u008c\2\67\3" + + "\2\2\2\4T\3\2\2\2\6V\3\2\2\2\bY\3\2\2\2\n\\\3\2\2\2\f_\3\2\2\2\16b\3\2" + + "\2\2\20e\3\2\2\2\22g\3\2\2\2\24i\3\2\2\2\26k\3\2\2\2\30m\3\2\2\2\32r\3" + + "\2\2\2\34t\3\2\2\2\36w\3\2\2\2 |\3\2\2\2\"~\3\2\2\2$\u0080\3\2\2\2&\u0086" + + "\3\2\2\2(\u0088\3\2\2\2*\u008a\3\2\2\2,\u008c\3\2\2\2.\u008e\3\2\2\2\60" + + "\u0092\3\2\2\2\62\u0094\3\2\2\2\64\66\7\t\2\2\65\64\3\2\2\2\669\3\2\2" + + "\2\67\65\3\2\2\2\678\3\2\2\28B\3\2\2\29\67\3\2\2\2:<\5\4\3\2;=\7\t\2\2" + + "<;\3\2\2\2=>\3\2\2\2><\3\2\2\2>?\3\2\2\2?A\3\2\2\2@:\3\2\2\2AD\3\2\2\2" + + "B@\3\2\2\2BC\3\2\2\2CK\3\2\2\2DB\3\2\2\2EG\5\32\16\2FH\7\t\2\2GF\3\2\2" + + "\2HI\3\2\2\2IG\3\2\2\2IJ\3\2\2\2JL\3\2\2\2KE\3\2\2\2LM\3\2\2\2MK\3\2\2" + + "\2MN\3\2\2\2N\3\3\2\2\2OU\5\6\4\2PU\5\b\5\2QU\5\n\6\2RU\5\f\7\2SU\5\16" + + "\b\2TO\3\2\2\2TP\3\2\2\2TQ\3\2\2\2TR\3\2\2\2TS\3\2\2\2U\5\3\2\2\2VW\7" + + "\3\2\2WX\5\20\t\2X\7\3\2\2\2YZ\7\4\2\2Z[\5\22\n\2[\t\3\2\2\2\\]\7\5\2" + + "\2]^\5\24\13\2^\13\3\2\2\2_`\7\6\2\2`a\5\26\f\2a\r\3\2\2\2bc\7\7\2\2c" + + "d\5\30\r\2d\17\3\2\2\2ef\7\n\2\2f\21\3\2\2\2gh\7\n\2\2h\23\3\2\2\2ij\7" + + "\n\2\2j\25\3\2\2\2kl\7\n\2\2l\27\3\2\2\2mn\7\n\2\2n\31\3\2\2\2os\5\34" + + "\17\2ps\5\36\20\2qs\5.\30\2ro\3\2\2\2rp\3\2\2\2rq\3\2\2\2s\33\3\2\2\2" + + "tu\5 \21\2uv\5&\24\2v\35\3\2\2\2wx\7\f\2\2xy\7\b\2\2y\37\3\2\2\2z}\5\"" + + "\22\2{}\5$\23\2|z\3\2\2\2|{\3\2\2\2}!\3\2\2\2~\177\7\f\2\2\177#\3\2\2" + + "\2\u0080\u0081\7\n\2\2\u0081%\3\2\2\2\u0082\u0087\5(\25\2\u0083\u0087" + + "\5*\26\2\u0084\u0087\5,\27\2\u0085\u0087\3\2\2\2\u0086\u0082\3\2\2\2\u0086" + + "\u0083\3\2\2\2\u0086\u0084\3\2\2\2\u0086\u0085\3\2\2\2\u0087\'\3\2\2\2" + + "\u0088\u0089\7\n\2\2\u0089)\3\2\2\2\u008a\u008b\7\13\2\2\u008b+\3\2\2" + + "\2\u008c\u008d\7\f\2\2\u008d-\3\2\2\2\u008e\u008f\5\60\31\2\u008f\u0090" + + "\7\b\2\2\u0090\u0091\5\62\32\2\u0091/\3\2\2\2\u0092\u0093\7\n\2\2\u0093" + + "\61\3\2\2\2\u0094\u0095\7\f\2\2\u0095\63\3\2\2\2\13\67>BIMTr|\u0086"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + private static final String[] _LITERAL_NAMES = { + null, "'.id '", "'.int_stack_count '", "'.string_stack_count '", "'.int_var_count '", + "'.string_var_count '", "':'" + }; + private static final String[] _SYMBOLIC_NAMES = { + null, null, null, null, null, null, null, "NEWLINE", "INT", "QSTRING", + "IDENTIFIER", "COMMENT", "WS" + }; + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + static + { + RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); + } + + static + { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) + { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) + { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) + { + tokenNames[i] = ""; + } + } + } + + static + { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) + { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } + + public rs2asmParser(TokenStream input) + { + super(input); + _interp = new ParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } + + @Override + @Deprecated + public String[] getTokenNames() + { + return tokenNames; + } + + @Override + public String[] getRuleNames() + { + return ruleNames; + } + + @Override + + public Vocabulary getVocabulary() + { + return VOCABULARY; + } + + @Override + public String getSerializedATN() + { + return _serializedATN; + } + + @Override + public String getGrammarFileName() + { + return "rs2asm.g4"; + } + + @Override + public ATN getATN() + { + return _ATN; + } + + public final ProgContext prog() throws RecognitionException + { + ProgContext _localctx = new ProgContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_prog); + int _la; + try + { + enterOuterAlt(_localctx, 1); + { + setState(53); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == NEWLINE) + { + { + { + setState(50); + match(NEWLINE); + } + } + setState(55); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(64); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__1) | (1L << T__2) | (1L << T__3) | (1L << T__4))) != 0)) + { + { + { + setState(56); + header(); + setState(58); + _errHandler.sync(this); + _la = _input.LA(1); + do + { + { + { + setState(57); + match(NEWLINE); + } + } + setState(60); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == NEWLINE); + } + } + setState(66); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(73); + _errHandler.sync(this); + _la = _input.LA(1); + do + { + { + { + setState(67); + line(); + setState(69); + _errHandler.sync(this); + _la = _input.LA(1); + do + { + { + { + setState(68); + match(NEWLINE); + } + } + setState(71); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == NEWLINE); + } + } + setState(75); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == INT || _la == IDENTIFIER); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final HeaderContext header() throws RecognitionException + { + HeaderContext _localctx = new HeaderContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_header); + try + { + setState(82); + _errHandler.sync(this); + switch (_input.LA(1)) + { + case T__0: + enterOuterAlt(_localctx, 1); + { + setState(77); + id(); + } + break; + case T__1: + enterOuterAlt(_localctx, 2); + { + setState(78); + int_stack_count(); + } + break; + case T__2: + enterOuterAlt(_localctx, 3); + { + setState(79); + string_stack_count(); + } + break; + case T__3: + enterOuterAlt(_localctx, 4); + { + setState(80); + int_var_count(); + } + break; + case T__4: + enterOuterAlt(_localctx, 5); + { + setState(81); + string_var_count(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final IdContext id() throws RecognitionException + { + IdContext _localctx = new IdContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_id); + try + { + enterOuterAlt(_localctx, 1); + { + setState(84); + match(T__0); + setState(85); + id_value(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Int_stack_countContext int_stack_count() throws RecognitionException + { + Int_stack_countContext _localctx = new Int_stack_countContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_int_stack_count); + try + { + enterOuterAlt(_localctx, 1); + { + setState(87); + match(T__1); + setState(88); + int_stack_value(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final String_stack_countContext string_stack_count() throws RecognitionException + { + String_stack_countContext _localctx = new String_stack_countContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_string_stack_count); + try + { + enterOuterAlt(_localctx, 1); + { + setState(90); + match(T__2); + setState(91); + string_stack_value(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Int_var_countContext int_var_count() throws RecognitionException + { + Int_var_countContext _localctx = new Int_var_countContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_int_var_count); + try + { + enterOuterAlt(_localctx, 1); + { + setState(93); + match(T__3); + setState(94); + int_var_value(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final String_var_countContext string_var_count() throws RecognitionException + { + String_var_countContext _localctx = new String_var_countContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_string_var_count); + try + { + enterOuterAlt(_localctx, 1); + { + setState(96); + match(T__4); + setState(97); + string_var_value(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Id_valueContext id_value() throws RecognitionException + { + Id_valueContext _localctx = new Id_valueContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_id_value); + try + { + enterOuterAlt(_localctx, 1); + { + setState(99); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Int_stack_valueContext int_stack_value() throws RecognitionException + { + Int_stack_valueContext _localctx = new Int_stack_valueContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_int_stack_value); + try + { + enterOuterAlt(_localctx, 1); + { + setState(101); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final String_stack_valueContext string_stack_value() throws RecognitionException + { + String_stack_valueContext _localctx = new String_stack_valueContext(_ctx, getState()); + enterRule(_localctx, 18, RULE_string_stack_value); + try + { + enterOuterAlt(_localctx, 1); + { + setState(103); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Int_var_valueContext int_var_value() throws RecognitionException + { + Int_var_valueContext _localctx = new Int_var_valueContext(_ctx, getState()); + enterRule(_localctx, 20, RULE_int_var_value); + try + { + enterOuterAlt(_localctx, 1); + { + setState(105); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final String_var_valueContext string_var_value() throws RecognitionException + { + String_var_valueContext _localctx = new String_var_valueContext(_ctx, getState()); + enterRule(_localctx, 22, RULE_string_var_value); + try + { + enterOuterAlt(_localctx, 1); + { + setState(107); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final LineContext line() throws RecognitionException + { + LineContext _localctx = new LineContext(_ctx, getState()); + enterRule(_localctx, 24, RULE_line); + try + { + setState(112); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 6, _ctx)) + { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(109); + instruction(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(110); + label(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(111); + switch_lookup(); + } + break; + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final InstructionContext instruction() throws RecognitionException + { + InstructionContext _localctx = new InstructionContext(_ctx, getState()); + enterRule(_localctx, 26, RULE_instruction); + try + { + enterOuterAlt(_localctx, 1); + { + setState(114); + instruction_name(); + setState(115); + instruction_operand(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final LabelContext label() throws RecognitionException + { + LabelContext _localctx = new LabelContext(_ctx, getState()); + enterRule(_localctx, 28, RULE_label); + try + { + enterOuterAlt(_localctx, 1); + { + setState(117); + match(IDENTIFIER); + setState(118); + match(T__5); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Instruction_nameContext instruction_name() throws RecognitionException + { + Instruction_nameContext _localctx = new Instruction_nameContext(_ctx, getState()); + enterRule(_localctx, 30, RULE_instruction_name); + try + { + setState(122); + _errHandler.sync(this); + switch (_input.LA(1)) + { + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(120); + name_string(); + } + break; + case INT: + enterOuterAlt(_localctx, 2); + { + setState(121); + name_opcode(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Name_stringContext name_string() throws RecognitionException + { + Name_stringContext _localctx = new Name_stringContext(_ctx, getState()); + enterRule(_localctx, 32, RULE_name_string); + try + { + enterOuterAlt(_localctx, 1); + { + setState(124); + match(IDENTIFIER); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Name_opcodeContext name_opcode() throws RecognitionException + { + Name_opcodeContext _localctx = new Name_opcodeContext(_ctx, getState()); + enterRule(_localctx, 34, RULE_name_opcode); + try + { + enterOuterAlt(_localctx, 1); + { + setState(126); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Instruction_operandContext instruction_operand() throws RecognitionException + { + Instruction_operandContext _localctx = new Instruction_operandContext(_ctx, getState()); + enterRule(_localctx, 36, RULE_instruction_operand); + try + { + setState(132); + _errHandler.sync(this); + switch (_input.LA(1)) + { + case INT: + enterOuterAlt(_localctx, 1); + { + setState(128); + operand_int(); + } + break; + case QSTRING: + enterOuterAlt(_localctx, 2); + { + setState(129); + operand_qstring(); + } + break; + case IDENTIFIER: + enterOuterAlt(_localctx, 3); + { + setState(130); + operand_label(); + } + break; + case NEWLINE: + enterOuterAlt(_localctx, 4); + { + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Operand_intContext operand_int() throws RecognitionException + { + Operand_intContext _localctx = new Operand_intContext(_ctx, getState()); + enterRule(_localctx, 38, RULE_operand_int); + try + { + enterOuterAlt(_localctx, 1); + { + setState(134); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Operand_qstringContext operand_qstring() throws RecognitionException + { + Operand_qstringContext _localctx = new Operand_qstringContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_operand_qstring); + try + { + enterOuterAlt(_localctx, 1); + { + setState(136); + match(QSTRING); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Operand_labelContext operand_label() throws RecognitionException + { + Operand_labelContext _localctx = new Operand_labelContext(_ctx, getState()); + enterRule(_localctx, 42, RULE_operand_label); + try + { + enterOuterAlt(_localctx, 1); + { + setState(138); + match(IDENTIFIER); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Switch_lookupContext switch_lookup() throws RecognitionException + { + Switch_lookupContext _localctx = new Switch_lookupContext(_ctx, getState()); + enterRule(_localctx, 44, RULE_switch_lookup); + try + { + enterOuterAlt(_localctx, 1); + { + setState(140); + switch_key(); + setState(141); + match(T__5); + setState(142); + switch_value(); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Switch_keyContext switch_key() throws RecognitionException + { + Switch_keyContext _localctx = new Switch_keyContext(_ctx, getState()); + enterRule(_localctx, 46, RULE_switch_key); + try + { + enterOuterAlt(_localctx, 1); + { + setState(144); + match(INT); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public final Switch_valueContext switch_value() throws RecognitionException + { + Switch_valueContext _localctx = new Switch_valueContext(_ctx, getState()); + enterRule(_localctx, 48, RULE_switch_value); + try + { + enterOuterAlt(_localctx, 1); + { + setState(146); + match(IDENTIFIER); + } + } + catch (RecognitionException re) + { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally + { + exitRule(); + } + return _localctx; + } + + public static class ProgContext extends ParserRuleContext + { + public ProgContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public List NEWLINE() + { + return getTokens(rs2asmParser.NEWLINE); + } + + public TerminalNode NEWLINE(int i) + { + return getToken(rs2asmParser.NEWLINE, i); + } + + public List header() + { + return getRuleContexts(HeaderContext.class); + } + + public HeaderContext header(int i) + { + return getRuleContext(HeaderContext.class, i); + } + + public List line() + { + return getRuleContexts(LineContext.class); + } + + public LineContext line(int i) + { + return getRuleContext(LineContext.class, i); + } + + @Override + public int getRuleIndex() + { + return RULE_prog; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterProg(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitProg(this); + } + } + } + + public static class HeaderContext extends ParserRuleContext + { + public HeaderContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public IdContext id() + { + return getRuleContext(IdContext.class, 0); + } + + public Int_stack_countContext int_stack_count() + { + return getRuleContext(Int_stack_countContext.class, 0); + } + + public String_stack_countContext string_stack_count() + { + return getRuleContext(String_stack_countContext.class, 0); + } + + public Int_var_countContext int_var_count() + { + return getRuleContext(Int_var_countContext.class, 0); + } + + public String_var_countContext string_var_count() + { + return getRuleContext(String_var_countContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_header; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterHeader(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitHeader(this); + } + } + } + + public static class IdContext extends ParserRuleContext + { + public IdContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Id_valueContext id_value() + { + return getRuleContext(Id_valueContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_id; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterId(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitId(this); + } + } + } + + public static class Int_stack_countContext extends ParserRuleContext + { + public Int_stack_countContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Int_stack_valueContext int_stack_value() + { + return getRuleContext(Int_stack_valueContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_int_stack_count; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInt_stack_count(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInt_stack_count(this); + } + } + } + + public static class String_stack_countContext extends ParserRuleContext + { + public String_stack_countContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public String_stack_valueContext string_stack_value() + { + return getRuleContext(String_stack_valueContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_string_stack_count; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterString_stack_count(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitString_stack_count(this); + } + } + } + + public static class Int_var_countContext extends ParserRuleContext + { + public Int_var_countContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Int_var_valueContext int_var_value() + { + return getRuleContext(Int_var_valueContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_int_var_count; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInt_var_count(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInt_var_count(this); + } + } + } + + public static class String_var_countContext extends ParserRuleContext + { + public String_var_countContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public String_var_valueContext string_var_value() + { + return getRuleContext(String_var_valueContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_string_var_count; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterString_var_count(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitString_var_count(this); + } + } + } + + public static class Id_valueContext extends ParserRuleContext + { + public Id_valueContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_id_value; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterId_value(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitId_value(this); + } + } + } + + public static class Int_stack_valueContext extends ParserRuleContext + { + public Int_stack_valueContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_int_stack_value; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInt_stack_value(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInt_stack_value(this); + } + } + } + + public static class String_stack_valueContext extends ParserRuleContext + { + public String_stack_valueContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_string_stack_value; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterString_stack_value(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitString_stack_value(this); + } + } + } + + public static class Int_var_valueContext extends ParserRuleContext + { + public Int_var_valueContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_int_var_value; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInt_var_value(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInt_var_value(this); + } + } + } + + public static class String_var_valueContext extends ParserRuleContext + { + public String_var_valueContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_string_var_value; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterString_var_value(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitString_var_value(this); + } + } + } + + public static class LineContext extends ParserRuleContext + { + public LineContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public InstructionContext instruction() + { + return getRuleContext(InstructionContext.class, 0); + } + + public LabelContext label() + { + return getRuleContext(LabelContext.class, 0); + } + + public Switch_lookupContext switch_lookup() + { + return getRuleContext(Switch_lookupContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_line; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterLine(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitLine(this); + } + } + } + + public static class InstructionContext extends ParserRuleContext + { + public InstructionContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Instruction_nameContext instruction_name() + { + return getRuleContext(Instruction_nameContext.class, 0); + } + + public Instruction_operandContext instruction_operand() + { + return getRuleContext(Instruction_operandContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_instruction; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInstruction(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInstruction(this); + } + } + } + + public static class LabelContext extends ParserRuleContext + { + public LabelContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode IDENTIFIER() + { + return getToken(rs2asmParser.IDENTIFIER, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_label; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterLabel(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitLabel(this); + } + } + } + + public static class Instruction_nameContext extends ParserRuleContext + { + public Instruction_nameContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Name_stringContext name_string() + { + return getRuleContext(Name_stringContext.class, 0); + } + + public Name_opcodeContext name_opcode() + { + return getRuleContext(Name_opcodeContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_instruction_name; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInstruction_name(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInstruction_name(this); + } + } + } + + public static class Name_stringContext extends ParserRuleContext + { + public Name_stringContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode IDENTIFIER() + { + return getToken(rs2asmParser.IDENTIFIER, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_name_string; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterName_string(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitName_string(this); + } + } + } + + public static class Name_opcodeContext extends ParserRuleContext + { + public Name_opcodeContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_name_opcode; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterName_opcode(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitName_opcode(this); + } + } + } + + public static class Instruction_operandContext extends ParserRuleContext + { + public Instruction_operandContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Operand_intContext operand_int() + { + return getRuleContext(Operand_intContext.class, 0); + } + + public Operand_qstringContext operand_qstring() + { + return getRuleContext(Operand_qstringContext.class, 0); + } + + public Operand_labelContext operand_label() + { + return getRuleContext(Operand_labelContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_instruction_operand; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterInstruction_operand(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitInstruction_operand(this); + } + } + } + + public static class Operand_intContext extends ParserRuleContext + { + public Operand_intContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_operand_int; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterOperand_int(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitOperand_int(this); + } + } + } + + public static class Operand_qstringContext extends ParserRuleContext + { + public Operand_qstringContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode QSTRING() + { + return getToken(rs2asmParser.QSTRING, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_operand_qstring; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterOperand_qstring(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitOperand_qstring(this); + } + } + } + + public static class Operand_labelContext extends ParserRuleContext + { + public Operand_labelContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode IDENTIFIER() + { + return getToken(rs2asmParser.IDENTIFIER, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_operand_label; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterOperand_label(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitOperand_label(this); + } + } + } + + public static class Switch_lookupContext extends ParserRuleContext + { + public Switch_lookupContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public Switch_keyContext switch_key() + { + return getRuleContext(Switch_keyContext.class, 0); + } + + public Switch_valueContext switch_value() + { + return getRuleContext(Switch_valueContext.class, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_switch_lookup; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterSwitch_lookup(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitSwitch_lookup(this); + } + } + } + + public static class Switch_keyContext extends ParserRuleContext + { + public Switch_keyContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode INT() + { + return getToken(rs2asmParser.INT, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_switch_key; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterSwitch_key(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitSwitch_key(this); + } + } + } + + public static class Switch_valueContext extends ParserRuleContext + { + public Switch_valueContext(ParserRuleContext parent, int invokingState) + { + super(parent, invokingState); + } + + public TerminalNode IDENTIFIER() + { + return getToken(rs2asmParser.IDENTIFIER, 0); + } + + @Override + public int getRuleIndex() + { + return RULE_switch_value; + } + + @Override + public void enterRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).enterSwitch_value(this); + } + } + + @Override + public void exitRule(ParseTreeListener listener) + { + if (listener instanceof rs2asmListener) + { + ((rs2asmListener) listener).exitSwitch_value(this); + } + } + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/script/rs2asm.tokens b/cache/src/main/java/net/runelite/cache/script/rs2asm.tokens new file mode 100644 index 0000000000..de505a0dff --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/script/rs2asm.tokens @@ -0,0 +1,18 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +NEWLINE=7 +INT=8 +QSTRING=9 +IDENTIFIER=10 +COMMENT=11 +WS=12 +'.id '=1 +'.int_stack_count '=2 +'.string_stack_count '=3 +'.int_var_count '=4 +'.string_var_count '=5 +':'=6 diff --git a/cache/src/main/java/net/runelite/cache/script/rs2asmLexer.tokens b/cache/src/main/java/net/runelite/cache/script/rs2asmLexer.tokens new file mode 100644 index 0000000000..de505a0dff --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/script/rs2asmLexer.tokens @@ -0,0 +1,18 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +NEWLINE=7 +INT=8 +QSTRING=9 +IDENTIFIER=10 +COMMENT=11 +WS=12 +'.id '=1 +'.int_stack_count '=2 +'.string_stack_count '=3 +'.int_var_count '=4 +'.string_var_count '=5 +':'=6 diff --git a/cache/src/main/java/net/runelite/cache/util/ScriptVarType.java b/cache/src/main/java/net/runelite/cache/util/ScriptVarType.java index 2ff3bdf515..bda13d8c3a 100644 --- a/cache/src/main/java/net/runelite/cache/util/ScriptVarType.java +++ b/cache/src/main/java/net/runelite/cache/util/ScriptVarType.java @@ -82,19 +82,18 @@ public enum ScriptVarType } } - public static ScriptVarType forCharKey(char key) - { - return keyToTypeMap.get(key); - } - /** * The character used when encoding or decoding types. */ private final char keyChar; - /** * The full name of the var type. */ private final String fullName; + public static ScriptVarType forCharKey(char key) + { + return keyToTypeMap.get(key); + } + } diff --git a/cache/src/main/resources/djb2.properties b/cache/src/main/resources/djb2.properties index 4d635ffaae..87c3bb8a6c 100644 --- a/cache/src/main/resources/djb2.properties +++ b/cache/src/main/resources/djb2.properties @@ -1,1403 +1,1403 @@ -#Wed Nov 29 15:08:06 PST 2017 --1863637185=miscgraphics,4 --1863637184=miscgraphics,5 --1863637187=miscgraphics,2 --1863637186=miscgraphics,3 --1863637181=miscgraphics,8 --1863637180=miscgraphics,9 --440204630=alls fairy in love n war --1863637183=miscgraphics,6 --1253085654=scorpia_dances --1863637182=miscgraphics,7 -1356196826=backvmid3 --751102526=high seas -1356196825=backvmid2 --1863637189=miscgraphics,0 -549358875=camelot --1863637188=miscgraphics,1 --1619800378=emotes_locked,19 --1619800379=emotes_locked,18 -792536868=understanding -1356196824=backvmid1 --1773559904=title_mute --342013218=p11_full -1523653533=pirates of peril -696768774=harmony --1701556831=magicoff2,27 -281586976=orb_icon,3 -286265996=ready for battle --1701556832=magicoff2,26 -281586977=orb_icon,4 --645977478=scape scared --1701556833=magicoff2,25 -281586978=orb_icon,5 --1701556834=magicoff2,24 --1701556830=magicoff2,28 --1052794696=dance of death --1619800383=emotes_locked,14 --1619800384=emotes_locked,13 --1619800385=emotes_locked,12 --1556842207=sl_flags --1619800386=emotes_locked,11 -1614826739=mapletree --1619800387=emotes_locked,10 --1701556835=magicoff2,23 --1701556836=magicoff2,22 -1363656441=serenade --1701556837=magicoff2,21 -3089326=door --1701556838=magicoff2,20 --1619800380=emotes_locked,17 --1619800381=emotes_locked,16 --1619800382=emotes_locked,15 --1037172987=tomorrow -825974316=melodrama -281586973=orb_icon,0 -281586974=orb_icon,1 -281586975=orb_icon,2 --1701556864=magicoff2,15 --1701556865=magicoff2,14 --1701556866=magicoff2,13 -1509400204=sarcophagus --1701556867=magicoff2,12 --1701556860=magicoff2,19 --1701556861=magicoff2,18 --1701556862=magicoff2,17 -1868377358=lower_depths --1701556863=magicoff2,16 -1086036315=reggae2 --1220755677=hermit --1544597765=sl_stars --1619800350=emotes_locked,26 --1619800351=emotes_locked,25 --1636062434=tex_brown --1619800352=emotes_locked,24 --1619800353=emotes_locked,23 --2122174648=back to life --1619800354=emotes_locked,22 --1701556868=magicoff2,11 --1619800355=emotes_locked,21 --1701556869=magicoff2,10 --1619800356=emotes_locked,20 -1619539773=side_icons,7 -1121239524=scape wild -368271413=diango's little helpers -1619539772=side_icons,6 -1619539775=side_icons,9 -1619539774=side_icons,8 --1938172321=miscgraphics2,0 -1619539771=side_icons,5 -1619539770=side_icons,4 --926977577=the enchanter -1202794514=doorways -1343649581=schools out --1097177625=q8_full -756012174=wornicons,4 -756012173=wornicons,3 -756012176=wornicons,6 -756012175=wornicons,5 -756012170=wornicons,0 -827249681=ogre the top -756012172=wornicons,2 -756012171=wornicons,1 --1741764817=poles apart -756012178=wornicons,8 --1938172320=miscgraphics2,1 -756012177=wornicons,7 --43136286=the last shanty -756012179=wornicons,9 -837131331=mapback --1938172313=miscgraphics2,8 -907740319=the depths --1938172312=miscgraphics2,9 --2099722614=cave of beasts --1938172317=miscgraphics2,4 --1938172316=miscgraphics2,5 --1938172315=miscgraphics2,6 --1938172314=miscgraphics2,7 -1619539769=side_icons,3 --1367483767=cavern --1938172319=miscgraphics2,2 -50474489=treestump --1938172318=miscgraphics2,3 -1619539766=side_icons,0 -1619539768=side_icons,2 -1619539767=side_icons,1 --607416954=prayeron,11 -1837251043=melzars maze --607416953=prayeron,12 -1318893900=have an ice day --607416952=prayeron,13 --1701556800=magicoff2,37 --607416951=prayeron,14 --1701556801=magicoff2,36 --56804840=woodland --607416950=prayeron,15 -1120636327=scape cave -358884868=button_red --1701556806=magicoff2,31 --1701556807=magicoff2,30 --1701556802=magicoff2,35 --1701556803=magicoff2,34 --1701556804=magicoff2,33 --1858265682=monster melee --1701556805=magicoff2,32 --649484675=land of the dwarves --1789903512=golden touch -1328851780=close_buttons,6 -1080306793=shayzien_march --1339126929=damage -4820960=monkey sadness --1951786153=bone dance -1328851781=close_buttons,7 -939546513=forlorn_homestead --1019905269=shadowland --607416955=prayeron,10 --2048535896=pheasant peasant --1025233830=monkey madness -1121125956=scape soft --1562452687=etcetera -1969878996=emotes,47 -1969878994=emotes,45 --1228279872=ge_icons,3 -1969878995=emotes,46 --1228279871=ge_icons,4 -1969878992=emotes,43 --1228279870=ge_icons,5 -1969878993=emotes,44 -1959803992=invback -399048409=mage arena -1969878990=emotes,41 --47057524=lasting -1969878991=emotes,42 --1228279875=ge_icons,0 --1228279874=ge_icons,1 --1228279873=ge_icons,2 --1860080918=inspiration -1997757502=redstone2 -1997757503=redstone3 --1060046352=tribal2 -1997757501=redstone1 --1701556829=magicoff2,29 -1890607210=magicon2,37 -1890607211=magicon2,38 -1890607212=magicon2,39 --1408684838=ascent --848436598=fishing --119984250=combaticons2,17 --119984251=combaticons2,16 -1769177816=jungle island --119984252=combaticons2,15 --119984253=combaticons2,14 --119984254=combaticons2,13 --119984255=combaticons2,12 --119984256=combaticons2,11 --119984257=combaticons2,10 -1890607205=magicon2,32 -1890607206=magicon2,33 -1890607207=magicon2,34 -1890607208=magicon2,35 -135141185=zeah_combat -1890607209=magicon2,36 --180851958=norse code -112903447=water -922007495=talking forest --672706748=miracle dance --1110089645=lament --1237461365=grotto -1890607203=magicon2,30 -1890607204=magicon2,31 --1073910849=mirror --988841056=still night --1857025509=sunburn --468596910=easter jig -796868952=major miner --1066798491=trawler -1640556978=wonderous --1624274920=emperor -740093634=find my way -1890607238=magicon2,44 -1890607239=magicon2,45 -3559837=tick --1839713245=sideicons -1029455878=hells bells -1890607234=magicon2,40 -1890607235=magicon2,41 -1890607236=magicon2,42 -1890607237=magicon2,43 -1503566841=forbidden --895763669=spooky --276138668=ham attack -500433071=combaticons,5 --1021014225=catch me if you can -500433070=combaticons,4 -500433073=combaticons,7 -500433072=combaticons,6 -500433075=combaticons,9 -1533565119=mind over matter -500433074=combaticons,8 -2025958358=emotes_locked,4 -500433066=combaticons,0 -2025958357=emotes_locked,3 -862821975=far away --1228392498=artistry -2025958356=emotes_locked,2 -500433068=combaticons,2 -2025958355=emotes_locked,1 -500433067=combaticons,1 -1085444827=refresh -500433069=combaticons,3 -2025958359=emotes_locked,5 -1427043851=on the up -2025958354=emotes_locked,0 -1316697938=whistle -347955347=venture -1959211608=mapfunction,77 -1959211609=mapfunction,78 -881850881=the chosen -1959211601=mapfunction,70 -1959211602=mapfunction,71 -584643951=lost soul -582140282=rising damp -1959211603=mapfunction,72 -1740872686=soulfall -1959211604=mapfunction,73 -1959211605=mapfunction,74 --119984248=combaticons2,19 -1959211606=mapfunction,75 --119984249=combaticons2,18 -1609255038=slither and thither -82917947=sarim's vermin -1959211607=mapfunction,76 -1728911401=natural --1189743137=duel arena -108698078=roof2 -214634021=head to head -2025958361=emotes_locked,7 --448773288=isle of everywhere -2025958360=emotes_locked,6 --1869996941=titlebox --338347745=showdown --2075972251=long ago -2025958363=emotes_locked,9 -2025958362=emotes_locked,8 --1487589606=7th realm --1253087691=garden --2133902017=zeah_farming --492926285=impetuous -3314014=lair -907815588=the desert --1960860275=barbarianism -1890607241=magicon2,47 -1890607242=magicon2,48 -1890607243=magicon2,49 --919642451=jungle bells -795515487=underground -561438836=fountain --1418827919=illusive --634763748=fruits de mer -1890607240=magicon2,46 -1694458038=large_button -1393517697=bandit camp -1959211632=mapfunction,80 -1884773718=magicoff2,2 -1884773719=magicoff2,3 -1884773716=magicoff2,0 -2121900771=backtop1 -1884773717=magicoff2,1 --103077377=gnomeball --1947119982=blistering barnacles -828650857=autumn voyage -92909147=alone -1691516951=undead dungeon -122265833=expecting --1320617626=dunjun -1959211633=mapfunction,81 -1959211634=mapfunction,82 -1959211635=mapfunction,83 -1959211636=mapfunction,84 -1959211637=mapfunction,85 -777534707=army of darkness -1959211638=mapfunction,86 -1959211639=mapfunction,87 -1884773721=magicoff2,5 -1884773722=magicoff2,6 -1884773720=magicoff2,4 -1959211640=mapfunction,88 -1959211641=mapfunction,89 --327707013=anywhere -1884773725=magicoff2,9 -1884773723=magicoff2,7 -1884773724=magicoff2,8 -1116844876=incantation --728886272=temple of light -685934899=in the clink --1237289460=grumpy -1945133711=inferno -466902883=strange place --418223472=phasmatys -817472004=zombiism -106578554=zeah_book,0 -106578555=zeah_book,1 -1509070203=eagle peak --485932799=expedition -1171923143=emotes,8 --675357975=attack1 -1171923144=emotes,9 -1959211610=mapfunction,79 --675357974=attack2 --675357973=attack3 --675357972=attack4 --675357971=attack5 -40246002=masquerade --675357970=attack6 --734206983=arrival --1980407601=sea shanty xmas -284435223=pharoah's tomb --148552909=down below -1171923141=emotes,6 -1171923142=emotes,7 -1171923140=emotes,5 --1077789440=mellow --710537653=kingdom -1171923138=emotes,3 -1171923139=emotes,4 -1171923136=emotes,1 --2098286081=venture2 -1171923137=emotes,2 -1171923135=emotes,0 --1094248165=sigmunds showdown --271106892=rat a tat tat -3288564=keys --143163121=ham fisted --900633031=medieval -944208821=life's a beach\! --1228279453=riverside --1666444059=combaticons,10 -825919125=options_icons,24 -825919126=options_icons,25 -1179379180=the trade parade --1666444057=combaticons,12 -825919123=options_icons,22 --1666444058=combaticons,11 -825919124=options_icons,23 -825919121=options_icons,20 -1884768169=magicoff,32 -825919122=options_icons,21 -1884768167=magicoff,30 -1884768168=magicoff,31 -1318818808=chainmail -582031337=intrepid -783525419=beetle juice -432605856=untouchable --969918857=neverland -79789174=narnode's theme --705938181=zealot -117588=web --1666444051=combaticons,18 --1666444052=combaticons,17 -1687654733=troubled --1666444050=combaticons,19 --1666444055=combaticons,14 -825919129=options_icons,28 --1666444056=combaticons,13 --1666444053=combaticons,16 -825919127=options_icons,26 --1666444054=combaticons,15 -825919128=options_icons,27 -1320694328=magical journey -364185053=roll the bones --1254483584=jungly1 -981183822=right on track --1254483583=jungly2 --1254483582=jungly3 -3075958=dark --2038936746=deep down -1512143976=everlasting fire --1392319985=beyond -46273615=tale of keldagrim --651951461=goblin game -3522941=save -104084791=mossy -1250935993=the monsters below -794539501=garden of summer -1814277765=elven mist -2110556093=the golem --1475251658=where eagles lair -1884768143=magicoff,27 -1884768144=magicoff,28 -1884768141=magicoff,25 -1529837717=bubble and squeak -1884768142=magicoff,26 --1679325940=technology -1884768145=magicoff,29 --826562194=troubled_waters -1884768140=magicoff,24 --1359348243=painting1 -1267356434=the power of tears --1359348242=painting2 --860755690=jungle hunt -1884768138=magicoff,22 --1197347961=magic magic magic -1884768139=magicoff,23 -1134405764=hypnotized -1959211539=mapfunction,50 -1381363755=my arms journey --1644401602=complication -1959211540=mapfunction,51 -1959211541=mapfunction,52 -1884768136=magicoff,20 -1959211542=mapfunction,53 -2111304827=warning_icons,0 -1884768137=magicoff,21 --440187560=zogre dance -1959211543=mapfunction,54 -2111304828=warning_icons,1 --2002535437=corridors of power -825919130=options_icons,29 -580384095=jungle troubles -1301622585=slice of station -1959211544=mapfunction,55 -2111304829=warning_icons,2 --1294172031=escape --1309477156=expanse --1526067851=alternative root -2124773424=dynasty -1743765602=leftarrow --1482676188=romancing the crone --1891851953=island of the trolls -736457293=small_button_pressed --1106172890=letter -986170990=dreamstate -1959211545=mapfunction,56 -1959211546=mapfunction,57 -1765722413=spirits of elid -1959211547=mapfunction,58 -1959211548=mapfunction,59 --2075333010=lonesome -3314400=lava -1355033875=worldmap_icon,1 -1814357716=knightmare -1690742645=nox_irae -94935104=cross --1249495153=frogland --1642689926=athletes foot -107944162=quest -1355033874=worldmap_icon,0 --2130741313=joy of the hunt --28982081=labyrinth -250959119=marooned --1522984472=altar_ego -1326424637=the lost melody --1779111734=arabique --398925062=sea shanty2 -1884768110=magicoff,15 -1884768111=magicoff,16 -1817249074=woe of the wyvern -1884768114=magicoff,19 -1884768112=magicoff,17 --1624760229=emotion -1884768113=magicoff,18 --353951458=attention -279431252=garden of autumn -422652266=small_button -1884768107=magicoff,12 -1884768108=magicoff,13 -375695247=the far side -1884768105=magicoff,10 -1884768106=magicoff,11 --528864109=crystal sword -1884768109=magicoff,14 -1959211570=mapfunction,60 --158141423=prayeron,7 --158141424=prayeron,6 -1959211571=mapfunction,61 --158141421=prayeron,9 -1959211572=mapfunction,62 --158141422=prayeron,8 -1959211573=mapfunction,63 -1959211574=mapfunction,64 -688840255=piscarilius_sigil -1959211575=mapfunction,65 -1959211576=mapfunction,66 -1170407052=headicons_prayer -1959211577=mapfunction,67 --324496873=soundscape --1418445703=tex_red -1961540869=wornicons,10 --1028580907=that_sullen_hall -397136995=elfpainting --2092714094=haunted mine -1959211578=mapfunction,68 -1959211579=mapfunction,69 --158141429=prayeron,1 --158141427=prayeron,3 --140492390=bunny_sugar_rush --158141428=prayeron,2 --158141425=prayeron,5 -1827366203=righteousness --649601274=darkness_in_the_depths --158141426=prayeron,4 -1961540870=wornicons,11 --158141430=prayeron,0 -910299584=principality --734028978=arrow,1 --734028979=arrow,0 -790067275=garden of spring -35762567=workshop --1095396929=competition -96463963=egypt --1154441378=jollyr --1685231711=cave background --2078908549=time out --1172405897=wildwood --170561624=spookyjungle -2110231453=mod_icons -2061491048=shining --1063411723=tremble -94627585=chest --520702427=ice melody -1346720899=backleft1 --607416919=prayeron,25 --607416918=prayeron,26 -900197712=staticons,6 --607416917=prayeron,27 -900197713=staticons,7 --607416916=prayeron,28 -900197710=staticons,4 --607416915=prayeron,29 -900197711=staticons,5 -957931606=courage -900197714=staticons,8 -900197715=staticons,9 --720253066=the other side --1655721374=prayeroff,31 --607416921=prayeron,23 --1655721375=prayeroff,30 --607416920=prayeron,24 --710515142=the mad mole --1350228392=stratosphere --1666438445=combaticons2,3 --1666438446=combaticons2,2 --1666438443=combaticons2,5 --1666438444=combaticons2,4 --1106570438=legion --1666438441=combaticons2,7 --1666438442=combaticons2,6 -1398587265=flute salad --1666438440=combaticons2,8 -837223705=mapedge -900197709=staticons,3 --243680393=peng_emotes,7 -900197707=staticons,1 -378300078=everlasting -900197708=staticons,2 --944748869=witching --243680396=peng_emotes,4 --1335336992=logo_deadman_mode --1368714737=small_button_blue --795140435=wander --243680397=peng_emotes,3 --243680394=peng_emotes,6 --1666438447=combaticons2,1 --243680395=peng_emotes,5 --1666438448=combaticons2,0 --243680398=peng_emotes,2 --243680399=peng_emotes,1 --607416924=prayeron,20 -900197706=staticons,0 --607416923=prayeron,21 --607416922=prayeron,22 -3016376=bark --89244313=romper chomper -346288985=dorgeshun deep -1585002399=magicon,21 --1725263140=chef surprize -1585002398=magicon,20 --993528987=making waves --628963539=ham and seek --1666438439=combaticons2,9 --333224315=baroque --1236252722=prime time -280241284=waking dream --564582358=distant land -115411843=castlewars -1513246078=al kharid --1377700863=unknown land -1264132816=miles away -1185785872=barbassault_icons,3 -1185785873=barbassault_icons,4 --1655721397=prayeroff,29 --1655721398=prayeroff,28 -1185785874=barbassault_icons,5 --1655721399=prayeroff,27 -1185785875=barbassault_icons,6 -1711341885=fight or flight -1185785870=barbassault_icons,1 -1185785871=barbassault_icons,2 -3530505=sire --309570839=pick_and_shovel -647234089=distillery hilarity --127408236=gnome_village_party -1337378554=backbase2 -109757537=stars -1337378553=backbase1 -109757538=start -819884325=wilderness3 -1328851775=close_buttons,1 -658759958=side_background -1328851774=close_buttons,0 --782211141=wonder -1328851777=close_buttons,3 --1995718284=wall_white -819884324=wilderness2 -1328851776=close_buttons,2 -1328851779=close_buttons,5 --943885542=scape hunter -1328851778=close_buttons,4 -1185785869=barbassault_icons,0 --607416949=prayeron,16 --607416948=prayeron,17 --1779684630=rune essence --607416947=prayeron,18 --607416946=prayeron,19 -1119460311=bandos battalion --967559823=creature cruelty --1904094243=zeah_fishing --1913214770=wilderness -460367020=village -825919161=options_icons,39 -1585002375=magicon,18 -94839810=coins -1585002376=magicon,19 -825919160=options_icons,38 --1282090556=faerie --521895311=the adventurer -788399136=tree spirits --1902858744=beneath_the_stronghold --356730043=pirates of penance -1185785876=barbassault_icons,7 -825919158=options_icons,36 -825919159=options_icons,37 -825919156=options_icons,34 --1455241861=victory is mine -825919157=options_icons,35 --1333874720=side_icons,17 -825919154=options_icons,32 -825919155=options_icons,33 -825919152=options_icons,30 -825919153=options_icons,31 -1437805631=chatback --1623296531=ground scape -685190118=in the brine -1366257555=nightfall -110327241=theme --1333874725=side_icons,12 --1333874726=side_icons,11 --1333874727=side_icons,10 --1333874721=side_icons,16 --1333874722=side_icons,15 --1124681475=darkly_altared --8976533=throne of the demon --1333874723=side_icons,14 --1333874724=side_icons,13 --1989106719=assault and battery -1958759012=greatness -1057075019=b12_full -1143353537=chain of command --51091830=desert voyage --1073927447=mirage --91048728=number_button -3165239=gaol --1380919269=breeze -445640248=rugged_terrain -106079=key --655784411=overlay_multiway --1025835715=backright2 --1025835716=backright1 -1120933843=scape main -3225350=iban --956253112=title fight --123912401=la mort -1585002367=magicon,10 --2128736428=startgame -1585002368=magicon,11 --925031874=royale -1585002369=magicon,12 -1585002370=magicon,13 -1585002373=magicon,16 -1585002374=magicon,17 --1307116191=superstition -1585002371=magicon,14 -1585002372=magicon,15 --587569902=path of peril -3392903=null --1601127242=inadequacy -2136330800=staticons2,0 -2136330801=staticons2,1 -344336468=grip of the talon -2136330804=staticons2,4 -2136330805=staticons2,5 -2136330802=staticons2,2 -2136330803=staticons2,3 -1960215130=barking mad --43712789=scape original -621171714=cellar song -1585002461=magicon,41 -1585002462=magicon,42 -1585002460=magicon,40 -111485446=upass -2136330808=staticons2,8 -694847251=in the manor -2136330809=staticons2,9 -2136330806=staticons2,6 -2136330807=staticons2,7 --1385847955=rightarrow -1343200077=the slayer -1585002465=magicon,45 -1585002466=magicon,46 -1585002463=magicon,43 -1585002464=magicon,44 -1585002469=magicon,49 --95571520=volcanic vikings -1585002467=magicon,47 -1585002468=magicon,48 --1032629963=shipwrecked -93330745=aztec --881372797=tabs,1 -1377351472=oriental -121641580=headicons_hint --881372798=tabs,0 -1585002438=magicon,39 --1661605940=elfwood --607416893=prayeron,30 --822106577=jungle island xmas --607416892=prayeron,31 -332368736=mad eadgar -1585002432=magicon,33 --143368781=side_background_right -1585002433=magicon,34 --1081494434=malady -1585002430=magicon,31 -1585002431=magicon,32 -1585002436=magicon,37 -1585002437=magicon,38 -1585002434=magicon,35 -1585002435=magicon,36 --1938171360=miscgraphics3,0 --1059680853=trinity -781557721=dies_irae --1938171359=miscgraphics3,1 -497375231=stillness --1938171358=miscgraphics3,2 --1938171357=miscgraphics3,3 --960709976=dogs of war -2129339089=magicon,1 -2129339088=magicon,0 -755433248=headicons_pk -108392383=regal --213632750=waterfall --1367706280=canvas -73828649=settlement -848123561=into the abyss -478781900=last stand -1339486127=the shadow --1055503808=roc and roll -837204902=mapdots -950484242=compass --1082154559=fanfare -747848680=nether_realm -788224888=dead quiet -1532279978=monarch waltz --149029727=side_background_left1 -812947089=fanfare2 --149029726=side_background_left2 -1006643748=high spirits --2136059388=starlight -2122572442=the tower --1998869913=spooky2 -1411067174=gnome village2 --2065077267=wild side -812947090=fanfare3 -1585002429=magicon,30 -1294629755=on the wing -2097127567=monkey badness --2032107216=sojourn -1020264019=pest control -3237038=info -1473393027=fe fi fo fum --1686202291=upper_depths -3540994=stop -1742080803=darkwood -740392969=little cave of horrors --158379532=prayerglow --691855347=in between --200702983=the noble rodent -1652745754=forgotten --1895307673=hitmark,3 --1895307674=hitmark,2 --1895307675=hitmark,1 --1895307676=hitmark,0 --1895307670=hitmark,6 --1895307671=hitmark,5 --1895307672=hitmark,4 -1968917071=bone dry --850506182=trawler minor -197029040=mapscene --808772318=in the pits --1165315580=looking back --1763090403=scape_ape --1938177931=miscgraphics,11 --1938177932=miscgraphics,10 -1936130561=thrall_of_the_serpent -1258863383=yesteryear -1994744000=slice of silent movie --1691854169=dead can dance -1585002407=magicon,29 -1585002405=magicon,27 -1585002406=magicon,28 -271319484=frostbite --499867199=meridian -1585002400=magicon,22 --1938177930=miscgraphics,12 --84626226=mudskipper melody -1585002403=magicon,25 -1585002404=magicon,26 -3641802=wall -1585002401=magicon,23 -1585002402=magicon,24 --606457701=wolf mountain -1276599785=button_brown -1969878899=emotes,13 -1969878897=emotes,11 -1969878898=emotes,12 -1969878896=emotes,10 --1938177928=miscgraphics,14 --907669678=brew hoo hoo --1938177929=miscgraphics,13 -72999866=subterranea -619237947=the galleon --1764950404=scape sad -295831445=heart and mind -908430134=dangerous road -738888631=tradebacking --174800339=verdana_11pt_regular -686705631=lightwalk --601591436=side_background_bottom --1479412376=the navigator --359173459=zamorak zoo -744536246=null and void --1701556798=magicoff2,39 --1701556799=magicoff2,38 --1396384012=bamboo --200388662=lighthouse -133626717=suspicious --810515425=voyage -3061973=crag -1802291895=big chords --1661619479=elfwall -113315621=wood2 -1813041183=steelborder2,0 -429244831=slug a bug ball -1813041184=steelborder2,1 --1658386264=shining_spirit -738909086=chamber -526264239=verdana_13pt_regular --877351859=temple -2142215577=the mollusc menace -1124498189=warpath --2136649922=no way out --339706871=grimly_fiendish -547534551=wrath and ruin -544229147=lore and order -3327206=load -1610073470=lovakengj_sigil --419218284=long way home --662489856=food for thought -1306461568=stagnant --1662171955=elfdoor --1043985601=meddling kids -947464074=titlebutton --1309055712=exposed --1487348923=ambient jungle --1829469821=lament of meiyerditch -233203434=leftarrow_small --1216167350=dangerous -114464611=railings --1106574323=legend --1701556767=magicoff2,49 --999707515=time to mine --1701556768=magicoff2,48 -2129339097=magicon,9 -2129339096=magicon,8 -1959211510=mapfunction,42 -2129339095=magicon,7 -1959211511=mapfunction,43 -2129339094=magicon,6 -2129339093=magicon,5 -2129339092=magicon,4 -2129339091=magicon,3 -2129339090=magicon,2 -3522472=saga --1701556769=magicoff2,47 --544722449=rellekka -1033441676=tribal background -1915718129=the desolate isle -1890607150=magicon2,19 -1787618597=stranded -1717999087=forgettable melody -1959211512=mapfunction,44 --243680400=peng_emotes,0 -1959211513=mapfunction,45 -1959211514=mapfunction,46 -1959211515=mapfunction,47 -1959211516=mapfunction,48 -1959211517=mapfunction,49 -1705947058=the cellar dwellers -1216634785=landlubber -1884768198=magicoff,40 --1588113323=the rogues den -1884768199=magicoff,41 --905842564=serene --607599698=prayeroff,2 --607599699=prayeroff,1 -1890607142=magicon2,11 -1389384362=monkey trouble -1890607143=magicon2,12 -1890607144=magicon2,13 -1890607145=magicon2,14 -1890607146=magicon2,15 -1890607147=magicon2,16 -1890607148=magicon2,17 -1966766798=mausoleum -1890607149=magicon2,18 -1808345541=armadyl alliance -290391725=options_slider,7 -1890607141=magicon2,10 -290391722=options_slider,4 --607599696=prayeroff,4 -290391721=options_slider,3 --607599697=prayeroff,3 -290391724=options_slider,6 --607599694=prayeroff,6 -290391723=options_slider,5 --607599695=prayeroff,5 --607599692=prayeroff,8 --607599693=prayeroff,7 -290391720=options_slider,2 --607599691=prayeroff,9 -1334775925=chat_background --1779127378=arabian2 --1779127377=arabian3 -528722471=island life -1890607175=magicon2,23 -1890607176=magicon2,24 -949634504=mouse trap -1890607177=magicon2,25 -1890607178=magicon2,26 -1890607179=magicon2,27 -3327403=logo -290391719=options_slider,1 -1092249049=storm brew -290391718=options_slider,0 -404357804=everywhere -1890607172=magicon2,20 -1890607173=magicon2,21 -951530772=contest -1890607174=magicon2,22 --1701556776=magicoff2,40 -1884768176=magicoff,39 --395250469=corporal punishment -1749113330=newbie melody -1884768174=magicoff,37 -1884768175=magicoff,38 --1701556772=magicoff2,44 --1701556773=magicoff2,43 --1701556774=magicoff2,42 --1701556775=magicoff2,41 --858121616=tzhaar -1884768172=magicoff,35 -1884768173=magicoff,36 -666772244=combat_shield -1884768170=magicoff,33 -1884768171=magicoff,34 -1959211509=mapfunction,41 -1639695510=mapmarker --1661748240=friends_icons --552301350=knightly --1918044851=mastermindless --1701556770=magicoff2,46 --1701556771=magicoff2,45 -201526300=corporealbeast -1959211508=mapfunction,40 -105001967=nomad --70910145=clickcross,3 --1737914947=mapfunction,5 -1801745440=staticons2,11 --70910146=clickcross,2 --865479038=tribal --1737914946=mapfunction,6 -1801745441=staticons2,12 --70910147=clickcross,1 --1737914945=mapfunction,7 -1801745442=staticons2,13 --70910148=clickcross,0 --1737914944=mapfunction,8 -1801745443=staticons2,14 --1737914943=mapfunction,9 -1801745444=staticons2,15 -1801745445=staticons2,16 -1801745446=staticons2,17 --1877545169=land down under -93921962=books --1737914949=mapfunction,3 --1737914948=mapfunction,4 --1655721428=prayeroff,19 --2136884405=title.jpg --1655721429=prayeroff,18 -1584819628=magicoff,6 -1584819629=magicoff,7 -437480876=voodoo cult -1584819624=magicoff,2 -1584819625=magicoff,3 -1584819626=magicoff,4 --1737914952=mapfunction,0 -1584819627=magicoff,5 --1737914951=mapfunction,1 -124995564=harmony2 -1584819622=magicoff,0 -1801745439=staticons2,10 -1584819623=magicoff,1 -346263512=dorgeshun city --1665011705=down and out -1890607180=magicon2,28 -1890607181=magicon2,29 -1417471781=titlescroll -1959211446=mapfunction,20 -1956141536=options_radio_buttons,0 -736568812=ballad of enchantment --1737914950=mapfunction,2 -1959211447=mapfunction,21 -1959211448=mapfunction,22 -1959211449=mapfunction,23 --1890130256=morytania --70910141=clickcross,7 --70910142=clickcross,6 -1956141539=options_radio_buttons,3 --70910143=clickcross,5 -1956141538=options_radio_buttons,2 -284766976=splendour --70910144=clickcross,4 -1956141537=options_radio_buttons,1 -196677638=the quizmaster -530068296=overture --1123094568=sl_button --700552779=hosidius_sigil --614076819=sad meadow -1956141543=options_radio_buttons,7 -1956141542=options_radio_buttons,6 -1956141541=options_radio_buttons,5 -1956141540=options_radio_buttons,4 -1584819631=magicoff,9 -1846633612=gnome village --2128560371=sl_back -1969878905=emotes,19 -306819362=crystal castle -1584819630=magicoff,8 -1969878903=emotes,17 -303737220=options_icons,7 -1969878904=emotes,18 -1969878901=emotes,15 --78220817=devils_may_care -1969878902=emotes,16 --40521666=dimension x -1969878900=emotes,14 -673424924=the lunar isle -789609582=brimstail's scales -303737222=options_icons,9 -303737221=options_icons,8 -1959211415=mapfunction,10 -3059343=coil -1959211416=mapfunction,11 -1959211417=mapfunction,12 --1256560486=last_man_standing -1959211418=mapfunction,13 -336238005=rightarrow_small -1959211419=mapfunction,14 --677662361=forever --1655721430=prayeroff,17 --1655721431=prayeroff,16 --1655721432=prayeroff,15 -1959211420=mapfunction,15 -1959211663=mapfunction,90 -1959211421=mapfunction,16 -1959211422=mapfunction,17 -1959211423=mapfunction,18 -303737217=options_icons,4 -303737216=options_icons,3 -303737215=options_icons,2 --1665005042=funny bunnies -303737214=options_icons,1 -303737219=options_icons,6 -303737218=options_icons,5 -303737213=options_icons,0 -95997798=we are the fairies -2001751835=desert heat -1959211424=mapfunction,19 --1655721437=prayeroff,10 -687938017=clanwars --1776024210=desolate_mage --650944128=strength of saradomin --1655721433=prayeroff,14 -1160873524=aye car rum ba --1655721434=prayeroff,13 --1655721435=prayeroff,12 --1081314499=marble --1655721436=prayeroff,11 -1097075475=reset,0 -1959211477=mapfunction,30 --693313916=warriors guild -3506388=roof -1959211478=mapfunction,31 -1097075476=reset,1 --2134967800=dagannoth dawn --985763247=planks -1959211479=mapfunction,32 -1999746381=fenkenstrain's refrain -898010371=garden of winter -359174830=rat hunt -1959211482=mapfunction,35 -686441581=lightness -1959211483=mapfunction,36 -1959211484=mapfunction,37 -1959211485=mapfunction,38 -1959211486=mapfunction,39 -2023201035=dwarf theme -1959211480=mapfunction,33 -1959211481=mapfunction,34 --1065532022=combatboxes,1 --1065532021=combatboxes,2 --1065532020=combatboxes,3 -1867160429=old_tiles -394756979=scape santa -25205919=elfroof2 --663428071=dangerous way --1065532023=combatboxes,0 -1959211450=mapfunction,24 --895939599=spirit -1959211451=mapfunction,25 -1959211452=mapfunction,26 -1959211453=mapfunction,27 -1959211454=mapfunction,28 -1959211455=mapfunction,29 --275310687=undercurrent -212205923=goblin village --303898981=faithless --1381531001=tomb raider -260940912=marzipan -1343267530=backhmid1 -1343267531=backhmid2 -1097468315=horizon --1655721404=prayeroff,22 -623451622=kourend_the_magnificent --1655721405=prayeroff,21 --1655721406=prayeroff,20 --1655721400=prayeroff,26 --313384067=p12_full --1655721401=prayeroff,25 --1655721402=prayeroff,24 --1655721403=prayeroff,23 -95848451=dream -1966781751=maws_jaws_claws --995428255=parade -95734525=method of madness --1308064877=hitmarks -1030045177=mutant medley -1333034828=blackmark -851641665=davy jones locker -417793574=scrollbar -1346720900=backleft2 -1884768206=magicoff,48 -1884768207=magicoff,49 -1801140808=fangs for the memory -1884768204=magicoff,46 -1345432055=pinball wizard -1884768205=magicoff,47 --783693496=dance of the undead -1274780903=chompy hunt -465278529=the lost tribe --1666437481=combaticons3,6 -2032696205=cabin fever --1666437480=combaticons3,7 -1825640471=borderland -415928477=zeah_mining -1884768202=magicoff,44 --607599700=prayeroff,0 -1884768203=magicoff,45 -1884768200=magicoff,42 -1884768201=magicoff,43 --1666437487=combaticons3,0 --1666437486=combaticons3,1 -813726263=crystal cave -1235442953=pathways -518814479=lullaby --1666437483=combaticons3,4 -1585007985=magicon2,7 --1666437482=combaticons3,5 -1585007986=magicon2,8 --1666437485=combaticons3,2 -1585007987=magicon2,9 --1666437484=combaticons3,3 -104080482=moody -1969878967=emotes,39 --665666447=work work work -1364992651=evil bobs island -1969878965=emotes,37 -1227328817=verdana_15pt_regular -1969878966=emotes,38 -1969878963=emotes,35 -1581724013=monkey business -1969878964=emotes,36 --74307138=miscellania -1969878961=emotes,33 -1969878962=emotes,34 -1969878960=emotes,32 -1131171307=wayward --1154558416=sl_arrows -529929957=overpass -1258058669=huffman --694094064=adventure -1171698653=orb_xp,1 -1171698652=orb_xp,0 -1171698655=orb_xp,3 -1171698654=orb_xp,2 -1802171733=arceuus_sigil -221109227=tears of guthix --1661754893=elfroof --1666437478=combaticons3,9 -1124565314=warrior -1969878958=emotes,30 -1969878959=emotes,31 --934797897=reggae -2110260221=the genie --1666437479=combaticons3,8 -104257585=mummy --1923924724=sworddecor,0 -2136325196=staticons,17 --1332194002=background -2136164423=homescape --1923924721=sworddecor,3 -2136325194=staticons,15 --1923924722=sworddecor,2 --873564465=tiptoe -2136325195=staticons,16 --1923924723=sworddecor,1 -123560953=espionage -2136325192=staticons,13 -2136325193=staticons,14 -1038911415=gnome king -2136325190=staticons,11 -2136325191=staticons,12 -1854274741=karamja jam -1969878989=emotes,40 --1242708793=glyphs -563269755=the terrible tower -1650323088=twilight --12868552=sea shanty -289742397=book of spells -1880989696=dragontooth island -2136325189=staticons,10 -110873=pen --454421102=out of the deep -825919099=options_icons,19 -825919097=options_icons,17 -825919098=options_icons,18 --1349119470=cursed -1585007978=magicon2,0 -825919095=options_icons,15 -1585007979=magicon2,1 -825919096=options_icons,16 -825919093=options_icons,13 -825919094=options_icons,14 -825919091=options_icons,11 -825919092=options_icons,12 --895977880=sphinx --874529881=city of the dead -825919090=options_icons,10 -1585007981=magicon2,3 -1585007982=magicon2,4 -1585007983=magicon2,5 --1618729246=body parts -1585007984=magicon2,6 -1585007980=magicon2,2 -1086075866=shayzien_sigil -2103661451=jester minute --911346307=steelborder,2 --1809781334=button_brown_big --911346306=steelborder,3 --816227352=vision --911346309=steelborder,0 -109407595=shine --911346308=steelborder,1 --119954464=combaticons3,12 --119954465=combaticons3,11 --1846853118=armageddon --119954462=combaticons3,14 --119954463=combaticons3,13 --119954460=combaticons3,16 --908183966=scarab --119954461=combaticons3,15 --282886672=home sweet home -103666243=march -1969878929=emotes,22 -1643875326=fire and brimstone -1969878927=emotes,20 --119954466=combaticons3,10 -1969878928=emotes,21 --839455633=close quarters -941457503=way of the enchanter --1453405761=mor-ul-rek --415134015=have a blast --1658514874=floating free -1213477442=chickened out --1619800349=emotes_locked,27 --599680631=fear and loathing --1081041422=insect queen --1268786147=forest --119954459=combaticons3,17 --119954457=combaticons3,19 --119954458=combaticons3,18 --850395529=trouble brewing --1773920521=cave of the goblins --771284962=claustrophobia -1310729739=bankbuttons,2 -1306691868=upcoming -1465443077=over to nardah -1310729744=bankbuttons,7 -1310729743=bankbuttons,6 -1310729742=bankbuttons,5 -1234827707=deep wildy --90350772=xenophobe --750127868=arabian -1310729741=bankbuttons,4 -1310729740=bankbuttons,3 -1041911129=waterlogged -108875897=runes -1447063382=barb wire --378865792=magic dance -285466503=overlay_duel -1814287296=zeah_magic -1976894499=down to earth -1969878936=emotes,29 -1969878934=emotes,27 --1567437308=deadlands -1969878935=emotes,28 -1310729738=bankbuttons,1 -1969878932=emotes,25 --957019274=too many cooks -1310729737=bankbuttons,0 -2092627105=silence -1969878933=emotes,26 -1969878930=emotes,23 -1969878931=emotes,24 --901674570=well of voyage +#Wed Nov 29 15:08:06 PST 2017 +-1863637185=miscgraphics,4 +-1863637184=miscgraphics,5 +-1863637187=miscgraphics,2 +-1863637186=miscgraphics,3 +-1863637181=miscgraphics,8 +-1863637180=miscgraphics,9 +-440204630=alls fairy in love n war +-1863637183=miscgraphics,6 +-1253085654=scorpia_dances +-1863637182=miscgraphics,7 +1356196826=backvmid3 +-751102526=high seas +1356196825=backvmid2 +-1863637189=miscgraphics,0 +549358875=camelot +-1863637188=miscgraphics,1 +-1619800378=emotes_locked,19 +-1619800379=emotes_locked,18 +792536868=understanding +1356196824=backvmid1 +-1773559904=title_mute +-342013218=p11_full +1523653533=pirates of peril +696768774=harmony +-1701556831=magicoff2,27 +281586976=orb_icon,3 +286265996=ready for battle +-1701556832=magicoff2,26 +281586977=orb_icon,4 +-645977478=scape scared +-1701556833=magicoff2,25 +281586978=orb_icon,5 +-1701556834=magicoff2,24 +-1701556830=magicoff2,28 +-1052794696=dance of death +-1619800383=emotes_locked,14 +-1619800384=emotes_locked,13 +-1619800385=emotes_locked,12 +-1556842207=sl_flags +-1619800386=emotes_locked,11 +1614826739=mapletree +-1619800387=emotes_locked,10 +-1701556835=magicoff2,23 +-1701556836=magicoff2,22 +1363656441=serenade +-1701556837=magicoff2,21 +3089326=door +-1701556838=magicoff2,20 +-1619800380=emotes_locked,17 +-1619800381=emotes_locked,16 +-1619800382=emotes_locked,15 +-1037172987=tomorrow +825974316=melodrama +281586973=orb_icon,0 +281586974=orb_icon,1 +281586975=orb_icon,2 +-1701556864=magicoff2,15 +-1701556865=magicoff2,14 +-1701556866=magicoff2,13 +1509400204=sarcophagus +-1701556867=magicoff2,12 +-1701556860=magicoff2,19 +-1701556861=magicoff2,18 +-1701556862=magicoff2,17 +1868377358=lower_depths +-1701556863=magicoff2,16 +1086036315=reggae2 +-1220755677=hermit +-1544597765=sl_stars +-1619800350=emotes_locked,26 +-1619800351=emotes_locked,25 +-1636062434=tex_brown +-1619800352=emotes_locked,24 +-1619800353=emotes_locked,23 +-2122174648=back to life +-1619800354=emotes_locked,22 +-1701556868=magicoff2,11 +-1619800355=emotes_locked,21 +-1701556869=magicoff2,10 +-1619800356=emotes_locked,20 +1619539773=side_icons,7 +1121239524=scape wild +368271413=diango's little helpers +1619539772=side_icons,6 +1619539775=side_icons,9 +1619539774=side_icons,8 +-1938172321=miscgraphics2,0 +1619539771=side_icons,5 +1619539770=side_icons,4 +-926977577=the enchanter +1202794514=doorways +1343649581=schools out +-1097177625=q8_full +756012174=wornicons,4 +756012173=wornicons,3 +756012176=wornicons,6 +756012175=wornicons,5 +756012170=wornicons,0 +827249681=ogre the top +756012172=wornicons,2 +756012171=wornicons,1 +-1741764817=poles apart +756012178=wornicons,8 +-1938172320=miscgraphics2,1 +756012177=wornicons,7 +-43136286=the last shanty +756012179=wornicons,9 +837131331=mapback +-1938172313=miscgraphics2,8 +907740319=the depths +-1938172312=miscgraphics2,9 +-2099722614=cave of beasts +-1938172317=miscgraphics2,4 +-1938172316=miscgraphics2,5 +-1938172315=miscgraphics2,6 +-1938172314=miscgraphics2,7 +1619539769=side_icons,3 +-1367483767=cavern +-1938172319=miscgraphics2,2 +50474489=treestump +-1938172318=miscgraphics2,3 +1619539766=side_icons,0 +1619539768=side_icons,2 +1619539767=side_icons,1 +-607416954=prayeron,11 +1837251043=melzars maze +-607416953=prayeron,12 +1318893900=have an ice day +-607416952=prayeron,13 +-1701556800=magicoff2,37 +-607416951=prayeron,14 +-1701556801=magicoff2,36 +-56804840=woodland +-607416950=prayeron,15 +1120636327=scape cave +358884868=button_red +-1701556806=magicoff2,31 +-1701556807=magicoff2,30 +-1701556802=magicoff2,35 +-1701556803=magicoff2,34 +-1701556804=magicoff2,33 +-1858265682=monster melee +-1701556805=magicoff2,32 +-649484675=land of the dwarves +-1789903512=golden touch +1328851780=close_buttons,6 +1080306793=shayzien_march +-1339126929=damage +4820960=monkey sadness +-1951786153=bone dance +1328851781=close_buttons,7 +939546513=forlorn_homestead +-1019905269=shadowland +-607416955=prayeron,10 +-2048535896=pheasant peasant +-1025233830=monkey madness +1121125956=scape soft +-1562452687=etcetera +1969878996=emotes,47 +1969878994=emotes,45 +-1228279872=ge_icons,3 +1969878995=emotes,46 +-1228279871=ge_icons,4 +1969878992=emotes,43 +-1228279870=ge_icons,5 +1969878993=emotes,44 +1959803992=invback +399048409=mage arena +1969878990=emotes,41 +-47057524=lasting +1969878991=emotes,42 +-1228279875=ge_icons,0 +-1228279874=ge_icons,1 +-1228279873=ge_icons,2 +-1860080918=inspiration +1997757502=redstone2 +1997757503=redstone3 +-1060046352=tribal2 +1997757501=redstone1 +-1701556829=magicoff2,29 +1890607210=magicon2,37 +1890607211=magicon2,38 +1890607212=magicon2,39 +-1408684838=ascent +-848436598=fishing +-119984250=combaticons2,17 +-119984251=combaticons2,16 +1769177816=jungle island +-119984252=combaticons2,15 +-119984253=combaticons2,14 +-119984254=combaticons2,13 +-119984255=combaticons2,12 +-119984256=combaticons2,11 +-119984257=combaticons2,10 +1890607205=magicon2,32 +1890607206=magicon2,33 +1890607207=magicon2,34 +1890607208=magicon2,35 +135141185=zeah_combat +1890607209=magicon2,36 +-180851958=norse code +112903447=water +922007495=talking forest +-672706748=miracle dance +-1110089645=lament +-1237461365=grotto +1890607203=magicon2,30 +1890607204=magicon2,31 +-1073910849=mirror +-988841056=still night +-1857025509=sunburn +-468596910=easter jig +796868952=major miner +-1066798491=trawler +1640556978=wonderous +-1624274920=emperor +740093634=find my way +1890607238=magicon2,44 +1890607239=magicon2,45 +3559837=tick +-1839713245=sideicons +1029455878=hells bells +1890607234=magicon2,40 +1890607235=magicon2,41 +1890607236=magicon2,42 +1890607237=magicon2,43 +1503566841=forbidden +-895763669=spooky +-276138668=ham attack +500433071=combaticons,5 +-1021014225=catch me if you can +500433070=combaticons,4 +500433073=combaticons,7 +500433072=combaticons,6 +500433075=combaticons,9 +1533565119=mind over matter +500433074=combaticons,8 +2025958358=emotes_locked,4 +500433066=combaticons,0 +2025958357=emotes_locked,3 +862821975=far away +-1228392498=artistry +2025958356=emotes_locked,2 +500433068=combaticons,2 +2025958355=emotes_locked,1 +500433067=combaticons,1 +1085444827=refresh +500433069=combaticons,3 +2025958359=emotes_locked,5 +1427043851=on the up +2025958354=emotes_locked,0 +1316697938=whistle +347955347=venture +1959211608=mapfunction,77 +1959211609=mapfunction,78 +881850881=the chosen +1959211601=mapfunction,70 +1959211602=mapfunction,71 +584643951=lost soul +582140282=rising damp +1959211603=mapfunction,72 +1740872686=soulfall +1959211604=mapfunction,73 +1959211605=mapfunction,74 +-119984248=combaticons2,19 +1959211606=mapfunction,75 +-119984249=combaticons2,18 +1609255038=slither and thither +82917947=sarim's vermin +1959211607=mapfunction,76 +1728911401=natural +-1189743137=duel arena +108698078=roof2 +214634021=head to head +2025958361=emotes_locked,7 +-448773288=isle of everywhere +2025958360=emotes_locked,6 +-1869996941=titlebox +-338347745=showdown +-2075972251=long ago +2025958363=emotes_locked,9 +2025958362=emotes_locked,8 +-1487589606=7th realm +-1253087691=garden +-2133902017=zeah_farming +-492926285=impetuous +3314014=lair +907815588=the desert +-1960860275=barbarianism +1890607241=magicon2,47 +1890607242=magicon2,48 +1890607243=magicon2,49 +-919642451=jungle bells +795515487=underground +561438836=fountain +-1418827919=illusive +-634763748=fruits de mer +1890607240=magicon2,46 +1694458038=large_button +1393517697=bandit camp +1959211632=mapfunction,80 +1884773718=magicoff2,2 +1884773719=magicoff2,3 +1884773716=magicoff2,0 +2121900771=backtop1 +1884773717=magicoff2,1 +-103077377=gnomeball +-1947119982=blistering barnacles +828650857=autumn voyage +92909147=alone +1691516951=undead dungeon +122265833=expecting +-1320617626=dunjun +1959211633=mapfunction,81 +1959211634=mapfunction,82 +1959211635=mapfunction,83 +1959211636=mapfunction,84 +1959211637=mapfunction,85 +777534707=army of darkness +1959211638=mapfunction,86 +1959211639=mapfunction,87 +1884773721=magicoff2,5 +1884773722=magicoff2,6 +1884773720=magicoff2,4 +1959211640=mapfunction,88 +1959211641=mapfunction,89 +-327707013=anywhere +1884773725=magicoff2,9 +1884773723=magicoff2,7 +1884773724=magicoff2,8 +1116844876=incantation +-728886272=temple of light +685934899=in the clink +-1237289460=grumpy +1945133711=inferno +466902883=strange place +-418223472=phasmatys +817472004=zombiism +106578554=zeah_book,0 +106578555=zeah_book,1 +1509070203=eagle peak +-485932799=expedition +1171923143=emotes,8 +-675357975=attack1 +1171923144=emotes,9 +1959211610=mapfunction,79 +-675357974=attack2 +-675357973=attack3 +-675357972=attack4 +-675357971=attack5 +40246002=masquerade +-675357970=attack6 +-734206983=arrival +-1980407601=sea shanty xmas +284435223=pharoah's tomb +-148552909=down below +1171923141=emotes,6 +1171923142=emotes,7 +1171923140=emotes,5 +-1077789440=mellow +-710537653=kingdom +1171923138=emotes,3 +1171923139=emotes,4 +1171923136=emotes,1 +-2098286081=venture2 +1171923137=emotes,2 +1171923135=emotes,0 +-1094248165=sigmunds showdown +-271106892=rat a tat tat +3288564=keys +-143163121=ham fisted +-900633031=medieval +944208821=life's a beach\! +-1228279453=riverside +-1666444059=combaticons,10 +825919125=options_icons,24 +825919126=options_icons,25 +1179379180=the trade parade +-1666444057=combaticons,12 +825919123=options_icons,22 +-1666444058=combaticons,11 +825919124=options_icons,23 +825919121=options_icons,20 +1884768169=magicoff,32 +825919122=options_icons,21 +1884768167=magicoff,30 +1884768168=magicoff,31 +1318818808=chainmail +582031337=intrepid +783525419=beetle juice +432605856=untouchable +-969918857=neverland +79789174=narnode's theme +-705938181=zealot +117588=web +-1666444051=combaticons,18 +-1666444052=combaticons,17 +1687654733=troubled +-1666444050=combaticons,19 +-1666444055=combaticons,14 +825919129=options_icons,28 +-1666444056=combaticons,13 +-1666444053=combaticons,16 +825919127=options_icons,26 +-1666444054=combaticons,15 +825919128=options_icons,27 +1320694328=magical journey +364185053=roll the bones +-1254483584=jungly1 +981183822=right on track +-1254483583=jungly2 +-1254483582=jungly3 +3075958=dark +-2038936746=deep down +1512143976=everlasting fire +-1392319985=beyond +46273615=tale of keldagrim +-651951461=goblin game +3522941=save +104084791=mossy +1250935993=the monsters below +794539501=garden of summer +1814277765=elven mist +2110556093=the golem +-1475251658=where eagles lair +1884768143=magicoff,27 +1884768144=magicoff,28 +1884768141=magicoff,25 +1529837717=bubble and squeak +1884768142=magicoff,26 +-1679325940=technology +1884768145=magicoff,29 +-826562194=troubled_waters +1884768140=magicoff,24 +-1359348243=painting1 +1267356434=the power of tears +-1359348242=painting2 +-860755690=jungle hunt +1884768138=magicoff,22 +-1197347961=magic magic magic +1884768139=magicoff,23 +1134405764=hypnotized +1959211539=mapfunction,50 +1381363755=my arms journey +-1644401602=complication +1959211540=mapfunction,51 +1959211541=mapfunction,52 +1884768136=magicoff,20 +1959211542=mapfunction,53 +2111304827=warning_icons,0 +1884768137=magicoff,21 +-440187560=zogre dance +1959211543=mapfunction,54 +2111304828=warning_icons,1 +-2002535437=corridors of power +825919130=options_icons,29 +580384095=jungle troubles +1301622585=slice of station +1959211544=mapfunction,55 +2111304829=warning_icons,2 +-1294172031=escape +-1309477156=expanse +-1526067851=alternative root +2124773424=dynasty +1743765602=leftarrow +-1482676188=romancing the crone +-1891851953=island of the trolls +736457293=small_button_pressed +-1106172890=letter +986170990=dreamstate +1959211545=mapfunction,56 +1959211546=mapfunction,57 +1765722413=spirits of elid +1959211547=mapfunction,58 +1959211548=mapfunction,59 +-2075333010=lonesome +3314400=lava +1355033875=worldmap_icon,1 +1814357716=knightmare +1690742645=nox_irae +94935104=cross +-1249495153=frogland +-1642689926=athletes foot +107944162=quest +1355033874=worldmap_icon,0 +-2130741313=joy of the hunt +-28982081=labyrinth +250959119=marooned +-1522984472=altar_ego +1326424637=the lost melody +-1779111734=arabique +-398925062=sea shanty2 +1884768110=magicoff,15 +1884768111=magicoff,16 +1817249074=woe of the wyvern +1884768114=magicoff,19 +1884768112=magicoff,17 +-1624760229=emotion +1884768113=magicoff,18 +-353951458=attention +279431252=garden of autumn +422652266=small_button +1884768107=magicoff,12 +1884768108=magicoff,13 +375695247=the far side +1884768105=magicoff,10 +1884768106=magicoff,11 +-528864109=crystal sword +1884768109=magicoff,14 +1959211570=mapfunction,60 +-158141423=prayeron,7 +-158141424=prayeron,6 +1959211571=mapfunction,61 +-158141421=prayeron,9 +1959211572=mapfunction,62 +-158141422=prayeron,8 +1959211573=mapfunction,63 +1959211574=mapfunction,64 +688840255=piscarilius_sigil +1959211575=mapfunction,65 +1959211576=mapfunction,66 +1170407052=headicons_prayer +1959211577=mapfunction,67 +-324496873=soundscape +-1418445703=tex_red +1961540869=wornicons,10 +-1028580907=that_sullen_hall +397136995=elfpainting +-2092714094=haunted mine +1959211578=mapfunction,68 +1959211579=mapfunction,69 +-158141429=prayeron,1 +-158141427=prayeron,3 +-140492390=bunny_sugar_rush +-158141428=prayeron,2 +-158141425=prayeron,5 +1827366203=righteousness +-649601274=darkness_in_the_depths +-158141426=prayeron,4 +1961540870=wornicons,11 +-158141430=prayeron,0 +910299584=principality +-734028978=arrow,1 +-734028979=arrow,0 +790067275=garden of spring +35762567=workshop +-1095396929=competition +96463963=egypt +-1154441378=jollyr +-1685231711=cave background +-2078908549=time out +-1172405897=wildwood +-170561624=spookyjungle +2110231453=mod_icons +2061491048=shining +-1063411723=tremble +94627585=chest +-520702427=ice melody +1346720899=backleft1 +-607416919=prayeron,25 +-607416918=prayeron,26 +900197712=staticons,6 +-607416917=prayeron,27 +900197713=staticons,7 +-607416916=prayeron,28 +900197710=staticons,4 +-607416915=prayeron,29 +900197711=staticons,5 +957931606=courage +900197714=staticons,8 +900197715=staticons,9 +-720253066=the other side +-1655721374=prayeroff,31 +-607416921=prayeron,23 +-1655721375=prayeroff,30 +-607416920=prayeron,24 +-710515142=the mad mole +-1350228392=stratosphere +-1666438445=combaticons2,3 +-1666438446=combaticons2,2 +-1666438443=combaticons2,5 +-1666438444=combaticons2,4 +-1106570438=legion +-1666438441=combaticons2,7 +-1666438442=combaticons2,6 +1398587265=flute salad +-1666438440=combaticons2,8 +837223705=mapedge +900197709=staticons,3 +-243680393=peng_emotes,7 +900197707=staticons,1 +378300078=everlasting +900197708=staticons,2 +-944748869=witching +-243680396=peng_emotes,4 +-1335336992=logo_deadman_mode +-1368714737=small_button_blue +-795140435=wander +-243680397=peng_emotes,3 +-243680394=peng_emotes,6 +-1666438447=combaticons2,1 +-243680395=peng_emotes,5 +-1666438448=combaticons2,0 +-243680398=peng_emotes,2 +-243680399=peng_emotes,1 +-607416924=prayeron,20 +900197706=staticons,0 +-607416923=prayeron,21 +-607416922=prayeron,22 +3016376=bark +-89244313=romper chomper +346288985=dorgeshun deep +1585002399=magicon,21 +-1725263140=chef surprize +1585002398=magicon,20 +-993528987=making waves +-628963539=ham and seek +-1666438439=combaticons2,9 +-333224315=baroque +-1236252722=prime time +280241284=waking dream +-564582358=distant land +115411843=castlewars +1513246078=al kharid +-1377700863=unknown land +1264132816=miles away +1185785872=barbassault_icons,3 +1185785873=barbassault_icons,4 +-1655721397=prayeroff,29 +-1655721398=prayeroff,28 +1185785874=barbassault_icons,5 +-1655721399=prayeroff,27 +1185785875=barbassault_icons,6 +1711341885=fight or flight +1185785870=barbassault_icons,1 +1185785871=barbassault_icons,2 +3530505=sire +-309570839=pick_and_shovel +647234089=distillery hilarity +-127408236=gnome_village_party +1337378554=backbase2 +109757537=stars +1337378553=backbase1 +109757538=start +819884325=wilderness3 +1328851775=close_buttons,1 +658759958=side_background +1328851774=close_buttons,0 +-782211141=wonder +1328851777=close_buttons,3 +-1995718284=wall_white +819884324=wilderness2 +1328851776=close_buttons,2 +1328851779=close_buttons,5 +-943885542=scape hunter +1328851778=close_buttons,4 +1185785869=barbassault_icons,0 +-607416949=prayeron,16 +-607416948=prayeron,17 +-1779684630=rune essence +-607416947=prayeron,18 +-607416946=prayeron,19 +1119460311=bandos battalion +-967559823=creature cruelty +-1904094243=zeah_fishing +-1913214770=wilderness +460367020=village +825919161=options_icons,39 +1585002375=magicon,18 +94839810=coins +1585002376=magicon,19 +825919160=options_icons,38 +-1282090556=faerie +-521895311=the adventurer +788399136=tree spirits +-1902858744=beneath_the_stronghold +-356730043=pirates of penance +1185785876=barbassault_icons,7 +825919158=options_icons,36 +825919159=options_icons,37 +825919156=options_icons,34 +-1455241861=victory is mine +825919157=options_icons,35 +-1333874720=side_icons,17 +825919154=options_icons,32 +825919155=options_icons,33 +825919152=options_icons,30 +825919153=options_icons,31 +1437805631=chatback +-1623296531=ground scape +685190118=in the brine +1366257555=nightfall +110327241=theme +-1333874725=side_icons,12 +-1333874726=side_icons,11 +-1333874727=side_icons,10 +-1333874721=side_icons,16 +-1333874722=side_icons,15 +-1124681475=darkly_altared +-8976533=throne of the demon +-1333874723=side_icons,14 +-1333874724=side_icons,13 +-1989106719=assault and battery +1958759012=greatness +1057075019=b12_full +1143353537=chain of command +-51091830=desert voyage +-1073927447=mirage +-91048728=number_button +3165239=gaol +-1380919269=breeze +445640248=rugged_terrain +106079=key +-655784411=overlay_multiway +-1025835715=backright2 +-1025835716=backright1 +1120933843=scape main +3225350=iban +-956253112=title fight +-123912401=la mort +1585002367=magicon,10 +-2128736428=startgame +1585002368=magicon,11 +-925031874=royale +1585002369=magicon,12 +1585002370=magicon,13 +1585002373=magicon,16 +1585002374=magicon,17 +-1307116191=superstition +1585002371=magicon,14 +1585002372=magicon,15 +-587569902=path of peril +3392903=null +-1601127242=inadequacy +2136330800=staticons2,0 +2136330801=staticons2,1 +344336468=grip of the talon +2136330804=staticons2,4 +2136330805=staticons2,5 +2136330802=staticons2,2 +2136330803=staticons2,3 +1960215130=barking mad +-43712789=scape original +621171714=cellar song +1585002461=magicon,41 +1585002462=magicon,42 +1585002460=magicon,40 +111485446=upass +2136330808=staticons2,8 +694847251=in the manor +2136330809=staticons2,9 +2136330806=staticons2,6 +2136330807=staticons2,7 +-1385847955=rightarrow +1343200077=the slayer +1585002465=magicon,45 +1585002466=magicon,46 +1585002463=magicon,43 +1585002464=magicon,44 +1585002469=magicon,49 +-95571520=volcanic vikings +1585002467=magicon,47 +1585002468=magicon,48 +-1032629963=shipwrecked +93330745=aztec +-881372797=tabs,1 +1377351472=oriental +121641580=headicons_hint +-881372798=tabs,0 +1585002438=magicon,39 +-1661605940=elfwood +-607416893=prayeron,30 +-822106577=jungle island xmas +-607416892=prayeron,31 +332368736=mad eadgar +1585002432=magicon,33 +-143368781=side_background_right +1585002433=magicon,34 +-1081494434=malady +1585002430=magicon,31 +1585002431=magicon,32 +1585002436=magicon,37 +1585002437=magicon,38 +1585002434=magicon,35 +1585002435=magicon,36 +-1938171360=miscgraphics3,0 +-1059680853=trinity +781557721=dies_irae +-1938171359=miscgraphics3,1 +497375231=stillness +-1938171358=miscgraphics3,2 +-1938171357=miscgraphics3,3 +-960709976=dogs of war +2129339089=magicon,1 +2129339088=magicon,0 +755433248=headicons_pk +108392383=regal +-213632750=waterfall +-1367706280=canvas +73828649=settlement +848123561=into the abyss +478781900=last stand +1339486127=the shadow +-1055503808=roc and roll +837204902=mapdots +950484242=compass +-1082154559=fanfare +747848680=nether_realm +788224888=dead quiet +1532279978=monarch waltz +-149029727=side_background_left1 +812947089=fanfare2 +-149029726=side_background_left2 +1006643748=high spirits +-2136059388=starlight +2122572442=the tower +-1998869913=spooky2 +1411067174=gnome village2 +-2065077267=wild side +812947090=fanfare3 +1585002429=magicon,30 +1294629755=on the wing +2097127567=monkey badness +-2032107216=sojourn +1020264019=pest control +3237038=info +1473393027=fe fi fo fum +-1686202291=upper_depths +3540994=stop +1742080803=darkwood +740392969=little cave of horrors +-158379532=prayerglow +-691855347=in between +-200702983=the noble rodent +1652745754=forgotten +-1895307673=hitmark,3 +-1895307674=hitmark,2 +-1895307675=hitmark,1 +-1895307676=hitmark,0 +-1895307670=hitmark,6 +-1895307671=hitmark,5 +-1895307672=hitmark,4 +1968917071=bone dry +-850506182=trawler minor +197029040=mapscene +-808772318=in the pits +-1165315580=looking back +-1763090403=scape_ape +-1938177931=miscgraphics,11 +-1938177932=miscgraphics,10 +1936130561=thrall_of_the_serpent +1258863383=yesteryear +1994744000=slice of silent movie +-1691854169=dead can dance +1585002407=magicon,29 +1585002405=magicon,27 +1585002406=magicon,28 +271319484=frostbite +-499867199=meridian +1585002400=magicon,22 +-1938177930=miscgraphics,12 +-84626226=mudskipper melody +1585002403=magicon,25 +1585002404=magicon,26 +3641802=wall +1585002401=magicon,23 +1585002402=magicon,24 +-606457701=wolf mountain +1276599785=button_brown +1969878899=emotes,13 +1969878897=emotes,11 +1969878898=emotes,12 +1969878896=emotes,10 +-1938177928=miscgraphics,14 +-907669678=brew hoo hoo +-1938177929=miscgraphics,13 +72999866=subterranea +619237947=the galleon +-1764950404=scape sad +295831445=heart and mind +908430134=dangerous road +738888631=tradebacking +-174800339=verdana_11pt_regular +686705631=lightwalk +-601591436=side_background_bottom +-1479412376=the navigator +-359173459=zamorak zoo +744536246=null and void +-1701556798=magicoff2,39 +-1701556799=magicoff2,38 +-1396384012=bamboo +-200388662=lighthouse +133626717=suspicious +-810515425=voyage +3061973=crag +1802291895=big chords +-1661619479=elfwall +113315621=wood2 +1813041183=steelborder2,0 +429244831=slug a bug ball +1813041184=steelborder2,1 +-1658386264=shining_spirit +738909086=chamber +526264239=verdana_13pt_regular +-877351859=temple +2142215577=the mollusc menace +1124498189=warpath +-2136649922=no way out +-339706871=grimly_fiendish +547534551=wrath and ruin +544229147=lore and order +3327206=load +1610073470=lovakengj_sigil +-419218284=long way home +-662489856=food for thought +1306461568=stagnant +-1662171955=elfdoor +-1043985601=meddling kids +947464074=titlebutton +-1309055712=exposed +-1487348923=ambient jungle +-1829469821=lament of meiyerditch +233203434=leftarrow_small +-1216167350=dangerous +114464611=railings +-1106574323=legend +-1701556767=magicoff2,49 +-999707515=time to mine +-1701556768=magicoff2,48 +2129339097=magicon,9 +2129339096=magicon,8 +1959211510=mapfunction,42 +2129339095=magicon,7 +1959211511=mapfunction,43 +2129339094=magicon,6 +2129339093=magicon,5 +2129339092=magicon,4 +2129339091=magicon,3 +2129339090=magicon,2 +3522472=saga +-1701556769=magicoff2,47 +-544722449=rellekka +1033441676=tribal background +1915718129=the desolate isle +1890607150=magicon2,19 +1787618597=stranded +1717999087=forgettable melody +1959211512=mapfunction,44 +-243680400=peng_emotes,0 +1959211513=mapfunction,45 +1959211514=mapfunction,46 +1959211515=mapfunction,47 +1959211516=mapfunction,48 +1959211517=mapfunction,49 +1705947058=the cellar dwellers +1216634785=landlubber +1884768198=magicoff,40 +-1588113323=the rogues den +1884768199=magicoff,41 +-905842564=serene +-607599698=prayeroff,2 +-607599699=prayeroff,1 +1890607142=magicon2,11 +1389384362=monkey trouble +1890607143=magicon2,12 +1890607144=magicon2,13 +1890607145=magicon2,14 +1890607146=magicon2,15 +1890607147=magicon2,16 +1890607148=magicon2,17 +1966766798=mausoleum +1890607149=magicon2,18 +1808345541=armadyl alliance +290391725=options_slider,7 +1890607141=magicon2,10 +290391722=options_slider,4 +-607599696=prayeroff,4 +290391721=options_slider,3 +-607599697=prayeroff,3 +290391724=options_slider,6 +-607599694=prayeroff,6 +290391723=options_slider,5 +-607599695=prayeroff,5 +-607599692=prayeroff,8 +-607599693=prayeroff,7 +290391720=options_slider,2 +-607599691=prayeroff,9 +1334775925=chat_background +-1779127378=arabian2 +-1779127377=arabian3 +528722471=island life +1890607175=magicon2,23 +1890607176=magicon2,24 +949634504=mouse trap +1890607177=magicon2,25 +1890607178=magicon2,26 +1890607179=magicon2,27 +3327403=logo +290391719=options_slider,1 +1092249049=storm brew +290391718=options_slider,0 +404357804=everywhere +1890607172=magicon2,20 +1890607173=magicon2,21 +951530772=contest +1890607174=magicon2,22 +-1701556776=magicoff2,40 +1884768176=magicoff,39 +-395250469=corporal punishment +1749113330=newbie melody +1884768174=magicoff,37 +1884768175=magicoff,38 +-1701556772=magicoff2,44 +-1701556773=magicoff2,43 +-1701556774=magicoff2,42 +-1701556775=magicoff2,41 +-858121616=tzhaar +1884768172=magicoff,35 +1884768173=magicoff,36 +666772244=combat_shield +1884768170=magicoff,33 +1884768171=magicoff,34 +1959211509=mapfunction,41 +1639695510=mapmarker +-1661748240=friends_icons +-552301350=knightly +-1918044851=mastermindless +-1701556770=magicoff2,46 +-1701556771=magicoff2,45 +201526300=corporealbeast +1959211508=mapfunction,40 +105001967=nomad +-70910145=clickcross,3 +-1737914947=mapfunction,5 +1801745440=staticons2,11 +-70910146=clickcross,2 +-865479038=tribal +-1737914946=mapfunction,6 +1801745441=staticons2,12 +-70910147=clickcross,1 +-1737914945=mapfunction,7 +1801745442=staticons2,13 +-70910148=clickcross,0 +-1737914944=mapfunction,8 +1801745443=staticons2,14 +-1737914943=mapfunction,9 +1801745444=staticons2,15 +1801745445=staticons2,16 +1801745446=staticons2,17 +-1877545169=land down under +93921962=books +-1737914949=mapfunction,3 +-1737914948=mapfunction,4 +-1655721428=prayeroff,19 +-2136884405=title.jpg +-1655721429=prayeroff,18 +1584819628=magicoff,6 +1584819629=magicoff,7 +437480876=voodoo cult +1584819624=magicoff,2 +1584819625=magicoff,3 +1584819626=magicoff,4 +-1737914952=mapfunction,0 +1584819627=magicoff,5 +-1737914951=mapfunction,1 +124995564=harmony2 +1584819622=magicoff,0 +1801745439=staticons2,10 +1584819623=magicoff,1 +346263512=dorgeshun city +-1665011705=down and out +1890607180=magicon2,28 +1890607181=magicon2,29 +1417471781=titlescroll +1959211446=mapfunction,20 +1956141536=options_radio_buttons,0 +736568812=ballad of enchantment +-1737914950=mapfunction,2 +1959211447=mapfunction,21 +1959211448=mapfunction,22 +1959211449=mapfunction,23 +-1890130256=morytania +-70910141=clickcross,7 +-70910142=clickcross,6 +1956141539=options_radio_buttons,3 +-70910143=clickcross,5 +1956141538=options_radio_buttons,2 +284766976=splendour +-70910144=clickcross,4 +1956141537=options_radio_buttons,1 +196677638=the quizmaster +530068296=overture +-1123094568=sl_button +-700552779=hosidius_sigil +-614076819=sad meadow +1956141543=options_radio_buttons,7 +1956141542=options_radio_buttons,6 +1956141541=options_radio_buttons,5 +1956141540=options_radio_buttons,4 +1584819631=magicoff,9 +1846633612=gnome village +-2128560371=sl_back +1969878905=emotes,19 +306819362=crystal castle +1584819630=magicoff,8 +1969878903=emotes,17 +303737220=options_icons,7 +1969878904=emotes,18 +1969878901=emotes,15 +-78220817=devils_may_care +1969878902=emotes,16 +-40521666=dimension x +1969878900=emotes,14 +673424924=the lunar isle +789609582=brimstail's scales +303737222=options_icons,9 +303737221=options_icons,8 +1959211415=mapfunction,10 +3059343=coil +1959211416=mapfunction,11 +1959211417=mapfunction,12 +-1256560486=last_man_standing +1959211418=mapfunction,13 +336238005=rightarrow_small +1959211419=mapfunction,14 +-677662361=forever +-1655721430=prayeroff,17 +-1655721431=prayeroff,16 +-1655721432=prayeroff,15 +1959211420=mapfunction,15 +1959211663=mapfunction,90 +1959211421=mapfunction,16 +1959211422=mapfunction,17 +1959211423=mapfunction,18 +303737217=options_icons,4 +303737216=options_icons,3 +303737215=options_icons,2 +-1665005042=funny bunnies +303737214=options_icons,1 +303737219=options_icons,6 +303737218=options_icons,5 +303737213=options_icons,0 +95997798=we are the fairies +2001751835=desert heat +1959211424=mapfunction,19 +-1655721437=prayeroff,10 +687938017=clanwars +-1776024210=desolate_mage +-650944128=strength of saradomin +-1655721433=prayeroff,14 +1160873524=aye car rum ba +-1655721434=prayeroff,13 +-1655721435=prayeroff,12 +-1081314499=marble +-1655721436=prayeroff,11 +1097075475=reset,0 +1959211477=mapfunction,30 +-693313916=warriors guild +3506388=roof +1959211478=mapfunction,31 +1097075476=reset,1 +-2134967800=dagannoth dawn +-985763247=planks +1959211479=mapfunction,32 +1999746381=fenkenstrain's refrain +898010371=garden of winter +359174830=rat hunt +1959211482=mapfunction,35 +686441581=lightness +1959211483=mapfunction,36 +1959211484=mapfunction,37 +1959211485=mapfunction,38 +1959211486=mapfunction,39 +2023201035=dwarf theme +1959211480=mapfunction,33 +1959211481=mapfunction,34 +-1065532022=combatboxes,1 +-1065532021=combatboxes,2 +-1065532020=combatboxes,3 +1867160429=old_tiles +394756979=scape santa +25205919=elfroof2 +-663428071=dangerous way +-1065532023=combatboxes,0 +1959211450=mapfunction,24 +-895939599=spirit +1959211451=mapfunction,25 +1959211452=mapfunction,26 +1959211453=mapfunction,27 +1959211454=mapfunction,28 +1959211455=mapfunction,29 +-275310687=undercurrent +212205923=goblin village +-303898981=faithless +-1381531001=tomb raider +260940912=marzipan +1343267530=backhmid1 +1343267531=backhmid2 +1097468315=horizon +-1655721404=prayeroff,22 +623451622=kourend_the_magnificent +-1655721405=prayeroff,21 +-1655721406=prayeroff,20 +-1655721400=prayeroff,26 +-313384067=p12_full +-1655721401=prayeroff,25 +-1655721402=prayeroff,24 +-1655721403=prayeroff,23 +95848451=dream +1966781751=maws_jaws_claws +-995428255=parade +95734525=method of madness +-1308064877=hitmarks +1030045177=mutant medley +1333034828=blackmark +851641665=davy jones locker +417793574=scrollbar +1346720900=backleft2 +1884768206=magicoff,48 +1884768207=magicoff,49 +1801140808=fangs for the memory +1884768204=magicoff,46 +1345432055=pinball wizard +1884768205=magicoff,47 +-783693496=dance of the undead +1274780903=chompy hunt +465278529=the lost tribe +-1666437481=combaticons3,6 +2032696205=cabin fever +-1666437480=combaticons3,7 +1825640471=borderland +415928477=zeah_mining +1884768202=magicoff,44 +-607599700=prayeroff,0 +1884768203=magicoff,45 +1884768200=magicoff,42 +1884768201=magicoff,43 +-1666437487=combaticons3,0 +-1666437486=combaticons3,1 +813726263=crystal cave +1235442953=pathways +518814479=lullaby +-1666437483=combaticons3,4 +1585007985=magicon2,7 +-1666437482=combaticons3,5 +1585007986=magicon2,8 +-1666437485=combaticons3,2 +1585007987=magicon2,9 +-1666437484=combaticons3,3 +104080482=moody +1969878967=emotes,39 +-665666447=work work work +1364992651=evil bobs island +1969878965=emotes,37 +1227328817=verdana_15pt_regular +1969878966=emotes,38 +1969878963=emotes,35 +1581724013=monkey business +1969878964=emotes,36 +-74307138=miscellania +1969878961=emotes,33 +1969878962=emotes,34 +1969878960=emotes,32 +1131171307=wayward +-1154558416=sl_arrows +529929957=overpass +1258058669=huffman +-694094064=adventure +1171698653=orb_xp,1 +1171698652=orb_xp,0 +1171698655=orb_xp,3 +1171698654=orb_xp,2 +1802171733=arceuus_sigil +221109227=tears of guthix +-1661754893=elfroof +-1666437478=combaticons3,9 +1124565314=warrior +1969878958=emotes,30 +1969878959=emotes,31 +-934797897=reggae +2110260221=the genie +-1666437479=combaticons3,8 +104257585=mummy +-1923924724=sworddecor,0 +2136325196=staticons,17 +-1332194002=background +2136164423=homescape +-1923924721=sworddecor,3 +2136325194=staticons,15 +-1923924722=sworddecor,2 +-873564465=tiptoe +2136325195=staticons,16 +-1923924723=sworddecor,1 +123560953=espionage +2136325192=staticons,13 +2136325193=staticons,14 +1038911415=gnome king +2136325190=staticons,11 +2136325191=staticons,12 +1854274741=karamja jam +1969878989=emotes,40 +-1242708793=glyphs +563269755=the terrible tower +1650323088=twilight +-12868552=sea shanty +289742397=book of spells +1880989696=dragontooth island +2136325189=staticons,10 +110873=pen +-454421102=out of the deep +825919099=options_icons,19 +825919097=options_icons,17 +825919098=options_icons,18 +-1349119470=cursed +1585007978=magicon2,0 +825919095=options_icons,15 +1585007979=magicon2,1 +825919096=options_icons,16 +825919093=options_icons,13 +825919094=options_icons,14 +825919091=options_icons,11 +825919092=options_icons,12 +-895977880=sphinx +-874529881=city of the dead +825919090=options_icons,10 +1585007981=magicon2,3 +1585007982=magicon2,4 +1585007983=magicon2,5 +-1618729246=body parts +1585007984=magicon2,6 +1585007980=magicon2,2 +1086075866=shayzien_sigil +2103661451=jester minute +-911346307=steelborder,2 +-1809781334=button_brown_big +-911346306=steelborder,3 +-816227352=vision +-911346309=steelborder,0 +109407595=shine +-911346308=steelborder,1 +-119954464=combaticons3,12 +-119954465=combaticons3,11 +-1846853118=armageddon +-119954462=combaticons3,14 +-119954463=combaticons3,13 +-119954460=combaticons3,16 +-908183966=scarab +-119954461=combaticons3,15 +-282886672=home sweet home +103666243=march +1969878929=emotes,22 +1643875326=fire and brimstone +1969878927=emotes,20 +-119954466=combaticons3,10 +1969878928=emotes,21 +-839455633=close quarters +941457503=way of the enchanter +-1453405761=mor-ul-rek +-415134015=have a blast +-1658514874=floating free +1213477442=chickened out +-1619800349=emotes_locked,27 +-599680631=fear and loathing +-1081041422=insect queen +-1268786147=forest +-119954459=combaticons3,17 +-119954457=combaticons3,19 +-119954458=combaticons3,18 +-850395529=trouble brewing +-1773920521=cave of the goblins +-771284962=claustrophobia +1310729739=bankbuttons,2 +1306691868=upcoming +1465443077=over to nardah +1310729744=bankbuttons,7 +1310729743=bankbuttons,6 +1310729742=bankbuttons,5 +1234827707=deep wildy +-90350772=xenophobe +-750127868=arabian +1310729741=bankbuttons,4 +1310729740=bankbuttons,3 +1041911129=waterlogged +108875897=runes +1447063382=barb wire +-378865792=magic dance +285466503=overlay_duel +1814287296=zeah_magic +1976894499=down to earth +1969878936=emotes,29 +1969878934=emotes,27 +-1567437308=deadlands +1969878935=emotes,28 +1310729738=bankbuttons,1 +1969878932=emotes,25 +-957019274=too many cooks +1310729737=bankbuttons,0 +2092627105=silence +1969878933=emotes,26 +1969878930=emotes,23 +1969878931=emotes,24 +-901674570=well of voyage diff --git a/cache/src/test/java/net/runelite/cache/AreaDumper.java b/cache/src/test/java/net/runelite/cache/AreaDumper.java index b789d78a0d..2aab1db48b 100644 --- a/cache/src/test/java/net/runelite/cache/AreaDumper.java +++ b/cache/src/test/java/net/runelite/cache/AreaDumper.java @@ -64,7 +64,7 @@ public class AreaDumper for (AreaDefinition area : areaManager.getAreas()) { - Files.write(gson.toJson(area), new File(outDir, area.id + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/CacheProperties.java b/cache/src/test/java/net/runelite/cache/CacheProperties.java index 50da8759dc..5614563f72 100644 --- a/cache/src/test/java/net/runelite/cache/CacheProperties.java +++ b/cache/src/test/java/net/runelite/cache/CacheProperties.java @@ -30,7 +30,7 @@ import java.util.Properties; public class CacheProperties { - private static Properties getProperies() throws IOException + private static Properties getProperties() throws IOException { Properties properties = new Properties(); InputStream resourceAsStream = StoreLocation.class.getResourceAsStream("/cache.properties"); @@ -40,11 +40,11 @@ public class CacheProperties public static int getRsVersion() throws IOException { - return Integer.parseInt(getProperies().getProperty("rs.version")); + return Integer.parseInt(getProperties().getProperty("rs.version")); } public static int getCacheVersion() throws IOException { - return Integer.parseInt(getProperies().getProperty("cache.version")); + return Integer.parseInt(getProperties().getProperty("cache.version")); } } diff --git a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java index a094b9fc24..705356b0b5 100644 --- a/cache/src/test/java/net/runelite/cache/EnumDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/EnumDumperTest.java @@ -80,7 +80,7 @@ public class EnumDumperTest if (def != null) { - Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FrameDumper.java b/cache/src/test/java/net/runelite/cache/FrameDumper.java index 2bd7e2ca17..f6cc20532d 100644 --- a/cache/src/test/java/net/runelite/cache/FrameDumper.java +++ b/cache/src/test/java/net/runelite/cache/FrameDumper.java @@ -88,7 +88,7 @@ public class FrameDumper int framemapArchiveId = (contents[0] & 0xff) << 8 | contents[1] & 0xff; - Archive framemapArchive = framemapIndex.getArchives().get(framemapArchiveId); + Archive framemapArchive = framemapIndex.getArchive(framemapArchiveId); archiveData = storage.loadArchive(framemapArchive); byte[] framemapContents = framemapArchive.decompress(archiveData); @@ -101,7 +101,7 @@ public class FrameDumper frames.add(frame); } - Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(frames)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/FramemapDumper.java b/cache/src/test/java/net/runelite/cache/FramemapDumper.java index 4513bf3dfb..f95e92c9fa 100644 --- a/cache/src/test/java/net/runelite/cache/FramemapDumper.java +++ b/cache/src/test/java/net/runelite/cache/FramemapDumper.java @@ -74,7 +74,7 @@ public class FramemapDumper FramemapLoader loader = new FramemapLoader(); FramemapDefinition framemap = loader.load(0, contents); - Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(framemap)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/InventoryDumper.java b/cache/src/test/java/net/runelite/cache/InventoryDumper.java index 4caf464141..f74c4ce188 100644 --- a/cache/src/test/java/net/runelite/cache/InventoryDumper.java +++ b/cache/src/test/java/net/runelite/cache/InventoryDumper.java @@ -77,7 +77,7 @@ public class InventoryDumper InventoryLoader loader = new InventoryLoader(); InventoryDefinition inv = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(inv), new File(outDir, inv.id + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, inv.id + ".json"), Charset.defaultCharset()).write(gson.toJson(inv)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/KitDumperTest.java b/cache/src/test/java/net/runelite/cache/KitDumperTest.java index 286ca6ea8e..4db1267506 100644 --- a/cache/src/test/java/net/runelite/cache/KitDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/KitDumperTest.java @@ -78,7 +78,7 @@ public class KitDumperTest KitDefinition def = loader.load(file.getFileId(), b); - Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/MapDumperTest.java b/cache/src/test/java/net/runelite/cache/MapDumperTest.java index 70d20dcb0f..8d1fffd7cb 100644 --- a/cache/src/test/java/net/runelite/cache/MapDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/MapDumperTest.java @@ -165,7 +165,7 @@ public class MapDumperTest @Test @Ignore - public void dunpJson() throws IOException + public void dumpJson() throws IOException { File base = StoreLocation.LOCATION, outDir = folder.newFolder(); diff --git a/cache/src/test/java/net/runelite/cache/OverlayDumper.java b/cache/src/test/java/net/runelite/cache/OverlayDumper.java index 4ac4b53a7c..51457192b7 100644 --- a/cache/src/test/java/net/runelite/cache/OverlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/OverlayDumper.java @@ -77,7 +77,7 @@ public class OverlayDumper OverlayLoader loader = new OverlayLoader(); OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(overlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(overlay)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SequenceDumper.java b/cache/src/test/java/net/runelite/cache/SequenceDumper.java index 94dd175bbb..485bd3d84f 100644 --- a/cache/src/test/java/net/runelite/cache/SequenceDumper.java +++ b/cache/src/test/java/net/runelite/cache/SequenceDumper.java @@ -77,7 +77,7 @@ public class SequenceDumper SequenceLoader loader = new SequenceLoader(); SequenceDefinition seq = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(seq), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(seq)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java index c2a420c0de..ec332656b2 100644 --- a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java @@ -27,11 +27,16 @@ package net.runelite.cache; import com.google.common.io.Files; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import java.io.File; + + import java.io.IOException; +import java.io.File; +import java.io.FileOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.ByteArrayInputStream; import java.nio.charset.Charset; -import net.runelite.cache.definitions.loaders.sound.SoundEffectLoader; -import net.runelite.cache.definitions.sound.SoundEffectDefinition; +import net.runelite.cache.definitions.loaders.sound.SoundEffectTrackLoader; +import net.runelite.cache.definitions.sound.SoundEffectTrackDefinition; import net.runelite.cache.fs.Archive; import net.runelite.cache.fs.Index; import net.runelite.cache.fs.Storage; @@ -42,6 +47,11 @@ import org.junit.rules.TemporaryFolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.sound.sampled.AudioFileFormat; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; + public class SoundEffectsDumperTest { private static final Logger logger = LoggerFactory.getLogger(SoundEffectsDumperTest.class); @@ -68,8 +78,8 @@ public class SoundEffectsDumperTest { byte[] contents = archive.decompress(storage.loadArchive(archive)); - SoundEffectLoader soundEffectLoader = new SoundEffectLoader(); - SoundEffectDefinition soundEffect = soundEffectLoader.load(contents); + SoundEffectTrackLoader setLoader = new SoundEffectTrackLoader(); + SoundEffectTrackDefinition soundEffect = setLoader.load(contents); Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); ++count; @@ -78,4 +88,58 @@ public class SoundEffectsDumperTest logger.info("Dumped {} sound effects to {}", count, dumpDir); } -} + + @Test + public void extractWavTest() throws IOException + { + File dumpDir = folder.newFolder(); + int count = 0; + + try (Store store = new Store(StoreLocation.LOCATION)) + { + store.load(); + + Storage storage = store.getStorage(); + Index index = store.getIndex(IndexType.SOUNDEFFECTS); + + for (Archive archive : index.getArchives()) + { + byte[] contents = archive.decompress(storage.loadArchive(archive)); + + SoundEffectTrackLoader setLoader = new SoundEffectTrackLoader(); + SoundEffectTrackDefinition soundEffect = setLoader.load(contents); + try + { + Object audioStream; + byte[] data = soundEffect.mix(); + + AudioFormat audioFormat = new AudioFormat(22050.0f, 8, 1, true, false); + audioStream = new AudioInputStream(new ByteArrayInputStream(data), audioFormat, data.length); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + AudioSystem.write((AudioInputStream) audioStream, AudioFileFormat.Type.WAVE, bos); + data = bos.toByteArray(); + + FileOutputStream fos = new FileOutputStream(new File(dumpDir, archive.getArchiveId() + ".wav")); + + try + { + fos.write(data); + } + finally + { + fos.close(); + } + + ++count; + } + catch (Exception e) + { + continue; + } + } + } + + logger.info("Dumped {} sound effects to {}", count, dumpDir); + } +} \ No newline at end of file diff --git a/cache/src/test/java/net/runelite/cache/StructManagerTest.java b/cache/src/test/java/net/runelite/cache/StructManagerTest.java index 470df61bc0..f1a1fb22ca 100644 --- a/cache/src/test/java/net/runelite/cache/StructManagerTest.java +++ b/cache/src/test/java/net/runelite/cache/StructManagerTest.java @@ -64,7 +64,7 @@ public class StructManagerTest { StructDefinition def = struct.getValue(); - Files.write(gson.toJson(def), new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/TextureDumper.java b/cache/src/test/java/net/runelite/cache/TextureDumper.java index cdcdbd9f6a..0aba683504 100644 --- a/cache/src/test/java/net/runelite/cache/TextureDumper.java +++ b/cache/src/test/java/net/runelite/cache/TextureDumper.java @@ -64,7 +64,7 @@ public class TextureDumper for (TextureDefinition texture : tm.getTextures()) { - Files.write(gson.toJson(texture), new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()).write(gson.toJson(texture)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java index db735d40cf..04f2997530 100644 --- a/cache/src/test/java/net/runelite/cache/UnderlayDumper.java +++ b/cache/src/test/java/net/runelite/cache/UnderlayDumper.java @@ -77,7 +77,7 @@ public class UnderlayDumper UnderlayLoader loader = new UnderlayLoader(); UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(underlay)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/VarbitDumper.java b/cache/src/test/java/net/runelite/cache/VarbitDumper.java index 5f75c7a157..9bcdcf9237 100644 --- a/cache/src/test/java/net/runelite/cache/VarbitDumper.java +++ b/cache/src/test/java/net/runelite/cache/VarbitDumper.java @@ -77,7 +77,7 @@ public class VarbitDumper VarbitLoader loader = new VarbitLoader(); VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents()); - Files.write(gson.toJson(varbit), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(varbit)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java index 8d8dd956c4..92b2582a91 100644 --- a/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/WorldMapDumperTest.java @@ -77,7 +77,7 @@ public class WorldMapDumperTest WorldMapLoader loader = new WorldMapLoader(); WorldMapDefinition def = loader.load(file.getContents(), file.getFileId()); - Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def)); ++count; } } diff --git a/cache/src/test/java/net/runelite/cache/definitions/savers/InterfaceSaverTest.java b/cache/src/test/java/net/runelite/cache/definitions/savers/InterfaceSaverTest.java index 6d95f445a9..e1955a6f79 100644 --- a/cache/src/test/java/net/runelite/cache/definitions/savers/InterfaceSaverTest.java +++ b/cache/src/test/java/net/runelite/cache/definitions/savers/InterfaceSaverTest.java @@ -1,65 +1,65 @@ -/* - * 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.cache.definitions.savers; - -import java.io.File; -import net.runelite.cache.IndexType; -import net.runelite.cache.StoreLocation; -import net.runelite.cache.definitions.InterfaceDefinition; -import net.runelite.cache.definitions.loaders.InterfaceLoader; -import net.runelite.cache.fs.Archive; -import net.runelite.cache.fs.ArchiveFiles; -import net.runelite.cache.fs.FSFile; -import net.runelite.cache.fs.Index; -import net.runelite.cache.fs.Storage; -import net.runelite.cache.fs.Store; -import static org.junit.Assert.assertArrayEquals; -import org.junit.Test; - -public class InterfaceSaverTest -{ - @Test - public void testSave() throws Exception - { - File base = StoreLocation.LOCATION; - try (Store store = new Store(base)) - { - store.load(); - - Storage storage = store.getStorage(); - Index index = store.getIndex(IndexType.INTERFACES); - Archive archive = index.getArchive(31); - byte[] archiveData = storage.loadArchive(archive); - ArchiveFiles files = archive.getFiles(archiveData); - FSFile file = files.findFile(76); - byte[] contents = file.getContents(); - - InterfaceDefinition def = new InterfaceLoader().load(0, contents); - byte[] b = new InterfaceSaver().save(def); - assertArrayEquals(contents, b); - } - } - -} +/* + * 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.cache.definitions.savers; + +import java.io.File; +import net.runelite.cache.IndexType; +import net.runelite.cache.StoreLocation; +import net.runelite.cache.definitions.InterfaceDefinition; +import net.runelite.cache.definitions.loaders.InterfaceLoader; +import net.runelite.cache.fs.Archive; +import net.runelite.cache.fs.ArchiveFiles; +import net.runelite.cache.fs.FSFile; +import net.runelite.cache.fs.Index; +import net.runelite.cache.fs.Storage; +import net.runelite.cache.fs.Store; +import static org.junit.Assert.assertArrayEquals; +import org.junit.Test; + +public class InterfaceSaverTest +{ + @Test + public void testSave() throws Exception + { + File base = StoreLocation.LOCATION; + try (Store store = new Store(base)) + { + store.load(); + + Storage storage = store.getStorage(); + Index index = store.getIndex(IndexType.INTERFACES); + Archive archive = index.getArchive(31); + byte[] archiveData = storage.loadArchive(archive); + ArchiveFiles files = archive.getFiles(archiveData); + FSFile file = files.findFile(76); + byte[] contents = file.getContents(); + + InterfaceDefinition def = new InterfaceLoader().load(0, contents); + byte[] b = new InterfaceSaver().save(def); + assertArrayEquals(contents, b); + } + } + +} diff --git a/cache/src/test/java/net/runelite/cache/definitions/savers/ScriptSaverTest.java b/cache/src/test/java/net/runelite/cache/definitions/savers/ScriptSaverTest.java index a2b55676bd..4d429632ca 100644 --- a/cache/src/test/java/net/runelite/cache/definitions/savers/ScriptSaverTest.java +++ b/cache/src/test/java/net/runelite/cache/definitions/savers/ScriptSaverTest.java @@ -1,66 +1,66 @@ -/* - * 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.cache.definitions.savers; - -import java.io.IOException; -import net.runelite.cache.definitions.ScriptDefinition; -import net.runelite.cache.definitions.loaders.ScriptLoader; -import net.runelite.cache.script.Instructions; -import net.runelite.cache.script.assembler.Assembler; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -/** - * - * @author Adam - */ -public class ScriptSaverTest -{ - private static final String SCRIPT_RESOURCE = "/net/runelite/cache/script/assembler/91.rs2asm"; - private static final String SCRIPT_RESOURCE_UNICODE = "/net/runelite/cache/script/assembler/Unicode.rs2asm"; - - @Test - public void testSave() throws IOException - { - Instructions instructions = new Instructions(); - instructions.init(); - ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE)); - byte[] saved = new ScriptSaver().save(script); - ScriptDefinition loadedScripot = new ScriptLoader().load(91, saved); - assertEquals(script, loadedScripot); - } - - @Test - public void testSaveUnicode() throws IOException - { - Instructions instructions = new Instructions(); - instructions.init(); - ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE_UNICODE)); - byte[] saved = new ScriptSaver().save(script); - ScriptDefinition loadedScripot = new ScriptLoader().load(1001, saved); - assertEquals(script, loadedScripot); - } - -} +/* + * 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.cache.definitions.savers; + +import java.io.IOException; +import net.runelite.cache.definitions.ScriptDefinition; +import net.runelite.cache.definitions.loaders.ScriptLoader; +import net.runelite.cache.script.Instructions; +import net.runelite.cache.script.assembler.Assembler; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +/** + * + * @author Adam + */ +public class ScriptSaverTest +{ + private static final String SCRIPT_RESOURCE = "/net/runelite/cache/script/assembler/91.rs2asm"; + private static final String SCRIPT_RESOURCE_UNICODE = "/net/runelite/cache/script/assembler/Unicode.rs2asm"; + + @Test + public void testSave() throws IOException + { + Instructions instructions = new Instructions(); + instructions.init(); + ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE)); + byte[] saved = new ScriptSaver().save(script); + ScriptDefinition loadedScripot = new ScriptLoader().load(91, saved); + assertEquals(script, loadedScripot); + } + + @Test + public void testSaveUnicode() throws IOException + { + Instructions instructions = new Instructions(); + instructions.init(); + ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE_UNICODE)); + byte[] saved = new ScriptSaver().save(script); + ScriptDefinition loadedScripot = new ScriptLoader().load(1001, saved); + assertEquals(script, loadedScripot); + } + +} diff --git a/cache/src/test/java/net/runelite/cache/fs/ContainerTest.java b/cache/src/test/java/net/runelite/cache/fs/ContainerTest.java index 1aca0df4ba..113385909b 100644 --- a/cache/src/test/java/net/runelite/cache/fs/ContainerTest.java +++ b/cache/src/test/java/net/runelite/cache/fs/ContainerTest.java @@ -1,55 +1,55 @@ -/* - * 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.cache.fs; - -import java.io.IOException; -import java.util.Random; -import static net.runelite.cache.fs.jagex.CompressionType.GZ; -import static org.junit.Assert.assertArrayEquals; -import org.junit.Test; - -public class ContainerTest -{ - - @Test - public void testCompress() throws IOException - { - int[] keys = new int[] - { - 4, 8, 15, 16 - }; - Random random = new Random(42L); - byte[] data = new byte[1024]; - random.nextBytes(data); - - Container container = new Container(GZ, -1); - container.compress(data, keys); - byte[] compressedData = container.data; - - container = Container.decompress(compressedData, keys); - assertArrayEquals(data, container.data); - } - -} +/* + * 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.cache.fs; + +import java.io.IOException; +import java.util.Random; +import static net.runelite.cache.fs.jagex.CompressionType.GZ; +import static org.junit.Assert.assertArrayEquals; +import org.junit.Test; + +public class ContainerTest +{ + + @Test + public void testCompress() throws IOException + { + int[] keys = new int[] + { + 4, 8, 15, 16 + }; + Random random = new Random(42L); + byte[] data = new byte[1024]; + random.nextBytes(data); + + Container container = new Container(GZ, -1); + container.compress(data, keys); + byte[] compressedData = container.data; + + container = Container.decompress(compressedData, keys); + assertArrayEquals(data, container.data); + } + +} diff --git a/cache/src/test/java/net/runelite/cache/fs/jagex/DiskStorageTest.java b/cache/src/test/java/net/runelite/cache/fs/jagex/DiskStorageTest.java index 6d6035a61e..240b7c67d7 100644 --- a/cache/src/test/java/net/runelite/cache/fs/jagex/DiskStorageTest.java +++ b/cache/src/test/java/net/runelite/cache/fs/jagex/DiskStorageTest.java @@ -1,102 +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.cache.fs.jagex; - -import java.io.File; -import net.runelite.cache.StoreLocation; -import net.runelite.cache.fs.Archive; -import net.runelite.cache.fs.Container; -import net.runelite.cache.fs.Index; -import net.runelite.cache.fs.Store; -import net.runelite.cache.index.FileData; -import org.junit.Test; -import static org.junit.Assert.*; -import org.junit.Rule; -import org.junit.rules.TemporaryFolder; - -public class DiskStorageTest -{ - @Rule - public TemporaryFolder folder = StoreLocation.getTemporaryFolder(); - - @Test - public void testSaveArchive() throws Exception - { - File file = folder.newFolder(); - DiskStorage storage = new DiskStorage(file); - Archive archive; - Archive archive2; - try (Store store = new Store(storage)) - { - Index index = store.addIndex(0); - archive = index.addArchive(0); - archive2 = index.addArchive(1); - - FileData[] fileData = new FileData[1]; - archive.setFileData(fileData); - fileData[0] = new FileData(); - - FileData[] fileData2 = new FileData[1]; - archive2.setFileData(fileData2); - fileData2[0] = new FileData(); - - byte[] data = "test".getBytes(); - Container container = new Container(archive.getCompression(), -1); - container.compress(data, null); - byte[] compressedData = container.data; - storage.saveArchive(archive, compressedData); - - container = new Container(archive.getCompression(), 42); - container.compress(data, null); - compressedData = container.data; - archive2.setRevision(42); - storage.saveArchive(archive2, compressedData); - - store.save(); - } - - storage = new DiskStorage(file); - try (Store store = new Store(storage)) - { - store.load(); - Index index = store.findIndex(0); - Archive archive2_1 = index.getArchive(0); - Archive archive2_2 = index.getArchive(1); - - byte[] comprsesedData = storage.loadArchive(archive2_1); - byte[] data = archive2_1.decompress(comprsesedData); - assertArrayEquals("test".getBytes(), data); - assertEquals(archive.getCrc(), archive2_1.getCrc()); - assertEquals(archive.getRevision(), archive2_1.getRevision()); - - comprsesedData = storage.loadArchive(archive2_2); - data = archive2_2.decompress(comprsesedData); - assertArrayEquals("test".getBytes(), data); - assertEquals(archive2.getCrc(), archive2_2.getCrc()); - assertEquals(archive2.getRevision(), archive2_2.getRevision()); - } - } - -} +/* + * 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.cache.fs.jagex; + +import java.io.File; +import net.runelite.cache.StoreLocation; +import net.runelite.cache.fs.Archive; +import net.runelite.cache.fs.Container; +import net.runelite.cache.fs.Index; +import net.runelite.cache.fs.Store; +import net.runelite.cache.index.FileData; +import org.junit.Test; +import static org.junit.Assert.*; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; + +public class DiskStorageTest +{ + @Rule + public TemporaryFolder folder = StoreLocation.getTemporaryFolder(); + + @Test + public void testSaveArchive() throws Exception + { + File file = folder.newFolder(); + DiskStorage storage = new DiskStorage(file); + Archive archive; + Archive archive2; + try (Store store = new Store(storage)) + { + Index index = store.addIndex(0); + archive = index.addArchive(0); + archive2 = index.addArchive(1); + + FileData[] fileData = new FileData[1]; + archive.setFileData(fileData); + fileData[0] = new FileData(); + + FileData[] fileData2 = new FileData[1]; + archive2.setFileData(fileData2); + fileData2[0] = new FileData(); + + byte[] data = "test".getBytes(); + Container container = new Container(archive.getCompression(), -1); + container.compress(data, null); + byte[] compressedData = container.data; + storage.saveArchive(archive, compressedData); + + container = new Container(archive.getCompression(), 42); + container.compress(data, null); + compressedData = container.data; + archive2.setRevision(42); + storage.saveArchive(archive2, compressedData); + + store.save(); + } + + storage = new DiskStorage(file); + try (Store store = new Store(storage)) + { + store.load(); + Index index = store.findIndex(0); + Archive archive2_1 = index.getArchive(0); + Archive archive2_2 = index.getArchive(1); + + byte[] comprsesedData = storage.loadArchive(archive2_1); + byte[] data = archive2_1.decompress(comprsesedData); + assertArrayEquals("test".getBytes(), data); + assertEquals(archive.getCrc(), archive2_1.getCrc()); + assertEquals(archive.getRevision(), archive2_1.getRevision()); + + comprsesedData = storage.loadArchive(archive2_2); + data = archive2_2.decompress(comprsesedData); + assertArrayEquals("test".getBytes(), data); + assertEquals(archive2.getCrc(), archive2_2.getCrc()); + assertEquals(archive2.getRevision(), archive2_2.getRevision()); + } + } + +} diff --git a/cache/src/test/java/net/runelite/cache/io/OutputStreamTest.java b/cache/src/test/java/net/runelite/cache/io/OutputStreamTest.java index 42bbc238bb..8fd46d9137 100644 --- a/cache/src/test/java/net/runelite/cache/io/OutputStreamTest.java +++ b/cache/src/test/java/net/runelite/cache/io/OutputStreamTest.java @@ -1,59 +1,59 @@ -/* - * 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.cache.io; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class OutputStreamTest -{ - @Test - public void testWriteBigSmart() - { - OutputStream os = new OutputStream(); - os.writeBigSmart(42); - os.writeBigSmart(70000); - os.writeBigSmart(65535); - - InputStream is = new InputStream(os.getArray()); - assertEquals(42, is.readBigSmart()); - assertEquals(70000, is.readBigSmart()); - assertEquals(65535, is.readBigSmart()); - } - - @Test - public void testWriteString() - { - char[] c = new char[]{32, 160}; - String str = new String(c, 0, c.length); - - OutputStream os = new OutputStream(); - os.writeString(str); - - // 1 byte length + 32 + 160 - assertEquals(3, os.getOffset()); - } - -} +/* + * 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.cache.io; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class OutputStreamTest +{ + @Test + public void testWriteBigSmart() + { + OutputStream os = new OutputStream(); + os.writeBigSmart(42); + os.writeBigSmart(70000); + os.writeBigSmart(65535); + + InputStream is = new InputStream(os.getArray()); + assertEquals(42, is.readBigSmart()); + assertEquals(70000, is.readBigSmart()); + assertEquals(65535, is.readBigSmart()); + } + + @Test + public void testWriteString() + { + char[] c = new char[]{32, 160}; + String str = new String(c, 0, c.length); + + OutputStream os = new OutputStream(); + os.writeString(str); + + // 1 byte length + 32 + 160 + assertEquals(3, os.getOffset()); + } + +} diff --git a/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java b/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java deleted file mode 100644 index 30fb140a1b..0000000000 --- a/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, 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.cache.item; - -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; -import lombok.extern.slf4j.Slf4j; -import net.runelite.cache.IndexType; -import net.runelite.cache.ItemManager; -import net.runelite.cache.SpriteManager; -import net.runelite.cache.StoreLocation; -import net.runelite.cache.TextureManager; -import net.runelite.cache.definitions.ItemDefinition; -import net.runelite.cache.definitions.ModelDefinition; -import net.runelite.cache.definitions.loaders.ModelLoader; -import net.runelite.cache.definitions.providers.ModelProvider; -import net.runelite.cache.fs.Archive; -import net.runelite.cache.fs.Index; -import net.runelite.cache.fs.Store; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -@Slf4j -public class ItemSpriteFactoryTest -{ - @Rule - public TemporaryFolder folder = StoreLocation.getTemporaryFolder(); - - @Test - @Ignore - public void test() throws IOException - { - File base = StoreLocation.LOCATION, - outDir = folder.newFolder(); - - int count = 0; - - try (Store store = new Store(base)) - { - store.load(); - - ItemManager itemManager = new ItemManager(store); - itemManager.load(); - - ModelProvider modelProvider = new ModelProvider() - { - @Override - public ModelDefinition provide(int modelId) throws IOException - { - Index models = store.getIndex(IndexType.MODELS); - Archive archive = models.getArchive(modelId); - - byte[] data = archive.decompress(store.getStorage().loadArchive(archive)); - ModelDefinition inventoryModel = new ModelLoader().load(modelId, data); - return inventoryModel; - } - }; - - SpriteManager spriteManager = new SpriteManager(store); - spriteManager.load(); - - TextureManager textureManager = new TextureManager(store); - textureManager.load(); - - for (ItemDefinition itemDef : itemManager.getItems()) - { - if (itemDef.name == null || itemDef.name.equalsIgnoreCase("null")) - { - continue; - } - - try - { - BufferedImage sprite = ItemSpriteFactory.createSprite(itemManager, modelProvider, spriteManager, textureManager, - itemDef.id, 1, 1, 3153952, false); - - File out = new File(outDir, itemDef.id + ".png"); - BufferedImage img = sprite; - ImageIO.write(img, "PNG", out); - - ++count; - } - catch (Exception ex) - { - log.warn("error dumping item {}", itemDef.id, ex); - } - } - } - - log.info("Dumped {} item images to {}", count, outDir); - } -} \ No newline at end of file diff --git a/cache/src/test/java/net/runelite/cache/util/Djb2Test.java b/cache/src/test/java/net/runelite/cache/util/Djb2Test.java index 5c3933b69d..49fb44df11 100644 --- a/cache/src/test/java/net/runelite/cache/util/Djb2Test.java +++ b/cache/src/test/java/net/runelite/cache/util/Djb2Test.java @@ -1,40 +1,40 @@ -/* - * 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.cache.util; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class Djb2Test -{ - - @Test - public void testHash() - { - int hash = Djb2.hash("l49_52"); - assertEquals(-1153204821, hash); - } - -} +/* + * 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.cache.util; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class Djb2Test +{ + + @Test + public void testHash() + { + int hash = Djb2.hash("l49_52"); + assertEquals(-1153204821, hash); + } + +} diff --git a/checkstyle.xml b/checkstyle.xml index e8669a742c..c1935e18a2 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -1,6 +1,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codebase b/codebase new file mode 100644 index 0000000000..ec9ec98cc5 --- /dev/null +++ b/codebase @@ -0,0 +1 @@ +http://oldschool17.runescape.com/ diff --git a/deobfuscator/build.gradle b/deobfuscator/build.gradle new file mode 100644 index 0000000000..7ee533ad4a --- /dev/null +++ b/deobfuscator/build.gradle @@ -0,0 +1,22 @@ + +description = 'Deobfuscator' +dependencies { + compile project(':runelite-api') + compile project(':runescape-api') + compile group: 'net.runelite', name: 'fernflower', version:'20171017' + compile group: 'com.google.guava', name: 'guava', version:'28.0-jre' + compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25' + compile group: 'com.google.code.gson', name: 'gson', version:'2.8.5' + compile group: 'org.ow2.asm', name: 'asm-debug-all', version:'5.2' + runtime group: 'org.slf4j', name: 'slf4j-simple', version:'1.7.26' + testCompile project(':rs-client') + testCompile group: 'net.runelite.rs', name: 'vanilla', version:'181' + testCompile group: 'junit', name: 'junit', version:'4.12' + testCompile group: 'org.mockito', name: 'mockito-all', version:'1.10.19' +} + +task packageTests(type: Jar) { + from sourceSets.test.output + classifier = 'tests' +} +artifacts.archives packageTests 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..6d9110a3b3 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java @@ -0,0 +1,446 @@ +/* + * 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(Class::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(Class::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 findStaticMethod(String name, Signature type) + { + for (Method m : methods) + { + if (m.isStatic() && + 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 findStaticMethod(String name) + { + for (Method m : methods) + { + if (m.isStatic() && 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 = findStaticMethod(name, type); + if (m != null) + { + 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..416281c305 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.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; + +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; +import net.runelite.asm.signature.Signature; + +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(); + } + } + } + + public Method findStaticMethod(String name, Signature type) + { + Method m = null; + + for (ClassFile cf : classes) + { + m = cf.findStaticMethod(name, type); + + if (m != null) + { + break; + } + } + + return m; + } + + public Method findStaticMethod(String name) + { + Method m = null; + + for (ClassFile cf : classes) + { + m = cf.findStaticMethod(name); + + if (m != null) + { + break; + } + } + + return m; + } +} 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..f5994ad1d3 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/Interfaces.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.List; +import java.util.stream.Collectors; +import net.runelite.asm.pool.Class; +import net.runelite.deob.DeobAnnotations; + +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; + } + + public List getIntfNames() + { + final List names = new ArrayList<>(); + for (ClassFile c : getMyInterfaces()) + { + String name = DeobAnnotations.getObfuscatedName(c.getAnnotations()); + if (name == null) + { + continue; + } + + names.add(name); + } + + return names; + } +} 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..e8cbdef92b --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/Method.java @@ -0,0 +1,321 @@ +/* + * 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(boolean s) + { + if (s) + { + accessFlags |= ACC_STATIC; + } + else + { + 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..89eb3b3023 --- /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") && s.endsWith(";")) + { + 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/runelite-client/src/main/java/net/runelite/client/plugins/batools/Calls.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java similarity index 52% rename from runelite-client/src/main/java/net/runelite/client/plugins/batools/Calls.java rename to deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java index 0c273f5be5..b1209a6631 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/batools/Calls.java +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Cameron + * Copyright (c) 2016-2017, Adam * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,63 +22,90 @@ * (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.client.plugins.batools; -import java.util.HashMap; -import java.util.Map; +package net.runelite.asm.attributes.code; -public enum Calls +import net.runelite.asm.ClassFile; +import net.runelite.asm.pool.Class; + +public class Exception implements Cloneable { - //Attacker Calls - RED_EGG("Red egg", "Tell-red"), - GREEN_EGG("Green egg", "Tell-green"), - BLUE_EGG("Blue egg", "Tell-blue"), - //Collector Calls - CONTROLLED("Controlled/Bullet/Wind", "Tell-controlled"), - ACCURATE("Accurate/Field/Water", "Tell-accurate"), - AGGRESSIVE("Aggressive/Blunt/Earth", "Tell-aggressive"), - DEFENSIVE("Defensive/Barbed/Fire", "Tell-defensive"), - //Healer Calls - TOFU("Tofu", "Tell-tofu"), - CRACKERS("Crackers", "Tell-crackers"), - WORMS("Worms", "Tell-worms"), - //Defender Calls - POIS_WORMS("Pois. Worms", "Tell-worms"), - POIS_TOFU("Pois. Tofu", "Tell-tofu"), - POIS_MEAT("Pois. Meat", "Tell-meat"); + private Exceptions exceptions; - private final String call; - private final String option; + private Label start, end, handler; + private Class catchType; - private static final Map CALL_MENU = new HashMap<>(); - - static + public Exception(Exceptions exceptions) { - for (Calls s : values()) + this.exceptions = exceptions; + } + + @Override + public Exception clone() + { + try { - CALL_MENU.put(s.getCall(), s.getOption()); + return (Exception) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(); } } - - Calls(String call, String option) + + public Exceptions getExceptions() { - this.call = call; - this.option = option; + 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 String getCall() + public void setEnd(Label end) { - return call; + this.end = end; + } + + public Label getHandler() + { + return handler; } - public String getOption() + public void setHandler(Label handler) { - return option; + this.handler = handler; + } + + public Class getCatchType() + { + return catchType; } - public static String getOption(String call) + public void setCatchType(Class catchType) { - return CALL_MENU.get(call); + 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 clazz; + + InstructionType(int op, String name, Class clazz) + { + this.code = op; + this.name = name; + this.clazz = clazz; + } + + public int getCode() + { + return code; + } + + public String getName() + { + return name; + } + + public Class 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/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java new file mode 100644 index 0000000000..3956b453d1 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2018 Morgan Lewis + * 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 org.objectweb.asm.Label; + +public class LocalVariable +{ + private final String name; + private final String desc; + private final String signature; + private final Label start; + private final Label end; + private final int index; + + public LocalVariable(String name, String desc, String signature, Label start, Label end, int index) + { + this.name = name; + this.desc = desc; + this.signature = signature; + this.start = start; + this.end = end; + this.index = index; + } + + public String getName() + { + return name; + } + + public String getDesc() + { + 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/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java new file mode 100644 index 0000000000..2bc361ef44 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java @@ -0,0 +1,33 @@ +/* + * 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 IntInstruction +{ + int getOperand(); + + 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