Thread: [Elvarg] Packing

Results 1 to 6 of 6
  1. #1 [Elvarg] Packing 
    Registered Member
    Join Date
    Feb 2017
    Posts
    55
    Thanks given
    6
    Thanks received
    0
    Rep Power
    11
    How do I pack new models into the cache?
    Reply With Quote  
     

  2. #2  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    1. Make a folder called index1 in the cache root dir, put all your models in that folder and make sure they're all .gz.
    2. Find //repackCacheIndex(1); and remove the //
    3. Start client
    4. After it's all been packed, go back and add the // to repackCacheIndex(1); again to make sure it doesn't repack again the next time you start client
    5. Should be done
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2017
    Posts
    55
    Thanks given
    6
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Professor Oak View Post
    1. Make a folder called index1 in the cache root dir, put all your models in that folder and make sure they're all .gz.
    2. Find //repackCacheIndex(1); and remove the //
    3. Start client
    4. After it's all been packed, go back and add the // to repackCacheIndex(1); again to make sure it doesn't repack again the next time you start client
    5. Should be done
    There's no method called repackCacheIndex in client. The class CacheUtils is where the repacking method is declared.

    Code:
    package org.seven.util;
    
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.zip.GZIPOutputStream;
    
    import com.runescape.Client;
    import com.runescape.cache.FileStore.Store;
    import com.runescape.sign.SignLink;
    
    public final class CacheUtils {
    
          public static void repackCacheIndex(Client client, Store cacheIndex) {
                System.out.println("Started repacking index " + cacheIndex.getIndex() + ".");
                int indexLength = new File(SignLink.indexLocation(cacheIndex.getIndex(), -1)).listFiles().length;
                File[] file = new File(SignLink.indexLocation(cacheIndex.getIndex(), -1)).listFiles();
                try {
                      for (int index = 0; index < indexLength; index++) {
                            int fileIndex = Integer.parseInt(
                                        getFileNameWithoutExtension(file[index].toString()));
                            byte[] data = FileUtils.fileToByteArray(cacheIndex.getIndex(), fileIndex);
                            if (data != null && data.length > 0) {
                                  client.indices[cacheIndex.getIndex()].writeFile(data.length, data, fileIndex);
                                  System.out.println("Repacked " + fileIndex + ".");
                            } else {
                                  System.out.println("Unable to locate index " + fileIndex + ".");
                            }
                      }
                } catch (Exception ex) {                  
                      System.out.println("Error packing cache index " + cacheIndex.getIndex() + ".");
                }
                System.out.println("Finished repacking " + cacheIndex.getIndex() + ".");
          }
          
    	public static String getFileNameWithoutExtension(String fileName) {
              File tmpFile = new File(fileName);
              tmpFile.getName();
              int whereDot = tmpFile.getName().lastIndexOf('.');
              if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
                    return tmpFile.getName().substring(0, whereDot);
              }
              return "";
        }
    
          public static void dumpCacheIndex(Client client, Store cacheIndex) { 
                try {
                      for (int i = 0;; i++) {
                            try {
                                  byte[] indexByteArray = client.indices[cacheIndex.getIndex()].decompress(i);
                                  if (indexByteArray == null) {
                                        System.out.println("Finished dumping index " + cacheIndex.getIndex()
                                                    + ", exiting dump operation.");
                                        break;
                                  }
                                  
                                  final File dir = new File("./dump" + cacheIndex.getIndex() + "/");
                                  
                                  if (!dir.exists()) {
                                	  dir.mkdirs();
                                  }
                                  
                                  BufferedOutputStream gzip = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream("./dump" + cacheIndex.getIndex() + "/" + i + ".gz")));
                                  
                                  if (indexByteArray.length == 0) {
                                        continue;
                                  } else {
                                        gzip.write(indexByteArray);
                                        System.out.println("Unpacked " + i + ".");
                                        gzip.close();
    
                                  }
                            } catch (IOException ex) {                              
                                  throw new IOException(
                                              "Error writing to folder. Ensure you have this directory created: '"
                                                          + "./dump"
                                                          + cacheIndex.getIndex() + "'");
                            }
                      }
                } catch (Exception e) {
                      e.printStackTrace();
                }
          }
    
    }
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    There should be.... Otherwise just do:

    Code:
    CacheUtils.repackCacheIndex(this, FileStore.Store.MODEL);
    in the startup method instead
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Feb 2017
    Posts
    55
    Thanks given
    6
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Professor Oak View Post
    There should be.... Otherwise just do:

    Code:
    CacheUtils.repackCacheIndex(this, FileStore.Store.MODEL);
    in the startup method instead
    Yeah I already tried that and it didn't work for some reason
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jul 2008
    Posts
    69
    Thanks given
    32
    Thanks received
    10
    Rep Power
    6
    A common method I use to find the exact location of the problem is Ctrl+F and search for "repackCacheIndex"

    Find that in Client.java and you should be able to work out the rest.
    Message me for novice help. Will give a hand to all newbies who want to learn the basic ropes.
    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. ==== Sever Starter Pack V2 ====
    By Icepkz in forum Tools
    Replies: 90
    Last Post: 10-19-2013, 10:45 PM
  2. === Awesome Starter Pack ===
    By Icepkz in forum Tools
    Replies: 24
    Last Post: 01-26-2008, 03:38 AM
  3. "Fixing" Lord Gliomaru's sinful prayer pack
    By jonyo in forum Tutorials
    Replies: 29
    Last Post: 01-03-2008, 04:14 AM
  4. Render Packs
    By Jv in forum Resources
    Replies: 23
    Last Post: 10-24-2007, 06:57 PM
  5. Replies: 6
    Last Post: 04-19-2007, 12:09 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •