Skip to content

Commit

Permalink
Refactor defactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynarus committed Aug 6, 2021
1 parent 75fb347 commit fffb4cd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/main/java/org/runejs/client/cache/CacheArchive.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,39 +162,39 @@ public int getPercentLoaded() {

}

public void method198(boolean arg1, byte[] arg2, int arg3, CacheIndex arg4) {
if(metaIndex == arg4) {
public void method198(boolean arg1, byte[] fileData, int arg3, CacheIndex cacheIndex) {
if(metaIndex == cacheIndex) {
if(aBoolean1800)
throw new RuntimeException();
if(arg2 == null) {
if(fileData == null) {
UpdateServer.method327(true, this, 255, cacheIndexId, (byte) 0,
archiveCrcValue);
return;
}
crc32.reset();
crc32.update(arg2, 0, arg2.length);
crc32.update(fileData, 0, fileData.length);
int i = (int) crc32.getValue();
if(i != archiveCrcValue) {
/*UpdateServer.method327(true, this, 255, cacheIndexId, (byte) 0,
archiveCrcValue);
return;*/
}

decodeArchive(arg2);
decodeArchive(fileData);
method199();
} else {
if(!arg1 && anInt1797 == arg3)
aBoolean1800 = true;
if(arg2 == null || arg2.length <= 2) {
if(fileData == null || fileData.length <= 2) {
aBooleanArray1796[arg3] = false;
if(hasVersionNumbers || arg1)
UpdateServer.method327(arg1, this, cacheIndexId, arg3, (byte) 2, anIntArray252[arg3]);
return;
}
crc32.reset();
crc32.update(arg2, 0, arg2.length - 2);
crc32.update(fileData, 0, fileData.length - 2);
int i = (int) crc32.getValue();
int i_0_ = ((arg2[-2 + arg2.length] & 0xff) << 8) + (0xff & arg2[arg2.length + -1]);
int i_0_ = ((fileData[-2 + fileData.length] & 0xff) << 8) + (0xff & fileData[fileData.length + -1]);
if(i != anIntArray252[arg3] || i_0_ != anIntArray224[arg3]) {
aBooleanArray1796[arg3] = false;
if(hasVersionNumbers || arg1)
Expand All @@ -203,7 +203,7 @@ public void method198(boolean arg1, byte[] arg2, int arg3, CacheIndex arg4) {
}
aBooleanArray1796[arg3] = true;
if(arg1)
aByteArrayArray212[arg3] = arg2;
aByteArrayArray212[arg3] = fileData;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,13 @@ public static GameInterface getInterface(int interfaceData) {
}
}

return cachedInterfaces[parentInterfaceId][childInterfaceId];
try {
return cachedInterfaces[parentInterfaceId][childInterfaceId];
} catch(Exception error) {
System.out.println(parentInterfaceId + " " + childInterfaceId);
error.printStackTrace();
return null;
}
}

public static void updateGameInterface(GameInterface gameInterface) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/runejs/client/net/UpdateServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static boolean processUpdateServerResponse() {
updateServerSocket.kill();
} catch(Exception exception) {
}
aByte302 = (byte) (int) (Math.random() * 255.0 + 1.0);
archiveIndex = (byte) (int) (Math.random() * 255.0 + 1.0);
updateServerSocket = null;
MovedStatics.anInt813++;
return false;*/
Expand Down

0 comments on commit fffb4cd

Please sign in to comment.