예제 #1
0
        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);
        }
예제 #2
0
        public void Add3FIB(string name)
        {
            //set name and header initial data
            byte[] byteName = CGeneric.ConvertStringToByteArray(name);
            byte[] rawData  = new byte[] { 0x33, 0x46, 0x49, 0x42, 8, 1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, (byte)byteName.Length, 0, 0, 0 };
            rawData = rawData.Concat(byteName).ToArray();

            //add .fib to the end, and init the 3fib.
            C3FIB new3Fib = new C3FIB(rawData, byteName.Concat(new Byte[] { 0x2E, 0x42, 0x49, 0x46 }).ToArray());

            new3Fib.Init();
            fibList.Add(new3Fib);
        }
예제 #3
0
        public void SetSBF1(byte[] scene, int index)
        {
            var name = CGeneric.ConvertStringToByteArray(sbfList[index].GetRessourceName());

            sbfList[index] = new CSBF1(scene, name);
        }
예제 #4
0
 public void ReplaceTexture(int indexBif, string bifName)
 {
     bifList[indexBif] = CGeneric.ConvertStringToByteArray(bifName.ToLower());
 }
예제 #5
0
 public void AddBifToSbf(string bifName)
 {
     byte[] newBif = new byte[16];
     Array.Copy(CGeneric.ConvertStringToByteArray(bifName), 0, newBif, 0, bifName.Length);
     bifList.Add(newBif);
 }