public AnimationBundleWrapper(DATA_Parser.FileEntry file, DATA_Parser dataParser, Dictionary <uint, DATA_Parser.FileEntry> animationFiles) { Label = file.Hash.ToString(); Tag = file.ChunkEntry.Data; File = file; Version = dataParser.Version; using (var reader = new FileReader(file.ChunkEntry.Data, true)) { uint numAnimations = reader.ReadUInt32(); reader.ReadUInt32(); for (int i = 0; i < numAnimations; i++) { reader.ReadUInt32(); uint hash = reader.ReadUInt32(); if (animationFiles.ContainsKey(hash)) { var fileNode = new AnimationWrapper(animationFiles[hash], dataParser); AddChild(fileNode); } } } }
public ScriptWrapper(DATA_Parser.FileEntry file, DATA_Parser dataParser) { Label = Hashing.CreateHashString(file.Hash); File = file; Version = dataParser.Version; OnClick(); }
public AnimationWrapper(DATA_Parser.FileEntry file, DATA_Parser dataParser) { Label = file.Hash.ToString(); File = file; Version = dataParser.Version; AddChild(new ObjectTreeNode("RAW DATA") { Tag = file.ChunkEntry.Data }); }
public TextureWrapper(DATA_Parser.FileEntry file, DATA_Parser dataParser) { Label = Hashing.CreateHashString(file.Hash); ImageKey = "Texture"; File = file; Version = dataParser.Version; try { OnClick(); } catch { } }
public DATA_Parser(Stream stream, DICT.GameVersion version, IDictionaryData dict) { Version = version; Dictionary = dict; foreach (var block in dict.BlockList) { block.DataParser = this; uint size = dict.BlocksCompressed ? block.CompressedSize : block.DecompressedSize; //Some cases the block sizes are too big? if (block.Offset + size > stream.Length) { continue; } block.Dictionary = dict; block.CompressedData = new SubStream(stream, block.Offset, size); } var blocks = dict.BlockList.ToList(); Stream[] blockList = new Stream[100]; if (version == DICT.GameVersion.LM3) { blockList[0] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 0); blockList[52] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 52); blockList[53] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 53); blockList[54] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 54); blockList[55] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 55); blockList[58] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 58); blockList[63] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 63); blockList[64] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 64); blockList[65] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 65); blockList[68] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 68); blockList[69] = DataCompressionCache.LoadDumpedBlocks(dict, blocks, stream, 69); } else { blockList[0] = GetDecompressedDataBlock(dict, blocks[0], stream); blockList[2] = GetDecompressedDataBlock(dict, blocks[2], stream); blockList[3] = GetDecompressedDataBlock(dict, blocks[3], stream); } var table = new ChunkTable(blockList[0]); Table = table; for (int i = 0; i < table.Files.Count; i++) { var file = table.Files[i]; Stream fileTableBlock = null; Stream fileTableBlock2 = null; if (version == DICT.GameVersion.LM3) { fileTableBlock = blockList[52]; fileTableBlock2 = blockList[63]; } else { fileTableBlock = blockList[2]; fileTableBlock2 = blockList[2]; } if (file.ChunkType == ChunkFileType.Texture) { Files.Add(ParseFileHeaders(fileTableBlock2, file)); } else if (file.ChunkType == ChunkFileType.FileTable) { Files.Add(ParseFileHeaders(fileTableBlock, file)); } else if (file.ChunkType == ChunkFileType.Script) { Files.Add(ParseFileHeaders(fileTableBlock2, file)); } else if (file.ChunkType == ChunkFileType.ClothPhysics) { Files.Add(ParseFileHeaders(fileTableBlock2, file)); } else if (file.ChunkType == (ChunkFileType)0x6510) { Files.Add(ParseFileHeaders(fileTableBlock2, file)); } else { Files.Add(ParseFileHeaders(fileTableBlock, file)); } if (file.SubData.Count == 0) { if (version == DICT.GameVersion.LM3) { file.Data = blockList[53]; if (file.ChunkType == ChunkFileType.FileTable) { file.Data = blockList[58]; } if (file.ChunkType == (ChunkFileType)0x7200) { file.Data = blockList[54]; } if (file.ChunkType == (ChunkFileType)0xF000) { file.Data = blockList[69]; } if (file.ChunkType == (ChunkFileType)0x4300) { file.Data = blockList[53]; } if (file.ChunkType == ChunkFileType.MessageData) { file.Data = blockList[69]; } } else { file.Data = blockList[3]; } if (file.Data != null && file.Flags3 + file.Flags2 <= file.Data.Length) { file.Data = new SubStream(file.Data, file.Flags3, file.Flags2); } } } foreach (var entry in table.DataEntries) { if (version == DICT.GameVersion.LM3) { if (entry.ChunkType == ChunkDataType.TextureData) { entry.Data = blockList[65]; } if (ChunkBlockFlags.ContainsKey(entry.Flags)) { var blockType = ChunkBlockFlags[entry.Flags]; entry.Data = blockList[blockType]; entry.BlockIndex = blockType; } else { continue; } switch (entry.ChunkType) { case (ChunkDataType)0xA201: case (ChunkDataType)0xA202: case (ChunkDataType)0xA203: case (ChunkDataType)0xA204: case (ChunkDataType)0xA205: case (ChunkDataType)0xA206: case (ChunkDataType)0xA207: entry.Data = blockList[64]; break; } } else { if (entry.BlockIndex == 0) { entry.Data = blockList[2]; } if (entry.BlockIndex == 1) { entry.Data = blockList[3]; } } if (entry.ChunkOffset + entry.ChunkSize <= entry.Data.Length) { entry.Data = new SubStream(entry.Data, entry.ChunkOffset, entry.ChunkSize); } } }