From fffb4cd06bb1b64c8bf14717fc9da7b55844b508 Mon Sep 17 00:00:00 2001 From: Tynarus Date: Fri, 6 Aug 2021 14:25:46 -0500 Subject: [PATCH] Refactor defactor --- .../org/runejs/client/cache/CacheArchive.java | 18 +++++++++--------- .../media/gameInterface/GameInterface.java | 8 +++++++- .../org/runejs/client/net/UpdateServer.java | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/runejs/client/cache/CacheArchive.java b/src/main/java/org/runejs/client/cache/CacheArchive.java index 744571f13..31dffe460 100644 --- a/src/main/java/org/runejs/client/cache/CacheArchive.java +++ b/src/main/java/org/runejs/client/cache/CacheArchive.java @@ -162,17 +162,17 @@ 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, @@ -180,21 +180,21 @@ public void method198(boolean arg1, byte[] arg2, int arg3, CacheIndex arg4) { 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) @@ -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; } } diff --git a/src/main/java/org/runejs/client/cache/media/gameInterface/GameInterface.java b/src/main/java/org/runejs/client/cache/media/gameInterface/GameInterface.java index af59213e4..721a23827 100644 --- a/src/main/java/org/runejs/client/cache/media/gameInterface/GameInterface.java +++ b/src/main/java/org/runejs/client/cache/media/gameInterface/GameInterface.java @@ -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) { diff --git a/src/main/java/org/runejs/client/net/UpdateServer.java b/src/main/java/org/runejs/client/net/UpdateServer.java index 98901136a..1f8e898f5 100644 --- a/src/main/java/org/runejs/client/net/UpdateServer.java +++ b/src/main/java/org/runejs/client/net/UpdateServer.java @@ -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;*/