Difference between revisions of "194 Cache Format"

From RuneWiki
Jump to navigationJump to search
 
(4 intermediate revisions by 3 users not shown)
Line 5: Line 5:
 
=== Name hashing ===
 
=== Name hashing ===
  
Every name in the cache was hashed using the following method which is, incidentally, the similar to the way player names are converted to longs.
+
Every name in the cache was hashed using the following method which is, incidentally, similar to the way player names are converted to longs.
  
 
  public static final long gethash(String string) {
 
  public static final long gethash(String string) {
Line 24: Line 24:
  
 
The resulting long was converted to a string and the file was given that name.
 
The resulting long was converted to a string and the file was given that name.
 +
 +
=== Files ===
 +
 +
The files in the cache were the ones used in the [[JAGGRAB Protocol]] (i.e. files in cache 0 in old engine caches) and map (mX_Y) and landscape (lX_Y) files. Incidentally, this naming is very similar to the names of the map and landscape files in new engine caches.

Latest revision as of 13:16, 15 August 2009

General Information

The 194 (RuneScape 2 beta) client worked with a very simple cache format. Each file in the cache was a file on the operating system.

Name hashing

Every name in the cache was hashed using the following method which is, incidentally, similar to the way player names are converted to longs.

public static final long gethash(String string) {
    string = string.trim();
    long l = 0L;
    for (int i = 0; i < string.length() && i < 12; i++) {
        char c = string.charAt(i);
        l *= 37L;
        if (c >= 'A' && c <= 'Z')
            l += (long) ('\001' + c - 'A');
        else if (c >= 'a' && c <= 'z')
            l += (long) ('\001' + c - 'a');
        else if (c >= '0' && c <= '9')
            l += (long) ('\033' + c - '0');
    }
    return l;
}

The resulting long was converted to a string and the file was given that name.

Files

The files in the cache were the ones used in the JAGGRAB Protocol (i.e. files in cache 0 in old engine caches) and map (mX_Y) and landscape (lX_Y) files. Incidentally, this naming is very similar to the names of the map and landscape files in new engine caches.