Thread: [Matrix592] How do I correctly pack xteas?

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 [Matrix592] How do I correctly pack xteas? 
    ;D
    biggyBeat's Avatar
    Join Date
    Jan 2018
    Posts
    113
    Thanks given
    205
    Thanks received
    15
    Rep Power
    30
    I downloaded this https://www.rune-server.ee/runescape...508-742-a.html, then I placed the 592 xteas (txt files) in .\data\map\archiveKeys\unpacked\. After that I deleted the existing "packed.mcx" file and restarted the server. But then this happened:

    Attached image

    Obviously I didn't do this in the correct way. How do I pack them?



    MapArchiveKeys:
    Code:
    package com.rs.utils;
    
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import java.nio.ByteBuffer;
    import java.nio.channels.FileChannel;
    import java.nio.channels.FileChannel.MapMode;
    import java.util.HashMap;
    
    public final class MapArchiveKeys {
    
    	private final static HashMap<Integer, int[]> keys = new HashMap<Integer, int[]>();
    	private final static String PACKED_PATH = "data/map/archiveKeys/packed.mcx";
    
    	public static final int[] getMapKeys(int regionId) {
    		return keys.get(regionId);
    	}
    
    	public static void init() {
    		if (new File(PACKED_PATH).exists())
    			loadPackedKeys();
    		else
    			loadUnpackedKeys();
    	}
    
    	private static final void loadPackedKeys() {
    		try {
    			RandomAccessFile in = new RandomAccessFile(PACKED_PATH, "r");
    			FileChannel channel = in.getChannel();
    			ByteBuffer buffer = channel.map(MapMode.READ_ONLY, 0, channel.size());
    			while (buffer.hasRemaining()) {
    				int regionId = buffer.getShort() & 0xffff;
    				int[] xteas = new int[4];
    				for (int index = 0; index < 4; index++)
    					xteas[index] = buffer.getInt();
    				keys.put(regionId, xteas);
    			}
    			channel.close();
    			in.close();
    		} catch (Throwable e) {
    			Logger.handle(e);
    		}
    	}
    
    	public static final void loadUnpackedKeys() {
    		Logger.log("MapArchiveKeys", "Packing map containers xteas...");
    		try {
    			DataOutputStream out = new DataOutputStream(new FileOutputStream(PACKED_PATH));
    			File unpacked = new File("data/map/archiveKeys/unpacked/");
    			File[] xteasFiles = unpacked.listFiles();
    			for (File region : xteasFiles) {
    				String name = region.getName();
    				if (!name.contains(".txt")) {
    					region.delete();
    					continue;
    				}
    				int regionId = Short.parseShort(name.replace(".txt", ""));
    				if (regionId <= 0) {
    					region.delete();
    					continue;
    				}
    				BufferedReader in = new BufferedReader(new FileReader(region));
    				out.writeShort(regionId);
    				final int[] xteas = new int[4];
    				for (int index = 0; index < 4; index++) {
    					xteas[index] = Integer.parseInt(in.readLine());
    					out.writeInt(xteas[index]);
    				}
    				keys.put(regionId, xteas);
    				in.close();
    			}
    			out.flush();
    			out.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	private MapArchiveKeys() {
    
    	}
    
    }

    Launcher:
    Code:
    package com.rs;
    
    import java.util.Calendar;
    import java.util.concurrent.TimeUnit;
    
    import com.alex.store.Index;
    import com.rs.cache.Cache;
    import com.rs.cache.loaders.AttackSpeed;
    import com.rs.cache.loaders.EquipData;
    import com.rs.cache.loaders.ItemDefinitions;
    import com.rs.cache.loaders.NPCDefinitions;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.cores.CoresManager;
    import com.rs.game.Region;
    import com.rs.game.World;
    import com.rs.game.map.MapBuilder;
    import com.rs.game.npc.combat.CombatScriptsHandler;
    import com.rs.game.player.Player;
    import com.rs.game.player.content.FishingSpotsHandler;
    import com.rs.game.player.content.FriendChatsManager;
    import com.rs.game.player.content.grandExchange.GrandExchange;
    import com.rs.game.player.controllers.ControllerHandler;
    import com.rs.game.player.cutscenes.CutscenesHandler;
    import com.rs.game.player.dialogues.DialogueHandler;
    import com.rs.network.Network;
    import com.rs.utils.Censor;
    import com.rs.utils.DisplayNames;
    import com.rs.utils.IPBanL;
    import com.rs.utils.IPMuteL;
    import com.rs.utils.ItemBonuses;
    import com.rs.utils.ItemDestroys;
    import com.rs.utils.ItemExamines;
    import com.rs.utils.ItemSpawns;
    import com.rs.utils.Logger;
    import com.rs.utils.MapArchiveKeys;
    import com.rs.utils.MapAreas;
    import com.rs.utils.MusicHints;
    import com.rs.utils.NPCBonuses;
    import com.rs.utils.NPCCombatDefinitionsL;
    import com.rs.utils.NPCDrops;
    import com.rs.utils.NPCExamines;
    import com.rs.utils.NPCSpawns;
    import com.rs.utils.ObjectSpawns;
    import com.rs.utils.PkRank;
    import com.rs.utils.SerializableFilesManager;
    import com.rs.utils.ShopsHandler;
    import com.rs.utils.Utils;
    import com.rs.utils.huffman.Huffman;
    import com.webrs.responder.Responder;
    
    public class Launcher {
    
    	public static void main(String[] args) throws Exception {
    		if (args.length < 3) {
    			System.out.println("USE: guimode(boolean) debug(boolean) hosted(boolean)");
    			return;
    		}
    		Settings.HOSTED = Boolean.parseBoolean(args[2]);
    		Settings.DEBUG = true;// Boolean.parseBoolean(args[1]);
    		long currentTime = Utils.currentTimeMillis();
    		Logger.log("Launcher", "Initing Cache...");
    		Cache.init();
    		Huffman.init();
    		Logger.log("Launcher", "Initing Data Files...");
    		EquipData.init();
    		AttackSpeed.init();
    		ItemBonuses.init();
    		Censor.init();
    		DisplayNames.init();
    		IPBanL.init();
    		IPMuteL.init();
    		PkRank.init();
    		MapAreas.init();
    		ObjectSpawns.init();
    		NPCSpawns.init();
    		NPCCombatDefinitionsL.init();
    		NPCBonuses.init();
    		NPCDrops.init();
    		NPCExamines.init();
    		ItemExamines.init();
    		ItemDestroys.init();
    		ItemSpawns.init();
    		MusicHints.init();
    		ShopsHandler.init();
    		GrandExchange.init();
    		Logger.log("Launcher", "Initing Controlers...");
    		ControllerHandler.init();
    		Logger.log("Launcher", "Initing Fishing Spots...");
    		FishingSpotsHandler.init();
    		Logger.log("Launcher", "Initing NPC Combat Scripts...");
    		CombatScriptsHandler.init();
    		Logger.log("Launcher", "Initing Dialogues...");
    		DialogueHandler.init();
    		Logger.log("Launcher", "Initing Cutscenes...");
    		CutscenesHandler.init();
    		Logger.log("Launcher", "Initing Friend Chats Manager...");
    		FriendChatsManager.init();
    		Logger.log("Launcher", "Initing Cores Manager...");
    		CoresManager.init();
    		MapArchiveKeys.init();
    		Logger.log("Launcher", "Initing World...");
    		World.init();
    		Logger.log("Launcher", "Initing Region Builder...");
    		MapBuilder.init();
    		Logger.log("Launcher", "Starting Network...");
    		Network.load();
    		// Logger.log("Launcher", "Initing Server Channel Handler...");
    		// try {
    		// ServerChannelHandler.init();
    		// } catch (Throwable e) {
    		// Logger.handle(e);
    		// Logger.log("Launcher", "Failed initing Server Channel Handler. Shutting down...");
    		// System.exit(1);
    		// return;
    		// }
    		// Logger.log("Launcher", "Initing Web responder...");
    		// try {
    		// if (!Settings.HOSTED)
    		// Responder.init();
    		// } catch (Throwable e) {
    		// Logger.handle(e);
    		// Logger.log("Launcher", "Failed initing web responder... Shutting down...");
    		// System.exit(1);
    		// return;
    		// }
    		Logger.log("Launcher", "Server took " + (Utils.currentTimeMillis() - currentTime) + " milli seconds to launch.");
    		addFilesSavingTask();
    		addCleanMemoryTask();
    		addrecalcPricesTask();
    	}
    
    	private static void addCleanMemoryTask() {
    		CoresManager.slowExecutor.scheduleWithFixedDelay(new Runnable() {
    			@Override
    			public void run() {
    				try {
    					cleanMemory(Runtime.getRuntime().freeMemory() < Settings.MIN_FREE_MEM_ALLOWED);
    				} catch (Throwable e) {
    					Logger.handle(e);
    				}
    			}
    		}, 0, 10, TimeUnit.MINUTES);
    	}
    
    	private static void addFilesSavingTask() {
    		CoresManager.slowExecutor.scheduleWithFixedDelay(new Runnable() {
    			@Override
    			public void run() {
    				try {
    					saveFiles();
    				} catch (Throwable e) {
    					Logger.handle(e);
    				}
    
    			}
    		}, 15, 15, TimeUnit.MINUTES);
    	}
    
    	private static void addrecalcPricesTask() {
    		Calendar c = Calendar.getInstance();
    		c.add(Calendar.DAY_OF_MONTH, 1);
    		c.set(Calendar.HOUR, 0);
    		c.set(Calendar.MINUTE, 0);
    		c.set(Calendar.SECOND, 0);
    		int minutes = (int) ((c.getTimeInMillis() - Utils.currentTimeMillis()) / 1000 / 60);
    		int halfDay = 12 * 60;
    		if (minutes > halfDay)
    			minutes -= halfDay;
    		CoresManager.slowExecutor.scheduleWithFixedDelay(new Runnable() {
    			@Override
    			public void run() {
    				try {
    					GrandExchange.recalcPrices();
    				} catch (Throwable e) {
    					Logger.handle(e);
    				}
    
    			}
    		}, minutes, halfDay, TimeUnit.MINUTES);
    	}
    
    	public static void saveFiles() {
    		for (Player player : World.getPlayers()) {
    			if (player == null || !player.hasStarted() || player.hasFinished())
    				continue;
    			SerializableFilesManager.savePlayer(player);
    		}
    		saveOtherFiles();
    	}
    
    	public static void saveOtherFiles() {
    		DisplayNames.save();
    		IPBanL.save();
    		IPMuteL.save();
    		PkRank.save();
    		GrandExchange.save();
    	}
    
    	public static void cleanMemory(boolean force) {
    		if (force) {
    			ItemDefinitions.clearItemsDefinitions();
    			NPCDefinitions.clearNPCDefinitions();
    			ObjectDefinitions.clearObjectDefinitions();
    			skip: for (Region region : World.getRegions().values()) {
    				for (int regionId : MapBuilder.FORCE_LOAD_REGIONS)
    					if (regionId == region.getRegionId())
    						continue skip;
    				region.unloadMap();
    			}
    		}
    		for (Index index : Cache.STORE.getIndexes())
    			index.resetCachedFiles();
    		CoresManager.fastExecutor.purge();
    		System.gc();
    	}
    
    	public static void shutdown() {
    		try {
    			closeServices();
    		} finally {
    			System.exit(0);
    		}
    	}
    
    	public static void closeServices() {
    		if (!Settings.HOSTED)
    			Responder.shutdown();
    		// ServerChannelHandler.shutdown();
    		Network.shutdown();
    		CoresManager.shutdown();
    	}
    
    	public static void restart() {
    		closeServices();
    		System.gc();
    		try {
    			Runtime.getRuntime().exec("java -server -Xms2048m -Xmx20000m -cp bin;/data/libs/netty-3.2.7.Final.jar;/data/libs/FileStore.jar Launcher false false true false");
    			System.exit(0);
    		} catch (Throwable e) {
    			Logger.handle(e);
    		}
    
    	}
    
    	private Launcher() {
    
    	}
    
    }
    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
    Did it recreate a packet.mcx after you restarted the server? If so, it repacked the keys correctly. That would mean your XTEAs are wrong, not the XTEAs packer.
    Project thread
    Reply With Quote  
     

  3. #3  
    ;D
    biggyBeat's Avatar
    Join Date
    Jan 2018
    Posts
    113
    Thanks given
    205
    Thanks received
    15
    Rep Power
    30
    Quote Originally Posted by clem585 View Post
    Did it recreate a packet.mcx after you restarted the server? If so, it repacked the keys correctly. That would mean your XTEAs are wrong, not the XTEAs packer.
    Yeah it did recreate the packed.mcx file (45kb), but didn't work. I'm using the xteas by Admiral Slee (OP link), from the 592 folder. Thank you for the help.

    Attached image
    Reply With Quote  
     

  4. #4  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by biggyBeat View Post
    Yeah it did recreate the packed.mcx file (45kb), but didn't work. I'm using the xteas by Admiral Slee (OP link), from the 592 folder. Thank you for the help.

    Attached image
    Well it's either the wrong cache or the wrong XTEAs then. Have you tried different areas to see if they were all missing XTEAs?
    Project thread
    Reply With Quote  
     

  5. #5  
    ;D
    biggyBeat's Avatar
    Join Date
    Jan 2018
    Posts
    113
    Thanks given
    205
    Thanks received
    15
    Rep Power
    30
    Quote Originally Posted by clem585 View Post
    Well it's either the wrong cache or the wrong XTEAs then. Have you tried different areas to see if they were all missing XTEAs?
    I downloaded the cache given from the Matrix592 release (https://www.rune-server.ee/runescape...-features.html), so I think they are correct. And the xteas was downloaded from Admiral Slee's thread (https://www.rune-server.ee/runescape...508-742-a.html), the .txt files that I placed was brought from the 592 folder. I just want to fix this:

    Attached image

    Also, the client crashes when entering Karamja. :/
    Reply With Quote  
     

  6. #6  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by biggyBeat View Post
    I downloaded the cache given from the Matrix592 release (https://www.rune-server.ee/runescape...-features.html), so I think they are correct. And the xteas was downloaded from Admiral Slee's thread (https://www.rune-server.ee/runescape...508-742-a.html), the .txt files that I placed was brought from the 592 folder. I just want to fix this:

    Attached image

    Also, the client crashes when entering Karamja. :/
    The fact that you still have some maps loading means that you're missing xteas for some regions, but that some of the ones you have are valid. You could try mixing some slightly different xteas like the 597/569 ones to see if you get any better results.

    If that doesn't work, only way to fix this would be to repack the maps from another cache.
    Project thread
    Reply With Quote  
     

  7. #7  
    Registered Member
    Lantern Web's Avatar
    Join Date
    Apr 2018
    Posts
    187
    Thanks given
    73
    Thanks received
    101
    Rep Power
    257
    Find the region id's and as said above look at the xteas from a different revision they will be near-to the same
    Reply With Quote  
     

  8. #8  
    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 biggyBeat View Post
    I downloaded the cache given from the Matrix592 release (https://www.rune-server.ee/runescape...-features.html), so I think they are correct. And the xteas was downloaded from Admiral Slee's thread (https://www.rune-server.ee/runescape...508-742-a.html), the .txt files that I placed was brought from the 592 folder. I just want to fix this:

    Attached image

    Also, the client crashes when entering Karamja. :/
    the 592 xteas from that thread actually doesn't have those regions. use the 614 xteas for those regions and it'll work just fine
    Attached image
    Attached image
    Reply With Quote  
     

  9. #9  
    ;D
    biggyBeat's Avatar
    Join Date
    Jan 2018
    Posts
    113
    Thanks given
    205
    Thanks received
    15
    Rep Power
    30
    Thank you all for the help!

    Quote Originally Posted by _jordan View Post
    the 592 xteas from that thread actually doesn't have those regions. use the 614 xteas for those regions and it'll work just fine
    I tried the 614 xteas for the regions i want to fix (10292, 10548), but it didn't work and I get this:

    Attached image



    Quote Originally Posted by clem585 View Post
    The fact that you still have some maps loading means that you're missing xteas for some regions, but that some of the ones you have are valid. You could try mixing some slightly different xteas like the 597/569 ones to see if you get any better results.

    If that doesn't work, only way to fix this would be to repack the maps from another cache.
    Quote Originally Posted by Lantern Web View Post
    Find the region id's and as said above look at the xteas from a different revision they will be near-to the same
    I will try different xteas, I will update if I have found the working ones!
    Reply With Quote  
     

  10. #10  
    Registered Member

    Join Date
    Dec 2009
    Posts
    774
    Thanks given
    367
    Thanks received
    455
    Rep Power
    927
    There are no working xteas for region 10292 and 10548 in 592. At least, I don't have them. Maybe some one else does.
    link removed
    Reply With Quote  
     

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. [PI]How do i Cache Pack models/sprites?
    By remcowp in forum Help
    Replies: 1
    Last Post: 08-29-2013, 01:17 AM
  2. Replies: 2
    Last Post: 01-31-2013, 08:40 AM
  3. how do i cache pack
    By killag123 in forum Help
    Replies: 0
    Last Post: 08-13-2012, 09:34 PM
  4. Invisible Nex - How do i cache pack?
    By Skiila pk in forum Help
    Replies: 0
    Last Post: 01-08-2012, 08:31 PM
  5. how do i cache pack?
    By gligli in forum Help
    Replies: 1
    Last Post: 12-20-2011, 08:52 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
  •