diff --git a/client/src/main/java/rt4/DelayedStateChange.java b/client/src/main/java/rt4/DelayedStateChange.java index ca6f7aa..072f6db 100644 --- a/client/src/main/java/rt4/DelayedStateChange.java +++ b/client/src/main/java/rt4/DelayedStateChange.java @@ -155,14 +155,14 @@ public final class DelayedStateChange extends SecondaryNode { @OriginalMember(owner = "client!k", name = "a", descriptor = "(B)Lclient!da;") public static DelayedStateChange poll() { - @Pc(10) DelayedStateChange local10 = (DelayedStateChange) serverQueue.method795(); + @Pc(10) DelayedStateChange local10 = (DelayedStateChange) serverQueue.head(); if (local10 != null) { local10.unlink(); - local10.method4365(); + local10.unlinkSecondary(); return local10; } do { - local10 = (DelayedStateChange) clientQueue.method795(); + local10 = (DelayedStateChange) clientQueue.head(); if (local10 == null) { return null; } @@ -170,7 +170,7 @@ public final class DelayedStateChange extends SecondaryNode { return null; } local10.unlink(); - local10.method4365(); + local10.unlinkSecondary(); } while ((Long.MIN_VALUE & local10.secondaryKey) == 0L); return local10; } diff --git a/client/src/main/java/rt4/Js5.java b/client/src/main/java/rt4/Js5.java index f8833b3..f593dab 100644 --- a/client/src/main/java/rt4/Js5.java +++ b/client/src/main/java/rt4/Js5.java @@ -44,8 +44,8 @@ public final class Js5 { return false; } @Pc(20) boolean success = true; - for (@Pc(22) int i = 0; i < this.index.anIntArray269.length; i++) { - @Pc(38) int groupId = this.index.anIntArray269[i]; + for (@Pc(22) int i = 0; i < this.index.groupIds.length; i++) { + @Pc(38) int groupId = this.index.groupIds[i]; if (this.packed[groupId] == null) { this.fetchGroup(groupId); if (this.packed[groupId] == null) { diff --git a/client/src/main/java/rt4/Js5CacheQueue.java b/client/src/main/java/rt4/Js5CacheQueue.java index 857e56a..e97c9c6 100644 --- a/client/src/main/java/rt4/Js5CacheQueue.java +++ b/client/src/main/java/rt4/Js5CacheQueue.java @@ -9,123 +9,119 @@ import org.openrs2.deob.annotation.Pc; public final class Js5CacheQueue implements Runnable { @OriginalMember(owner = "client!k", name = "q", descriptor = "Lclient!ce;") - private final SecondaryLinkedList aClass16_6 = new SecondaryLinkedList(); + private final SecondaryLinkedList queue = new SecondaryLinkedList(); @OriginalMember(owner = "client!k", name = "s", descriptor = "I") - public int anInt3131 = 0; + public int size = 0; @OriginalMember(owner = "client!k", name = "w", descriptor = "Z") - private boolean aBoolean161 = false; + private boolean stop = false; @OriginalMember(owner = "client!k", name = "v", descriptor = "Ljava/lang/Thread;") - private Thread aThread2; + private Thread thread; @OriginalMember(owner = "client!k", name = "", descriptor = "()V") public Js5CacheQueue() { - @Pc(20) PrivilegedRequest local20 = GameShell.signLink.startThread(5, this); - while (local20.status == 0) { + @Pc(20) PrivilegedRequest request = GameShell.signLink.startThread(5, this); + while (request.status == 0) { ThreadUtils.sleep(10L); } - if (local20.status == 2) { + if (request.status == 2) { throw new RuntimeException(); } - this.aThread2 = (Thread) local20.result; + this.thread = (Thread) request.result; } @OriginalMember(owner = "client!k", name = "a", descriptor = "(Lclient!c;I)V") - private void method2461(@OriginalArg(0) Js5CacheRequest arg0) { - @Pc(7) SecondaryLinkedList local7 = this.aClass16_6; - synchronized (this.aClass16_6) { - this.aClass16_6.addTail(arg0); - this.anInt3131++; - this.aClass16_6.notifyAll(); + private void enqueue(@OriginalArg(0) Js5CacheRequest arg0) { + synchronized (this.queue) { + this.queue.addTail(arg0); + this.size++; + this.queue.notifyAll(); } } @OriginalMember(owner = "client!k", name = "a", descriptor = "(I)V") public final void quit() { - this.aBoolean161 = true; - @Pc(6) SecondaryLinkedList local6 = this.aClass16_6; - synchronized (this.aClass16_6) { - this.aClass16_6.notifyAll(); + this.stop = true; + synchronized (this.queue) { + this.queue.notifyAll(); } try { - this.aThread2.join(); - } catch (@Pc(23) InterruptedException local23) { + this.thread.join(); + } catch (@Pc(23) InterruptedException ignored) { } - this.aThread2 = null; + this.thread = null; } @OriginalMember(owner = "client!k", name = "a", descriptor = "(Lclient!ge;I[BI)Lclient!c;") - public final Js5CacheRequest method2467(@OriginalArg(0) Cache arg0, @OriginalArg(2) byte[] arg1, @OriginalArg(3) int arg2) { - @Pc(7) Js5CacheRequest local7 = new Js5CacheRequest(); - local7.aByteArray11 = arg1; - local7.aBoolean225 = false; - local7.secondaryKey = arg2; - local7.aClass49_3 = arg0; - local7.anInt824 = 2; - this.method2461(local7); - return local7; + public final Js5CacheRequest write(@OriginalArg(0) Cache arg0, @OriginalArg(2) byte[] arg1, @OriginalArg(3) int arg2) { + @Pc(7) Js5CacheRequest request = new Js5CacheRequest(); + request.data = arg1; + request.urgent = false; + request.secondaryKey = arg2; + request.cache = arg0; + request.type = 2; + this.enqueue(request); + return request; } @OriginalMember(owner = "client!k", name = "a", descriptor = "(IILclient!ge;)Lclient!c;") - public final Js5CacheRequest method2469(@OriginalArg(0) int arg0, @OriginalArg(2) Cache arg1) { + public final Js5CacheRequest read(@OriginalArg(0) int arg0, @OriginalArg(2) Cache arg1) { @Pc(7) Js5CacheRequest local7 = new Js5CacheRequest(); - local7.aClass49_3 = arg1; - local7.anInt824 = 3; - local7.aBoolean225 = false; + local7.cache = arg1; + local7.type = 3; + local7.urgent = false; local7.secondaryKey = arg0; - this.method2461(local7); + this.enqueue(local7); return local7; } @OriginalMember(owner = "client!k", name = "a", descriptor = "(Lclient!ge;BI)Lclient!c;") - public final Js5CacheRequest method2471(@OriginalArg(0) Cache arg0, @OriginalArg(2) int arg1) { + public final Js5CacheRequest readSynchronous(@OriginalArg(0) Cache arg0, @OriginalArg(2) int arg1) { @Pc(9) Js5CacheRequest local9 = new Js5CacheRequest(); - local9.anInt824 = 1; - @Pc(16) SecondaryLinkedList local16 = this.aClass16_6; - synchronized (this.aClass16_6) { - @Pc(31) Js5CacheRequest local31 = (Js5CacheRequest) this.aClass16_6.method795(); + local9.type = 1; + synchronized (this.queue) { + @Pc(31) Js5CacheRequest local31 = (Js5CacheRequest) this.queue.head(); while (true) { if (local31 == null) { break; } - if (local31.secondaryKey == (long) arg1 && local31.aClass49_3 == arg0 && local31.anInt824 == 2) { - local9.aByteArray11 = local31.aByteArray11; + if (local31.secondaryKey == (long) arg1 && local31.cache == arg0 && local31.type == 2) { + local9.data = local31.data; local9.incomplete = false; return local9; } - local31 = (Js5CacheRequest) this.aClass16_6.method797(); + local31 = (Js5CacheRequest) this.queue.next(); } } - local9.aByteArray11 = arg0.read(arg1); + local9.data = arg0.read(arg1); local9.incomplete = false; - local9.aBoolean225 = true; + local9.urgent = true; return local9; } @OriginalMember(owner = "client!k", name = "run", descriptor = "()V") @Override public final void run() { - while (!this.aBoolean161) { - @Pc(12) SecondaryLinkedList local12 = this.aClass16_6; + while (!this.stop) { @Pc(19) Js5CacheRequest local19; - synchronized (this.aClass16_6) { - local19 = (Js5CacheRequest) this.aClass16_6.method796(); + synchronized (this.queue) { + local19 = (Js5CacheRequest) this.queue.removeHead(); if (local19 == null) { try { - this.aClass16_6.wait(); - } catch (@Pc(35) InterruptedException local35) { + this.queue.wait(); + } catch (@Pc(35) InterruptedException ignored) { } continue; } - this.anInt3131--; + this.size--; } try { - if (local19.anInt824 == 2) { - local19.aClass49_3.write((int) local19.secondaryKey, local19.aByteArray11.length, local19.aByteArray11); - } else if (local19.anInt824 == 3) { - local19.aByteArray11 = local19.aClass49_3.read((int) local19.secondaryKey); + if (local19.type == 2) { + local19.cache.write((int) local19.secondaryKey, local19.data.length, local19.data); + } else if (local19.type == 3) { + local19.data = local19.cache.read((int) local19.secondaryKey); } } catch (@Pc(83) Exception local83) { TracingException.report(null, local83); diff --git a/client/src/main/java/rt4/Js5CacheRequest.java b/client/src/main/java/rt4/Js5CacheRequest.java index ee8bbbf..3544557 100644 --- a/client/src/main/java/rt4/Js5CacheRequest.java +++ b/client/src/main/java/rt4/Js5CacheRequest.java @@ -7,13 +7,13 @@ import org.openrs2.deob.annotation.OriginalMember; public final class Js5CacheRequest extends Js5Request { @OriginalMember(owner = "client!c", name = "X", descriptor = "Lclient!ge;") - public Cache aClass49_3; + public Cache cache; @OriginalMember(owner = "client!c", name = "ab", descriptor = "[B") - public byte[] aByteArray11; + public byte[] data; @OriginalMember(owner = "client!c", name = "cb", descriptor = "I") - public int anInt824; + public int type; @OriginalMember(owner = "client!c", name = "b", descriptor = "(Z)[B") @Override @@ -21,12 +21,12 @@ public final class Js5CacheRequest extends Js5Request { if (this.incomplete) { throw new RuntimeException(); } - return this.aByteArray11; + return this.data; } @OriginalMember(owner = "client!c", name = "a", descriptor = "(Z)I") @Override - public final int method3553() { + public final int getPercentageComplete() { return this.incomplete ? 0 : 100; } } diff --git a/client/src/main/java/rt4/Js5CachedResourceProvider.java b/client/src/main/java/rt4/Js5CachedResourceProvider.java index e26f9a4..22721f3 100644 --- a/client/src/main/java/rt4/Js5CachedResourceProvider.java +++ b/client/src/main/java/rt4/Js5CachedResourceProvider.java @@ -11,134 +11,134 @@ import java.util.zip.CRC32; public final class Js5CachedResourceProvider extends Js5ResourceProvider { @OriginalMember(owner = "client!fn", name = "X", descriptor = "Ljava/util/zip/CRC32;") - public static final CRC32 aCRC32_1 = new CRC32(); + public static final CRC32 crc32 = new CRC32(); @OriginalMember(owner = "client!bg", name = "m", descriptor = "Lclient!ii;") - private Js5Index aClass70_1; + private Js5Index index; @OriginalMember(owner = "client!bg", name = "w", descriptor = "[B") - private byte[] aByteArray9; + private byte[] groupStatus; @OriginalMember(owner = "client!bg", name = "T", descriptor = "Z") - private boolean aBoolean36; + private boolean prefetchAll; @OriginalMember(owner = "client!bg", name = "u", descriptor = "I") - private int anInt567 = 0; + private int verifiedGroups = 0; @OriginalMember(owner = "client!bg", name = "p", descriptor = "Lclient!sc;") - private final HashTable aClass133_1 = new HashTable(16); + private final HashTable requests = new HashTable(16); @OriginalMember(owner = "client!bg", name = "S", descriptor = "I") - private int anInt578 = 0; + private int group = 0; @OriginalMember(owner = "client!bg", name = "R", descriptor = "Lclient!ih;") - private final LinkedList aClass69_16 = new LinkedList(); + private final LinkedList prefetchQueue = new LinkedList(); @OriginalMember(owner = "client!bg", name = "V", descriptor = "J") - private long aLong20 = 0L; + private long orphanCheckTime = 0L; @OriginalMember(owner = "client!bg", name = "L", descriptor = "I") - private final int anInt576; + private final int archive; @OriginalMember(owner = "client!bg", name = "F", descriptor = "Lclient!ge;") - private final Cache aClass49_2; + private final Cache cache; @OriginalMember(owner = "client!bg", name = "Q", descriptor = "Z") - private boolean aBoolean35; + private boolean verifyAll; @OriginalMember(owner = "client!bg", name = "U", descriptor = "Lclient!ih;") - private LinkedList aClass69_17; + private LinkedList groupQueue; @OriginalMember(owner = "client!bg", name = "J", descriptor = "Lclient!k;") - private final Js5CacheQueue aClass80_2; + private final Js5CacheQueue cacheQueue; @OriginalMember(owner = "client!bg", name = "H", descriptor = "I") - private final int anInt573; + private final int expectedChecksum; @OriginalMember(owner = "client!bg", name = "W", descriptor = "Z") - private final boolean aBoolean37; + private final boolean discardOrphans; @OriginalMember(owner = "client!bg", name = "k", descriptor = "Lclient!ge;") - private final Cache aClass49_1; + private final Cache masterCache; @OriginalMember(owner = "client!bg", name = "D", descriptor = "Lclient!jb;") - private final Js5NetQueue aClass73_2; + private final Js5NetQueue netQueue; @OriginalMember(owner = "client!bg", name = "t", descriptor = "I") - private final int anInt566; + private final int expectedVersion; @OriginalMember(owner = "client!bg", name = "x", descriptor = "Lclient!il;") - private Js5Request aClass3_Sub2_Sub5_1; + private Js5Request indexRequest; @OriginalMember(owner = "client!bg", name = "", descriptor = "(ILclient!ge;Lclient!ge;Lclient!jb;Lclient!k;IIZ)V") - public Js5CachedResourceProvider(@OriginalArg(0) int arg0, @OriginalArg(1) Cache arg1, @OriginalArg(2) Cache arg2, @OriginalArg(3) Js5NetQueue arg3, @OriginalArg(4) Js5CacheQueue arg4, @OriginalArg(5) int arg5, @OriginalArg(6) int arg6, @OriginalArg(7) boolean arg7) { - this.anInt576 = arg0; - this.aClass49_2 = arg1; - if (this.aClass49_2 == null) { - this.aBoolean35 = false; + public Js5CachedResourceProvider(@OriginalArg(0) int archive, @OriginalArg(1) Cache cache, @OriginalArg(2) Cache masterCache, @OriginalArg(3) Js5NetQueue netQueue, @OriginalArg(4) Js5CacheQueue cacheQueue, @OriginalArg(5) int expectedChecksum, @OriginalArg(6) int expectedVersion, @OriginalArg(7) boolean discardOrphans) { + this.archive = archive; + this.cache = cache; + if (this.cache == null) { + this.verifyAll = false; } else { - this.aBoolean35 = true; - this.aClass69_17 = new LinkedList(); + this.verifyAll = true; + this.groupQueue = new LinkedList(); } - this.aClass80_2 = arg4; - this.anInt573 = arg5; - this.aBoolean37 = arg7; - this.aClass49_1 = arg2; - this.aClass73_2 = arg3; - this.anInt566 = arg6; - if (this.aClass49_1 != null) { - this.aClass3_Sub2_Sub5_1 = this.aClass80_2.method2471(this.aClass49_1, this.anInt576); + this.cacheQueue = cacheQueue; + this.expectedChecksum = expectedChecksum; + this.discardOrphans = discardOrphans; + this.masterCache = masterCache; + this.netQueue = netQueue; + this.expectedVersion = expectedVersion; + if (this.masterCache != null) { + this.indexRequest = this.cacheQueue.readSynchronous(this.masterCache, this.archive); } } @OriginalMember(owner = "client!bg", name = "a", descriptor = "(II)V") @Override public final void prefetchGroup(@OriginalArg(0) int arg0) { - if (this.aClass49_2 == null) { + if (this.cache == null) { return; } - @Pc(15) Node local15; - for (local15 = this.aClass69_16.head(); local15 != null; local15 = this.aClass69_16.next()) { - if (local15.key == (long) arg0) { + @Pc(15) Node node; + for (node = this.prefetchQueue.head(); node != null; node = this.prefetchQueue.next()) { + if (node.key == (long) arg0) { return; } } - local15 = new Node(); - local15.key = arg0; - this.aClass69_16.addTail(local15); + node = new Node(); + node.key = arg0; + this.prefetchQueue.addTail(node); } @OriginalMember(owner = "client!bg", name = "b", descriptor = "(I)Lclient!ii;") @Override public final Js5Index fetchIndex() { - if (this.aClass70_1 != null) { - return this.aClass70_1; + if (this.index != null) { + return this.index; } - if (this.aClass3_Sub2_Sub5_1 == null) { - if (this.aClass73_2.isUrgentRequestQueueFull()) { + if (this.indexRequest == null) { + if (this.netQueue.isUrgentRequestQueueFull()) { return null; } - this.aClass3_Sub2_Sub5_1 = this.aClass73_2.read(255, (byte) 0, this.anInt576, true); + this.indexRequest = this.netQueue.read(255, (byte) 0, this.archive, true); } - if (this.aClass3_Sub2_Sub5_1.incomplete) { + if (this.indexRequest.incomplete) { return null; } - @Pc(52) byte[] local52 = this.aClass3_Sub2_Sub5_1.getData(); - if (this.aClass3_Sub2_Sub5_1 instanceof Js5CacheRequest) { + @Pc(52) byte[] local52 = this.indexRequest.getData(); + if (this.indexRequest instanceof Js5CacheRequest) { try { if (local52 == null) { throw new RuntimeException(); } - this.aClass70_1 = new Js5Index(local52, this.anInt573); - if (this.anInt566 != this.aClass70_1.anInt2908) { + this.index = new Js5Index(local52, this.expectedChecksum); + if (this.expectedVersion != this.index.version) { throw new RuntimeException(); } } catch (@Pc(88) RuntimeException local88) { - this.aClass70_1 = null; - if (this.aClass73_2.isUrgentRequestQueueFull()) { - this.aClass3_Sub2_Sub5_1 = null; + this.index = null; + if (this.netQueue.isUrgentRequestQueueFull()) { + this.indexRequest = null; } else { - this.aClass3_Sub2_Sub5_1 = this.aClass73_2.read(255, (byte) 0, this.anInt576, true); + this.indexRequest = this.netQueue.read(255, (byte) 0, this.archive, true); } return null; } @@ -147,210 +147,210 @@ public final class Js5CachedResourceProvider extends Js5ResourceProvider { if (local52 == null) { throw new RuntimeException(); } - this.aClass70_1 = new Js5Index(local52, this.anInt573); - } catch (@Pc(131) RuntimeException local131) { - this.aClass73_2.method2327(); - this.aClass70_1 = null; - if (this.aClass73_2.isUrgentRequestQueueFull()) { - this.aClass3_Sub2_Sub5_1 = null; + this.index = new Js5Index(local52, this.expectedChecksum); + } catch (@Pc(131) RuntimeException ignored) { + this.netQueue.rekey(); + this.index = null; + if (this.netQueue.isUrgentRequestQueueFull()) { + this.indexRequest = null; } else { - this.aClass3_Sub2_Sub5_1 = this.aClass73_2.read(255, (byte) 0, this.anInt576, true); + this.indexRequest = this.netQueue.read(255, (byte) 0, this.archive, true); } return null; } - if (this.aClass49_1 != null) { - this.aClass80_2.method2467(this.aClass49_1, local52, this.anInt576); + if (this.masterCache != null) { + this.cacheQueue.write(this.masterCache, local52, this.archive); } } - if (this.aClass49_2 != null) { - this.aByteArray9 = new byte[this.aClass70_1.capacity]; - this.anInt567 = 0; + if (this.cache != null) { + this.groupStatus = new byte[this.index.capacity]; + this.verifiedGroups = 0; } - this.aClass3_Sub2_Sub5_1 = null; - return this.aClass70_1; + this.indexRequest = null; + return this.index; } @OriginalMember(owner = "client!bg", name = "a", descriptor = "(Z)V") public final void prefetchAll() { - if (this.aClass49_2 != null) { - this.aBoolean36 = true; - if (this.aClass69_17 == null) { - this.aClass69_17 = new LinkedList(); + if (this.cache != null) { + this.prefetchAll = true; + if (this.groupQueue == null) { + this.groupQueue = new LinkedList(); } } } @OriginalMember(owner = "client!bg", name = "c", descriptor = "(I)I") - public final int method529() { - return this.anInt567; + public final int getVerifiedGroups() { + return this.verifiedGroups; } @OriginalMember(owner = "client!bg", name = "d", descriptor = "(I)I") - public final int method533() { - if (this.aClass70_1 == null) { + public final int getTotalVerifiedGroups() { + if (this.index == null) { return 0; - } else if (this.aBoolean35) { - @Pc(25) Node local25 = this.aClass69_17.head(); - return local25 == null ? 0 : (int) local25.key; + } else if (this.verifyAll) { + @Pc(25) Node node = this.groupQueue.head(); + return node == null ? 0 : (int) node.key; } else { - return this.aClass70_1.anInt2902; + return this.index.size; } } @OriginalMember(owner = "client!bg", name = "c", descriptor = "(Z)V") - public final void method534() { - if (this.aClass69_17 != null) { + public final void loop() { + if (this.groupQueue != null) { if (this.fetchIndex() == null) { return; } @Pc(32) boolean local32; @Pc(37) Node local37; @Pc(43) int local43; - if (this.aBoolean35) { + if (this.verifyAll) { local32 = true; - for (local37 = this.aClass69_17.head(); local37 != null; local37 = this.aClass69_17.next()) { + for (local37 = this.groupQueue.head(); local37 != null; local37 = this.groupQueue.next()) { local43 = (int) local37.key; - if (this.aByteArray9[local43] == 0) { - this.method536(1, local43); + if (this.groupStatus[local43] == 0) { + this.fetchGroupInner(1, local43); } - if (this.aByteArray9[local43] == 0) { + if (this.groupStatus[local43] == 0) { local32 = false; } else { local37.unlink(); } } - while (this.aClass70_1.groupSizes.length > this.anInt578) { - if (this.aClass70_1.groupSizes[this.anInt578] == 0) { - this.anInt578++; + while (this.index.groupSizes.length > this.group) { + if (this.index.groupSizes[this.group] == 0) { + this.group++; } else { - if (this.aClass80_2.anInt3131 >= 250) { + if (this.cacheQueue.size >= 250) { local32 = false; break; } - if (this.aByteArray9[this.anInt578] == 0) { - this.method536(1, this.anInt578); + if (this.groupStatus[this.group] == 0) { + this.fetchGroupInner(1, this.group); } - if (this.aByteArray9[this.anInt578] == 0) { + if (this.groupStatus[this.group] == 0) { local32 = false; local37 = new Node(); - local37.key = this.anInt578; - this.aClass69_17.addTail(local37); + local37.key = this.group; + this.groupQueue.addTail(local37); } - this.anInt578++; + this.group++; } } if (local32) { - this.aBoolean35 = false; - this.anInt578 = 0; + this.verifyAll = false; + this.group = 0; } - } else if (this.aBoolean36) { + } else if (this.prefetchAll) { local32 = true; - for (local37 = this.aClass69_17.head(); local37 != null; local37 = this.aClass69_17.next()) { + for (local37 = this.groupQueue.head(); local37 != null; local37 = this.groupQueue.next()) { local43 = (int) local37.key; - if (this.aByteArray9[local43] != 1) { - this.method536(2, local43); + if (this.groupStatus[local43] != 1) { + this.fetchGroupInner(2, local43); } - if (this.aByteArray9[local43] == 1) { + if (this.groupStatus[local43] == 1) { local37.unlink(); } else { local32 = false; } } - while (this.aClass70_1.groupSizes.length > this.anInt578) { - if (this.aClass70_1.groupSizes[this.anInt578] == 0) { - this.anInt578++; + while (this.index.groupSizes.length > this.group) { + if (this.index.groupSizes[this.group] == 0) { + this.group++; } else { - if (this.aClass73_2.method2316()) { + if (this.netQueue.isPrefetchRequestQueueFull()) { local32 = false; break; } - if (this.aByteArray9[this.anInt578] != 1) { - this.method536(2, this.anInt578); + if (this.groupStatus[this.group] != 1) { + this.fetchGroupInner(2, this.group); } - if (this.aByteArray9[this.anInt578] != 1) { + if (this.groupStatus[this.group] != 1) { local37 = new Node(); - local37.key = this.anInt578; - this.aClass69_17.addTail(local37); + local37.key = this.group; + this.groupQueue.addTail(local37); local32 = false; } - this.anInt578++; + this.group++; } } if (local32) { - this.anInt578 = 0; - this.aBoolean36 = false; + this.group = 0; + this.prefetchAll = false; } } else { - this.aClass69_17 = null; + this.groupQueue = null; } } - if (!this.aBoolean37 || this.aLong20 > MonotonicClock.currentTimeMillis()) { + if (!this.discardOrphans || this.orphanCheckTime > MonotonicClock.currentTimeMillis()) { return; } - for (@Pc(331) Js5Request local331 = (Js5Request) this.aClass133_1.head(); local331 != null; local331 = (Js5Request) this.aClass133_1.next()) { - if (!local331.incomplete) { - if (local331.aBoolean227) { - if (!local331.aBoolean225) { + for (@Pc(331) Js5Request request = (Js5Request) this.requests.head(); request != null; request = (Js5Request) this.requests.next()) { + if (!request.incomplete) { + if (request.orphan) { + if (!request.urgent) { throw new RuntimeException(); } - local331.unlink(); + request.unlink(); } else { - local331.aBoolean227 = true; + request.orphan = true; } } } - this.aLong20 = MonotonicClock.currentTimeMillis() + 1000L; + this.orphanCheckTime = MonotonicClock.currentTimeMillis() + 1000L; } @OriginalMember(owner = "client!bg", name = "b", descriptor = "(II)I") @Override public final int getPercentageComplete(@OriginalArg(0) int arg0) { - @Pc(15) Js5Request local15 = (Js5Request) this.aClass133_1.get((long) arg0); - return local15 == null ? 0 : local15.method3553(); + @Pc(15) Js5Request request = (Js5Request) this.requests.get((long) arg0); + return request == null ? 0 : request.getPercentageComplete(); } @OriginalMember(owner = "client!bg", name = "b", descriptor = "(B)I") - public final int method535() { - return this.aClass70_1 == null ? 0 : this.aClass70_1.anInt2902; + public final int getIndexSize() { + return this.index == null ? 0 : this.index.size; } @OriginalMember(owner = "client!bg", name = "a", descriptor = "(III)Lclient!il;") - private Js5Request method536(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1) { - @Pc(13) Js5Request local13 = (Js5Request) this.aClass133_1.get((long) arg1); - if (local13 != null && arg0 == 0 && !local13.aBoolean225 && local13.incomplete) { + private Js5Request fetchGroupInner(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1) { + @Pc(13) Js5Request local13 = (Js5Request) this.requests.get((long) arg1); + if (local13 != null && arg0 == 0 && !local13.urgent && local13.incomplete) { local13.unlink(); local13 = null; } if (local13 == null) { if (arg0 == 0) { - if (this.aClass49_2 == null || this.aByteArray9[arg1] == -1) { - if (this.aClass73_2.isUrgentRequestQueueFull()) { + if (this.cache == null || this.groupStatus[arg1] == -1) { + if (this.netQueue.isUrgentRequestQueueFull()) { return null; } - local13 = this.aClass73_2.read(this.anInt576, (byte) 2, arg1, true); + local13 = this.netQueue.read(this.archive, (byte) 2, arg1, true); } else { - local13 = this.aClass80_2.method2471(this.aClass49_2, arg1); + local13 = this.cacheQueue.readSynchronous(this.cache, arg1); } } else if (arg0 == 1) { - if (this.aClass49_2 == null) { + if (this.cache == null) { throw new RuntimeException(); } - local13 = this.aClass80_2.method2469(arg1, this.aClass49_2); + local13 = this.cacheQueue.read(arg1, this.cache); } else if (arg0 == 2) { - if (this.aClass49_2 == null) { + if (this.cache == null) { throw new RuntimeException(); } - if (this.aByteArray9[arg1] != -1) { + if (this.groupStatus[arg1] != -1) { throw new RuntimeException(); } - if (this.aClass73_2.method2316()) { + if (this.netQueue.isPrefetchRequestQueueFull()) { return null; } - local13 = this.aClass73_2.read(this.anInt576, (byte) 2, arg1, false); + local13 = this.netQueue.read(this.archive, (byte) 2, arg1, false); } else { throw new RuntimeException(); } - this.aClass133_1.put(local13, (long) arg1); + this.requests.put(local13, (long) arg1); } if (local13.incomplete) { return null; @@ -363,33 +363,33 @@ public final class Js5CachedResourceProvider extends Js5ResourceProvider { if (local161 == null || local161.length <= 2) { throw new RuntimeException(); } - aCRC32_1.reset(); - aCRC32_1.update(local161, 0, local161.length - 2); - local199 = (int) aCRC32_1.getValue(); - if (this.aClass70_1.groupChecksums[arg1] != local199) { + crc32.reset(); + crc32.update(local161, 0, local161.length - 2); + local199 = (int) crc32.getValue(); + if (this.index.groupChecksums[arg1] != local199) { throw new RuntimeException(); } - this.aClass73_2.errors = 0; - this.aClass73_2.response = 0; + this.netQueue.errors = 0; + this.netQueue.response = 0; } catch (@Pc(225) RuntimeException local225) { - this.aClass73_2.method2327(); + this.netQueue.rekey(); local13.unlink(); - if (local13.aBoolean225 && !this.aClass73_2.isUrgentRequestQueueFull()) { - local252 = this.aClass73_2.read(this.anInt576, (byte) 2, arg1, true); - this.aClass133_1.put(local252, (long) arg1); + if (local13.urgent && !this.netQueue.isUrgentRequestQueueFull()) { + local252 = this.netQueue.read(this.archive, (byte) 2, arg1, true); + this.requests.put(local252, (long) arg1); } return null; } - local161[local161.length - 2] = (byte) (this.aClass70_1.anIntArray273[arg1] >>> 8); - local161[local161.length - 1] = (byte) this.aClass70_1.anIntArray273[arg1]; - if (this.aClass49_2 != null) { - this.aClass80_2.method2467(this.aClass49_2, local161, arg1); - if (this.aByteArray9[arg1] != 1) { - this.anInt567++; - this.aByteArray9[arg1] = 1; + local161[local161.length - 2] = (byte) (this.index.groupVersions[arg1] >>> 8); + local161[local161.length - 1] = (byte) this.index.groupVersions[arg1]; + if (this.cache != null) { + this.cacheQueue.write(this.cache, local161, arg1); + if (this.groupStatus[arg1] != 1) { + this.verifiedGroups++; + this.groupStatus[arg1] = 1; } } - if (!local13.aBoolean225) { + if (!local13.urgent) { local13.unlink(); } return local13; @@ -398,54 +398,54 @@ public final class Js5CachedResourceProvider extends Js5ResourceProvider { if (local161 == null || local161.length <= 2) { throw new RuntimeException(); } - aCRC32_1.reset(); - aCRC32_1.update(local161, 0, local161.length - 2); - local199 = (int) aCRC32_1.getValue(); - if (this.aClass70_1.groupChecksums[arg1] != local199) { + crc32.reset(); + crc32.update(local161, 0, local161.length - 2); + local199 = (int) crc32.getValue(); + if (this.index.groupChecksums[arg1] != local199) { throw new RuntimeException(); } @Pc(385) int local385 = ((local161[local161.length - 2] & 0xFF) << 8) + (local161[local161.length - 1] & 0xFF); - if (local385 != (this.aClass70_1.anIntArray273[arg1] & 0xFFFF)) { + if (local385 != (this.index.groupVersions[arg1] & 0xFFFF)) { throw new RuntimeException(); } - if (this.aByteArray9[arg1] != 1) { - if (this.aByteArray9[arg1] != 0) { + if (this.groupStatus[arg1] != 1) { + if (this.groupStatus[arg1] != 0) { } - this.anInt567++; - this.aByteArray9[arg1] = 1; + this.verifiedGroups++; + this.groupStatus[arg1] = 1; } - if (!local13.aBoolean225) { + if (!local13.urgent) { local13.unlink(); } return local13; } catch (@Pc(437) Exception local437) { - this.aByteArray9[arg1] = -1; + this.groupStatus[arg1] = -1; local13.unlink(); - if (local13.aBoolean225 && !this.aClass73_2.isUrgentRequestQueueFull()) { - local252 = this.aClass73_2.read(this.anInt576, (byte) 2, arg1, true); - this.aClass133_1.put(local252, (long) arg1); + if (local13.urgent && !this.netQueue.isUrgentRequestQueueFull()) { + local252 = this.netQueue.read(this.archive, (byte) 2, arg1, true); + this.requests.put(local252, (long) arg1); } return null; } } @OriginalMember(owner = "client!bg", name = "e", descriptor = "(I)V") - public final void method537() { - if (this.aClass69_17 == null || this.fetchIndex() == null) { + public final void processPrefetchQueue() { + if (this.groupQueue == null || this.fetchIndex() == null) { return; } - for (@Pc(21) Node local21 = this.aClass69_16.head(); local21 != null; local21 = this.aClass69_16.next()) { + for (@Pc(21) Node local21 = this.prefetchQueue.head(); local21 != null; local21 = this.prefetchQueue.next()) { @Pc(28) int local28 = (int) local21.key; - if (local28 < 0 || this.aClass70_1.capacity <= local28 || this.aClass70_1.groupSizes[local28] == 0) { + if (local28 < 0 || this.index.capacity <= local28 || this.index.groupSizes[local28] == 0) { local21.unlink(); } else { - if (this.aByteArray9[local28] == 0) { - this.method536(1, local28); + if (this.groupStatus[local28] == 0) { + this.fetchGroupInner(1, local28); } - if (this.aByteArray9[local28] == -1) { - this.method536(2, local28); + if (this.groupStatus[local28] == -1) { + this.fetchGroupInner(2, local28); } - if (this.aByteArray9[local28] == 1) { + if (this.groupStatus[local28] == 1) { local21.unlink(); } } @@ -455,7 +455,7 @@ public final class Js5CachedResourceProvider extends Js5ResourceProvider { @OriginalMember(owner = "client!bg", name = "f", descriptor = "(I)I") public final int getIndexPercentageComplete() { if (this.fetchIndex() == null) { - return this.aClass3_Sub2_Sub5_1 == null ? 0 : this.aClass3_Sub2_Sub5_1.method3553(); + return this.indexRequest == null ? 0 : this.indexRequest.getPercentageComplete(); } else { return 100; } @@ -464,7 +464,7 @@ public final class Js5CachedResourceProvider extends Js5ResourceProvider { @OriginalMember(owner = "client!bg", name = "c", descriptor = "(II)[B") @Override public final byte[] fetchGroup(@OriginalArg(0) int arg0) { - @Pc(9) Js5Request local9 = this.method536(0, arg0); + @Pc(9) Js5Request local9 = this.fetchGroupInner(0, arg0); if (local9 == null) { return null; } else { diff --git a/client/src/main/java/rt4/Js5GlTextureProvider.java b/client/src/main/java/rt4/Js5GlTextureProvider.java index f62864b..3306a04 100644 --- a/client/src/main/java/rt4/Js5GlTextureProvider.java +++ b/client/src/main/java/rt4/Js5GlTextureProvider.java @@ -9,10 +9,10 @@ import org.openrs2.deob.annotation.Pc; public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "z", descriptor = "Z") - private boolean aBoolean200 = false; + private boolean lowDetail = false; @OriginalMember(owner = "client!nk", name = "J", descriptor = "I") - private int anInt4186 = 50; + private int capacity = 50; @OriginalMember(owner = "client!nk", name = "b", descriptor = "Lclient!ve;") private final Js5 aClass153_72; @@ -21,10 +21,10 @@ public final class Js5GlTextureProvider implements TextureProvider { private final Js5 aClass153_73; @OriginalMember(owner = "client!nk", name = "P", descriptor = "Lclient!gn;") - private LruHashTable aClass54_12; + private LruHashTable glTextures; @OriginalMember(owner = "client!nk", name = "G", descriptor = "Lclient!gn;") - private LruHashTable aClass54_11; + private LruHashTable solidColorSprites; @OriginalMember(owner = "client!nk", name = "Q", descriptor = "[B") private final byte[] aByteArray61; @@ -59,15 +59,16 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "", descriptor = "(Lclient!ve;Lclient!ve;Lclient!ve;IZ)V") public Js5GlTextureProvider(@OriginalArg(0) Js5 arg0, @OriginalArg(1) Js5 arg1, @OriginalArg(2) Js5 arg2, @OriginalArg(3) int arg3, @OriginalArg(4) boolean arg4) { this.aClass153_72 = arg2; - this.aBoolean200 = arg4; - this.anInt4186 = arg3; + this.lowDetail = arg4; + this.capacity = arg3; this.aClass153_73 = arg0; - this.aClass54_12 = new LruHashTable(this.anInt4186); + this.glTextures = new LruHashTable(this.capacity); if (GlRenderer.enabled) { - this.aClass54_11 = new LruHashTable(this.anInt4186); + this.solidColorSprites = new LruHashTable(this.capacity); } else { - this.aClass54_11 = null; + this.solidColorSprites = null; } + @Pc(51) Buffer local51 = new Buffer(arg1.fetchFile(0, 0)); @Pc(55) int local55 = local51.g2(); this.aByteArray61 = new byte[local55]; @@ -133,7 +134,7 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "a", descriptor = "(ZI)V") public final void method3239(@OriginalArg(1) int arg0) { - for (@Pc(19) GlTexture local19 = (GlTexture) this.aClass54_12.method1808(); local19 != null; local19 = (GlTexture) this.aClass54_12.method1813()) { + for (@Pc(19) GlTexture local19 = (GlTexture) this.glTextures.method1808(); local19 != null; local19 = (GlTexture) this.glTextures.method1813()) { if (local19.aBoolean287) { local19.method4300(arg0); local19.aBoolean287 = false; @@ -145,7 +146,7 @@ public final class Js5GlTextureProvider implements TextureProvider { @Override public final int[] method3235(@OriginalArg(1) int arg0) { @Pc(16) GlTexture local16 = this.method3242(arg0); - return local16 == null ? null : local16.method4297(this.aBoolean200 || this.aBooleanArray89[arg0], this, this.aClass153_72); + return local16 == null ? null : local16.method4297(this.lowDetail || this.aBooleanArray89[arg0], this, this.aClass153_72); } @OriginalMember(owner = "client!nk", name = "a", descriptor = "(IZ)V") @@ -155,7 +156,7 @@ public final class Js5GlTextureProvider implements TextureProvider { @Pc(23) boolean local23 = false; @Pc(28) GlTexture local28 = this.method3242(arg0); if (local28 != null) { - local23 = local28.method4296(this.aClass153_72, this, this.aBoolean200 || this.aBooleanArray89[arg0]); + local23 = local28.method4296(this.aClass153_72, this, this.lowDetail || this.aBooleanArray89[arg0]); } if (!local23) { @Pc(56) GlSolidColorTexture local56 = this.method3244(arg0); @@ -165,7 +166,7 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "i", descriptor = "(II)Lclient!uh;") private GlTexture method3242(@OriginalArg(0) int arg0) { - @Pc(14) GlTexture local14 = (GlTexture) this.aClass54_12.get((long) arg0); + @Pc(14) GlTexture local14 = (GlTexture) this.glTextures.get((long) arg0); if (local14 != null) { return local14; } @@ -175,7 +176,7 @@ public final class Js5GlTextureProvider implements TextureProvider { } else { @Pc(41) Buffer local41 = new Buffer(local30); local14 = new GlTexture(local41); - this.aClass54_12.put(local14, (long) arg0); + this.glTextures.put(local14, (long) arg0); return local14; } } @@ -206,10 +207,10 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "j", descriptor = "(II)Lclient!sd;") private GlSolidColorTexture method3244(@OriginalArg(1) int arg0) { - @Pc(19) GlSolidColorTexture local19 = (GlSolidColorTexture) this.aClass54_11.get((long) arg0); + @Pc(19) GlSolidColorTexture local19 = (GlSolidColorTexture) this.solidColorSprites.get((long) arg0); if (local19 == null) { local19 = new GlSolidColorTexture(this.aShortArray59[arg0] & 0xFFFF); - this.aClass54_11.put(local19, (long) arg0); + this.solidColorSprites.put(local19, (long) arg0); return local19; } else { return local19; @@ -225,7 +226,7 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "b", descriptor = "(ZI)V") public final void method3245(@OriginalArg(0) boolean arg0) { - this.aBoolean200 = arg0; + this.lowDetail = arg0; this.clear(); } @@ -243,9 +244,9 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "b", descriptor = "(I)V") public final void clear() { - this.aClass54_12.clear(); - if (this.aClass54_11 != null) { - this.aClass54_11.clear(); + this.glTextures.clear(); + if (this.solidColorSprites != null) { + this.solidColorSprites.clear(); } } @@ -258,17 +259,17 @@ public final class Js5GlTextureProvider implements TextureProvider { @OriginalMember(owner = "client!nk", name = "b", descriptor = "(BI)Z") @Override public final boolean isLowDetail(@OriginalArg(1) int arg0) { - return this.aBoolean200 || this.aBooleanArray89[arg0]; + return this.lowDetail || this.aBooleanArray89[arg0]; } @OriginalMember(owner = "client!nk", name = "k", descriptor = "(II)V") public final void method3248(@OriginalArg(0) int arg0) { - this.anInt4186 = arg0; - this.aClass54_12 = new LruHashTable(this.anInt4186); + this.capacity = arg0; + this.glTextures = new LruHashTable(this.capacity); if (GlRenderer.enabled) { - this.aClass54_11 = new LruHashTable(this.anInt4186); + this.solidColorSprites = new LruHashTable(this.capacity); } else { - this.aClass54_11 = null; + this.solidColorSprites = null; } } @@ -286,7 +287,7 @@ public final class Js5GlTextureProvider implements TextureProvider { return null; } else { local8.aBoolean287 = true; - return local8.method4295(this, arg1, this.aClass153_72, this.aBoolean200 || this.aBooleanArray89[arg0]); + return local8.method4295(this, arg1, this.aClass153_72, this.lowDetail || this.aBooleanArray89[arg0]); } } } diff --git a/client/src/main/java/rt4/Js5Index.java b/client/src/main/java/rt4/Js5Index.java index 10f8f66..c038400 100644 --- a/client/src/main/java/rt4/Js5Index.java +++ b/client/src/main/java/rt4/Js5Index.java @@ -15,13 +15,13 @@ public final class Js5Index { public int[] groupChecksums; @OriginalMember(owner = "client!ii", name = "f", descriptor = "I") - public int anInt2902; + public int size; @OriginalMember(owner = "client!ii", name = "h", descriptor = "Lclient!jg;") public IntHashTable groupNameHashTable; @OriginalMember(owner = "client!ii", name = "m", descriptor = "[I") - public int[] anIntArray269; + public int[] groupIds; @OriginalMember(owner = "client!ii", name = "n", descriptor = "[I") public int[] groupCapacities; @@ -33,7 +33,7 @@ public final class Js5Index { public int[] groupSizes; @OriginalMember(owner = "client!ii", name = "r", descriptor = "[I") - public int[] anIntArray273; + public int[] groupVersions; @OriginalMember(owner = "client!ii", name = "s", descriptor = "[[I") public int[][] fileIds; @@ -42,7 +42,7 @@ public final class Js5Index { public int capacity; @OriginalMember(owner = "client!ii", name = "v", descriptor = "I") - public int anInt2908; + public int version; @OriginalMember(owner = "client!ii", name = "x", descriptor = "[Lclient!jg;") public IntHashTable[] fileNameHashTables; @@ -67,24 +67,24 @@ public final class Js5Index { throw new RuntimeException(); } if (local16 >= 6) { - this.anInt2908 = local12.g4(); + this.version = local12.g4(); } else { - this.anInt2908 = 0; + this.version = 0; } @Pc(48) int local48 = local12.g1(); @Pc(50) int local50 = 0; - this.anInt2902 = local12.g2(); + this.size = local12.g2(); @Pc(59) int local59 = -1; - this.anIntArray269 = new int[this.anInt2902]; + this.groupIds = new int[this.size]; @Pc(66) int local66; - for (local66 = 0; local66 < this.anInt2902; local66++) { - this.anIntArray269[local66] = local50 += local12.g2(); - if (this.anIntArray269[local66] > local59) { - local59 = this.anIntArray269[local66]; + for (local66 = 0; local66 < this.size; local66++) { + this.groupIds[local66] = local50 += local12.g2(); + if (this.groupIds[local66] > local59) { + local59 = this.groupIds[local66]; } } this.capacity = local59 + 1; - this.anIntArray273 = new int[this.capacity]; + this.groupVersions = new int[this.capacity]; this.fileIds = new int[this.capacity][]; this.groupChecksums = new int[this.capacity]; this.groupCapacities = new int[this.capacity]; @@ -94,27 +94,27 @@ public final class Js5Index { for (local66 = 0; local66 < this.capacity; local66++) { this.groupNameHashes[local66] = -1; } - for (local66 = 0; local66 < this.anInt2902; local66++) { - this.groupNameHashes[this.anIntArray269[local66]] = local12.g4(); + for (local66 = 0; local66 < this.size; local66++) { + this.groupNameHashes[this.groupIds[local66]] = local12.g4(); } this.groupNameHashTable = new IntHashTable(this.groupNameHashes); } - for (local66 = 0; local66 < this.anInt2902; local66++) { - this.groupChecksums[this.anIntArray269[local66]] = local12.g4(); + for (local66 = 0; local66 < this.size; local66++) { + this.groupChecksums[this.groupIds[local66]] = local12.g4(); } - for (local66 = 0; local66 < this.anInt2902; local66++) { - this.anIntArray273[this.anIntArray269[local66]] = local12.g4(); + for (local66 = 0; local66 < this.size; local66++) { + this.groupVersions[this.groupIds[local66]] = local12.g4(); } - for (local66 = 0; local66 < this.anInt2902; local66++) { - this.groupSizes[this.anIntArray269[local66]] = local12.g2(); + for (local66 = 0; local66 < this.size; local66++) { + this.groupSizes[this.groupIds[local66]] = local12.g2(); } @Pc(273) int local273; @Pc(278) int local278; @Pc(280) int local280; @Pc(288) int local288; - for (local66 = 0; local66 < this.anInt2902; local66++) { + for (local66 = 0; local66 < this.size; local66++) { local50 = 0; - local273 = this.anIntArray269[local66]; + local273 = this.groupIds[local66]; local278 = this.groupSizes[local273]; local280 = -1; this.fileIds[local273] = new int[local278]; @@ -134,8 +134,8 @@ public final class Js5Index { } this.fileNameHashTables = new IntHashTable[local59 + 1]; this.fileNameHashes = new int[local59 + 1][]; - for (local66 = 0; local66 < this.anInt2902; local66++) { - local273 = this.anIntArray269[local66]; + for (local66 = 0; local66 < this.size; local66++) { + local273 = this.groupIds[local66]; local278 = this.groupSizes[local273]; this.fileNameHashes[local273] = new int[this.groupCapacities[local273]]; for (local280 = 0; local280 < this.groupCapacities[local273]; local280++) { diff --git a/client/src/main/java/rt4/Js5MasterIndex.java b/client/src/main/java/rt4/Js5MasterIndex.java index 9aa14a9..efbc967 100644 --- a/client/src/main/java/rt4/Js5MasterIndex.java +++ b/client/src/main/java/rt4/Js5MasterIndex.java @@ -60,12 +60,12 @@ public final class Js5MasterIndex { @Pc(13) int local13; for (local13 = 0; local13 < this.resourceProviders.length; local13++) { if (this.resourceProviders[local13] != null) { - this.resourceProviders[local13].method537(); + this.resourceProviders[local13].processPrefetchQueue(); } } for (local13 = 0; local13 < this.resourceProviders.length; local13++) { if (this.resourceProviders[local13] != null) { - this.resourceProviders[local13].method534(); + this.resourceProviders[local13].loop(); } } } diff --git a/client/src/main/java/rt4/Js5NetQueue.java b/client/src/main/java/rt4/Js5NetQueue.java index 1970818..a766a09 100644 --- a/client/src/main/java/rt4/Js5NetQueue.java +++ b/client/src/main/java/rt4/Js5NetQueue.java @@ -10,34 +10,34 @@ import org.openrs2.deob.annotation.Pc; public final class Js5NetQueue { @OriginalMember(owner = "client!jb", name = "A", descriptor = "J") - private long aLong104; + private long previousLoop; @OriginalMember(owner = "client!jb", name = "B", descriptor = "Lclient!ma;") - private BufferedSocket aClass95_1; + private BufferedSocket socket; @OriginalMember(owner = "client!jb", name = "C", descriptor = "I") - private int anInt2962; + private int latency; @OriginalMember(owner = "client!jb", name = "J", descriptor = "Lclient!pm;") - private Js5NetRequest aClass3_Sub2_Sub5_Sub2_2; + private Js5NetRequest current; @OriginalMember(owner = "client!jb", name = "a", descriptor = "Lclient!ce;") - private final SecondaryLinkedList aClass16_2 = new SecondaryLinkedList(); + private final SecondaryLinkedList pendingUrgentRequests = new SecondaryLinkedList(); @OriginalMember(owner = "client!jb", name = "q", descriptor = "Lclient!ce;") - private final SecondaryLinkedList aClass16_3 = new SecondaryLinkedList(); + private final SecondaryLinkedList inFlightUrgentRequests = new SecondaryLinkedList(); @OriginalMember(owner = "client!jb", name = "v", descriptor = "Lclient!ce;") - private final SecondaryLinkedList aClass16_4 = new SecondaryLinkedList(); + private final SecondaryLinkedList pendingPrefetchRequests = new SecondaryLinkedList(); @OriginalMember(owner = "client!jb", name = "z", descriptor = "Lclient!ce;") - private final SecondaryLinkedList aClass16_5 = new SecondaryLinkedList(); + private final SecondaryLinkedList inFlightPrefetchRequests = new SecondaryLinkedList(); @OriginalMember(owner = "client!jb", name = "E", descriptor = "Lclient!wa;") - private final Buffer aClass3_Sub15_4 = new Buffer(4); + private final Buffer outBuffer = new Buffer(4); @OriginalMember(owner = "client!jb", name = "G", descriptor = "B") - private byte aByte8 = 0; + private byte encryptionKey = 0; @OriginalMember(owner = "client!jb", name = "I", descriptor = "I") public volatile int errors = 0; @@ -46,141 +46,141 @@ public final class Js5NetQueue { public volatile int response = 0; @OriginalMember(owner = "client!jb", name = "F", descriptor = "Lclient!wa;") - private final Buffer aClass3_Sub15_5 = new Buffer(8); + private final Buffer inBuffer = new Buffer(8); @OriginalMember(owner = "client!jb", name = "a", descriptor = "(I)Z") - public final boolean method2316() { - return this.method2321() >= 20; + public final boolean isPrefetchRequestQueueFull() { + return this.getPrefetchRequestCount() >= 20; } @OriginalMember(owner = "client!jb", name = "b", descriptor = "(B)Z") public final boolean loop() { @Pc(19) int local19; - if (this.aClass95_1 != null) { + if (this.socket != null) { @Pc(12) long local12 = MonotonicClock.currentTimeMillis(); - local19 = (int) (local12 - this.aLong104); - this.aLong104 = local12; + local19 = (int) (local12 - this.previousLoop); + this.previousLoop = local12; if (local19 > 200) { local19 = 200; } - this.anInt2962 += local19; - if (this.anInt2962 > 30000) { + this.latency += local19; + if (this.latency > 30000) { try { - this.aClass95_1.close(); + this.socket.close(); } catch (@Pc(43) Exception local43) { } - this.aClass95_1 = null; + this.socket = null; } } - if (this.aClass95_1 == null) { - return this.method2328() == 0 && this.method2321() == 0; + if (this.socket == null) { + return this.getUrgentRequestCount() == 0 && this.getPrefetchRequestCount() == 0; } try { - this.aClass95_1.checkError(); + this.socket.checkError(); @Pc(75) Js5NetRequest local75; - for (local75 = (Js5NetRequest) this.aClass16_2.method795(); local75 != null; local75 = (Js5NetRequest) this.aClass16_2.method797()) { - this.aClass3_Sub15_4.offset = 0; - this.aClass3_Sub15_4.p1(1); - this.aClass3_Sub15_4.p3((int) local75.secondaryKey); - this.aClass95_1.write(this.aClass3_Sub15_4.data, 4); - this.aClass16_3.addTail(local75); + for (local75 = (Js5NetRequest) this.pendingUrgentRequests.head(); local75 != null; local75 = (Js5NetRequest) this.pendingUrgentRequests.next()) { + this.outBuffer.offset = 0; + this.outBuffer.p1(1); + this.outBuffer.p3((int) local75.secondaryKey); + this.socket.write(this.outBuffer.data, 4); + this.inFlightUrgentRequests.addTail(local75); } - for (local75 = (Js5NetRequest) this.aClass16_4.method795(); local75 != null; local75 = (Js5NetRequest) this.aClass16_4.method797()) { - this.aClass3_Sub15_4.offset = 0; - this.aClass3_Sub15_4.p1(0); - this.aClass3_Sub15_4.p3((int) local75.secondaryKey); - this.aClass95_1.write(this.aClass3_Sub15_4.data, 4); - this.aClass16_5.addTail(local75); + for (local75 = (Js5NetRequest) this.pendingPrefetchRequests.head(); local75 != null; local75 = (Js5NetRequest) this.pendingPrefetchRequests.next()) { + this.outBuffer.offset = 0; + this.outBuffer.p1(0); + this.outBuffer.p3((int) local75.secondaryKey); + this.socket.write(this.outBuffer.data, 4); + this.inFlightPrefetchRequests.addTail(local75); } for (@Pc(172) int local172 = 0; local172 < 100; local172++) { - local19 = this.aClass95_1.available(); + local19 = this.socket.available(); if (local19 < 0) { throw new IOException(); } if (local19 == 0) { break; } - this.anInt2962 = 0; + this.latency = 0; @Pc(196) byte local196 = 0; - if (this.aClass3_Sub2_Sub5_Sub2_2 == null) { + if (this.current == null) { local196 = 8; - } else if (this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 == 0) { + } else if (this.current.blockPosition == 0) { local196 = 1; } @Pc(228) int local228; @Pc(235) int local235; @Pc(283) int local283; if (local196 <= 0) { - local228 = this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.data.length - this.aClass3_Sub2_Sub5_Sub2_2.aByte16; - local235 = 512 - this.aClass3_Sub2_Sub5_Sub2_2.anInt4617; - if (local235 > local228 - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset) { - local235 = local228 - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset; + local228 = this.current.buffer.data.length - this.current.trailerLen; + local235 = 512 - this.current.blockPosition; + if (local235 > local228 - this.current.buffer.offset) { + local235 = local228 - this.current.buffer.offset; } if (local235 > local19) { local235 = local19; } - this.aClass95_1.read(this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset, local235, this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.data); - if (this.aByte8 != 0) { + this.socket.read(this.current.buffer.offset, local235, this.current.buffer.data); + if (this.encryptionKey != 0) { for (local283 = 0; local283 < local235; local283++) { - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.data[this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset + local283] = (byte) (this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.data[this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset + local283] ^ this.aByte8); + this.current.buffer.data[this.current.buffer.offset + local283] = (byte) (this.current.buffer.data[this.current.buffer.offset + local283] ^ this.encryptionKey); } } - this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 += local235; - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset += local235; - if (this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.offset == local228) { - this.aClass3_Sub2_Sub5_Sub2_2.method4365(); - this.aClass3_Sub2_Sub5_Sub2_2.incomplete = false; - this.aClass3_Sub2_Sub5_Sub2_2 = null; - } else if (this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 == 512) { - this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 = 0; + this.current.blockPosition += local235; + this.current.buffer.offset += local235; + if (this.current.buffer.offset == local228) { + this.current.unlinkSecondary(); + this.current.incomplete = false; + this.current = null; + } else if (this.current.blockPosition == 512) { + this.current.blockPosition = 0; } } else { - local228 = local196 - this.aClass3_Sub15_5.offset; + local228 = local196 - this.inBuffer.offset; if (local19 < local228) { local228 = local19; } - this.aClass95_1.read(this.aClass3_Sub15_5.offset, local228, this.aClass3_Sub15_5.data); - if (this.aByte8 != 0) { + this.socket.read(this.inBuffer.offset, local228, this.inBuffer.data); + if (this.encryptionKey != 0) { for (local235 = 0; local235 < local228; local235++) { - this.aClass3_Sub15_5.data[local235 + this.aClass3_Sub15_5.offset] ^= this.aByte8; + this.inBuffer.data[local235 + this.inBuffer.offset] ^= this.encryptionKey; } } - this.aClass3_Sub15_5.offset += local228; - if (this.aClass3_Sub15_5.offset >= local196) { - if (this.aClass3_Sub2_Sub5_Sub2_2 == null) { - this.aClass3_Sub15_5.offset = 0; - local235 = this.aClass3_Sub15_5.g1(); - local283 = this.aClass3_Sub15_5.g2(); - @Pc(471) int local471 = this.aClass3_Sub15_5.g1(); - @Pc(476) int local476 = this.aClass3_Sub15_5.g4(); + this.inBuffer.offset += local228; + if (this.inBuffer.offset >= local196) { + if (this.current == null) { + this.inBuffer.offset = 0; + local235 = this.inBuffer.g1(); + local283 = this.inBuffer.g2(); + @Pc(471) int local471 = this.inBuffer.g1(); + @Pc(476) int local476 = this.inBuffer.g4(); @Pc(480) int local480 = local471 & 0x7F; @Pc(491) boolean local491 = (local471 & 0x80) != 0; @Pc(501) long local501 = (long) ((local235 << 16) + local283); @Pc(509) Js5NetRequest local509; if (local491) { - for (local509 = (Js5NetRequest) this.aClass16_5.method795(); local509 != null && local509.secondaryKey != local501; local509 = (Js5NetRequest) this.aClass16_5.method797()) { + for (local509 = (Js5NetRequest) this.inFlightPrefetchRequests.head(); local509 != null && local509.secondaryKey != local501; local509 = (Js5NetRequest) this.inFlightPrefetchRequests.next()) { } } else { - for (local509 = (Js5NetRequest) this.aClass16_3.method795(); local509 != null && local501 != local509.secondaryKey; local509 = (Js5NetRequest) this.aClass16_3.method797()) { + for (local509 = (Js5NetRequest) this.inFlightUrgentRequests.head(); local509 != null && local501 != local509.secondaryKey; local509 = (Js5NetRequest) this.inFlightUrgentRequests.next()) { } } if (local509 == null) { throw new IOException(); } @Pc(568) int local568 = local480 == 0 ? 5 : 9; - this.aClass3_Sub2_Sub5_Sub2_2 = local509; - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7 = new Buffer(local476 + local568 + this.aClass3_Sub2_Sub5_Sub2_2.aByte16); - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.p1(local480); - this.aClass3_Sub2_Sub5_Sub2_2.aClass3_Sub15_7.p4(local476); - this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 = 8; - this.aClass3_Sub15_5.offset = 0; - } else if (this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 != 0) { + this.current = local509; + this.current.buffer = new Buffer(local476 + local568 + this.current.trailerLen); + this.current.buffer.p1(local480); + this.current.buffer.p4(local476); + this.current.blockPosition = 8; + this.inBuffer.offset = 0; + } else if (this.current.blockPosition != 0) { throw new IOException(); - } else if (this.aClass3_Sub15_5.data[0] == -1) { - this.aClass3_Sub2_Sub5_Sub2_2.anInt4617 = 1; - this.aClass3_Sub15_5.offset = 0; + } else if (this.inBuffer.data[0] == -1) { + this.current.blockPosition = 1; + this.inBuffer.offset = 0; } else { - this.aClass3_Sub2_Sub5_Sub2_2 = null; + this.current = null; } } } @@ -188,161 +188,161 @@ public final class Js5NetQueue { return true; } catch (@Pc(644) IOException local644) { try { - this.aClass95_1.close(); - } catch (@Pc(650) Exception local650) { + this.socket.close(); + } catch (@Pc(650) Exception ignored) { } this.response = -2; this.errors++; - this.aClass95_1 = null; - return this.method2328() == 0 && this.method2321() == 0; + this.socket = null; + return this.getUrgentRequestCount() == 0 && this.getPrefetchRequestCount() == 0; } } @OriginalMember(owner = "client!jb", name = "a", descriptor = "(Z)V") public final void drop() { - if (this.aClass95_1 == null) { + if (this.socket == null) { return; } try { - this.aClass3_Sub15_4.offset = 0; - this.aClass3_Sub15_4.p1(7); - this.aClass3_Sub15_4.p3(0); - this.aClass95_1.write(this.aClass3_Sub15_4.data, 4); + this.outBuffer.offset = 0; + this.outBuffer.p1(7); + this.outBuffer.p3(0); + this.socket.write(this.outBuffer.data, 4); } catch (@Pc(39) IOException local39) { try { - this.aClass95_1.close(); + this.socket.close(); } catch (@Pc(45) Exception local45) { } this.errors++; this.response = -2; - this.aClass95_1 = null; + this.socket = null; } } @OriginalMember(owner = "client!jb", name = "b", descriptor = "(I)I") - private int method2321() { - return this.aClass16_4.method793() + this.aClass16_5.method793(); + private int getPrefetchRequestCount() { + return this.pendingPrefetchRequests.size() + this.inFlightPrefetchRequests.size(); } @OriginalMember(owner = "client!jb", name = "a", descriptor = "(ZZ)V") public final void writeLoggedIn(@OriginalArg(0) boolean arg0) { - if (this.aClass95_1 == null) { + if (this.socket == null) { return; } try { - this.aClass3_Sub15_4.offset = 0; - this.aClass3_Sub15_4.p1(arg0 ? 2 : 3); - this.aClass3_Sub15_4.p3(0); - this.aClass95_1.write(this.aClass3_Sub15_4.data, 4); + this.outBuffer.offset = 0; + this.outBuffer.p1(arg0 ? 2 : 3); + this.outBuffer.p3(0); + this.socket.write(this.outBuffer.data, 4); } catch (@Pc(42) IOException local42) { try { - this.aClass95_1.close(); + this.socket.close(); } catch (@Pc(48) Exception local48) { } this.errors++; this.response = -2; - this.aClass95_1 = null; + this.socket = null; } } @OriginalMember(owner = "client!jb", name = "c", descriptor = "(I)V") public final void breakConnection() { - if (this.aClass95_1 != null) { - this.aClass95_1.breakConnection(); + if (this.socket != null) { + this.socket.breakConnection(); } } @OriginalMember(owner = "client!jb", name = "a", descriptor = "(ZLclient!ma;I)V") public final void start(@OriginalArg(0) boolean arg0, @OriginalArg(1) BufferedSocket arg1) { - if (this.aClass95_1 != null) { + if (this.socket != null) { try { - this.aClass95_1.close(); + this.socket.close(); } catch (@Pc(14) Exception local14) { } - this.aClass95_1 = null; + this.socket = null; } - this.aClass95_1 = arg1; + this.socket = arg1; this.method2331(); this.writeLoggedIn(arg0); - this.aClass3_Sub15_5.offset = 0; - this.aClass3_Sub2_Sub5_Sub2_2 = null; + this.inBuffer.offset = 0; + this.current = null; while (true) { - @Pc(44) Js5NetRequest local44 = (Js5NetRequest) this.aClass16_3.method796(); + @Pc(44) Js5NetRequest local44 = (Js5NetRequest) this.inFlightUrgentRequests.removeHead(); if (local44 == null) { while (true) { - local44 = (Js5NetRequest) this.aClass16_5.method796(); + local44 = (Js5NetRequest) this.inFlightPrefetchRequests.removeHead(); if (local44 == null) { - if (this.aByte8 != 0) { + if (this.encryptionKey != 0) { try { - this.aClass3_Sub15_4.offset = 0; - this.aClass3_Sub15_4.p1(4); - this.aClass3_Sub15_4.p1(this.aByte8); - this.aClass3_Sub15_4.p2(0); - this.aClass95_1.write(this.aClass3_Sub15_4.data, 4); + this.outBuffer.offset = 0; + this.outBuffer.p1(4); + this.outBuffer.p1(this.encryptionKey); + this.outBuffer.p2(0); + this.socket.write(this.outBuffer.data, 4); } catch (@Pc(107) IOException local107) { try { - this.aClass95_1.close(); + this.socket.close(); } catch (@Pc(113) Exception local113) { } this.response = -2; this.errors++; - this.aClass95_1 = null; + this.socket = null; } } - this.anInt2962 = 0; - this.aLong104 = MonotonicClock.currentTimeMillis(); + this.latency = 0; + this.previousLoop = MonotonicClock.currentTimeMillis(); return; } - this.aClass16_4.addTail(local44); + this.pendingPrefetchRequests.addTail(local44); } } - this.aClass16_2.addTail(local44); + this.pendingUrgentRequests.addTail(local44); } } @OriginalMember(owner = "client!jb", name = "c", descriptor = "(B)Z") public final boolean isUrgentRequestQueueFull() { - return this.method2328() >= 20; + return this.getUrgentRequestCount() >= 20; } @OriginalMember(owner = "client!jb", name = "d", descriptor = "(B)V") - public final void method2327() { + public final void rekey() { try { - this.aClass95_1.close(); + this.socket.close(); } catch (@Pc(17) Exception local17) { } this.response = -1; - this.aByte8 = (byte) (Math.random() * 255.0D + 1.0D); - this.aClass95_1 = null; + this.encryptionKey = (byte) (Math.random() * 255.0D + 1.0D); + this.socket = null; this.errors++; } @OriginalMember(owner = "client!jb", name = "d", descriptor = "(I)I") - public final int method2328() { - return this.aClass16_2.method793() + this.aClass16_3.method793(); + public final int getUrgentRequestCount() { + return this.pendingUrgentRequests.size() + this.inFlightUrgentRequests.size(); } @OriginalMember(owner = "client!jb", name = "b", descriptor = "(Z)V") public final void quit() { - if (this.aClass95_1 != null) { - this.aClass95_1.close(); + if (this.socket != null) { + this.socket.close(); } } @OriginalMember(owner = "client!jb", name = "a", descriptor = "(IIBIZ)Lclient!pm;") public final Js5NetRequest read(@OriginalArg(1) int arg0, @OriginalArg(2) byte arg1, @OriginalArg(3) int arg2, @OriginalArg(4) boolean arg3) { @Pc(7) Js5NetRequest local7 = new Js5NetRequest(); - @Pc(14) long local14 = (long) (arg2 + (arg0 << 16)); - local7.aBoolean225 = arg3; + @Pc(14) long local14 = arg2 + ((long) arg0 << 16); + local7.urgent = arg3; local7.secondaryKey = local14; - local7.aByte16 = arg1; + local7.trailerLen = arg1; if (arg3) { - if (this.method2328() >= 20) { + if (this.getUrgentRequestCount() >= 20) { throw new RuntimeException(); } - this.aClass16_2.addTail(local7); - } else if (this.method2321() < 20) { - this.aClass16_4.addTail(local7); + this.pendingUrgentRequests.addTail(local7); + } else if (this.getPrefetchRequestCount() < 20) { + this.pendingPrefetchRequests.addTail(local7); } else { throw new RuntimeException(); } @@ -351,21 +351,21 @@ public final class Js5NetQueue { @OriginalMember(owner = "client!jb", name = "e", descriptor = "(B)V") private void method2331() { - if (this.aClass95_1 == null) { + if (this.socket == null) { return; } try { - this.aClass3_Sub15_4.offset = 0; - this.aClass3_Sub15_4.p1(6); - this.aClass3_Sub15_4.p3(3); - this.aClass95_1.write(this.aClass3_Sub15_4.data, 4); + this.outBuffer.offset = 0; + this.outBuffer.p1(6); + this.outBuffer.p3(3); + this.socket.write(this.outBuffer.data, 4); } catch (@Pc(37) IOException local37) { try { - this.aClass95_1.close(); - } catch (@Pc(43) Exception local43) { + this.socket.close(); + } catch (@Pc(43) Exception ignored) { } this.errors++; - this.aClass95_1 = null; + this.socket = null; this.response = -2; } } diff --git a/client/src/main/java/rt4/Js5NetRequest.java b/client/src/main/java/rt4/Js5NetRequest.java index 69a4d72..42bf8fb 100644 --- a/client/src/main/java/rt4/Js5NetRequest.java +++ b/client/src/main/java/rt4/Js5NetRequest.java @@ -7,26 +7,26 @@ import org.openrs2.deob.annotation.OriginalMember; public final class Js5NetRequest extends Js5Request { @OriginalMember(owner = "client!pm", name = "U", descriptor = "B") - public byte aByte16; + public byte trailerLen; @OriginalMember(owner = "client!pm", name = "Z", descriptor = "I") - public int anInt4617; + public int blockPosition; @OriginalMember(owner = "client!pm", name = "bb", descriptor = "Lclient!wa;") - public Buffer aClass3_Sub15_7; + public Buffer buffer; @OriginalMember(owner = "client!pm", name = "a", descriptor = "(Z)I") @Override - public final int method3553() { - return this.aClass3_Sub15_7 == null ? 0 : this.aClass3_Sub15_7.offset * 100 / (this.aClass3_Sub15_7.data.length - this.aByte16); + public final int getPercentageComplete() { + return this.buffer == null ? 0 : this.buffer.offset * 100 / (this.buffer.data.length - this.trailerLen); } @OriginalMember(owner = "client!pm", name = "b", descriptor = "(Z)[B") @Override public final byte[] getData() { - if (this.incomplete || this.aClass3_Sub15_7.offset < this.aClass3_Sub15_7.data.length - this.aByte16) { + if (this.incomplete || this.buffer.offset < this.buffer.data.length - this.trailerLen) { throw new RuntimeException(); } - return this.aClass3_Sub15_7.data; + return this.buffer.data; } } diff --git a/client/src/main/java/rt4/Js5QuickChatCommandDecoder.java b/client/src/main/java/rt4/Js5QuickChatCommandDecoder.java index c099809..3b3a4ba 100644 --- a/client/src/main/java/rt4/Js5QuickChatCommandDecoder.java +++ b/client/src/main/java/rt4/Js5QuickChatCommandDecoder.java @@ -10,15 +10,15 @@ public final class Js5QuickChatCommandDecoder implements QuickChatCommandDecoder @OriginalMember(owner = "client!af", name = "a", descriptor = "(I[IIJ)Lclient!na;") @Override - public final JagString method30(@OriginalArg(0) int arg0, @OriginalArg(1) int[] arg1, @OriginalArg(3) long arg2) { - if (arg0 == 0) { - @Pc(12) EnumType local12 = EnumTypeList.get(arg1[0]); - return local12.getString((int) arg2); - } else if (arg0 == 1 || arg0 == 10) { - @Pc(31) ObjType local31 = ObjTypeList.get((int) arg2); - return local31.name; - } else if (arg0 == 6 || arg0 == 7 || arg0 == 11) { - return EnumTypeList.get(arg1[0]).getString((int) arg2); + public final JagString decode(@OriginalArg(0) int command, @OriginalArg(1) int[] params, @OriginalArg(3) long value) { + if (command == 0) { + @Pc(12) EnumType type = EnumTypeList.get(params[0]); + return type.getString((int) value); + } else if (command == 1 || command == 10) { + @Pc(31) ObjType type = ObjTypeList.get((int) value); + return type.name; + } else if (command == 6 || command == 7 || command == 11) { + return EnumTypeList.get(params[0]).getString((int) value); } else { return null; } diff --git a/client/src/main/java/rt4/Js5Request.java b/client/src/main/java/rt4/Js5Request.java index 8032bf1..7e1e7bb 100644 --- a/client/src/main/java/rt4/Js5Request.java +++ b/client/src/main/java/rt4/Js5Request.java @@ -7,16 +7,16 @@ import org.openrs2.deob.annotation.OriginalMember; public abstract class Js5Request extends SecondaryNode { @OriginalMember(owner = "client!il", name = "L", descriptor = "Z") - public boolean aBoolean225; + public boolean urgent; @OriginalMember(owner = "client!il", name = "T", descriptor = "Z") - public boolean aBoolean227; + public boolean orphan; @OriginalMember(owner = "client!il", name = "P", descriptor = "Z") public volatile boolean incomplete = true; @OriginalMember(owner = "client!il", name = "a", descriptor = "(Z)I") - public abstract int method3553(); + public abstract int getPercentageComplete(); @OriginalMember(owner = "client!il", name = "b", descriptor = "(Z)[B") public abstract byte[] getData(); diff --git a/client/src/main/java/rt4/LruHashTable.java b/client/src/main/java/rt4/LruHashTable.java index e81abcc..c76359b 100644 --- a/client/src/main/java/rt4/LruHashTable.java +++ b/client/src/main/java/rt4/LruHashTable.java @@ -51,13 +51,13 @@ public final class LruHashTable { @OriginalMember(owner = "client!gn", name = "a", descriptor = "(Lclient!rg;JB)V") public final void put(@OriginalArg(0) SecondaryNode arg0, @OriginalArg(1) long arg1) { if (this.anInt2314 == 0) { - @Pc(14) SecondaryNode local14 = this.aClass16_1.method796(); + @Pc(14) SecondaryNode local14 = this.aClass16_1.removeHead(); local14.unlink(); - local14.method4365(); + local14.unlinkSecondary(); if (this.aClass3_Sub2_37 == local14) { - local14 = this.aClass16_1.method796(); + local14 = this.aClass16_1.removeHead(); local14.unlink(); - local14.method4365(); + local14.unlinkSecondary(); } } else { this.anInt2314--; diff --git a/client/src/main/java/rt4/QuickChatCommandDecoder.java b/client/src/main/java/rt4/QuickChatCommandDecoder.java index 5f42c3e..40a57c6 100644 --- a/client/src/main/java/rt4/QuickChatCommandDecoder.java +++ b/client/src/main/java/rt4/QuickChatCommandDecoder.java @@ -8,5 +8,5 @@ import org.openrs2.deob.annotation.OriginalMember; public interface QuickChatCommandDecoder { @OriginalMember(owner = "client!of", name = "a", descriptor = "(I[IIJ)Lclient!na;") - JagString method30(@OriginalArg(0) int arg0, @OriginalArg(1) int[] arg1, @OriginalArg(3) long arg2); + JagString decode(@OriginalArg(0) int arg0, @OriginalArg(1) int[] arg1, @OriginalArg(3) long arg2); } diff --git a/client/src/main/java/rt4/ScriptRunner.java b/client/src/main/java/rt4/ScriptRunner.java index 7543c2b..aff1e7d 100644 --- a/client/src/main/java/rt4/ScriptRunner.java +++ b/client/src/main/java/rt4/ScriptRunner.java @@ -332,7 +332,7 @@ public final class ScriptRunner { Static5.anInt40 = local57; Camera.renderX = local59; Camera.cameraYaw = local125; - if (aBoolean43 && client.js5NetQueue.method2328() == 0) { + if (aBoolean43 && client.js5NetQueue.getUrgentRequestCount() == 0) { aBoolean43 = false; } if (aBoolean43) { @@ -4368,7 +4368,7 @@ public final class ScriptRunner { str1 = stringStack[ssp]; local7566 = false; @Pc(7577) SecondaryLinkedList local7577 = method3333(int1 >> 14 & 0x3FFF, int1 & 0x3FFF); - for (@Pc(7582) Map local7582 = (Map) local7577.method795(); local7582 != null; local7582 = (Map) local7577.method797()) { + for (@Pc(7582) Map local7582 = (Map) local7577.head(); local7582 != null; local7582 = (Map) local7577.next()) { if (local7582.group.equalsIgnoreCase(str1)) { local7566 = true; break; diff --git a/client/src/main/java/rt4/SecondaryHashTable.java b/client/src/main/java/rt4/SecondaryHashTable.java index 2974137..c2b9ebd 100644 --- a/client/src/main/java/rt4/SecondaryHashTable.java +++ b/client/src/main/java/rt4/SecondaryHashTable.java @@ -16,8 +16,8 @@ public final class SecondaryHashTable { this.aClass3_Sub2Array1 = new SecondaryNode[arg0]; for (@Pc(7) int local7 = 0; local7 < arg0; local7++) { @Pc(23) SecondaryNode local23 = this.aClass3_Sub2Array1[local7] = new SecondaryNode(); - local23.aClass3_Sub2_66 = local23; - local23.aClass3_Sub2_67 = local23; + local23.secondaryPrev = local23; + local23.secondaryNext = local23; } } } diff --git a/client/src/main/java/rt4/SecondaryLinkedList.java b/client/src/main/java/rt4/SecondaryLinkedList.java index da1f95a..3b5a75e 100644 --- a/client/src/main/java/rt4/SecondaryLinkedList.java +++ b/client/src/main/java/rt4/SecondaryLinkedList.java @@ -9,83 +9,83 @@ import org.openrs2.deob.annotation.Pc; public final class SecondaryLinkedList { @OriginalMember(owner = "client!ce", name = "n", descriptor = "Lclient!rg;") - private SecondaryNode aClass3_Sub2_22; + private SecondaryNode cursor; @OriginalMember(owner = "client!ce", name = "l", descriptor = "Lclient!rg;") - private final SecondaryNode aClass3_Sub2_21 = new SecondaryNode(); + private final SecondaryNode sentinel = new SecondaryNode(); @OriginalMember(owner = "client!ce", name = "", descriptor = "()V") public SecondaryLinkedList() { - this.aClass3_Sub2_21.aClass3_Sub2_67 = this.aClass3_Sub2_21; - this.aClass3_Sub2_21.aClass3_Sub2_66 = this.aClass3_Sub2_21; + this.sentinel.secondaryNext = this.sentinel; + this.sentinel.secondaryPrev = this.sentinel; } @OriginalMember(owner = "client!ce", name = "a", descriptor = "(I)I") - public final int method793() { + public final int size() { @Pc(3) int local3 = 0; - @Pc(7) SecondaryNode local7 = this.aClass3_Sub2_21.aClass3_Sub2_67; - while (local7 != this.aClass3_Sub2_21) { - local7 = local7.aClass3_Sub2_67; + @Pc(7) SecondaryNode local7 = this.sentinel.secondaryNext; + while (local7 != this.sentinel) { + local7 = local7.secondaryNext; local3++; } return local3; } @OriginalMember(owner = "client!ce", name = "b", descriptor = "(B)Lclient!rg;") - public final SecondaryNode method795() { - @Pc(3) SecondaryNode local3 = this.aClass3_Sub2_21.aClass3_Sub2_67; - if (this.aClass3_Sub2_21 == local3) { - this.aClass3_Sub2_22 = null; + public final SecondaryNode head() { + @Pc(3) SecondaryNode local3 = this.sentinel.secondaryNext; + if (this.sentinel == local3) { + this.cursor = null; return null; } else { - this.aClass3_Sub2_22 = local3.aClass3_Sub2_67; + this.cursor = local3.secondaryNext; return local3; } } @OriginalMember(owner = "client!ce", name = "b", descriptor = "(I)Lclient!rg;") - public final SecondaryNode method796() { - @Pc(7) SecondaryNode local7 = this.aClass3_Sub2_21.aClass3_Sub2_67; - if (local7 == this.aClass3_Sub2_21) { + public final SecondaryNode removeHead() { + @Pc(7) SecondaryNode local7 = this.sentinel.secondaryNext; + if (local7 == this.sentinel) { return null; } else { - local7.method4365(); + local7.unlinkSecondary(); return local7; } } @OriginalMember(owner = "client!ce", name = "c", descriptor = "(I)Lclient!rg;") - public final SecondaryNode method797() { - @Pc(2) SecondaryNode local2 = this.aClass3_Sub2_22; - if (local2 == this.aClass3_Sub2_21) { - this.aClass3_Sub2_22 = null; + public final SecondaryNode next() { + @Pc(2) SecondaryNode local2 = this.cursor; + if (local2 == this.sentinel) { + this.cursor = null; return null; } else { - this.aClass3_Sub2_22 = local2.aClass3_Sub2_67; + this.cursor = local2.secondaryNext; return local2; } } @OriginalMember(owner = "client!ce", name = "a", descriptor = "(Lclient!rg;B)V") public final void addTail(@OriginalArg(0) SecondaryNode arg0) { - if (arg0.aClass3_Sub2_66 != null) { - arg0.method4365(); + if (arg0.secondaryPrev != null) { + arg0.unlinkSecondary(); } - arg0.aClass3_Sub2_66 = this.aClass3_Sub2_21.aClass3_Sub2_66; - arg0.aClass3_Sub2_67 = this.aClass3_Sub2_21; - arg0.aClass3_Sub2_66.aClass3_Sub2_67 = arg0; - arg0.aClass3_Sub2_67.aClass3_Sub2_66 = arg0; + arg0.secondaryPrev = this.sentinel.secondaryPrev; + arg0.secondaryNext = this.sentinel; + arg0.secondaryPrev.secondaryNext = arg0; + arg0.secondaryNext.secondaryPrev = arg0; } @OriginalMember(owner = "client!ce", name = "d", descriptor = "(I)V") public final void clear() { while (true) { - @Pc(15) SecondaryNode local15 = this.aClass3_Sub2_21.aClass3_Sub2_67; - if (this.aClass3_Sub2_21 == local15) { - this.aClass3_Sub2_22 = null; + @Pc(15) SecondaryNode local15 = this.sentinel.secondaryNext; + if (this.sentinel == local15) { + this.cursor = null; return; } - local15.method4365(); + local15.unlinkSecondary(); } } } diff --git a/client/src/main/java/rt4/SecondaryNode.java b/client/src/main/java/rt4/SecondaryNode.java index 2f6dd99..5b17943 100644 --- a/client/src/main/java/rt4/SecondaryNode.java +++ b/client/src/main/java/rt4/SecondaryNode.java @@ -10,18 +10,18 @@ public class SecondaryNode extends Node { public long secondaryKey; @OriginalMember(owner = "client!rg", name = "w", descriptor = "Lclient!rg;") - public SecondaryNode aClass3_Sub2_66; + public SecondaryNode secondaryPrev; @OriginalMember(owner = "client!rg", name = "G", descriptor = "Lclient!rg;") - public SecondaryNode aClass3_Sub2_67; + public SecondaryNode secondaryNext; @OriginalMember(owner = "client!rg", name = "e", descriptor = "(B)V") - public final void method4365() { - if (this.aClass3_Sub2_66 != null) { - this.aClass3_Sub2_66.aClass3_Sub2_67 = this.aClass3_Sub2_67; - this.aClass3_Sub2_67.aClass3_Sub2_66 = this.aClass3_Sub2_66; - this.aClass3_Sub2_67 = null; - this.aClass3_Sub2_66 = null; + public final void unlinkSecondary() { + if (this.secondaryPrev != null) { + this.secondaryPrev.secondaryNext = this.secondaryNext; + this.secondaryNext.secondaryPrev = this.secondaryPrev; + this.secondaryNext = null; + this.secondaryPrev = null; } } } diff --git a/client/src/main/java/rt4/SoftLruHashTable.java b/client/src/main/java/rt4/SoftLruHashTable.java index 4b59062..4472fb3 100644 --- a/client/src/main/java/rt4/SoftLruHashTable.java +++ b/client/src/main/java/rt4/SoftLruHashTable.java @@ -32,22 +32,22 @@ public final class SoftLruHashTable { @OriginalMember(owner = "client!gk", name = "a", descriptor = "(Lclient!rg;Lclient!rg;B)V") public static void method1772(@OriginalArg(0) SecondaryNode arg0, @OriginalArg(1) SecondaryNode arg1) { - if (arg1.aClass3_Sub2_66 != null) { - arg1.method4365(); + if (arg1.secondaryPrev != null) { + arg1.unlinkSecondary(); } - arg1.aClass3_Sub2_66 = arg0; - arg1.aClass3_Sub2_67 = arg0.aClass3_Sub2_67; - arg1.aClass3_Sub2_66.aClass3_Sub2_67 = arg1; - arg1.aClass3_Sub2_67.aClass3_Sub2_66 = arg1; + arg1.secondaryPrev = arg0; + arg1.secondaryNext = arg0.secondaryNext; + arg1.secondaryPrev.secondaryNext = arg1; + arg1.secondaryNext.secondaryPrev = arg1; } @OriginalMember(owner = "client!n", name = "a", descriptor = "(BLjava/lang/Object;J)V") public final void put(@OriginalArg(1) Object arg0, @OriginalArg(2) long arg1) { this.method3098(arg1); if (this.anInt3966 == 0) { - @Pc(26) ReferenceNode local26 = (ReferenceNode) this.aClass16_8.method796(); + @Pc(26) ReferenceNode local26 = (ReferenceNode) this.aClass16_8.removeHead(); local26.unlink(); - local26.method4365(); + local26.unlinkSecondary(); } else { this.anInt3966--; } @@ -62,7 +62,7 @@ public final class SoftLruHashTable { @Pc(6) ReferenceNode local6 = (ReferenceNode) this.aClass133_18.get(arg0); if (local6 != null) { local6.unlink(); - local6.method4365(); + local6.unlinkSecondary(); this.anInt3966++; } } @@ -70,7 +70,7 @@ public final class SoftLruHashTable { @OriginalMember(owner = "client!n", name = "a", descriptor = "(I)I") public final int method3100() { @Pc(10) int local10 = 0; - for (@Pc(16) ReferenceNode local16 = (ReferenceNode) this.aClass16_8.method795(); local16 != null; local16 = (ReferenceNode) this.aClass16_8.method797()) { + for (@Pc(16) ReferenceNode local16 = (ReferenceNode) this.aClass16_8.head(); local16 != null; local16 = (ReferenceNode) this.aClass16_8.next()) { if (!local16.method3619()) { local10++; } @@ -83,11 +83,11 @@ public final class SoftLruHashTable { if (ReferenceNodeFactory.SOFT_REFERENCE_NODE_FACTORY == null) { return; } - for (@Pc(9) ReferenceNode local9 = (ReferenceNode) this.aClass16_8.method795(); local9 != null; local9 = (ReferenceNode) this.aClass16_8.method797()) { + for (@Pc(9) ReferenceNode local9 = (ReferenceNode) this.aClass16_8.head(); local9 != null; local9 = (ReferenceNode) this.aClass16_8.next()) { if (local9.method3619()) { if (local9.method3618() == null) { local9.unlink(); - local9.method4365(); + local9.unlinkSecondary(); this.anInt3966++; } } else if (++local9.secondaryKey > (long) arg0) { @@ -95,17 +95,17 @@ public final class SoftLruHashTable { this.aClass133_18.put(local33, local9.key); method1772(local9, local33); local9.unlink(); - local9.method4365(); + local9.unlinkSecondary(); } } } @OriginalMember(owner = "client!n", name = "b", descriptor = "(B)V") public final void method3103() { - for (@Pc(7) ReferenceNode local7 = (ReferenceNode) this.aClass16_8.method795(); local7 != null; local7 = (ReferenceNode) this.aClass16_8.method797()) { + for (@Pc(7) ReferenceNode local7 = (ReferenceNode) this.aClass16_8.head(); local7 != null; local7 = (ReferenceNode) this.aClass16_8.next()) { if (local7.method3619()) { local7.unlink(); - local7.method4365(); + local7.unlinkSecondary(); this.anInt3966++; } } @@ -127,7 +127,7 @@ public final class SoftLruHashTable { @Pc(27) Object local27 = local12.method3618(); if (local27 == null) { local12.unlink(); - local12.method4365(); + local12.unlinkSecondary(); this.anInt3966++; return null; } @@ -137,7 +137,7 @@ public final class SoftLruHashTable { this.aClass16_8.addTail(local53); local53.secondaryKey = 0L; local12.unlink(); - local12.method4365(); + local12.unlinkSecondary(); } else { this.aClass16_8.addTail(local12); local12.secondaryKey = 0L; diff --git a/client/src/main/java/rt4/Static87.java b/client/src/main/java/rt4/Static87.java index ebb08f7..f0d70cd 100644 --- a/client/src/main/java/rt4/Static87.java +++ b/client/src/main/java/rt4/Static87.java @@ -329,9 +329,9 @@ public final class Static87 { objId = 0; local556 = 0; for (local563 = 0; local563 < 28; local563++) { - cardMemory += client.js5Providers[local563].method535(); - local556 += client.js5Providers[local563].method529(); - objId += client.js5Providers[local563].method533(); + cardMemory += client.js5Providers[local563].getIndexSize(); + local556 += client.js5Providers[local563].getVerifiedGroups(); + objId += client.js5Providers[local563].getTotalVerifiedGroups(); } local571 = local556 * 10000 / cardMemory; local563 = objId * 100 / cardMemory; diff --git a/client/src/main/java/rt4/Static89.java b/client/src/main/java/rt4/Static89.java index b53d116..c2a9587 100644 --- a/client/src/main/java/rt4/Static89.java +++ b/client/src/main/java/rt4/Static89.java @@ -77,7 +77,7 @@ public final class Static89 { @OriginalMember(owner = "client!ha", name = "a", descriptor = "([IJIZ)Lclient!na;") public static JagString method1838(@OriginalArg(0) int[] arg0, @OriginalArg(1) long arg1, @OriginalArg(2) int arg2) { if (QuickChatPhraseTypeList.decoder != null) { - @Pc(17) JagString local17 = QuickChatPhraseTypeList.decoder.method30(arg2, arg0, arg1); + @Pc(17) JagString local17 = QuickChatPhraseTypeList.decoder.decode(arg2, arg0, arg1); if (local17 != null) { return local17; }