client: rev 198 (#3014)
* client: rev 198 * client: checkstyle Co-authored-by: therealnull <therealnull@gmail.com>
This commit is contained in:
@@ -3,206 +3,208 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import net.runelite.mapping.Export;
|
||||
import net.runelite.mapping.Implements;
|
||||
import net.runelite.mapping.ObfuscatedGetter;
|
||||
import net.runelite.mapping.ObfuscatedName;
|
||||
import net.runelite.mapping.ObfuscatedSignature;
|
||||
|
||||
@ObfuscatedName("ea")
|
||||
@ObfuscatedName("ek")
|
||||
@Implements("NetSocket")
|
||||
public final class NetSocket extends AbstractSocket implements Runnable {
|
||||
@ObfuscatedName("f")
|
||||
@ObfuscatedName("s")
|
||||
@Export("inputStream")
|
||||
InputStream inputStream;
|
||||
@ObfuscatedName("e")
|
||||
@ObfuscatedName("t")
|
||||
@Export("outputStream")
|
||||
OutputStream outputStream;
|
||||
@ObfuscatedName("v")
|
||||
@Export("socket")
|
||||
Socket socket;
|
||||
@ObfuscatedName("y")
|
||||
@ObfuscatedName("j")
|
||||
@Export("isClosed")
|
||||
boolean isClosed;
|
||||
@ObfuscatedName("j")
|
||||
@ObfuscatedName("l")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "Lda;"
|
||||
descriptor = "Ldz;"
|
||||
)
|
||||
@Export("taskHandler")
|
||||
TaskHandler taskHandler;
|
||||
@ObfuscatedName("o")
|
||||
@ObfuscatedName("n")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "Lel;"
|
||||
descriptor = "Lex;"
|
||||
)
|
||||
@Export("task")
|
||||
Task task;
|
||||
@ObfuscatedName("m")
|
||||
@ObfuscatedName("w")
|
||||
@Export("outBuffer")
|
||||
byte[] outBuffer;
|
||||
@ObfuscatedName("r")
|
||||
@ObfuscatedName("f")
|
||||
@ObfuscatedGetter(
|
||||
intValue = -1328963059
|
||||
intValue = 2140398327
|
||||
)
|
||||
@Export("outLength")
|
||||
int outLength;
|
||||
@ObfuscatedName("h")
|
||||
@ObfuscatedName("o")
|
||||
@ObfuscatedGetter(
|
||||
intValue = -1887422677
|
||||
intValue = -430888233
|
||||
)
|
||||
@Export("outOffset")
|
||||
int outOffset;
|
||||
@ObfuscatedName("d")
|
||||
@ObfuscatedName("x")
|
||||
@Export("exceptionWriting")
|
||||
boolean exceptionWriting;
|
||||
@ObfuscatedName("z")
|
||||
@ObfuscatedName("r")
|
||||
@ObfuscatedGetter(
|
||||
intValue = 957852253
|
||||
intValue = -1829022253
|
||||
)
|
||||
@Export("bufferLength")
|
||||
final int bufferLength;
|
||||
@ObfuscatedName("b")
|
||||
@ObfuscatedName("p")
|
||||
@ObfuscatedGetter(
|
||||
intValue = -1007889337
|
||||
intValue = 1103416471
|
||||
)
|
||||
@Export("maxPacketLength")
|
||||
final int maxPacketLength;
|
||||
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(Ljava/net/Socket;Lda;I)V"
|
||||
descriptor = "(Ljava/net/Socket;Ldz;I)V"
|
||||
)
|
||||
public NetSocket(Socket var1, TaskHandler var2, int var3) throws IOException {
|
||||
this.isClosed = false; // L: 16
|
||||
this.outLength = 0; // L: 20
|
||||
this.outOffset = 0; // L: 21
|
||||
this.exceptionWriting = false; // L: 22
|
||||
this.taskHandler = var2; // L: 28
|
||||
this.socket = var1; // L: 29
|
||||
this.bufferLength = var3; // L: 30
|
||||
this.maxPacketLength = var3 - 100; // L: 31
|
||||
this.socket.setSoTimeout(30000); // L: 32
|
||||
this.socket.setTcpNoDelay(true); // L: 33
|
||||
this.socket.setReceiveBufferSize(65536); // L: 34
|
||||
this.socket.setSendBufferSize(65536); // L: 35
|
||||
this.inputStream = this.socket.getInputStream(); // L: 36
|
||||
this.outputStream = this.socket.getOutputStream(); // L: 37
|
||||
} // L: 38
|
||||
this.isClosed = false;
|
||||
this.outLength = 0;
|
||||
this.outOffset = 0;
|
||||
this.exceptionWriting = false;
|
||||
this.taskHandler = var2;
|
||||
this.socket = var1;
|
||||
this.bufferLength = var3;
|
||||
this.maxPacketLength = var3 - 100;
|
||||
this.socket.setSoTimeout(30000);
|
||||
this.socket.setTcpNoDelay(true);
|
||||
this.socket.setReceiveBufferSize(65536);
|
||||
this.socket.setSendBufferSize(65536);
|
||||
this.inputStream = this.socket.getInputStream();
|
||||
this.outputStream = this.socket.getOutputStream();
|
||||
}
|
||||
|
||||
@ObfuscatedName("f")
|
||||
@ObfuscatedName("s")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(I)V",
|
||||
garbageValue = "1854440694"
|
||||
descriptor = "(S)V",
|
||||
garbageValue = "-27454"
|
||||
)
|
||||
@Export("close")
|
||||
public void close() {
|
||||
if (!this.isClosed) { // L: 41
|
||||
synchronized(this) { // L: 42
|
||||
this.isClosed = true; // L: 43
|
||||
this.notifyAll(); // L: 44
|
||||
} // L: 45
|
||||
if (!this.isClosed) {
|
||||
synchronized(this) {
|
||||
this.isClosed = true;
|
||||
this.notifyAll();
|
||||
}
|
||||
|
||||
if (this.task != null) { // L: 46
|
||||
while (this.task.status == 0) { // L: 47
|
||||
class18.method272(1L); // L: 48
|
||||
if (this.task != null) {
|
||||
while (this.task.status == 0) {
|
||||
SceneTilePaint.method4322(1L);
|
||||
}
|
||||
|
||||
if (this.task.status == 1) { // L: 50
|
||||
if (this.task.status == 1) {
|
||||
try {
|
||||
((Thread)this.task.result).join(); // L: 52
|
||||
} catch (InterruptedException var3) { // L: 54
|
||||
((Thread)this.task.result).join();
|
||||
} catch (InterruptedException var3) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.task = null; // L: 57
|
||||
this.task = null;
|
||||
}
|
||||
} // L: 58
|
||||
}
|
||||
|
||||
@ObfuscatedName("e")
|
||||
@ObfuscatedName("t")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(I)I",
|
||||
garbageValue = "574875272"
|
||||
garbageValue = "1311148246"
|
||||
)
|
||||
@Export("readUnsignedByte")
|
||||
public int readUnsignedByte() throws IOException {
|
||||
return this.isClosed ? 0 : this.inputStream.read(); // L: 65 66
|
||||
return this.isClosed ? 0 : this.inputStream.read();
|
||||
}
|
||||
|
||||
@ObfuscatedName("v")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(I)I",
|
||||
garbageValue = "-2063198043"
|
||||
descriptor = "(B)I",
|
||||
garbageValue = "88"
|
||||
)
|
||||
@Export("available")
|
||||
public int available() throws IOException {
|
||||
return this.isClosed ? 0 : this.inputStream.available(); // L: 70 71
|
||||
}
|
||||
|
||||
@ObfuscatedName("y")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(II)Z",
|
||||
garbageValue = "-2019948581"
|
||||
)
|
||||
@Export("isAvailable")
|
||||
public boolean isAvailable(int var1) throws IOException {
|
||||
if (this.isClosed) { // L: 75
|
||||
return false;
|
||||
} else {
|
||||
return this.inputStream.available() >= var1; // L: 76
|
||||
}
|
||||
return this.isClosed ? 0 : this.inputStream.available();
|
||||
}
|
||||
|
||||
@ObfuscatedName("j")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(IB)Z",
|
||||
garbageValue = "-60"
|
||||
)
|
||||
@Export("isAvailable")
|
||||
public boolean isAvailable(int var1) throws IOException {
|
||||
if (this.isClosed) {
|
||||
return false;
|
||||
} else {
|
||||
return this.inputStream.available() >= var1;
|
||||
}
|
||||
}
|
||||
|
||||
@ObfuscatedName("l")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "([BIII)I",
|
||||
garbageValue = "-334344092"
|
||||
garbageValue = "1814286008"
|
||||
)
|
||||
@Export("read")
|
||||
public int read(byte[] var1, int var2, int var3) throws IOException {
|
||||
if (this.isClosed) { // L: 80
|
||||
if (this.isClosed) {
|
||||
return 0;
|
||||
} else {
|
||||
int var4;
|
||||
int var5;
|
||||
for (var4 = var3; var3 > 0; var3 -= var5) { // L: 81 82 86
|
||||
var5 = this.inputStream.read(var1, var2, var3); // L: 83
|
||||
if (var5 <= 0) { // L: 84
|
||||
for (var4 = var3; var3 > 0; var3 -= var5) {
|
||||
var5 = this.inputStream.read(var1, var2, var3);
|
||||
if (var5 <= 0) {
|
||||
throw new EOFException();
|
||||
}
|
||||
|
||||
var2 += var5; // L: 85
|
||||
var2 += var5;
|
||||
}
|
||||
|
||||
return var4; // L: 88
|
||||
return var4;
|
||||
}
|
||||
}
|
||||
|
||||
@ObfuscatedName("o")
|
||||
@ObfuscatedName("n")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "([BIIB)V",
|
||||
garbageValue = "-94"
|
||||
descriptor = "([BIII)V",
|
||||
garbageValue = "1961891652"
|
||||
)
|
||||
@Export("write0")
|
||||
void write0(byte[] var1, int var2, int var3) throws IOException {
|
||||
if (!this.isClosed) { // L: 92
|
||||
if (this.exceptionWriting) { // L: 93
|
||||
this.exceptionWriting = false; // L: 94
|
||||
throw new IOException(); // L: 95
|
||||
if (!this.isClosed) {
|
||||
if (this.exceptionWriting) {
|
||||
this.exceptionWriting = false;
|
||||
throw new IOException();
|
||||
} else {
|
||||
if (this.outBuffer == null) { // L: 97
|
||||
if (this.outBuffer == null) {
|
||||
this.outBuffer = new byte[this.bufferLength];
|
||||
}
|
||||
|
||||
synchronized(this) { // L: 98
|
||||
for (int var5 = 0; var5 < var3; ++var5) { // L: 99
|
||||
this.outBuffer[this.outOffset] = var1[var5 + var2]; // L: 100
|
||||
this.outOffset = (this.outOffset + 1) % this.bufferLength; // L: 101
|
||||
if ((this.outLength + this.maxPacketLength) % this.bufferLength == this.outOffset) { // L: 102
|
||||
throw new IOException(); // L: 103
|
||||
synchronized(this) {
|
||||
for (int var5 = 0; var5 < var3; ++var5) {
|
||||
this.outBuffer[this.outOffset] = var1[var5 + var2];
|
||||
this.outOffset = (this.outOffset + 1) % this.bufferLength;
|
||||
if ((this.outLength + this.maxPacketLength) % this.bufferLength == this.outOffset) {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.task == null) { // L: 106
|
||||
this.task = this.taskHandler.newThreadTask(this, 3); // L: 107
|
||||
if (this.task == null) {
|
||||
this.task = this.taskHandler.newThreadTask(this, 3);
|
||||
}
|
||||
|
||||
this.notifyAll();
|
||||
@@ -211,19 +213,15 @@ public final class NetSocket extends AbstractSocket implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
@ObfuscatedName("m")
|
||||
@ObfuscatedName("w")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "([BIII)V",
|
||||
garbageValue = "-1206684972"
|
||||
descriptor = "([BIIB)V",
|
||||
garbageValue = "-30"
|
||||
)
|
||||
@Export("write")
|
||||
public void write(byte[] var1, int var2, int var3) throws IOException {
|
||||
this.write0(var1, var2, var3); // L: 160
|
||||
} // L: 161
|
||||
|
||||
protected void finalize() {
|
||||
this.close(); // L: 61
|
||||
} // L: 62
|
||||
this.write0(var1, var2, var3);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
@@ -232,7 +230,7 @@ public final class NetSocket extends AbstractSocket implements Runnable {
|
||||
int var1;
|
||||
int var2;
|
||||
synchronized(this) {
|
||||
if (this.outLength == this.outOffset) {
|
||||
if (this.outOffset == this.outLength) {
|
||||
if (this.isClosed) {
|
||||
break label84;
|
||||
}
|
||||
@@ -251,12 +249,12 @@ public final class NetSocket extends AbstractSocket implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
if (var1 <= 0) { // L: 130
|
||||
if (var1 <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
this.outputStream.write(this.outBuffer, var2, var1); // L: 132
|
||||
this.outputStream.write(this.outBuffer, var2, var1);
|
||||
} catch (IOException var9) {
|
||||
this.exceptionWriting = true;
|
||||
}
|
||||
@@ -274,92 +272,140 @@ public final class NetSocket extends AbstractSocket implements Runnable {
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.inputStream != null) { // L: 147
|
||||
if (this.inputStream != null) {
|
||||
this.inputStream.close();
|
||||
}
|
||||
|
||||
if (this.outputStream != null) { // L: 148
|
||||
if (this.outputStream != null) {
|
||||
this.outputStream.close();
|
||||
}
|
||||
|
||||
if (this.socket != null) { // L: 149
|
||||
if (this.socket != null) {
|
||||
this.socket.close();
|
||||
}
|
||||
} catch (IOException var7) { // L: 151
|
||||
} catch (IOException var7) {
|
||||
}
|
||||
|
||||
this.outBuffer = null; // L: 152
|
||||
this.outBuffer = null;
|
||||
break;
|
||||
}
|
||||
} catch (Exception var12) { // L: 154
|
||||
FriendsChat.RunException_sendStackTrace((String)null, var12); // L: 155
|
||||
} catch (Exception var12) {
|
||||
BufferedSink.RunException_sendStackTrace((String)null, var12);
|
||||
}
|
||||
|
||||
} // L: 157
|
||||
}
|
||||
|
||||
@ObfuscatedName("v")
|
||||
protected void finalize() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
@ObfuscatedName("t")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "([BI)Lcf;",
|
||||
garbageValue = "1671409942"
|
||||
descriptor = "(Ljs;IIIBZI)V",
|
||||
garbageValue = "1569285753"
|
||||
)
|
||||
@Export("newScript")
|
||||
static Script newScript(byte[] var0) {
|
||||
Script var1 = new Script(); // L: 108
|
||||
Buffer var2 = new Buffer(var0); // L: 109
|
||||
var2.offset = var2.array.length - 2; // L: 110
|
||||
int var3 = var2.readUnsignedShort(); // L: 111
|
||||
int var4 = var2.array.length - 2 - var3 - 12; // L: 112
|
||||
var2.offset = var4; // L: 113
|
||||
int var5 = var2.readInt(); // L: 114
|
||||
var1.localIntCount = var2.readUnsignedShort(); // L: 115
|
||||
var1.localStringCount = var2.readUnsignedShort(); // L: 116
|
||||
var1.intArgumentCount = var2.readUnsignedShort(); // L: 117
|
||||
var1.stringArgumentCount = var2.readUnsignedShort(); // L: 118
|
||||
int var6 = var2.readUnsignedByte(); // L: 119
|
||||
int var7;
|
||||
int var8;
|
||||
if (var6 > 0) { // L: 120
|
||||
var1.switches = var1.newIterableNodeHashTable(var6); // L: 121
|
||||
@Export("requestNetFile")
|
||||
static void requestNetFile(Archive var0, int var1, int var2, int var3, byte var4, boolean var5) {
|
||||
long var6 = (long)((var1 << 16) + var2);
|
||||
NetFileRequest var8 = (NetFileRequest)NetCache.NetCache_pendingPriorityWrites.get(var6);
|
||||
if (var8 == null) {
|
||||
var8 = (NetFileRequest)NetCache.NetCache_pendingPriorityResponses.get(var6);
|
||||
if (var8 == null) {
|
||||
var8 = (NetFileRequest)NetCache.NetCache_pendingWrites.get(var6);
|
||||
if (var8 != null) {
|
||||
if (var5) {
|
||||
var8.removeDual();
|
||||
NetCache.NetCache_pendingPriorityWrites.put(var8, var6);
|
||||
--NetCache.NetCache_pendingWritesCount;
|
||||
++NetCache.NetCache_pendingPriorityWritesCount;
|
||||
}
|
||||
|
||||
for (var7 = 0; var7 < var6; ++var7) { // L: 122
|
||||
var8 = var2.readUnsignedShort(); // L: 123
|
||||
IterableNodeHashTable var9 = new IterableNodeHashTable(var8 > 0 ? UrlRequester.method2504(var8) : 1); // L: 124
|
||||
var1.switches[var7] = var9; // L: 125
|
||||
} else {
|
||||
if (!var5) {
|
||||
var8 = (NetFileRequest)NetCache.NetCache_pendingResponses.get(var6);
|
||||
if (var8 != null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var8 = new NetFileRequest();
|
||||
var8.archive = var0;
|
||||
var8.crc = var3;
|
||||
var8.padding = var4;
|
||||
if (var5) {
|
||||
NetCache.NetCache_pendingPriorityWrites.put(var8, var6);
|
||||
++NetCache.NetCache_pendingPriorityWritesCount;
|
||||
} else {
|
||||
NetCache.NetCache_pendingWritesQueue.addFirst(var8);
|
||||
NetCache.NetCache_pendingWrites.put(var8, var6);
|
||||
++NetCache.NetCache_pendingWritesCount;
|
||||
}
|
||||
|
||||
while (var8-- > 0) { // L: 126
|
||||
int var10 = var2.readInt(); // L: 127
|
||||
int var11 = var2.readInt(); // L: 128
|
||||
var9.put(new IntegerNode(var11), (long)var10); // L: 129
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var2.offset = 0; // L: 133
|
||||
var1.field1069 = var2.readStringCp1252NullTerminatedOrNull(); // L: 134
|
||||
var1.opcodes = new int[var5]; // L: 135
|
||||
var1.intOperands = new int[var5]; // L: 136
|
||||
var1.stringOperands = new String[var5]; // L: 137
|
||||
@ObfuscatedName("z")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(Ldz;III)Ly;",
|
||||
garbageValue = "-1978264697"
|
||||
)
|
||||
public static final PcmPlayer method2634(TaskHandler var0, int var1, int var2) {
|
||||
if (GrandExchangeOfferAgeComparator.field3633 == 0) {
|
||||
throw new IllegalStateException();
|
||||
} else if (var1 >= 0 && var1 < 2) {
|
||||
if (var2 < 256) {
|
||||
var2 = 256;
|
||||
}
|
||||
|
||||
for (var7 = 0; var2.offset < var4; var1.opcodes[var7++] = var8) { // L: 138 139 144
|
||||
var8 = var2.readUnsignedShort(); // L: 140
|
||||
if (var8 == 3) { // L: 141
|
||||
var1.stringOperands[var7] = var2.readStringCp1252NullTerminated();
|
||||
} else if (var8 < 100 && var8 != 21 && var8 != 38 && var8 != 39) {
|
||||
var1.intOperands[var7] = var2.readInt(); // L: 142
|
||||
} else {
|
||||
var1.intOperands[var7] = var2.readUnsignedByte(); // L: 143
|
||||
try {
|
||||
PcmPlayer var3 = class181.pcmPlayerProvider.player();
|
||||
var3.samples = new int[256 * (PcmPlayer.PcmPlayer_stereo ? 2 : 1)];
|
||||
var3.field180 = var2;
|
||||
var3.init();
|
||||
var3.capacity = (var2 & -1024) + 1024;
|
||||
if (var3.capacity > 16384) {
|
||||
var3.capacity = 16384;
|
||||
}
|
||||
|
||||
var3.open(var3.capacity);
|
||||
if (PcmPlayer.field181 > 0 && BoundaryObject.soundSystem == null) {
|
||||
BoundaryObject.soundSystem = new SoundSystem();
|
||||
ArchiveDisk.soundSystemExecutor = Executors.newScheduledThreadPool(1);
|
||||
ArchiveDisk.soundSystemExecutor.scheduleAtFixedRate(BoundaryObject.soundSystem, 0L, 10L, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
if (BoundaryObject.soundSystem != null) {
|
||||
if (BoundaryObject.soundSystem.players[var1] != null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
BoundaryObject.soundSystem.players[var1] = var3;
|
||||
}
|
||||
|
||||
return var3;
|
||||
} catch (Throwable var4) {
|
||||
return new PcmPlayer();
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
@ObfuscatedName("gu")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(I)V",
|
||||
garbageValue = "-873884067"
|
||||
)
|
||||
static final void method2629() {
|
||||
for (int var0 = 0; var0 < Client.npcCount; ++var0) {
|
||||
int var1 = Client.npcIndices[var0];
|
||||
NPC var2 = Client.npcs[var1];
|
||||
if (var2 != null) {
|
||||
class16.updateActorSequence(var2, var2.definition.size);
|
||||
}
|
||||
}
|
||||
|
||||
return var1; // L: 146
|
||||
}
|
||||
|
||||
@ObfuscatedName("fc")
|
||||
@ObfuscatedSignature(
|
||||
descriptor = "(II)I",
|
||||
garbageValue = "582256450"
|
||||
)
|
||||
static int method2676(int var0) {
|
||||
return var0 * 3 + 600; // L: 1723
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user