public DdsFile ToDds() { DdsFile dds = new DdsFile(); dds.width = mipMaps[0].width; dds.height = mipMaps[0].height; dds.pitchOrLinearSize = mipMaps[0].byteSize; dds.flag = 0xA1007; dds.mipMapCount = mipCount; dds.pixelFormat = new DdsPixelFormat(); switch (mipMaps[0].type) { case TxpMipMap.TexType.RGB: dds.pixelFormat = new DdsPixelFormat(DdsPFType.RGB); break; case TxpMipMap.TexType.RGBA: dds.pixelFormat = new DdsPixelFormat(DdsPFType.RGBA); break; case TxpMipMap.TexType.DXT1: dds.pixelFormat = new DdsPixelFormat(DdsPFType.DXT1); break; case TxpMipMap.TexType.DXT3: dds.pixelFormat = new DdsPixelFormat(DdsPFType.DXT3); break; case TxpMipMap.TexType.DXT5: dds.pixelFormat = new DdsPixelFormat(DdsPFType.DXT5); break; case TxpMipMap.TexType.ATI2n: dds.pixelFormat = new DdsPixelFormat(DdsPFType.ATI2n); break; default: Console.Write("WTF, Unknown TXP type " + mipMaps[0].type + "\n"); break; } dds.caps = 0x401008; List <byte> bytes = new List <byte>(); foreach (TxpMipMap mip in mipMaps) { foreach (byte bitdata in mip.data) { bytes.Add(bitdata); } } dds.data = bytes.ToArray(); dds.SetMipMaps(); return(dds); }