Created
October 28, 2020 17:58
-
-
Save Subby/2a44c9b6191be0b38e57130f92f5f80c to your computer and use it in GitHub Desktop.
Main
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.guthix.js5.Js5Archive; | |
import io.guthix.js5.Js5Cache; | |
import io.guthix.js5.container.disk.Js5DiskStore; | |
import io.guthix.js5.util.XteaKt; | |
import io.guthix.oldscape.cache.ConfigArchive; | |
import io.guthix.oldscape.cache.config.SpotAnimConfig; | |
import org.jetbrains.annotations.NotNull; | |
import java.nio.file.Path; | |
import java.util.Arrays; | |
import java.util.Map; | |
public class Main { | |
public static final int JAD_RANGE = 451; | |
public static final int JAD_MAGE = 448; | |
public static final int JAD_MAGE_END = 157; | |
private static final int AIR_STRIKE = 91; | |
private static final int AIR_BOLT = 118; | |
private static final int AIR_BLAST = 133; | |
private static final int AIR_WAVE = 159; | |
private static final String CACHE_LOC = "C:/cache"; | |
public static void main(String[] args) { | |
new Main().findModels(); | |
} | |
private void findModels() { | |
final Map<Integer, SpotAnimConfig> spotAnimConfig = loadSpotAnims(); | |
printModelsForSpotAnimIds(spotAnimConfig, new int[] {JAD_RANGE, JAD_MAGE, JAD_MAGE_END, AIR_STRIKE, AIR_BOLT, AIR_BLAST, AIR_WAVE}); | |
} | |
private Map<Integer, SpotAnimConfig> loadSpotAnims() { | |
final Js5DiskStore cacheStore = Js5DiskStore.Companion.open(Path.of(CACHE_LOC)); | |
final Js5Cache cache = new Js5Cache(cacheStore); | |
final Js5Archive archive = cache.readArchive(ConfigArchive.id, new int[XteaKt.XTEA_KEY_SIZE]); | |
final Map<Integer, SpotAnimConfig> spotAnimConfig = SpotAnimConfig.Companion.load(archive.readGroup(SpotAnimConfig.Companion.getId(), new int[XteaKt.XTEA_KEY_SIZE])); | |
return spotAnimConfig; | |
} | |
private void printModelsForSpotAnimIds(Map<Integer, SpotAnimConfig> spotAnimConfig, int[] ids) { | |
Arrays.stream(ids).forEach(id -> System.out.println(spotAnimConfig.get(id).getModelId())); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>net.isawesum</groupId> | |
<artifactId>model-id-extractor</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<source>11</source> | |
<target>11</target> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<dependency> | |
<groupId>io.guthix</groupId> | |
<artifactId>jagex-store-5</artifactId> | |
<version>0.4.0</version> | |
</dependency> | |
<dependency> | |
<groupId>io.guthix.oldscape</groupId> | |
<artifactId>oldscape-cache</artifactId> | |
<version>0.1.0</version> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/Library/Java/JavaVirtualMachines/openjdk-12.0.2.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=50430:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/denver.fernandes/dev_personal/osrs-cache-editor/model-id-extractor/target/classes:/Users/denver.fernandes/.m2/repository/io/guthix/jagex-store-5/0.4.0/jagex-store-5-0.4.0.jar:/Users/denver.fernandes/.m2/repository/io/guthix/jagex-bytebuf/0.1/jagex-bytebuf-0.1.jar:/Users/denver.fernandes/.m2/repository/io/netty/netty-buffer/4.1.51.Final/netty-buffer-4.1.51.Final.jar:/Users/denver.fernandes/.m2/repository/io/netty/netty-common/4.1.51.Final/netty-common-4.1.51.Final.jar:/Users/denver.fernandes/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.0/kotlin-stdlib-jdk8-1.4.0.jar:/Users/denver.fernandes/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.4.0/kotlin-stdlib-1.4.0.jar:/Users/denver.fernandes/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/Users/denver.fernandes/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.4.0/kotlin-stdlib-jdk7-1.4.0.jar:/Users/denver.fernandes/.m2/repository/io/github/microutils/kotlin-logging/1.8.3/kotlin-logging-1.8.3.jar:/Users/denver.fernandes/.m2/repository/org/slf4j/slf4j-api/1.7.29/slf4j-api-1.7.29.jar:/Users/denver.fernandes/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.3.72/kotlin-stdlib-common-1.3.72.jar:/Users/denver.fernandes/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar:/Users/denver.fernandes/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.66/bcprov-jdk15on-1.66.jar:/Users/denver.fernandes/.m2/repository/org/apache/commons/commons-compress/1.20/commons-compress-1.20.jar:/Users/denver.fernandes/.m2/repository/io/guthix/oldscape/oldscape-cache/0.1.0/oldscape-cache-0.1.0.jar:/Users/denver.fernandes/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/denver.fernandes/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx-swt.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.base.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.controls.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.fxml.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.graphics.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.media.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.swing.jar:/Users/denver.fernandes/dev_personal/osrs-cache-editor/javafx-lib/javafx.web.jar Main
17:46:57.878 [main] DEBUG io.guthix.js5.container.disk.DataFile - Found .dat2 file
17:46:57.883 [main] DEBUG io.guthix.js5.container.disk.IndexFile - Found .idx255 file
17:46:57.888 [main] DEBUG io.guthix.js5.container.disk.Js5DiskStore - Created disk store with archive count 21
17:46:57.972 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
17:46:57.975 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
17:46:57.975 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
17:46:58.025 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: MacOS
17:46:58.027 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
17:46:58.027 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 12
17:46:58.030 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
17:46:58.031 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
17:46:58.031 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
17:46:58.036 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable
java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
at io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:233)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
at io.netty.util.internal.PlatformDependent0.(PlatformDependent0.java:227)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
at io.netty.util.internal.PlatformDependent.(PlatformDependent.java:92)
at io.netty.buffer.UnpooledByteBufAllocator.(UnpooledByteBufAllocator.java:37)
at io.netty.buffer.Unpooled.(Unpooled.java:75)
at io.guthix.js5.container.disk.IdxFile.read$jagex_store_5(IndexFile.kt:50)
at io.guthix.js5.container.disk.Js5DiskStore.read(Js5DiskStore.kt:48)
at io.guthix.js5.Js5Cache.readArchive(Js5Cache.kt:62)
at Main.loadSpotAnims(Main.java:36)
at Main.findModels(Main.java:28)
at Main.main(Main.java:24)
17:46:58.037 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
17:46:58.040 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @7f9a81e8
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:376)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:639)
at java.base/java.lang.reflect.Method.invoke(Method.java:559)
at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:347)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
at io.netty.util.internal.PlatformDependent0.(PlatformDependent0.java:338)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
at io.netty.util.internal.PlatformDependent.(PlatformDependent.java:92)
at io.netty.buffer.UnpooledByteBufAllocator.(UnpooledByteBufAllocator.java:37)
at io.netty.buffer.Unpooled.(Unpooled.java:75)
at io.guthix.js5.container.disk.IdxFile.read$jagex_store_5(IndexFile.kt:50)
at io.guthix.js5.container.disk.Js5DiskStore.read(Js5DiskStore.kt:48)
at io.guthix.js5.Js5Cache.readArchive(Js5Cache.kt:62)
at Main.loadSpotAnims(Main.java:36)
at Main.findModels(Main.java:28)
at Main.main(Main.java:24)
17:46:58.040 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.(long, int): unavailable
17:46:58.041 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
17:46:58.098 [main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 4294967296 bytes (maybe)
17:46:58.099 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/9l/tlxfq4gx40d1n5mzj49n_v_j6g_gnt/T (java.io.tmpdir)
17:46:58.099 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
17:46:58.103 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
17:46:58.103 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
17:46:58.108 [main] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
17:46:58.108 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
17:46:58.130 [main] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkAccessible: true
17:46:58.130 [main] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkBounds: true
17:46:58.135 [main] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@31a5c39e
17:46:58.146 [main] DEBUG io.guthix.js5.container.disk.Js5DiskStore - Reading index file 255 container 2
17:46:58.187 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
17:46:58.188 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
17:46:58.196 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
17:46:58.197 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
17:46:58.197 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
17:46:58.197 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
17:46:58.197 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
17:46:58.210 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
17:46:58.210 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
17:46:58.210 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
17:46:58.410 [main] DEBUG io.guthix.js5.container.disk.IndexFile - Found .idx2 file
17:46:58.412 [main] DEBUG io.guthix.js5.container.disk.Js5DiskStore - Reading index file 2 container 13
17:46:58.509 [main] INFO io.guthix.js5.Js5Archive - Reading group 13 from archive 2
9342
9337
3116
3081
3084
3087
3115
Process finished with exit code 0