Skip to content

Commit 817de0b

Browse files
committed
Disable CRC check
- Disabled CRC and used it as a fallback if /cache isnt found
1 parent c485281 commit 817de0b

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

src/main/java/jagex2/client/Client.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,11 @@ public void load() {
15831583
}
15841584
try {
15851585
int var4 = 5;
1586-
this.jagChecksum[8] = 0;
1586+
if (this.loadLocalJagChecksums()) {
1587+
this.drawProgress("Using local cache", 20);
1588+
} else {
1589+
this.jagChecksum[8] = 0;
1590+
}
15871591
while (this.jagChecksum[8] == 0) {
15881592
this.drawProgress("Connecting to web server", 20);
15891593
try {
@@ -1939,6 +1943,26 @@ public void load() {
19391943
}
19401944
}
19411945

1946+
private boolean loadLocalJagChecksums() {
1947+
if (this.fileStreams[0] == null) {
1948+
return false;
1949+
}
1950+
int[] localChecksums = new int[9];
1951+
for (int archive = 0; archive < localChecksums.length; archive++) {
1952+
byte[] data = this.fileStreams[0].read(archive);
1953+
if (data == null) {
1954+
System.out.println("[Cache] Local archive " + archive + " missing; falling back to HTTP /crc");
1955+
return false;
1956+
}
1957+
this.crc32.reset();
1958+
this.crc32.update(data);
1959+
localChecksums[archive] = (int) this.crc32.getValue();
1960+
}
1961+
System.arraycopy(localChecksums, 0, this.jagChecksum, 0, localChecksums.length);
1962+
System.out.println("[Cache] Using local startup CRCs from cache folder");
1963+
return true;
1964+
}
1965+
19421966
@ObfuscatedName("client.b(B)V")
19431967
public void loop() {
19441968
if (this.errorStarted || this.errorLoading || this.errorHost) {

0 commit comments

Comments
 (0)