A RuneTek3 client (377) that is deobfuscated, converted to Kotlin, and includes QoL improvements.
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2 from dope-head/master

Merging changes from @dope-head

author
Promises
committer
GitHub
date (Apr 3, 2018, 12:58 PM +0200) commit b862e667 parent 135c9c0f
+587 -433
+323 -237
src/com/jagex/runescape/Game.java
··· 6 6 import java.awt.Font; 7 7 import java.awt.Graphics; 8 8 import java.io.*; 9 - import java.math.BigInteger; 10 9 import java.net.InetAddress; 11 10 import java.net.Socket; 12 11 import java.net.URL; ··· 50 49 import com.jagex.runescape.sound.SoundTrack; 51 50 import com.jagex.runescape.util.*; 52 51 import tech.henning.client.Actions; 52 + import tech.henning.client.Configuration; 53 53 54 54 @SuppressWarnings("serial") 55 55 public class Game extends GameShell { ··· 118 118 public int anInt897 = 559; 119 119 public byte aByte898 = 6; 120 120 public ISAACCipher incomingRandom; 121 - public boolean aBoolean900 = false; 121 + private boolean useJaggrab = Configuration.JAGGRAB_ENABLED; 122 122 public byte aByte901 = -123; 123 123 public long aLong902; 124 124 public int lastOpcode; ··· 245 245 public int anInt1021; 246 246 public int crossIndex; 247 247 public int crossType; 248 - public BufferedConnection bufferedConnection; 248 + public BufferedConnection gameConnection; 249 249 public String chatMessage = ""; 250 250 public String aString1027; 251 251 public boolean aBoolean1028 = false; ··· 308 308 public int anIntArray1085[]; 309 309 public ImageRGB aClass50_Sub1_Sub1_Sub1_1086; 310 310 public int anInt1087; 311 - public CRC32 aCRC32_1088 = new CRC32(); 311 + public CRC32 archiveCrc = new CRC32(); 312 312 public int anInt1089 = -1; 313 313 public int sound[] = new int[50]; 314 314 public int plane; ··· 444 444 public int friendsListAction; 445 445 public int anInt1222; 446 446 public int anInt1223; 447 - public Socket aSocket1224; 447 + public Socket jaggrabSocket; 448 448 public int loginScreenState; 449 449 public int anInt1226; 450 450 public int tradeMode; ··· 536 536 public int anIntArray1313[]; 537 537 public volatile boolean aBoolean1314 = false; 538 538 public int anInt1315; 539 - public static BigInteger JAGEX_PUBLIC_KEY = new BigInteger("65537"); 540 539 public byte aByte1317 = -58; 541 540 public int anInt1318 = 416; 542 541 public int anInt1319; ··· 554 553 public int anInt1331; 555 554 public int atInventoryInterfaceType; 556 555 public static String VALID_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| "; 557 - public static BigInteger JAGEX_MODULUS = new BigInteger("" + 558 - "122160430267449798360978854041191852368220518230394092579319523064196043297582796633947085783119585744206711526658432067003468760585446552721871622840788528486712970246999980397054139494332878352882978447726827719186528904097434708997584641726572284342202641622966960383866799686443535696434839673638141409593" + 559 - ""); 560 556 561 557 static { 562 558 SKILL_EXPERIENCE = new int[99]; ··· 606 602 portOffset = 0; 607 603 setHighMemory(); 608 604 memberServer = true; 609 - SignLink.storeid = 32; 605 + SignLink.storeId = 32; 610 606 SignLink.initialize(InetAddress.getLocalHost()); 611 607 Game cl = new Game(); 612 608 cl.initializeApplication(765, 503); ··· 707 703 outBuffer.putLong(name); 708 704 return; 709 705 } catch (RuntimeException runtimeexception) { 710 - SignLink.reporterror("94629, " + name + ", " + ", " + runtimeexception.toString()); 706 + SignLink.reportError("94629, " + name + ", " + ", " + runtimeexception.toString()); 711 707 } 712 708 throw new RuntimeException(); 713 709 } ··· 739 735 outBuffer.putLong(name); 740 736 return; 741 737 } catch (RuntimeException runtimeexception) { 742 - SignLink.reporterror("27939, " + i + ", " + name + ", " + runtimeexception.toString()); 738 + SignLink.reportError("27939, " + i + ", " + name + ", " + runtimeexception.toString()); 743 739 } 744 740 throw new RuntimeException(); 745 741 } ··· 999 995 minimapBackgroundImage = null; 1000 996 chatboxBackgroundImage = null; 1001 997 try { 1002 - if (bufferedConnection != null) 1003 - bufferedConnection.close(); 998 + if (gameConnection != null) 999 + gameConnection.close(); 1004 1000 } catch (Exception _ex) { 1005 1001 } 1006 - bufferedConnection = null; 1002 + gameConnection = null; 1007 1003 minimapHintX = null; 1008 1004 minimapHintY = null; 1009 1005 minimapHint = null; ··· 1209 1205 return; 1210 1206 } 1211 1207 } catch (Exception _ex) { 1212 - SignLink.reporterror("glfc_ex " + localPlayer.worldX + "," 1208 + SignLink.reportError("glfc_ex " + localPlayer.worldX + "," 1213 1209 + localPlayer.worldY + "," + anInt1262 + "," + anInt1263 + "," + chunkX + "," 1214 1210 + chunkY + "," + nextTopLeftTileX + "," + nextTopRightTileY); 1215 1211 throw new RuntimeException("eek"); ··· 1610 1606 if (anInt872 > 50) 1611 1607 outBuffer.putOpcode(40); 1612 1608 try { 1613 - if (bufferedConnection != null && outBuffer.currentPosition > 0) { 1614 - bufferedConnection.write(outBuffer.currentPosition, 0, outBuffer.buffer); 1609 + if (gameConnection != null && outBuffer.currentPosition > 0) { 1610 + gameConnection.write(outBuffer.currentPosition, 0, outBuffer.buffer); 1615 1611 outBuffer.currentPosition = 0; 1616 1612 anInt872 = 0; 1617 1613 return; ··· 1949 1945 } 1950 1946 } 1951 1947 1952 - public DataInputStream method31(String s) throws IOException { 1953 - if (!aBoolean900) 1954 - if (SignLink.mainapp != null) 1955 - return SignLink.openURL(s); 1956 - else 1957 - return new DataInputStream((new URL(getCodeBase(), s)).openStream()); 1958 - if (aSocket1224 != null) { 1948 + private DataInputStream openJaggrabStream(String request) throws IOException { 1949 + if (!useJaggrab) { 1950 + if (SignLink.applet != null) 1951 + return SignLink.openURL(request); 1952 + else 1953 + return new DataInputStream((new URL(getCodeBase(), request)).openStream()); 1954 + } 1955 + 1956 + if (jaggrabSocket != null) { 1959 1957 try { 1960 - aSocket1224.close(); 1961 - } catch (Exception _ex) { 1962 - } 1963 - aSocket1224 = null; 1958 + jaggrabSocket.close(); 1959 + } catch (Exception ignored) {} 1960 + 1961 + jaggrabSocket = null; 1964 1962 } 1965 - aSocket1224 = openSocket(43595); 1966 - aSocket1224.setSoTimeout(10000); 1967 - InputStream inputstream = aSocket1224.getInputStream(); 1968 - OutputStream outputstream = aSocket1224.getOutputStream(); 1969 - outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes()); 1970 - return new DataInputStream(inputstream); 1963 + 1964 + byte[] buffer = String.format("JAGGRAB /%s\n\n", request).getBytes(); 1965 + jaggrabSocket = openSocket(Configuration.JAGGRAB_PORT); 1966 + 1967 + jaggrabSocket.setSoTimeout(10000); 1968 + jaggrabSocket.getOutputStream().write(buffer); 1969 + 1970 + return new DataInputStream(jaggrabSocket.getInputStream()); 1971 1971 } 1972 1972 1973 - public Socket openSocket(int i) throws IOException { 1974 - if (SignLink.mainapp != null) 1975 - return SignLink.openSocket(i); 1976 - else 1977 - return new Socket(InetAddress.getByName(getCodeBase().getHost()), i); 1973 + public Socket openSocket(int port) throws IOException { 1974 + if (SignLink.applet != null) 1975 + return SignLink.openSocket(port); 1976 + 1977 + return new Socket(InetAddress.getByName(getCodeBase().getHost()), port); 1978 1978 } 1979 1979 1980 1980 public boolean parseIncomingPacket() { 1981 - if (bufferedConnection == null) 1981 + if (gameConnection == null) 1982 1982 return false; 1983 1983 try { 1984 - int available = bufferedConnection.getAvailable(); 1984 + int available = gameConnection.getAvailable(); 1985 1985 if (available == 0) 1986 1986 return false; 1987 1987 if (opcode == -1) { 1988 - bufferedConnection.read(buffer.buffer, 0, 1); 1988 + gameConnection.read(buffer.buffer, 0, 1); 1989 1989 opcode = buffer.buffer[0] & 0xff; 1990 1990 if (incomingRandom != null) 1991 1991 opcode = opcode - incomingRandom.nextInt() & 0xff; ··· 1994 1994 } 1995 1995 if (packetSize == -1) 1996 1996 if (available > 0) { 1997 - bufferedConnection.read(buffer.buffer, 0, 1); 1997 + gameConnection.read(buffer.buffer, 0, 1); 1998 1998 packetSize = buffer.buffer[0] & 0xff; 1999 1999 available--; 2000 2000 } else { ··· 2002 2002 } 2003 2003 if (packetSize == -2) 2004 2004 if (available > 1) { 2005 - bufferedConnection.read(buffer.buffer, 0, 2); 2005 + gameConnection.read(buffer.buffer, 0, 2); 2006 2006 buffer.currentPosition = 0; 2007 2007 packetSize = buffer.getUnsignedLEShort(); 2008 2008 available -= 2; ··· 2012 2012 if (available < packetSize) 2013 2013 return false; 2014 2014 buffer.currentPosition = 0; 2015 - bufferedConnection.read(buffer.buffer, 0, packetSize); 2015 + gameConnection.read(buffer.buffer, 0, packetSize); 2016 2016 timeoutCounter = 0; 2017 2017 thirdLastOpcode = secondLastOpcode; 2018 2018 secondLastOpcode = lastOpcode; ··· 2335 2335 lastAddress = buffer.method555(); 2336 2336 anInt1034 = buffer.getLittleShortA(); 2337 2337 buffer.getByteAdded(); 2338 - SignLink.dnslookup(TextUtils.decodeAddress(lastAddress)); 2338 + SignLink.dnsLookup(TextUtils.decodeAddress(lastAddress)); 2339 2339 opcode = -1; 2340 2340 return true; 2341 2341 } ··· 2624 2624 else 2625 2625 addChatMessage(TextUtils.formatName(TextUtils.longToName(l6)), s9, 3); 2626 2626 } catch (Exception exception1) { 2627 - SignLink.reporterror("cde1"); 2627 + SignLink.reportError("cde1"); 2628 2628 } 2629 2629 opcode = -1; 2630 2630 return true; ··· 3168 3168 opcode = -1; 3169 3169 return true; 3170 3170 } 3171 - SignLink.reporterror("T1 - " + opcode + "," + packetSize + " - " + secondLastOpcode + "," + thirdLastOpcode); 3171 + SignLink.reportError("T1 - " + opcode + "," + packetSize + " - " + secondLastOpcode + "," + thirdLastOpcode); 3172 3172 logout(); 3173 3173 } catch (IOException _ex) { 3174 3174 dropClient(); ··· 3179 3179 for (int j16 = 0; j16 < packetSize && j16 < 50; j16++) 3180 3180 s1 = s1 + buffer.buffer[j16] + ","; 3181 3181 3182 - SignLink.reporterror(s1); 3182 + SignLink.reportError(s1); 3183 3183 logout(); 3184 3184 3185 3185 exception.printStackTrace(); ··· 3455 3455 public String method37(int i) { 3456 3456 if (i != -42588) 3457 3457 opcode = buffer.getUnsignedByte(); 3458 - if (SignLink.mainapp != null) 3459 - return SignLink.mainapp.getDocumentBase().getHost().toLowerCase(); 3458 + if (SignLink.applet != null) 3459 + return SignLink.applet.getDocumentBase().getHost().toLowerCase(); 3460 3460 if (super.gameFrame != null) 3461 3461 return "runescape.com"; 3462 3462 else ··· 3937 3937 3938 3938 } 3939 3939 if (j > anInt1133) { 3940 - SignLink.reporterror(username + " Too many npcs"); 3940 + SignLink.reportError(username + " Too many npcs"); 3941 3941 throw new RuntimeException("eek"); 3942 3942 } 3943 3943 anInt1133 = 0; ··· 3995 3995 } 3996 3996 3997 3997 if (class50_sub1_sub2.currentPosition != i) { 3998 - SignLink.reporterror(username + " size mismatch in getnpcpos - coord:" + class50_sub1_sub2.currentPosition 3998 + SignLink.reportError(username + " size mismatch in getnpcpos - coord:" + class50_sub1_sub2.currentPosition 3999 3999 + " psize:" + i); 4000 4000 throw new RuntimeException("eek"); 4001 4001 } 4002 4002 for (int l = 0; l < anInt1133; l++) 4003 4003 if (npcs[anIntArray1134[l]] == null) { 4004 - SignLink.reporterror(username + " null entry in npc list - coord:" + l + " size:" + anInt1133); 4004 + SignLink.reportError(username + " null entry in npc list - coord:" + l + " size:" + anInt1133); 4005 4005 throw new RuntimeException("eek"); 4006 4006 } 4007 4007 ··· 4160 4160 } 4161 4161 4162 4162 } catch (RuntimeException runtimeexception) { 4163 - SignLink.reporterror("38799, " + l + ", " + runtimeexception.toString()); 4163 + SignLink.reportError("38799, " + l + ", " + runtimeexception.toString()); 4164 4164 } 4165 4165 throw new RuntimeException(); 4166 4166 } ··· 4343 4343 } 4344 4344 4345 4345 public void setWaveVolume( int j) { 4346 - SignLink.wavevol = j; 4346 + SignLink.waveVolume = j; 4347 4347 } 4348 4348 4349 4349 public void dropClient() { ··· 4354 4354 method125("Please wait - attempting to reestablish", "Connection lost"); 4355 4355 minimapState = 0; 4356 4356 destinationX = 0; 4357 - BufferedConnection class17 = bufferedConnection; 4357 + BufferedConnection class17 = gameConnection; 4358 4358 loggedIn = false; 4359 4359 anInt850 = 0; 4360 4360 login(username, password, true); ··· 4468 4468 return false; 4469 4469 } 4470 4470 4471 - public Archive method61(int i, int j, String s, int k, int l, String s1) { 4472 - byte abyte0[] = null; 4473 - int i1 = 5; 4471 + private Archive requestArchive(int id, String file, int expectedCrc, int x, String displayName) { 4472 + byte[] archiveBuffer = null; 4473 + int reconnectionDelay = 5; 4474 + 4474 4475 try { 4475 4476 if (stores[0] != null) 4476 - abyte0 = stores[0].get(l); 4477 - } catch (Exception _ex) { 4478 - } 4479 - if (abyte0 != null) { 4480 - aCRC32_1088.reset(); 4481 - aCRC32_1088.update(abyte0); 4482 - int j1 = (int) aCRC32_1088.getValue(); 4483 - if (j1 != j) 4484 - abyte0 = null; 4485 - } 4486 - if (abyte0 != null) { 4487 - Archive class2 = new Archive(abyte0); 4488 - return class2; 4477 + archiveBuffer = stores[0].get(id); 4478 + } catch (Exception ignored) {} 4479 + 4480 + if (archiveBuffer != null && Configuration.JAGGRAB_ENABLED) { 4481 + archiveCrc.reset(); 4482 + archiveCrc.update(archiveBuffer); 4483 + 4484 + int calculatedCrc = (int) archiveCrc.getValue(); 4485 + 4486 + if (calculatedCrc != expectedCrc) 4487 + archiveBuffer = null; 4489 4488 } 4490 - int k1 = 0; 4491 - if (i != 14076) 4492 - anInt1281 = -343; 4493 - while (abyte0 == null) { 4494 - String s2 = "Unknown error"; 4495 - drawLoadingText(k, "Requesting " + s1); 4489 + 4490 + if (archiveBuffer != null) 4491 + return new Archive(archiveBuffer); 4492 + 4493 + int attempts = 0; 4494 + 4495 + while (archiveBuffer == null) { 4496 + String error = "Unknown error"; 4497 + 4498 + drawLoadingText(x, "Requesting " + displayName); 4499 + 4496 4500 try { 4497 - int l1 = 0; 4498 - DataInputStream datainputstream = method31(s + j); 4499 - byte abyte1[] = new byte[6]; 4500 - datainputstream.readFully(abyte1, 0, 6); 4501 - Buffer class50_sub1_sub2 = new Buffer(abyte1); 4502 - class50_sub1_sub2.currentPosition = 3; 4503 - int j2 = class50_sub1_sub2.get24BitInt() + 6; 4504 - int k2 = 6; 4505 - abyte0 = new byte[j2]; 4506 - for (int l2 = 0; l2 < 6; l2++) 4507 - abyte0[l2] = abyte1[l2]; 4501 + int currentPercentage = 0; 4502 + DataInputStream jaggrabStream = openJaggrabStream(file + expectedCrc); 4503 + byte[] bytes = new byte[6]; 4508 4504 4509 - while (k2 < j2) { 4510 - int i3 = j2 - k2; 4511 - if (i3 > 1000) 4512 - i3 = 1000; 4513 - int k3 = datainputstream.read(abyte0, k2, i3); 4514 - if (k3 < 0) { 4515 - s2 = "Length error: " + k2 + "/" + j2; 4505 + jaggrabStream.readFully(bytes, 0, 6); 4506 + 4507 + Buffer buffer = new Buffer(bytes); 4508 + buffer.currentPosition = 3; 4509 + int archiveLength = buffer.get24BitInt() + 6; 4510 + int archiveRead = 6; 4511 + archiveBuffer = new byte[archiveLength]; 4512 + 4513 + System.arraycopy(bytes, 0, archiveBuffer, 0, 6); 4514 + 4515 + while (archiveRead < archiveLength) { 4516 + int remaining = archiveLength - archiveRead; 4517 + 4518 + if (remaining > 1000) 4519 + remaining = 1000; 4520 + 4521 + int read = jaggrabStream.read(archiveBuffer, archiveRead, remaining); 4522 + 4523 + if (read < 0) { 4524 + error = "Length error: " + archiveRead + "/" + archiveLength; 4516 4525 throw new IOException("EOF"); 4517 4526 } 4518 - k2 += k3; 4519 - int l3 = (k2 * 100) / j2; 4520 - if (l3 != l1) 4521 - drawLoadingText(k, "Loading " + s1 + " - " + l3 + "%"); 4522 - l1 = l3; 4527 + 4528 + archiveRead += read; 4529 + int calculatedPercentage = (archiveRead * 100) / archiveLength; 4530 + 4531 + if (calculatedPercentage != currentPercentage) 4532 + drawLoadingText(x, "Loading " + displayName + " - " + calculatedPercentage + "%"); 4533 + 4534 + currentPercentage = calculatedPercentage; 4523 4535 } 4524 - datainputstream.close(); 4536 + 4537 + jaggrabStream.close(); 4538 + 4525 4539 try { 4526 4540 if (stores[0] != null) 4527 - stores[0].put(abyte0.length, abyte0, l); 4541 + stores[0].put(archiveBuffer.length, archiveBuffer, id); 4528 4542 } catch (Exception _ex) { 4529 4543 stores[0] = null; 4530 4544 } 4531 - if (abyte0 != null) { 4532 - aCRC32_1088.reset(); 4533 - aCRC32_1088.update(abyte0); 4534 - int j3 = (int) aCRC32_1088.getValue(); 4535 - if (j3 != j) { 4536 - abyte0 = null; 4537 - k1++; 4538 - s2 = "Checksum error: " + j3; 4545 + 4546 + if (Configuration.JAGGRAB_ENABLED) { 4547 + archiveCrc.reset(); 4548 + archiveCrc.update(archiveBuffer); 4549 + 4550 + int calculatedCrc = (int) archiveCrc.getValue(); 4551 + 4552 + if (calculatedCrc != expectedCrc) { 4553 + archiveBuffer = null; 4554 + attempts++; 4555 + error = "Checksum error: " + calculatedCrc; 4539 4556 } 4540 4557 } 4541 - } catch (IOException ioexception) { 4542 - if (s2.equals("Unknown error")) 4543 - s2 = "Connection error"; 4544 - abyte0 = null; 4545 - } catch (NullPointerException _ex) { 4546 - s2 = "Null error"; 4547 - abyte0 = null; 4548 - if (!SignLink.reporterror) 4558 + } catch (IOException ex) { 4559 + if (error.equals("Unknown error")) 4560 + error = "Connection error"; 4561 + 4562 + archiveBuffer = null; 4563 + } catch (NullPointerException ex) { 4564 + error = "Null error"; 4565 + archiveBuffer = null; 4566 + 4567 + if (!SignLink.reportError) 4549 4568 return null; 4550 - } catch (ArrayIndexOutOfBoundsException _ex) { 4551 - s2 = "Bounds error"; 4552 - abyte0 = null; 4553 - if (!SignLink.reporterror) 4569 + } catch (ArrayIndexOutOfBoundsException ex) { 4570 + error = "Bounds error"; 4571 + archiveBuffer = null; 4572 + 4573 + if (!SignLink.reportError) 4554 4574 return null; 4555 - } catch (Exception _ex) { 4556 - s2 = "Unexpected error"; 4557 - abyte0 = null; 4558 - if (!SignLink.reporterror) 4575 + } catch (Exception ex) { 4576 + error = "Unexpected error"; 4577 + archiveBuffer = null; 4578 + 4579 + if (!SignLink.reportError) 4559 4580 return null; 4560 4581 } 4561 - if (abyte0 == null) { 4562 - for (int i2 = i1; i2 > 0; i2--) { 4563 - if (k1 >= 3) { 4564 - drawLoadingText(k, "Game updated - please reload page"); 4565 - i2 = 10; 4582 + 4583 + if (archiveBuffer == null) { 4584 + for (int time = reconnectionDelay; time > 0; time--) { 4585 + if (attempts >= 3) { 4586 + drawLoadingText(x, "Game updated - please reload page"); 4587 + time = 10; 4566 4588 } else { 4567 - drawLoadingText(k, s2 + " - Retrying in " + i2); 4589 + drawLoadingText(x, error + " - Retrying in " + time); 4568 4590 } 4591 + 4569 4592 try { 4570 4593 Thread.sleep(1000L); 4571 - } catch (Exception _ex) { 4572 - } 4594 + } catch (Exception ignored) {} 4573 4595 } 4574 4596 4575 - i1 *= 2; 4576 - if (i1 > 60) 4577 - i1 = 60; 4578 - aBoolean900 = !aBoolean900; 4597 + reconnectionDelay *= 2; 4598 + 4599 + if (reconnectionDelay > 60) 4600 + reconnectionDelay = 60; 4601 + 4602 + useJaggrab = !useJaggrab; 4579 4603 } 4580 4604 } 4581 - Archive class2_1 = new Archive(abyte0); 4582 - return class2_1; 4605 + 4606 + return new Archive(archiveBuffer); 4583 4607 } 4584 4608 4585 4609 public void redraw() { ··· 4793 4817 else 4794 4818 addChatMessage(plr.playerName, s, 2); 4795 4819 } catch (Exception exception) { 4796 - SignLink.reporterror("cde2"); 4820 + SignLink.reportError("cde2"); 4797 4821 } 4798 4822 } 4799 4823 vec.currentPosition = i4 + length; ··· 4846 4870 4847 4871 public void startup() { 4848 4872 drawLoadingText(20, "Starting up"); 4849 - if (SignLink.cache_dat != null) { 4873 + if (SignLink.cacheData != null) { 4850 4874 for (int type = 0; type < 5; type++) 4851 - stores[type] = new Index(type + 1, 0x927c0, SignLink.cache_dat, SignLink.cache_idx[type]); 4875 + stores[type] = new Index(type + 1, 0x927c0, SignLink.cacheData, SignLink.cacheIndex[type]); 4852 4876 } 4853 4877 try { 4854 4878 connectWebServer(); 4855 - titleArchive = method61(14076, archiveHashes[1], "title", 25, 1, "title screen"); 4879 + titleArchive = requestArchive(1, "title", archiveHashes[1], 25, "title screen"); 4856 4880 fontSmall = new TypeFace(false, titleArchive, "p11_full"); 4857 4881 fontNormal = new TypeFace(false, titleArchive, "p12_full"); 4858 4882 fontBold = new TypeFace(false, titleArchive, "b12_full"); 4859 4883 fontFancy = new TypeFace(true, titleArchive, "q8_full"); 4860 4884 prepareTitleBackground(); 4861 4885 prepareTitle(); 4862 - Archive configArchive = method61(14076, archiveHashes[2], "config", 30, 2, "config"); 4863 - Archive archiveInterface = method61(14076, archiveHashes[3], "interface", 35, 3, "interface"); 4864 - Archive archiveMedia = method61(14076, archiveHashes[4], "media", 40, 4, "2d gameGraphics"); 4865 - Archive textureArchive = method61(14076, archiveHashes[6], "textures", 45, 6, "textures"); 4866 - Archive chatArchive = method61(14076, archiveHashes[7], "wordenc", 50, 7, "chat system"); 4867 - Archive soundArchive = method61(14076, archiveHashes[8], "sounds", 55, 8, "sound effects"); 4886 + Archive configArchive = requestArchive(2, "config", archiveHashes[2], 30, "config"); 4887 + Archive archiveInterface = requestArchive(3, "interface", archiveHashes[3], 35, "interface"); 4888 + Archive archiveMedia = requestArchive(4, "media", archiveHashes[4], 40, "2d gameGraphics"); 4889 + Archive textureArchive = requestArchive(6, "textures", archiveHashes[6], 45, "textures"); 4890 + Archive chatArchive = requestArchive(7, "wordenc", archiveHashes[7], 50, "chat system"); 4891 + Archive soundArchive = requestArchive(8, "sounds", archiveHashes[8], 55, "sound effects"); 4868 4892 currentSceneTileFlags = new byte[4][104][104]; 4869 4893 anIntArrayArrayArray891 = new int[4][105][105]; 4870 4894 currentScene = new Scene(anIntArrayArrayArray891, 104, 4, 104, (byte) 5); ··· 4872 4896 currentCollisionMap[j] = new CollisionMap(104, 104); 4873 4897 4874 4898 minimapImage = new ImageRGB(512, 512); 4875 - Archive versionListArchive = method61(14076, archiveHashes[5], "versionlist", 60, 5, "update list"); 4899 + Archive versionListArchive = requestArchive(5, "versionlist", archiveHashes[5], 60, "update list"); 4876 4900 drawLoadingText(60, "Connecting to update server"); 4877 4901 onDemandRequester = new OnDemandRequester(); 4878 4902 onDemandRequester.init(versionListArchive, this); ··· 5196 5220 ActorDefinition.client = this; 5197 5221 return; 5198 5222 } catch (Exception exception) { 5199 - SignLink.reporterror("loaderror " + aString1027 + " " + anInt1322); 5223 + SignLink.reportError("loaderror " + aString1027 + " " + anInt1322); 5200 5224 } 5201 5225 aBoolean1283 = true; 5202 5226 } ··· 6132 6156 } while (true); 6133 6157 } 6134 6158 6135 - 6159 + private void login(String username, String password, boolean reconnecting) { 6160 + SignLink.errorName = username; 6136 6161 6137 - public void login(String username, String password, boolean reconnecting) { 6138 - SignLink.errorname = username; 6139 6162 try { 6140 6163 if (!reconnecting) { 6141 6164 statusLineOne = ""; 6142 6165 statusLineTwo = "Connecting to server..."; 6166 + 6143 6167 drawLoginScreen(true); 6144 6168 } 6145 - bufferedConnection = new BufferedConnection(this, openSocket(43594 + portOffset)); 6169 + 6170 + gameConnection = new BufferedConnection(this, openSocket(Configuration.GAME_PORT + portOffset)); 6146 6171 long base37name = TextUtils.nameToLong(username); 6147 6172 int hash = (int) (base37name >> 16 & 31L); 6148 6173 outBuffer.currentPosition = 0; 6174 + 6149 6175 outBuffer.putByte(14); 6150 6176 outBuffer.putByte(hash); 6151 - bufferedConnection.write(2, 0, outBuffer.buffer); 6177 + gameConnection.write(2, 0, outBuffer.buffer); 6178 + 6152 6179 for (int j = 0; j < 8; j++) 6153 - bufferedConnection.read(); 6180 + gameConnection.read(); 6181 + 6182 + int responseCode = gameConnection.read(); 6183 + int initialResponseCode = responseCode; 6184 + 6185 + if (responseCode == 0) { 6186 + gameConnection.read(buffer.buffer, 0, 8); 6154 6187 6155 - int returnCode = bufferedConnection.read(); 6156 - int i1 = returnCode; 6157 - if (returnCode == 0) { 6158 - bufferedConnection.read(buffer.buffer, 0, 8); 6159 6188 buffer.currentPosition = 0; 6160 6189 serverSeed = buffer.getLong(); 6161 6190 int seed[] = new int[4]; 6191 + 6162 6192 seed[0] = (int) (Math.random() * 99999999D); 6163 6193 seed[1] = (int) (Math.random() * 99999999D); 6164 6194 seed[2] = (int) (serverSeed >> 32); 6165 6195 seed[3] = (int) serverSeed; 6196 + 6166 6197 outBuffer.currentPosition = 0; 6198 + 6167 6199 outBuffer.putByte(10); 6168 6200 outBuffer.putInt(seed[0]); 6169 6201 outBuffer.putInt(seed[1]); ··· 6172 6204 outBuffer.putInt(SignLink.uid); 6173 6205 outBuffer.putString(username); 6174 6206 outBuffer.putString(password); 6175 - outBuffer.rsa(JAGEX_MODULUS, JAGEX_PUBLIC_KEY); 6207 + 6208 + if (Configuration.RSA_ENABLED) 6209 + outBuffer.encrypt(Configuration.RSA_MODULUS, Configuration.RSA_PUBLIC_KEY); 6210 + 6176 6211 tempBuffer.currentPosition = 0; 6212 + 6177 6213 if (reconnecting) 6178 6214 tempBuffer.putByte(18); 6179 6215 else 6180 6216 tempBuffer.putByte(16); 6217 + 6181 6218 tempBuffer.putByte(outBuffer.currentPosition + 36 + 1 + 1 + 2); 6182 6219 tempBuffer.putByte(255); 6183 - tempBuffer.putShort(377); 6220 + tempBuffer.putShort(SignLink.CLIENT_REVISION); 6184 6221 tempBuffer.putByte(lowMemory ? 1 : 0); 6222 + 6185 6223 for (int i = 0; i < 9; i++) 6186 6224 tempBuffer.putInt(archiveHashes[i]); 6187 6225 6188 6226 tempBuffer.putBytes(outBuffer.buffer, 0, outBuffer.currentPosition); 6227 + 6189 6228 outBuffer.random = new ISAACCipher(seed); 6229 + 6190 6230 for (int i = 0; i < 4; i++) 6191 6231 seed[i] += 50; 6192 6232 6193 6233 incomingRandom = new ISAACCipher(seed); 6194 - bufferedConnection.write(tempBuffer.currentPosition, 0, tempBuffer.buffer); 6195 - returnCode = bufferedConnection.read(); 6234 + 6235 + gameConnection.write(tempBuffer.currentPosition, 0, tempBuffer.buffer); 6236 + 6237 + responseCode = gameConnection.read(); 6196 6238 } 6197 - if (returnCode == 1) { 6239 + 6240 + if (responseCode == 1) { 6198 6241 try { 6199 6242 Thread.sleep(2000L); 6200 - } catch (Exception _ex) { 6201 - } 6243 + } catch (Exception ignored) {} 6244 + 6202 6245 login(username, password, reconnecting); 6203 6246 return; 6204 6247 } 6205 - if (returnCode == 2) { 6206 - playerRights = bufferedConnection.read(); 6207 - accountFlagged = bufferedConnection.read() == 1; 6248 + 6249 + if (responseCode == 2) { 6250 + playerRights = gameConnection.read(); 6251 + accountFlagged = gameConnection.read() == 1; 6208 6252 aLong902 = 0L; 6209 6253 duplicateClickCount = 0; 6210 6254 mouseCapturer.coord = 0; ··· 6225 6269 menuActionRow = 0; 6226 6270 menuOpen = false; 6227 6271 super.idleTime = 0; 6272 + 6228 6273 for (int j1 = 0; j1 < 100; j1++) 6229 6274 chatMessages[j1] = null; 6230 6275 ··· 6244 6289 destinationY = 0; 6245 6290 localPlayerCount = 0; 6246 6291 anInt1133 = 0; 6292 + 6247 6293 for (int i2 = 0; i2 < anInt968; i2++) { 6248 6294 players[i2] = null; 6249 6295 cachedAppearances[i2] = null; ··· 6253 6299 npcs[k2] = null; 6254 6300 6255 6301 localPlayer = players[thisPlayerId] = new Player(); 6302 + 6256 6303 aClass6_1282.getNodeCount(); 6257 6304 aClass6_1210.getNodeCount(); 6305 + 6258 6306 for (int l2 = 0; l2 < 4; l2++) { 6259 6307 for (int i3 = 0; i3 < 104; i3++) { 6260 6308 for (int k3 = 0; k3 < 104; k3++) 6261 6309 groundItems[l2][i3][k3] = null; 6262 - 6263 6310 } 6264 - 6265 6311 } 6266 6312 6267 6313 aClass6_1261 = new LinkedList(); 6268 6314 friendListStatus = 0; 6269 6315 friendsCount = 0; 6316 + 6270 6317 method44(aBoolean1190, dialogueId); 6271 6318 dialogueId = -1; 6319 + 6272 6320 method44(aBoolean1190, backDialogueId); 6273 6321 backDialogueId = -1; 6322 + 6274 6323 method44(aBoolean1190, openInterfaceId); 6275 6324 openInterfaceId = -1; 6325 + 6276 6326 method44(aBoolean1190, anInt1053); 6277 6327 anInt1053 = -1; 6328 + 6278 6329 method44(aBoolean1190, anInt960); 6279 6330 anInt960 = -1; 6331 + 6280 6332 method44(aBoolean1190, anInt1089); 6281 6333 anInt1089 = -1; 6334 + 6282 6335 method44(aBoolean1190, anInt1279); 6283 6336 anInt1279 = -1; 6337 + 6284 6338 aBoolean1239 = false; 6285 6339 anInt1285 = 3; 6286 6340 inputType = 0; ··· 6290 6344 anInt1319 = 0; 6291 6345 anInt1213 = -1; 6292 6346 characterEditChangeGenger = true; 6347 + 6293 6348 method25(); 6349 + 6294 6350 for (int j3 = 0; j3 < 5; j3++) 6295 6351 characterEditColors[j3] = 0; 6296 6352 ··· 6309 6365 anInt1013 = 0; 6310 6366 anInt1049 = 0; 6311 6367 anInt1162 = 0; 6368 + 6312 6369 method122(-906); 6313 6370 return; 6314 6371 } 6315 - if (returnCode == 3) { 6372 + 6373 + if (responseCode == 3) { 6316 6374 statusLineOne = ""; 6317 6375 statusLineTwo = "Invalid username or password."; 6318 6376 return; 6319 6377 } 6320 - if (returnCode == 4) { 6378 + 6379 + if (responseCode == 4) { 6321 6380 statusLineOne = "Your account has been disabled."; 6322 6381 statusLineTwo = "Please check your message-centre for details."; 6323 6382 return; 6324 6383 } 6325 - if (returnCode == 5) { 6384 + 6385 + if (responseCode == 5) { 6326 6386 statusLineOne = "Your account is already logged in."; 6327 6387 statusLineTwo = "Try again in 60 secs..."; 6328 6388 return; 6329 6389 } 6330 - if (returnCode == 6) { 6390 + 6391 + if (responseCode == 6) { 6331 6392 statusLineOne = "RuneScape has been updated!"; 6332 6393 statusLineTwo = "Please reload this page."; 6333 6394 return; 6334 6395 } 6335 - if (returnCode == 7) { 6396 + 6397 + if (responseCode == 7) { 6336 6398 statusLineOne = "This world is full."; 6337 6399 statusLineTwo = "Please use a different world."; 6338 6400 return; 6339 6401 } 6340 - if (returnCode == 8) { 6402 + 6403 + if (responseCode == 8) { 6341 6404 statusLineOne = "Unable to connect."; 6342 6405 statusLineTwo = "Login server offline."; 6343 6406 return; 6344 6407 } 6345 - if (returnCode == 9) { 6408 + 6409 + if (responseCode == 9) { 6346 6410 statusLineOne = "Login limit exceeded."; 6347 6411 statusLineTwo = "Too many connections from your address."; 6348 6412 return; 6349 6413 } 6350 - if (returnCode == 10) { 6414 + 6415 + if (responseCode == 10) { 6351 6416 statusLineOne = "Unable to connect."; 6352 6417 statusLineTwo = "Bad session id."; 6353 6418 return; 6354 6419 } 6355 - if (returnCode == 12) { 6420 + 6421 + if (responseCode == 12) { 6356 6422 statusLineOne = "You need a members account to login to this world."; 6357 6423 statusLineTwo = "Please subscribe, or use a different world."; 6358 6424 return; 6359 6425 } 6360 - if (returnCode == 13) { 6426 + 6427 + if (responseCode == 13) { 6361 6428 statusLineOne = "Could not complete login."; 6362 6429 statusLineTwo = "Please try using a different world."; 6363 6430 return; 6364 6431 } 6365 - if (returnCode == 14) { 6432 + 6433 + if (responseCode == 14) { 6366 6434 statusLineOne = "The server is being updated."; 6367 6435 statusLineTwo = "Please wait 1 minute and try again."; 6368 6436 return; 6369 6437 } 6370 - if (returnCode == 15) { 6438 + 6439 + if (responseCode == 15) { 6371 6440 loggedIn = true; 6372 6441 outBuffer.currentPosition = 0; 6373 6442 buffer.currentPosition = 0; ··· 6383 6452 aLong1229 = System.currentTimeMillis(); 6384 6453 return; 6385 6454 } 6386 - if (returnCode == 16) { 6455 + 6456 + if (responseCode == 16) { 6387 6457 statusLineOne = "Login attempts exceeded."; 6388 6458 statusLineTwo = "Please wait 1 minute and try again."; 6389 6459 return; 6390 6460 } 6391 - if (returnCode == 17) { 6461 + 6462 + if (responseCode == 17) { 6392 6463 statusLineOne = "You are standing in a members-only area."; 6393 6464 statusLineTwo = "To play on this world move to a free area first"; 6394 6465 return; 6395 6466 } 6396 - if (returnCode == 18) { 6467 + 6468 + if (responseCode == 18) { 6397 6469 statusLineOne = "Account locked as we suspect it has been stolen."; 6398 6470 statusLineTwo = "Press 'recover a locked account' on front page."; 6399 6471 return; 6400 6472 } 6401 - if (returnCode == 20) { 6473 + 6474 + if (responseCode == 20) { 6402 6475 statusLineOne = "Invalid loginserver requested"; 6403 6476 statusLineTwo = "Please try using a different world."; 6404 6477 return; 6405 6478 } 6406 - if (returnCode == 21) { 6407 - int k1 = bufferedConnection.read(); 6408 - for (k1 += 3; k1 >= 0; k1--) { 6479 + 6480 + if (responseCode == 21) { 6481 + int time = gameConnection.read(); 6482 + 6483 + for (time += 3; time >= 0; time--) { 6409 6484 statusLineOne = "You have only just left another world"; 6410 - statusLineTwo = "Your profile will be transferred in: " + k1; 6485 + statusLineTwo = "Your profile will be transferred in: " + time; 6486 + 6411 6487 drawLoginScreen(true); 6488 + 6412 6489 try { 6413 6490 Thread.sleep(1200L); 6414 - } catch (Exception _ex) { 6415 - } 6491 + } catch (Exception ignored) {} 6416 6492 } 6417 6493 6418 6494 login(username, password, reconnecting); 6419 6495 return; 6420 6496 } 6421 - if (returnCode == 22) { 6497 + 6498 + if (responseCode == 22) { 6422 6499 statusLineOne = "Malformed login packet."; 6423 6500 statusLineTwo = "Please try again."; 6424 6501 return; 6425 6502 } 6426 - if (returnCode == 23) { 6503 + 6504 + if (responseCode == 23) { 6427 6505 statusLineOne = "No reply from loginserver."; 6428 6506 statusLineTwo = "Please try again."; 6429 6507 return; 6430 6508 } 6431 - if (returnCode == 24) { 6509 + 6510 + if (responseCode == 24) { 6432 6511 statusLineOne = "Error loading your profile."; 6433 6512 statusLineTwo = "Please contact customer support."; 6434 6513 return; 6435 6514 } 6436 - if (returnCode == 25) { 6515 + 6516 + if (responseCode == 25) { 6437 6517 statusLineOne = "Unexpected loginserver response."; 6438 6518 statusLineTwo = "Please try using a different world."; 6439 6519 return; 6440 6520 } 6441 - if (returnCode == 26) { 6521 + 6522 + if (responseCode == 26) { 6442 6523 statusLineOne = "This computers address has been blocked"; 6443 6524 statusLineTwo = "as it was used to break our rules"; 6444 6525 return; 6445 6526 } 6446 - if (returnCode == -1) { 6447 - if (i1 == 0) { 6527 + 6528 + if (responseCode == -1) { 6529 + if (initialResponseCode == 0) { 6448 6530 if (anInt850 < 2) { 6449 6531 try { 6450 6532 Thread.sleep(2000L); 6451 - } catch (Exception _ex) { 6452 - } 6533 + } catch (Exception ignored) {} 6534 + 6453 6535 anInt850++; 6536 + 6454 6537 login(username, password, reconnecting); 6455 6538 return; 6456 6539 } else { ··· 6464 6547 return; 6465 6548 } 6466 6549 } else { 6467 - System.out.println("response:" + returnCode); 6550 + System.out.println("response:" + responseCode); 6551 + 6468 6552 statusLineOne = "Unexpected server response"; 6469 6553 statusLineTwo = "Please try using a different world."; 6470 6554 return; 6471 6555 } 6472 - } catch (IOException _ex) { 6556 + } catch (IOException ex) { 6473 6557 statusLineOne = ""; 6474 6558 } 6559 + 6475 6560 statusLineTwo = "Error connecting to server."; 6476 6561 } 6477 6562 ··· 6890 6975 String s = "Unknown problem"; 6891 6976 drawLoadingText(20, "Connecting to web server"); 6892 6977 try { 6893 - DataInputStream datainputstream = method31("crc" + (int) (Math.random() * 99999999D) + "-" + 377); 6978 + DataInputStream datainputstream = openJaggrabStream("crc" + (int) (Math.random() * 99999999D) + "-" + 377); 6894 6979 Buffer class50_sub1_sub2 = new Buffer(new byte[40]); 6895 6980 datainputstream.readFully(class50_sub1_sub2.buffer, 0, 40); 6896 6981 datainputstream.close(); ··· 6915 7000 } catch (Exception _ex) { 6916 7001 s = "logic problem"; 6917 7002 archiveHashes[8] = 0; 6918 - if (!SignLink.reporterror) 7003 + if (!SignLink.reportError) 6919 7004 return; 6920 7005 } 6921 7006 if (archiveHashes[8] == 0) { ··· 6936 7021 i *= 2; 6937 7022 if (i > 60) 6938 7023 i = 60; 6939 - aBoolean900 = !aBoolean900; 7024 + useJaggrab = !useJaggrab; 6940 7025 } 6941 7026 } 6942 7027 } ··· 7066 7151 } 7067 7152 7068 7153 public URL getCodeBase() { 7069 - if (SignLink.mainapp != null) 7070 - return SignLink.mainapp.getCodeBase(); 7154 + if (SignLink.applet != null) 7155 + return SignLink.applet.getCodeBase(); 7156 + 7071 7157 try { 7072 7158 if (super.gameFrame != null) 7073 - return new URL("http://127.0.0.1:" + (10080 + portOffset)); 7074 - } catch (Exception _ex) { 7075 - } 7159 + return new URL("http://" + Configuration.SERVER_ADDRESS + ":" + (Configuration.HTTP_PORT + portOffset)); 7160 + } catch (Exception ignored) {} 7161 + 7076 7162 return super.getCodeBase(); 7077 7163 } 7078 7164 ··· 7386 7472 outBuffer.putOpcode(78); 7387 7473 outBuffer.putInt(0x3f008edd); 7388 7474 } 7389 - if (lowMemory && SignLink.cache_dat != null) { 7475 + if (lowMemory && SignLink.cacheData != null) { 7390 7476 int k = onDemandRequester.fileCount(0); 7391 7477 for (int j1 = 0; j1 < k; j1++) { 7392 7478 int i2 = onDemandRequester.modelId(j1); ··· 7493 7579 7494 7580 if (vec.currentPosition != packetSize) { 7495 7581 SignLink 7496 - .reporterror("Error packet size mismatch in getplayer coord:" + vec.currentPosition + " psize:" + packetSize); 7582 + .reportError("Error packet size mismatch in getplayer coord:" + vec.currentPosition + " psize:" + packetSize); 7497 7583 throw new RuntimeException("eek"); 7498 7584 } 7499 7585 for (int i1 = 0; i1 < localPlayerCount; i1++) 7500 7586 if (players[playerList[i1]] == null) { 7501 - SignLink.reporterror(username + " null entry in pl list - coord:" + i1 + " size:" 7587 + SignLink.reportError(username + " null entry in pl list - coord:" + i1 + " size:" 7502 7588 + localPlayerCount); 7503 7589 throw new RuntimeException("eek"); 7504 7590 } ··· 7525 7611 i = 42 / i; 7526 7612 return; 7527 7613 } catch (RuntimeException runtimeexception) { 7528 - SignLink.reporterror("45745, " + i + ", " + l + ", " + runtimeexception.toString()); 7614 + SignLink.reportError("45745, " + i + ", " + l + ", " + runtimeexception.toString()); 7529 7615 } 7530 7616 throw new RuntimeException(); 7531 7617 } 7532 7618 7533 7619 public String getParameter(String s) { 7534 - if (SignLink.mainapp != null) 7535 - return SignLink.mainapp.getParameter(s); 7620 + if (SignLink.applet != null) 7621 + return SignLink.applet.getParameter(s); 7536 7622 else 7537 7623 return super.getParameter(s); 7538 7624 } ··· 8179 8265 } 8180 8266 8181 8267 public AppletContext getAppletContext() { 8182 - if (SignLink.mainapp != null) 8183 - return SignLink.mainapp.getAppletContext(); 8268 + if (SignLink.applet != null) 8269 + return SignLink.applet.getAppletContext(); 8184 8270 else 8185 8271 return super.getAppletContext(); 8186 8272 } ··· 8329 8415 8330 8416 } 8331 8417 if (playerCount > localPlayerCount) { 8332 - SignLink.reporterror(username + " Too many players"); 8418 + SignLink.reportError(username + " Too many players"); 8333 8419 throw new RuntimeException("eek"); 8334 8420 } 8335 8421 localPlayerCount = 0; ··· 8563 8649 public void startRunnable(Runnable runnable, int i) { 8564 8650 if (i > 10) 8565 8651 i = 10; 8566 - if (SignLink.mainapp != null) { 8652 + if (SignLink.applet != null) { 8567 8653 SignLink.startThread(runnable, i); 8568 8654 return; 8569 8655 } else { ··· 9758 9844 9759 9845 public void logout() { 9760 9846 try { 9761 - if (bufferedConnection != null) 9762 - bufferedConnection.close(); 9847 + if (gameConnection != null) 9848 + gameConnection.close(); 9763 9849 } catch (Exception _ex) { 9764 9850 } 9765 - bufferedConnection = null; 9851 + gameConnection = null; 9766 9852 loggedIn = false; 9767 9853 loginScreenState = 0; 9768 9854 username = ""; ··· 10513 10599 System.out.println("draw-cycle:" + anInt1309); 10514 10600 System.out.println("ptype:" + opcode); 10515 10601 System.out.println("psize:" + packetSize); 10516 - if (bufferedConnection != null) 10517 - bufferedConnection.printDebug(); 10602 + if (gameConnection != null) 10603 + gameConnection.printDebug(); 10518 10604 super.dumpRequested = true; 10519 10605 } 10520 10606 10521 10607 public Component getParentComponent() { 10522 - if (SignLink.mainapp != null) 10523 - return SignLink.mainapp; 10608 + if (SignLink.applet != null) 10609 + return SignLink.applet; 10524 10610 if (super.gameFrame != null) 10525 10611 return super.gameFrame; 10526 10612 else ··· 11024 11110 if (loadingStage == 1) { 11025 11111 int i = method144(5); 11026 11112 if (i != 0 && System.currentTimeMillis() - aLong1229 > 0x57e40L) { 11027 - SignLink.reporterror(username + " glcfb " + serverSeed + "," + i + "," + lowMemory + "," 11113 + SignLink.reportError(username + " glcfb " + serverSeed + "," + i + "," + lowMemory + "," 11028 11114 + stores[0] + "," + onDemandRequester.method333() + "," + plane + "," 11029 11115 + chunkX + "," + chunkY); 11030 11116 aLong1229 = System.currentTimeMillis(); ··· 11491 11577 11492 11578 } 11493 11579 } catch (Exception exception) { 11494 - if (SignLink.reporterror) { 11580 + if (SignLink.reportError) { 11495 11581 outBuffer.putOpcode(80); 11496 11582 outBuffer.putShort(sound[index] & 0x7fff); 11497 11583 } else {
+12 -9
src/com/jagex/runescape/net/Buffer.java
··· 229 229 return getUnsignedLEShort() - 32768; 230 230 } 231 231 232 - public void rsa(BigInteger modulus, BigInteger key) { 233 - int len = currentPosition; 232 + public void encrypt(BigInteger modulus, BigInteger key) { 233 + int length = currentPosition; 234 234 currentPosition = 0; 235 - byte rawBytes[] = new byte[len]; 236 - getBytes(rawBytes, 0, len); 237 - BigInteger rawInteger = new BigInteger(rawBytes); 238 - BigInteger encryptedInteger = rawInteger.modPow(key, modulus); 239 - byte encryptedBytes[] = encryptedInteger.toByteArray(); 235 + byte bytes[] = new byte[length]; 236 + 237 + getBytes(bytes, 0, length); 238 + 239 + BigInteger raw = new BigInteger(bytes); 240 + BigInteger encrypted = raw.modPow(key, modulus); 241 + bytes = encrypted.toByteArray(); 240 242 currentPosition = 0; 241 - putByte(encryptedBytes.length); 242 - putBytes(encryptedBytes, 0, encryptedBytes.length); 243 + 244 + putByte(bytes.length); 245 + putBytes(bytes, 0, bytes.length); 243 246 } 244 247 245 248 public void putByteAdded(int value) {
+2 -2
src/com/jagex/runescape/net/requester/OnDemandRequester.java
··· 95 95 if (onDemandNode != null) { 96 96 idleCycles = 0; 97 97 if (size == 0) { 98 - SignLink.reporterror("Rej: " + type + "," + id); 98 + SignLink.reportError("Rej: " + type + "," + id); 99 99 onDemandNode.buffer = null; 100 100 if (onDemandNode.immediate) 101 101 synchronized (completed) { ··· 373 373 } 374 374 return; 375 375 } catch (Exception exception) { 376 - SignLink.reporterror("od_ex " + exception.getMessage()); 376 + SignLink.reportError("od_ex " + exception.getMessage()); 377 377 } 378 378 } 379 379
+18 -4
src/com/jagex/runescape/util/ChatEncoder.java
··· 4 4 5 5 public class ChatEncoder { 6 6 7 - public static char[] message = new char[100]; 8 - public static Buffer messageBuffer = new Buffer(new byte[100]); 9 - public static char VALID_CHARACTERS[] = {' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u', 'm', 'w', 7 + private static char[] message = new char[100]; 8 + private static Buffer messageBuffer = new Buffer(new byte[100]); 9 + private static char VALID_CHARACTERS[] = {' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u', 'm', 'w', 10 10 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', 11 11 '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-', '&', '*', '\\', '\'', '@', '#', '+', '=', '\243', 12 12 '$', '%', '"', '[', ']'}; ··· 14 14 public static String get(int length, Buffer buffer) { 15 15 int count = 0; 16 16 int validCharacterIndex = -1; 17 + 17 18 for (int lengthCounter = 0; lengthCounter < length; lengthCounter++) { 18 19 int character = buffer.getUnsignedByte(); 19 20 int characterBit = character >> 4 & 0xf; 21 + 20 22 if (validCharacterIndex == -1) { 21 23 if (characterBit < 13) 22 24 message[count++] = VALID_CHARACTERS[characterBit]; ··· 26 28 message[count++] = VALID_CHARACTERS[((validCharacterIndex << 4) + characterBit) - 195]; 27 29 validCharacterIndex = -1; 28 30 } 31 + 29 32 characterBit = character & 0xf; 33 + 30 34 if (validCharacterIndex == -1) { 31 35 if (characterBit < 13) 32 36 message[count++] = VALID_CHARACTERS[characterBit]; ··· 39 43 } 40 44 41 45 boolean isSymbol = true; 46 + 42 47 for (int messageIndex = 0; messageIndex < count; messageIndex++) { 43 48 char c = message[messageIndex]; 49 + 44 50 if (isSymbol && c >= 'a' && c <= 'z') { 45 51 message[messageIndex] += '\uFFE0'; 46 52 isSymbol = false; 47 53 } 54 + 48 55 if (c == '.' || c == '!' || c == '?') 49 56 isSymbol = true; 50 57 } ··· 55 62 public static void put(String chatMessage, Buffer buffer) { 56 63 if (chatMessage.length() > 80) 57 64 chatMessage = chatMessage.substring(0, 80); 65 + 58 66 int chatMessageCharacter = -1; 67 + 59 68 for (int index = 0; index < chatMessage.length(); index++) { 60 69 char character = chatMessage.charAt(index); 61 70 int validCharacterIndex = 0; 71 + 62 72 for (int validIndex = 0; validIndex < VALID_CHARACTERS.length; validIndex++) { 63 73 if (character != VALID_CHARACTERS[validIndex]) 64 74 continue; 75 + 65 76 validCharacterIndex = validIndex; 66 77 break; 67 78 } 68 79 69 - 70 80 if (validCharacterIndex > 12) 71 81 validCharacterIndex += 195; 82 + 72 83 if (chatMessageCharacter == -1) { 73 84 if (validCharacterIndex < 13) 74 85 chatMessageCharacter = validCharacterIndex; ··· 89 100 90 101 public static String formatChatMessage(String chatMessage) { 91 102 messageBuffer.currentPosition = 0; 103 + 92 104 put(chatMessage, messageBuffer); 105 + 93 106 int offset = messageBuffer.currentPosition; 94 107 messageBuffer.currentPosition = 0; 108 + 95 109 return get(offset, messageBuffer); 96 110 } 97 111
+179 -181
src/com/jagex/runescape/util/SignLink.java
··· 1 1 package com.jagex.runescape.util; 2 - import java.applet.Applet; 3 - import java.io.*; 4 - import java.net.*; 2 + 5 3 import javax.sound.midi.*; 6 4 import javax.sound.sampled.*; 5 + import java.applet.Applet; 6 + import java.io.*; 7 + import java.net.InetAddress; 8 + import java.net.Socket; 9 + import java.net.URL; 7 10 8 11 public final class SignLink implements Runnable { 9 - 10 - 11 - public static final int clientversion = 377; 12 + 13 + public static final int CLIENT_REVISION = 377; 14 + 12 15 public static int uid; 13 - public static int storeid = 32; 14 - public static RandomAccessFile cache_dat = null; 15 - public static final RandomAccessFile[] cache_idx = new RandomAccessFile[5]; 16 - public static Applet mainapp = null; 16 + public static int storeId = 32; 17 + public static RandomAccessFile cacheData = null; 18 + public static final RandomAccessFile[] cacheIndex = new RandomAccessFile[5]; 19 + public static Applet applet = null; 17 20 private static boolean active; 18 - private static int threadliveid; 21 + private static int threadLiveId; 19 22 private static InetAddress inetAddress; 20 23 private static int socketRequest; 21 24 private static Socket socket = null; 22 - private static int threadreqpri = 1; 25 + private static int threadRequestPriority = 1; 23 26 private static Runnable threadRequest = null; 24 27 private static String dnsRequest = null; 25 28 public static String dns = null; 26 29 private static String urlRequest = null; 27 - private static DataInputStream urlstream = null; 28 - private static int savelen; 30 + private static DataInputStream urlStream = null; 31 + private static int saveLength; 29 32 private static String saveRequest = null; 30 - private static byte[] savebuf = null; 33 + private static byte[] saveBuffer = null; 31 34 private static boolean play; 32 - private static int midipos; 35 + private static int midiPosition; 33 36 public static String midi = null; 34 37 public static int midiVolume; 35 38 public static int fadeMidi; 36 - private static boolean midiplay; 37 - private static int wavepos; 38 - public static int wavevol; 39 - public static boolean reporterror = true; 40 - public static String errorname = ""; 41 - public static boolean musicEnable = true; 39 + private static boolean midiPlay; 40 + private static int wavePosition; 41 + public static int waveVolume; 42 + public static boolean reportError = true; 43 + public static String errorName = ""; 44 + public static Sequencer music = null; 45 + private static Synthesizer synthesizer = null; 46 + private Position curPosition; 42 47 48 + enum Position { 49 + LEFT, RIGHT 50 + } 43 51 44 - public static final void initialize(InetAddress inetaddress) { 45 - threadliveid = (int) (Math.random() * 99999999D); 52 + public static void initialize(InetAddress address) { 53 + threadLiveId = (int) (Math.random() * 99999999D); 54 + 46 55 if (active) { 47 56 try { 48 57 Thread.sleep(500L); 49 - } catch (Exception _ex) { 50 - } 58 + } catch (Exception ignored) {} 59 + 51 60 active = false; 52 61 } 62 + 53 63 socketRequest = 0; 54 64 threadRequest = null; 55 65 dnsRequest = null; 56 66 saveRequest = null; 57 67 urlRequest = null; 58 - inetAddress = inetaddress; 68 + inetAddress = address; 59 69 Thread thread = new Thread(new SignLink()); 70 + 60 71 thread.setDaemon(true); 61 72 thread.start(); 62 - while (!active) 63 - try { 64 - Thread.sleep(50L); 65 - } catch (Exception _ex) { 66 - } 73 + 74 + while (!active) { 75 + try { 76 + Thread.sleep(50L); 77 + } catch (Exception ignored) {} 78 + } 67 79 } 68 80 69 - enum Position { 70 - LEFT, RIGHT, NORMAL 71 - }; 72 - 73 - private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb 74 - private Position curPosition; 75 - 76 81 public void run() { 77 82 active = true; 78 83 String directory = cacheLocation(); 79 84 uid = getUID(directory); 85 + 80 86 try { 81 - cache_dat = new RandomAccessFile(directory + "main_file_cache.dat", "rw"); 87 + cacheData = new RandomAccessFile(directory + "main_file_cache.dat", "rw"); 88 + 82 89 for (int idx = 0; idx < 5; idx++) 83 - cache_idx[idx] = new RandomAccessFile(directory + "main_file_cache.idx" + idx, "rw"); 90 + cacheIndex[idx] = new RandomAccessFile(directory + "main_file_cache.idx" + idx, "rw"); 84 91 } catch (Exception exception) { 85 92 exception.printStackTrace(); 86 93 } 87 - for (int i = threadliveid; threadliveid == i;) { 94 + 95 + for (int i = threadLiveId; threadLiveId == i;) { 88 96 if (socketRequest != 0) { 89 97 try { 90 98 socket = new Socket(inetAddress, socketRequest); 91 99 } catch (Exception _ex) { 92 100 socket = null; 93 101 } 102 + 94 103 socketRequest = 0; 95 104 } else if (threadRequest != null) { 96 105 Thread thread = new Thread(threadRequest); 106 + 97 107 thread.setDaemon(true); 98 108 thread.start(); 99 - thread.setPriority(threadreqpri); 109 + thread.setPriority(threadRequestPriority); 110 + 100 111 threadRequest = null; 101 112 } else if (dnsRequest != null) { 102 113 try { ··· 104 115 } catch (Exception _ex) { 105 116 dns = "unknown"; 106 117 } 118 + 107 119 dnsRequest = null; 108 120 } else if (saveRequest != null) { 109 - if (savebuf != null) 121 + if (saveBuffer != null) { 110 122 try { 111 123 FileOutputStream fileoutputstream = new FileOutputStream(directory + saveRequest); 112 - fileoutputstream.write(savebuf, 0, savelen); 124 + 125 + fileoutputstream.write(saveBuffer, 0, saveLength); 113 126 fileoutputstream.close(); 114 - } catch (Exception _ex) { 115 - } 116 - if (midiplay) { 127 + } catch (Exception ignored) {} 128 + } 129 + 130 + if (midiPlay) { 117 131 String wave = directory + saveRequest; 118 - midiplay = false; 119 - AudioInputStream audioInputStream = null; 132 + midiPlay = false; 133 + AudioInputStream audioInputStream; 134 + 120 135 try { 121 136 audioInputStream = AudioSystem.getAudioInputStream(new File(wave)); 122 - } catch (UnsupportedAudioFileException e1) { 123 - e1.printStackTrace(); 124 - return; 125 - } catch (IOException e1) { 126 - e1.printStackTrace(); 137 + } catch (UnsupportedAudioFileException | IOException e) { 138 + e.printStackTrace(); 127 139 return; 128 140 } 129 - AudioFormat format = audioInputStream.getFormat(); 130 - SourceDataLine auline = null; 141 + 142 + AudioFormat format = audioInputStream.getFormat(); 131 143 DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); 144 + SourceDataLine audioLine; 145 + 132 146 try { 133 - auline = (SourceDataLine) AudioSystem.getLine(info); 134 - auline.open(format); 135 - } catch (LineUnavailableException e) { 136 - e.printStackTrace(); 137 - return; 147 + audioLine = (SourceDataLine) AudioSystem.getLine(info); 148 + audioLine.open(format); 138 149 } catch (Exception e) { 139 150 e.printStackTrace(); 140 151 return; 141 152 } 142 - if (auline.isControlSupported(FloatControl.Type.PAN)) { 143 - FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.PAN); 153 + 154 + if (audioLine.isControlSupported(FloatControl.Type.PAN)) { 155 + FloatControl pan = (FloatControl) audioLine.getControl(FloatControl.Type.PAN); 156 + 144 157 if (curPosition == Position.RIGHT) 145 158 pan.setValue(1.0f); 146 159 else if (curPosition == Position.LEFT) 147 160 pan.setValue(-1.0f); 148 161 } 149 - auline.start(); 162 + 163 + audioLine.start(); 164 + 150 165 int nBytesRead = 0; 151 - byte[] abData = new byte[EXTERNAL_BUFFER_SIZE]; 166 + byte[] abData = new byte[524288]; 167 + 152 168 try { 153 169 while (nBytesRead != -1) { 154 - nBytesRead = audioInputStream.read(abData, 0, 155 - abData.length); 170 + nBytesRead = audioInputStream.read(abData, 0, abData.length); 171 + 156 172 if (nBytesRead >= 0) 157 - auline.write(abData, 0, nBytesRead); 173 + audioLine.write(abData, 0, nBytesRead); 158 174 } 159 175 } catch (IOException e) { 160 176 e.printStackTrace(); 161 177 return; 162 178 } finally { 163 - auline.drain(); 164 - auline.close(); 179 + audioLine.drain(); 180 + audioLine.close(); 165 181 } 166 182 } 183 + 167 184 if (play) { 168 185 midi = directory + saveRequest; 186 + 169 187 try { 170 188 if (music != null) { 171 189 music.stop(); 172 190 music.close(); 173 191 } 192 + 174 193 playMidi(midi); 175 194 } catch (Exception ex) { 176 195 ex.printStackTrace(); 177 196 } 197 + 178 198 play = false; 179 199 } 200 + 180 201 saveRequest = null; 181 202 } else if (urlRequest != null) { 182 203 try { 183 - System.out.println("urlstream"); 184 - urlstream = new DataInputStream((new URL(mainapp.getCodeBase(), urlRequest)).openStream()); 204 + System.out.println("urlStream"); 205 + 206 + urlStream = new DataInputStream((new URL(applet.getCodeBase(), urlRequest)).openStream()); 185 207 } catch (Exception _ex) { 186 - urlstream = null; 208 + urlStream = null; 187 209 } 210 + 188 211 urlRequest = null; 189 212 } 213 + 190 214 try { 191 215 Thread.sleep(50L); 192 - } catch (Exception _ex) { 193 - } 216 + } catch (Exception ignored) {} 194 217 } 195 218 } 196 219 ··· 199 222 * @param location 200 223 */ 201 224 private void playMidi(String location) { 225 + Sequence sequence; 202 226 music = null; 203 227 synthesizer = null; 204 - sequence = null; 205 228 File midiFile = new File(location); 229 + 206 230 try { 207 - if (musicEnable) { 208 - sequence = MidiSystem.getSequence(midiFile); 209 - music = MidiSystem.getSequencer(); 210 - music.open(); 211 - music.setSequence(sequence); 212 - } 231 + sequence = MidiSystem.getSequence(midiFile); 232 + music = MidiSystem.getSequencer(); 233 + 234 + music.open(); 235 + music.setSequence(sequence); 213 236 } catch (Exception e) { 214 237 System.err.println("Problem loading MIDI file."); 215 238 e.printStackTrace(); 216 239 return; 217 240 } 241 + 218 242 if (music instanceof Synthesizer) { 219 243 synthesizer = (Synthesizer) music; 220 244 } else { 221 245 try { 222 246 synthesizer = MidiSystem.getSynthesizer(); 247 + 223 248 synthesizer.open(); 249 + 224 250 if (synthesizer.getDefaultSoundbank() == null) { 225 251 music.getTransmitter().setReceiver(MidiSystem.getReceiver()); 226 252 } else { ··· 231 257 return; 232 258 } 233 259 } 260 + 234 261 music.setLoopCount(Sequencer.LOOP_CONTINUOUSLY); 235 262 music.start(); 236 263 } ··· 240 267 * @param value 241 268 */ 242 269 public static void setVolume(int value) { 243 - int CHANGE_VOLUME = 7; 270 + final int CHANGE_VOLUME = 7; 244 271 midiVolume = value; 272 + 245 273 if (synthesizer.getDefaultSoundbank() == null) { 246 274 try { 247 275 ShortMessage volumeMessage = new ShortMessage(); 276 + 248 277 for (int i = 0; i < 16; i++) { 249 278 volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, CHANGE_VOLUME, midiVolume); 250 279 volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 39, midiVolume); ··· 255 284 } 256 285 } else { 257 286 MidiChannel[] channels = synthesizer.getChannels(); 287 + 258 288 for (int c = 0; channels != null && c < channels.length; c++) { 259 289 channels[c].controlChange(CHANGE_VOLUME, midiVolume); 260 290 channels[c].controlChange(39, midiVolume); ··· 262 292 } 263 293 } 264 294 265 - public static Sequencer music = null; 266 - public static Sequence sequence = null; 267 - public static Synthesizer synthesizer = null; 268 - 269 - public static String cacheLocationOrig() { 270 - String locations[] = { "c:/windows/", "c:/WINDOWS/", "c:/winnt/", 271 - "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", 272 - "f:/windows/", "f:/winnt/", "c:/", "~/", "/tmp/", "", 273 - "c:/rscache", "/rscache" }; 274 - String cacheFolder = ".377galkon"; 275 - for (int i = 0; i < locations.length; i++) { 276 - try { 277 - String location = locations[i]; 278 - if (location.length() > 0) { 279 - File file = new File(location); 280 - if (!file.exists()) 281 - continue; 282 - } 283 - File finalDirectory = new File(location + cacheFolder); 284 - if (finalDirectory.exists() || finalDirectory.mkdir()) 285 - return location + cacheFolder 286 - + System.getProperty("file.separator"); 287 - } catch (Exception _ex) { 288 - } 289 - } 290 - return System.getProperty("user.home") 291 - + System.getProperty("file.separator") + cacheFolder 292 - + System.getProperty("file.separator"); 293 - } 294 - 295 295 public static String cacheLocation() { 296 296 String name = ".377cache"; 297 297 File file = new File(System.getProperty("user.home") + System.getProperty("file.separator") + name + System.getProperty("file.separator")); ··· 310 310 return file.toString(); 311 311 } 312 312 313 - private static int getUID(String name) { 313 + private static int getUID(String location) { 314 314 try { 315 - File file = new File(name + "uid.dat"); 316 - if (!file.exists() || file.length() < 4L) { 317 - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(name + "uid.dat")); 318 - dataoutputstream.writeInt((int) (Math.random() * 99999999D)); 319 - dataoutputstream.close(); 315 + File uid = new File(location + "uid.dat"); 316 + 317 + if (!uid.exists() || uid.length() < 4L) { 318 + DataOutputStream output = new DataOutputStream(new FileOutputStream(location + "uid.dat")); 319 + 320 + output.writeInt((int) (Math.random() * 99999999D)); 321 + output.close(); 320 322 } 321 - } catch (Exception _ex) { 322 - } 323 + } catch (Exception ignored) {} 324 + 323 325 try { 324 - DataInputStream datainputstream = new DataInputStream(new FileInputStream(name + "uid.dat")); 325 - int i = datainputstream.readInt(); 326 - datainputstream.close(); 327 - return i + 1; 328 - } catch (Exception _ex) { 326 + DataInputStream input = new DataInputStream(new FileInputStream(location + "uid.dat")); 327 + int value = input.readInt(); 328 + 329 + input.close(); 330 + 331 + return value + 1; 332 + } catch (Exception ex) { 329 333 return 0; 330 334 } 331 335 } 332 336 333 - public static synchronized Socket openSocket(int i) throws IOException { 334 - for (socketRequest = i; socketRequest != 0;) 335 - try { 336 - Thread.sleep(50L); 337 - } catch (Exception _ex) { 338 - } 337 + public static synchronized Socket openSocket(int port) throws IOException { 338 + for (socketRequest = port; socketRequest != 0;) { 339 + try { 340 + Thread.sleep(50L); 341 + } catch (Exception ignored) {} 342 + } 343 + 339 344 if (socket == null) 340 345 throw new IOException("could not open socket"); 341 346 else 342 347 return socket; 343 348 } 344 349 345 - public static synchronized DataInputStream openURL(String s) throws IOException { 346 - for (urlRequest = s; urlRequest != null;) 347 - try { 348 - Thread.sleep(50L); 349 - } catch (Exception _ex) { 350 - } 351 - if (urlstream == null) 352 - throw new IOException("could not open: " + s); 350 + public static synchronized DataInputStream openURL(String url) throws IOException { 351 + for (urlRequest = url; urlRequest != null;) { 352 + try { 353 + Thread.sleep(50L); 354 + } catch (Exception ignored) {} 355 + } 356 + 357 + if (urlStream == null) 358 + throw new IOException("could not open: " + url); 353 359 else 354 - return urlstream; 360 + return urlStream; 355 361 } 356 362 357 - public static synchronized void dnslookup(String s) { 358 - dns = s; 359 - dnsRequest = s; 363 + public static synchronized void dnsLookup(String host) { 364 + dns = host; 365 + dnsRequest = host; 360 366 } 361 367 362 - public static synchronized void startThread(Runnable runnable, int i) { 363 - threadreqpri = i; 368 + public static synchronized void startThread(Runnable runnable, int priority) { 369 + threadRequestPriority = priority; 364 370 threadRequest = runnable; 365 371 } 366 372 367 - public static synchronized boolean saveWave(byte abyte0[], int i) { 368 - if (i > 0x1e8480) 369 - return false; 370 - if (saveRequest != null) { 373 + public static synchronized boolean saveWave(byte[] data, int length) { 374 + if (length > 2000000 || saveRequest != null) 371 375 return false; 372 - } else { 373 - wavepos = (wavepos + 1) % 5; 374 - savelen = i; 375 - savebuf = abyte0; 376 - midiplay = true; 377 - saveRequest = "sound" + wavepos + ".wav"; 378 - return true; 379 - } 376 + 377 + wavePosition = (wavePosition + 1) % 5; 378 + saveLength = length; 379 + saveBuffer = data; 380 + midiPlay = true; 381 + saveRequest = "sound" + wavePosition + ".wav"; 382 + 383 + return true; 380 384 } 381 385 382 386 public static synchronized boolean replayWave() { 383 - if (saveRequest != null) { 387 + if (saveRequest != null) 384 388 return false; 385 - } else { 386 - savebuf = null; 387 - midiplay = true; 388 - saveRequest = "sound" + wavepos + ".wav"; 389 - return true; 390 - } 389 + 390 + saveBuffer = null; 391 + midiPlay = true; 392 + saveRequest = "sound" + wavePosition + ".wav"; 393 + 394 + return true; 391 395 } 392 396 393 - public static synchronized void saveMidi(byte abyte0[], int i) { 394 - if (i > 0x1e8480) 397 + public static synchronized void saveMidi(byte[] data, int length) { 398 + if (length > 2000000 || saveRequest != null) 395 399 return; 396 - if (saveRequest != null) { 397 - } else { 398 - midipos = (midipos + 1) % 5; 399 - savelen = i; 400 - savebuf = abyte0; 401 - play = true; 402 - saveRequest = "jingle" + midipos + ".mid"; 403 - } 404 - } 405 400 406 - public static void reporterror(String s) { 407 - System.out.println("Error: " + s); 401 + midiPosition = (midiPosition + 1) % 5; 402 + saveLength = length; 403 + saveBuffer = data; 404 + play = true; 405 + saveRequest = "jingle" + midiPosition + ".mid"; 408 406 } 409 407 410 - private SignLink() { 408 + public static void reportError(String error) { 409 + System.out.println("Error: " + error); 411 410 } 412 - 413 411 414 412 }
+53
src/tech/henning/client/Configuration.java
··· 1 + package tech.henning.client; 2 + 3 + import java.math.BigInteger; 4 + 5 + public class Configuration { 6 + 7 + /** 8 + * IP Address or Hostname of the server to establish a connection. 9 + */ 10 + public static final String SERVER_ADDRESS = "127.0.0.1"; 11 + 12 + /** 13 + * Name of the cache folder located in the users home directory. 14 + */ 15 + public static final String CACHE_NAME = ".377cache"; 16 + 17 + /** 18 + * Port for establishing a connection to the game server. 19 + */ 20 + public static final int GAME_PORT = 43594; 21 + 22 + /** 23 + * Port for establishing a connection to the update server. 24 + */ 25 + public static final int JAGGRAB_PORT = 43595; 26 + 27 + /** 28 + * Port for establishing a backup connection to the update 29 + * server in case the initial JAGGRAB connection fails. 30 + */ 31 + public static final int HTTP_PORT = 80; 32 + 33 + /** 34 + * Whether or not the update server should be used. 35 + */ 36 + public static final boolean JAGGRAB_ENABLED = true; 37 + 38 + /** 39 + * Whether or not the network packets should be encrypted. 40 + */ 41 + public static final boolean RSA_ENABLED = true; 42 + 43 + /** 44 + * Public key to be used in RSA network encryption. 45 + */ 46 + public static final BigInteger RSA_PUBLIC_KEY = new BigInteger("65537"); 47 + 48 + /** 49 + * Modulus to be used in the RSA network encryption. 50 + */ 51 + public static final BigInteger RSA_MODULUS = new BigInteger("141676157752195554735559211145264378937976297633767586286947546254112706939523147177486275692443604121432268321940975736544648897121324600822274740814139678532354218331462623318311718669229065754584663117654839398911927015058106642488139604266125209131471909966472090271413833528051210941238152814528481571969"); 52 + 53 + }