private void CreateMDXChunks() { var calculatedSize = CalculateChunkSize(MDXFilenames); adt.AddEmptyBytes(adtPos, (int)calculatedSize + 8); adt.WriteHeaderMagic("MMDX", ref adtPos); adt.WriteUInt(calculatedSize, ref adtPos); foreach (var filename in MDXFilenames.Values) { adt.WriteString(filename, ref adtPos); } adt.AddEmptyBytes(adtPos, (MDXFilenames.Count * 4) + 8); adt.WriteHeaderMagic("MMID", ref adtPos); adt.WriteInt(MDXFilenames.Count * 4, ref adtPos); var mdxFilenames = MDXFilenames.Values.ToList(); var lastMDX = string.Empty; foreach (var filename in mdxFilenames) { if (lastMDX == string.Empty) { adt.WriteInt(0, ref adtPos); } else { adt.WriteInt(lastMDX.Length, ref adtPos); } lastMDX = filename; } }
private void RetrieveMMDX() { int size = 0x8; if (models) { size += obj.ReadInt(0x10); adt.AddEmptyBytes(currentPos, size); obj.BlockCopy(0xC, adt, currentPos, size); obj.RemoveBytes(0, size + 0xC); } else { adt.AddEmptyBytes(currentPos, size); adt.WriteHeaderMagic(currentPos, "MMDX"); obj.RemoveBytes(0, obj.ReadInt(0x10) + 0xC + 0x8); } adt.WriteInt(0x20, currentPos - 0x14); currentPos += size; }