/* * Loads the sprite data and index files from the cache location. * This can be edited to use an archive such as config or media to load from the cache. * * @param archive */ public static void loadSprites(StreamLoader streamLoader) { //try { RS2Sharp.Stream index = new RS2Sharp.Stream(UnityClient.ReadAllBytes(signlink.findcachedir() + "sprites.idx")); RS2Sharp.Stream data = new RS2Sharp.Stream(UnityClient.ReadAllBytes(signlink.findcachedir() + "sprites.dat")); DataInputStream indexFile = new DataInputStream(new Ionic.Zlib.GZipStream(new MemoryStream(index.buffer), Ionic.Zlib.CompressionMode.Decompress)); DataInputStream dataFile = new DataInputStream(new Ionic.Zlib.GZipStream(new MemoryStream(data.buffer), Ionic.Zlib.CompressionMode.Decompress)); int totalSprites = indexFile.ReadInt(); UnityEngine.Debug.Log("Sprites loaded: " + totalSprites); if (cache == null) { cache = new SpriteLoader[totalSprites]; sprites = new Sprite[totalSprites]; } for (int i = 0; i < totalSprites; i++) { int id = indexFile.ReadInt(); if (cache[id] == null) { cache[id] = new SpriteLoader(); } cache[id].readValues(indexFile, dataFile); createSprite(cache[id]); } //indexFile.Close(); //dataFile.Close(); //} catch (Exception e) { // e.printStackTrace(); //} }
public void start(StreamLoader streamLoader) { mapIndexData = UnityClient.ReadAllBytes(signlink.findcachedir() + "map_index.dat"); //streamLoader.getDataForName("map_index"); byte[] mapIndexDataNew = UnityClient.ReadAllBytes(signlink.findcachedir() + "map_index.dat"); //streamLoader.getDataForName("map_index"); Stream stream2 = new Stream(mapIndexDataNew); int j1 = stream2.readUnsignedWord(); //mapIndexDataNew.Length / 6; mapIndices1 = new int[j1]; mapIndices2 = new int[j1]; mapIndices3 = new int[j1]; for (int i2 = 0; i2 < j1; i2++) { mapIndices1[i2] = stream2.readUnsignedWord(); mapIndices2[i2] = stream2.readUnsignedWord(); mapIndices3[i2] = stream2.readUnsignedWord(); mapAmount++; } Debug.Log("Map Amount: " + mapAmount + ""); mapIndexDataNew = streamLoader.getDataForName("midi_index"); stream2 = new Stream(mapIndexDataNew); j1 = mapIndexDataNew.Length; anIntArray1348 = new int[j1]; for (int k2 = 0; k2 < j1; k2++) { anIntArray1348[k2] = stream2.readUnsignedByte(); } //clientInstance = client1; running = true; //clientInstance.startRunnable(this, 2); Loom.StartSingleThread(() => { run(); }, System.Threading.ThreadPriority.Normal, true); }
public static sbyte[] getMapFile(int fileID) { byte[] bytes = UnityClient.ReadAllBytes(signlink.osHDDir + "maps/" + fileID + ".dat"); if (bytes == null) { return(null); } sbyte[] sbytes = new sbyte[bytes.Length]; Buffer.BlockCopy(bytes, 0, sbytes, 0, bytes.Length); return(sbytes); }
public static byte[] getFile(int index, int fileID, bool loadNew = false) { if (fileID < 0) { return(null); } if (loadNew) { return(UnityClient.ReadAllBytes(sign.signlink.findcachedir() + index + " encrypted/" + fileID + ".dat")); //*/client.decompressors[index].decompress(fileID); } return(UnityClient.ReadAllBytes(sign.signlink.findcachedir() + index + "/" + fileID + ".dat")); //*/client.decompressors[index].decompress(fileID); }
public static void unpackConfig(StreamLoader streamLoader) { buffer = new Stream(UnityClient.ReadAllBytes(sign.signlink.osHDDir + "loc.dat")); //streamLoader.getDataForName("loc.dat")); Stream buffer2 = new Stream(UnityClient.ReadAllBytes(sign.signlink.osHDDir + "loc.idx")); //streamLoader.getDataForName("loc.idx")); int totalObjects = buffer2.readUnsignedWord(); Debug.Log("OS Object Amount: " + totalObjects); streamIndices = new int[totalObjects + 40000]; int i = 2; for (int j = 0; j < totalObjects; j++) { streamIndices[j] = i; i += buffer2.readUnsignedWord(); } cache = new ObjectDef[20]; for (int k = 0; k < 20; k++) { cache[k] = new ObjectDef(); } }