Thread: Prefetch keys generation

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 Prefetch keys generation 
    I heal clients


    Join Date
    Apr 2013
    Posts
    680
    Thanks given
    65
    Thanks received
    239
    Rep Power
    108
    Hi everyone, so i have recently figured out how to generation whats known as "Grab Server Keys" or "Prefetch Keys", so i thought it might be worthy to share.

    R-S Admin Response  Q/A

    Q: What are these keys?
    A: These keys are the sizes of certain archives in the file store.

    Q: What are these keys used for?
    A: They are used to calculate the cache completion size, and necessary to start up the Js5 update process.

    Q: Whats the point?
    A: Having a perfect completion percentage.

    Q: How i know what each key is for what element?
    A: Simply you have to refactor the client a bit, You can check the enum reference at Js5 start up method in the client.

    Q: How i can generate these?
    A: Check the example below.



    R-S Admin Response  Generation

    In-order to generate these you need a direct access to the store load method, So you can grab the raw archive bytes.

    Each key could be for one specific case of these cases:


    • Archive or "Index": In this case the size is calculated by adding all the archive groups sizes together then add them to the meta file size for that archive.
    • Group or "Archive": In this case the size is calculated by the raw group file size in the file store minus two.
    • Native library group: Same as group but in this case the group id the group with the following name "windows/x86/" + libname + ".dll"
    • File entry: This can be two cases, either the file with id zero at the group with name of the file name, or the the file with the provided name at group with id zero.


    Example code to generate these:
    Spoiler for Example:

    Code:
    package com.rs2.server.utility.tools.prefetch;
    
    
    import com.wycody.cache.Cache;
    import com.wycody.cache.config.Js5Archive;
    
    
    /**
     * Created at: Jan 19, 2017 6:04:40 PM
     * 
     * @author Walied-Yassen A.k.A Cody
     */
    public enum Js5PrefetchType {
    	
    	/**
    	 * The defaults ARCHIVEe.
    	 */
    	DEFAULTS(new Js5PrefetchArchive(Js5Archive.JS5_DEFAULTS)),
    	
    	/**
    	 * The native JagexCoreLib library node.
    	 */
    	JACLIB(new Js5PrefetchNative("jaclib")),
    	
    	/**
    	 * The native JagexOpenGL library node.
    	 */
    	JAGGL(new Js5PrefetchNative("jaggl")),
    	
    	/**
    	 * The native JagexDirectX library node.
    	 */
    	JAGDX(new Js5PrefetchNative("jagdx")),
    	
    	/**
    	 * The native Software3D library node.
    	 */
    	SW3D(new Js5PrefetchNative("sw3d")),
    	
    	/**
    	 * The native Hardware3D library node.
    	 */
    	HW3D(new Js5PrefetchNative("hw3d")),
    	
    	/**
    	 * The native JagexTheora library node.
    	 */
    	JAGTHEORA(new Js5PrefetchNative("jagtheora")),
    	
    	/**
    	 * The shaders archive node.
    	 */
    	SHADERS(new Js5PrefetchArchive(Js5Archive.JS5_SHADERS)),
    	
    	/**
    	 * The materials archive node.
    	 */
    	MATERIALS(new Js5PrefetchArchive(Js5Archive.JS5_MATERIALS)),
    	
    	/**
    	 * The configurations archive node.
    	 */
    	CONFIG(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG)),
    	
    	/**
    	 * The locations type configurations archive node.
    	 */
    	CONFIG_LOC(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_LOC)),
    	
    	/**
    	 * the enum type configurations archive node.
    	 */
    	CONFIG_ENUM(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_ENUM)),
    	
    	/**
    	 * The NPC type configurations archive node.
    	 */
    	CONFIG_NPC(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_NPC)),
    	
    	/**
    	 * The object type configurations archive node.
    	 */
    	CONFIG_OBJ(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_OBJ)),
    	
    	/**
    	 * The animation sequence type configurations archive node.
    	 */
    	CONFIG_SEQ(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_SEQ)),
    	
    	/**
    	 * The spot animation type configurations archive node.
    	 */
    	CONFIG_SPOT(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_SPOT)),
    	
    	/**
    	 * The variable bit type configurations archive node.
    	 */
    	VAR_BIT(new Js5PrefetchArchive(Js5Archive.JS5_VAR_BIT)),
    	
    	/**
    	 * The common quick chat entries archive node.
    	 */
    	QUICKCHAT(new Js5PrefetchArchive(Js5Archive.JS5_QUICKCHAT)),
    	
    	/**
    	 * The global quick chat entries archive node.
    	 */
    	QUICKCHAT_GLOBAL(new Js5PrefetchArchive(Js5Archive.JS5_QUICKCHAT_GLOBAL)),
    	
    	/**
    	 * The particles archive node.
    	 */
    	PARTICLES(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_PARTICLE)),
    	
    	/**
    	 * The billboards archive node.
    	 */
    	BILLBOARDS(new Js5PrefetchArchive(Js5Archive.JS5_CONFIG_BILLBOARD)),
    	
    	/**
    	 * The huffman binary archive node.
    	 */
    	 HUFFMAN(new Js5PrefetchFile(Js5Archive.JS5_BINARY, "huffman")),
    	
    	/**
    	 * The interfaces archive node.
    	 */
    	INTERFACES(new Js5PrefetchArchive(Js5Archive.JS5_INTERFACES)),
    	
    	/**
    	 * The client scripts archive node.
    	 */
    	CLIENTSCRIPTS(new Js5PrefetchArchive(Js5Archive.JS5_CLIENTSCRIPTS)),
    	
    	/**
    	 * The font metrics archive node.
    	 */
    	FONTMETRICS(new Js5PrefetchArchive(Js5Archive.JS5_FONTMETRICS)),
    	
    	/**
    	 * The world map data file node.
    	 */
    	WORLDMAP_DATA(new Js5PrefetchGroup(Js5Archive.JS5_WORLDMAPDATA, "details")) ;
    	
    	/**
    	 * The prefetch type.
    	 */
    	private Js5Prefetch prefetch;
    	
    	/**
    	 * Construct a new {@link Js5PrefetchType} object instance.
    	 * 
    	 * @param prefetch
    	 *            the type prefetch.
    	 */
    	private Js5PrefetchType(Js5Prefetch prefetch) {
    		this.prefetch = prefetch;
    	}
    	
    	/**
    	 * Initializes all the prefetch types.
    	 * 
    	 * @param cache
    	 *            the cache to initialize for.
    	 */
    	public static void initialize(Cache cache) {
    		for (Js5PrefetchType type : values())
    			type.getPrefetch().initialize(cache);
    	}
    	
    	/**
    	 * Gets the prefetch type.
    	 * 
    	 * @return the prefetch type.
    	 */
    	public Js5Prefetch getPrefetch() {
    		return prefetch;
    	}
    	
    }
    Code:
    package com.rs2.server.utility.tools.prefetch;
    
    
    import com.wycody.cache.Cache;
    import com.wycody.cache.config.Js5Archive;
    
    
    /**
     * Created at: Jan 19, 2017 6:22:18 PM
     * 
     * @author Walied-Yassen A.k.A Cody
     */
    public class Js5PrefetchNative implements Js5Prefetch {
    	
    	/**
    	 * The library name.
    	 */
    	private String name;
    	
    	/**
    	 * The prefetch value.
    	 */
    	private int value;
    	
    	/**
    	 * Construct a new {@link Js5PrefetchNative} object instance.
    	 * 
    	 * @param name
    	 *            the library name.
    	 */
    	public Js5PrefetchNative(String name) {
    		this.name = name;
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see
    	 * com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#initialize(com.
    	 * wycody.cache.Cache)
    	 */
    	@Override
    	public void initialize(Cache cache) {
    		if (name != null) {
    			int groupId = cache.getArchive(Js5Archive.JS5_DLLS).getGroupId("windows/x86/" + name + ".dll");
    			value = groupId != -1 ? cache.getArchive(Js5Archive.JS5_DLLS).getIndexStore().load(groupId).length - 2 : 0;
    		}
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#getValue()
    	 */
    	@Override
    	public int getValue() {
    		return value;
    	}
    	
    }
    Code:
    package com.rs2.server.utility.tools.prefetch;
    
    
    import com.wycody.cache.Cache;
    import com.wycody.cache.archive.Archive;
    import com.wycody.cache.config.Js5Archive;
    
    
    /**
     * Created at: Jan 19, 2017 7:09:11 PM
     * 
     * @author Walied-Yassen A.k.A Cody
     */
    public class Js5PrefetchGroup implements Js5Prefetch {
    	
    	/**
    	 * The archive id.
    	 */
    	private Js5Archive type;
    	
    	/**
    	 * The group name.
    	 */
    	private String name;
    	
    	/**
    	 * The prefetch value.
    	 */
    	private int value;
    	
    	/**
    	 * Construct a new {@link Js5PrefetchGroup} object instance.
    	 * 
    	 * @param type
    	 *            the archive type.
    	 * @param name
    	 *            the group name.
    	 */
    	public Js5PrefetchGroup(Js5Archive type, String name) {
    		this.type = type;
    		this.name = name;
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see
    	 * com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#initialize(com.
    	 * wycody.cache.Cache)
    	 */
    	@Override
    	public void initialize(Cache cache) {
    		if (type != null) {
    			Archive archive = cache.getArchive(type);
    			value = archive.getIndexStore().load(archive.getGroupId(name)).length - 2;
    		}
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#getValue()
    	 */
    	@Override
    	public int getValue() {
    		return value;
    	}
    	
    }
    Code:
    package com.rs2.server.utility.tools.prefetch;
    
    
    import com.wycody.cache.Cache;
    import com.wycody.cache.archive.Archive;
    import com.wycody.cache.config.Js5Archive;
    
    
    /**
     * Created at: Jan 19, 2017 7:09:19 PM
     * 
     * @author Walied-Yassen A.k.A Cody
     */
    public class Js5PrefetchFile implements Js5Prefetch {
    	
    	/**
    	 * The group archive.
    	 */
    	private Js5Archive type;
    	
    	/**
    	 * The file name.
    	 */
    	private String name;
    	
    	/**
    	 * The prefetch value.
    	 */
    	private int value;
    	
    	/**
    	 * Construct a new {@link Js5PrefetchFile} object instance.
    	 * 
    	 * @param type
    	 *            the archive type.
    	 * @param name
    	 *            the file name.
    	 */
    	public Js5PrefetchFile(Js5Archive type, String name) {
    		this.type = type;
    		this.name = name;
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see
    	 * com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#initialize(com.
    	 * wycody.cache.Cache)
    	 */
    	@Override
    	public void initialize(Cache cache) {
    		if (type != null) {
    			Archive archive = cache.getArchive(type);
    			value = archive.getIndexStore().load(archive.getGroupId(name)).length - 2;
    		}
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#getValue()
    	 */
    	@Override
    	public int getValue() {
    		return value;
    	}
    	
    }
    Code:
    package com.rs2.server.utility.tools.prefetch;
    
    
    import com.wycody.cache.Cache;
    import com.wycody.cache.archive.Archive;
    import com.wycody.cache.config.Js5Archive;
    
    
    /**
     * Created at: Jan 19, 2017 6:47:08 PM
     * 
     * @author Walied-Yassen A.k.A Cody
     */
    public class Js5PrefetchArchive implements Js5Prefetch {
    	
    	/**
    	 * The archive id.
    	 */
    	private Js5Archive type;
    	
    	/**
    	 * The prefetch value.
    	 */
    	private int value;
    	
    	/**
    	 * Construct a new {@link Js5PrefetchArchive} object instance.
    	 * 
    	 * @param type
    	 *            the archive type.
    	 */
    	public Js5PrefetchArchive(Js5Archive type) {
    		this.type = type;
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see
    	 * com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#initialize(com.
    	 * wycody.cache.Cache)
    	 */
    	@Override
    	public void initialize(Cache cache) {
    		if (type != null) {
    			Archive archive = cache.getArchive(type);
    			int total = 0;
    			for (int groupId = 0; groupId < archive.getBiggestGroupId() + 1; groupId++) {
    				if (archive.groupExists(groupId)) {
    					total += archive.getIndexStore().load(groupId).length;
    				}
    			}
    			total += cache.getMetaStore().load(type.getId()).length;
    			value = total;
    		}
    	}
    	
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see com.rs2.server.utility.tools.prefetch.impl.Js5Prefetch#getValue()
    	 */
    	@Override
    	public int getValue() {
    		return value;
    	}
    	
    }
    Code:
    package com.rs2.server.utility.tools.prefetch;
    
    
    import com.wycody.cache.Cache;
    
    
    /**
     * Created at: Jan 19, 2017 6:22:53 PM
     * 
     * @author Walied-Yassen A.k.A Cody
     */
    public interface Js5Prefetch {
    	
    	/**
    	 * Initializes the prefetch type.
    	 * 
    	 * @param cache
    	 *            the cache to initialize for.
    	 */
    	public void initialize(Cache cache);
    	
    	/**
    	 * Gets the prefetch value.
    	 * 
    	 * @return the prefetch value.
    	 */
    	public int getValue();
    	
    }




    NO ONE IS PERFECT
    "No one in this world is pure and perfect, if you avoid people for their little mistakes you will be always alone in this world, so judge less and love more."
    "Ship in the harbor is safe, but that is not what ships are built for."
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Banned
    Join Date
    Dec 2012
    Posts
    245
    Thanks given
    60
    Thanks received
    68
    Rep Power
    0
    Thanks for the release
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Jan 2017
    Posts
    90
    Thanks given
    17
    Thanks received
    8
    Rep Power
    12
    Quote Originally Posted by Significance View Post
    Thanks for the release
    Is this what I think it is??
    Spoiler for Pax is shit:


    Reply With Quote  
     

  5. #4  
    Registered Member

    Join Date
    Sep 2009
    Posts
    1,919
    Thanks given
    479
    Thanks received
    1,687
    Rep Power
    1262
    I hope to god you don't generate these every time.
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Reverse Engineering

    freeezr's Avatar
    Join Date
    Dec 2011
    Posts
    1,067
    Thanks given
    288
    Thanks received
    444
    Rep Power
    401
    Nice find man. cool to see where these numbers come from.

    Attached image
    Reply With Quote  
     

  8. #6  
    WVWVWVWVWVWVWVW

    _jordan's Avatar
    Join Date
    Nov 2012
    Posts
    3,046
    Thanks given
    111
    Thanks received
    1,848
    Rep Power
    5000
    nice find
    Attached image
    Attached image
    Reply With Quote  
     

  9. #7  
    Registered Member

    Join Date
    Sep 2009
    Posts
    1,919
    Thanks given
    479
    Thanks received
    1,687
    Rep Power
    1262
    Code:
    private static int getIndexWeight(int index) {
    		int total = 0;
    		Index idx = STORE.getIndexes()[index];
    		for (int archive : idx.getTable().getValidArchiveIds()) {
    			Archive a = idx.getArchive(archive);
    			total += a != null ? a.getDecompressedLength() : 0;
    		}
    
    		return total;
    	}
    This is the code using alex's cache editor. Aka for matrix if anyone is interested. Highly recommend printing out the values and making an array or something.
    Reply With Quote  
     

  10. #8  
    I heal clients


    Join Date
    Apr 2013
    Posts
    680
    Thanks given
    65
    Thanks received
    239
    Rep Power
    108
    They are supposed to be generated upon the server start up
    NO ONE IS PERFECT
    "No one in this world is pure and perfect, if you avoid people for their little mistakes you will be always alone in this world, so judge less and love more."
    "Ship in the harbor is safe, but that is not what ships are built for."
    Reply With Quote  
     

  11. #9  
    WVWVWVWVWVWVWVW

    _jordan's Avatar
    Join Date
    Nov 2012
    Posts
    3,046
    Thanks given
    111
    Thanks received
    1,848
    Rep Power
    5000
    Quote Originally Posted by Walied View Post
    They are supposed to be generated upon the server start up
    hes saying that its unnecessary. make an array like everyone's been doing already
    Attached image
    Attached image
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,871
    Thanks given
    1,854
    Thanks received
    4,745
    Rep Power
    5000
    Quote Originally Posted by _jordan View Post
    hes saying that its unnecessary. make an array like everyone's been doing already
    And manually edit it every time you edit your cache? No, load it on startup

    Attached image

    Reply With Quote  
     

  14. Thankful user:


Page 1 of 2 12 LastLast

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. Insane Random Key Generator
    By Optimum in forum Application Development
    Replies: 11
    Last Post: 09-15-2014, 04:03 PM
  2. Update Key Generator
    By Mikee in forum Requests
    Replies: 22
    Last Post: 04-24-2014, 11:26 AM
  3. Simple Key Generation and Usage [Update 2]
    By Wiffles in forum Tools
    Replies: 14
    Last Post: 02-27-2012, 12:46 AM
  4. RSA Key Generation and Decryption for Private Servers
    By blakeman8192 in forum Snippets
    Replies: 16
    Last Post: 01-01-2010, 11:55 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
  •