public static byte[] GenerateBFF2(byte[] palette, byte[] data, CGeneric.Compression compressionMethod, int sizeX, int sizeY, string bffName) { //generate header //--> determine GreenAlpha and palette size byte greenAlphaIndex = 0; if (palette.Length > 0) { greenAlphaIndex = CTextureManager.GetGreenAlphaValueIndex(palette, compressionMethod); } //make almost random compressed value.. (10)(because not enought information about it) //set displayedWidth equal pixel width (because not enought information about it) byte[] sizeXB = CGeneric.ConvertIntToByteArray16bits(sizeX); byte[] sizeYB = CGeneric.ConvertIntToByteArray16bits(sizeY); byte[] name = CGeneric.ConvertStringToByteArray(bffName); byte[] nbColors = new byte[0]; if (palette.Length > 0) { nbColors = CGeneric.ConvertIntToByteArray(palette.Length / CTextureManager.GetBytePerPixel(compressionMethod)); } byte[] bff2header = SetHeader(compressionMethod, greenAlphaIndex, 0xE, sizeXB, sizeXB, sizeYB, name, nbColors); //concatenate header, palette and compressed data byte[] finalData = new byte[bff2header.Length + palette.Length + data.Length]; Array.Copy(bff2header, 0, finalData, 0, bff2header.Length); if (palette.Length > 0) { Array.Copy(palette, 0, finalData, bff2header.Length, palette.Length); } Array.Copy(data, 0, finalData, bff2header.Length + palette.Length, data.Length); return(finalData); }