Thread: Getting "server keys" for js5

Results 1 to 3 of 3
  1. #1 Getting "server keys" for js5 
    Registered Member
    Join Date
    Jan 2017
    Posts
    24
    Thanks given
    8
    Thanks received
    1
    Rep Power
    24
    Been messing around with the 600+ revisions and I'm not sure when they updated the JS5 protocol but after the handshake and the server sends byte 0 to initiate the Js5 it also sends ints. People name it as "Server keys"

    example taken from matrix 718:
    Code:
    public static final int[] GRAB_SERVER_KEYS = {1441,78700,44880,39771,363186,44375,0,16140,7316
            ,271148,810710,216189,379672,454149,933950,21006,25367,17247,1244,1,14856,1494,119,882901,1818764,3963,3618};
    Just wondering where I would get these?
    Reply With Quote  
     

  2. #2  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by ey b0ss View Post
    Been messing around with the 600+ revisions and I'm not sure when they updated the JS5 protocol but after the handshake and the server sends byte 0 to initiate the Js5 it also sends ints. People name it as "Server keys"

    example taken from matrix 718:
    Code:
    public static final int[] GRAB_SERVER_KEYS = {1441,78700,44880,39771,363186,44375,0,16140,7316
            ,271148,810710,216189,379672,454149,933950,21006,25367,17247,1244,1,14856,1494,119,882901,1818764,3963,3618};
    Just wondering where I would get these?
    You can calculate them using something like: Prefetch keys generation

    My implementation:

    Code:
    class ServerKeys(val store: CacheStore) {
    
        val serverKeys: MutableList<Int> = mutableListOf()
    
    
        init {
            if (store.indexesCount >= 31) {
                serverKeys.add(calculateIndexSize(CacheIndex.DEFAULT_DATA))
                serverKeys.add(calculateNativeLibSize("jaclib"))
                serverKeys.add(calculateNativeLibSize("jaggl"))
                serverKeys.add(calculateNativeLibSize("jagdx"))
                serverKeys.add(calculateNativeLibSize("sw3d"))
                serverKeys.add(calculateNativeLibSize("hw3d"))
                serverKeys.add(calculateNativeLibSize("jagtheora"))
                serverKeys.add(calculateIndexSize(CacheIndex.GRAPHICS_SHADERS))
                serverKeys.add(calculateIndexSize(CacheIndex.TEXTURES_DEFINITIONS))
                serverKeys.add(calculateIndexSize(CacheIndex.MISCELLANEOUS))
                serverKeys.add(calculateIndexSize(CacheIndex.OBJECTS))
                serverKeys.add(calculateIndexSize(CacheIndex.CLIENT_SCRIPTS_MAPS))
                serverKeys.add(calculateIndexSize(CacheIndex.NPCS))
                serverKeys.add(calculateIndexSize(CacheIndex.ITEMS))
                serverKeys.add(calculateIndexSize(CacheIndex.ANIMATION_DEFINITIONS))
                serverKeys.add(calculateIndexSize(CacheIndex.GRAPHICS_DEFINITIONS))
                serverKeys.add(calculateIndexSize(CacheIndex.VARBIT_DEFINITIONS))
                serverKeys.add(calculateIndexSize(CacheIndex.QUICK_CHAT_MESSAGES))
                serverKeys.add(calculateIndexSize(CacheIndex.QUICK_CHAT_MENUS))
                serverKeys.add(calculateIndexSize(CacheIndex.TEXTURES)) // unsure about that one
                serverKeys.add(calculateIndexSize(CacheIndex.PARTICLES))
                serverKeys.add(calculateIndexSize(CacheIndex.BILLBOARDS))
                serverKeys.add(calculateArchiveSize(CacheIndex.HUFFMAN, "huffman"))
                serverKeys.add(calculateIndexSize(CacheIndex.INTERFACES))
                serverKeys.add(calculateIndexSize(CacheIndex.INTERFACE_SCRIPTS))
                serverKeys.add(calculateIndexSize(CacheIndex.TEXT_FONTS))
                serverKeys.add(calculateArchiveSize(CacheIndex.WORLD_MAP, "details"))
            }
        }
    
    
        private fun calculateIndexSize(index: CacheIndex): Int {
            var total = 0
            for (archiveId in store[index].referenceTable.archives.keys) {
                total += store[index].getArchive(archiveId).decompressedData.size
            }
            total += store.index255.getArchive(index.id)!!.decompressedData.size
            return total
        }
    
    
        private fun calculateNativeLibSize(name: String): Int {
            val archiveId = store[CacheIndex.NATIVE_LIBRARIES].getArchiveId("windows/x86/$name.dll")
            return if (archiveId >= 0) {
                store[CacheIndex.NATIVE_LIBRARIES].getArchive(archiveId).decompressedData.size - 2
            } else 0
        }
    
    
        private fun calculateArchiveSize(index: CacheIndex, archiveName: String): Int {
            val archiveId = store[index].getArchiveId(archiveName)
            return if (archiveId >= 0) {
                store[index].getArchive(archiveId).decompressedData.size - 2
            } else 0
        }
    }
    Project thread
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Jan 2017
    Posts
    24
    Thanks given
    8
    Thanks received
    1
    Rep Power
    24
    I really appreciate the tips! I looked at the article and your code as reference it worked out perfectly!
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 0
    Last Post: 06-19-2014, 06:03 AM
  2. Replies: 8
    Last Post: 03-02-2014, 03:56 PM
  3. Replies: 5
    Last Post: 12-13-2013, 10:17 PM
  4. Replies: 4
    Last Post: 12-25-2011, 10:36 AM
  5. paying $10 for getting my server running on vps
    By danster549 in forum Buying
    Replies: 5
    Last Post: 12-04-2011, 01:37 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •