/// <summary>
        /// Gets list of compressions of the textures in the tpk block array.
        /// </summary>
        /// <param name="byteptr_t">Pointer to the tpk block array.</param>
        /// <param name="offset">Partial 1 part5 offset in the tpk block array.</param>
        protected override unsafe void GetCompressionList(byte *byteptr_t, int offset)
        {
            if (offset == -1)
            {
                return;                // if Part5 does not exist
            }
            if (*(uint *)(byteptr_t + offset) != TPK.INFO_PART5_BLOCKID)
            {
                return; // check Part5 ID
            }
            int ReaderSize = 8 + *(int *)(byteptr_t + offset + 4);
            int current    = 0x10;

            while (current < ReaderSize)
            {
                uint comp = *(uint *)(byteptr_t + offset + current + 12);
                if (Comp.IsComp(comp))
                {
                    var Slot = new CompSlot();
                    Slot.var1 = *(int *)(byteptr_t + offset + current);
                    Slot.var2 = *(int *)(byteptr_t + offset + current + 4);
                    Slot.var3 = *(int *)(byteptr_t + offset + current + 8);
                    Slot.comp = comp;
                    this.compressions.Add(Slot);
                }
                current += 0x20;
            }
        }
Beispiel #2
0
 /// <summary>
 /// Checks texture compressions and tpk compressions for matching.
 /// </summary>
 protected override void CheckComps()
 {
     this.compressions.Clear();
     for (int a1 = 0; a1 < this.Textures.Count; ++a1)
     {
         var Slot = new CompSlot();
         Slot.var1 = this.Textures[a1].CompVal1;
         Slot.var2 = this.Textures[a1].CompVal2;
         Slot.var3 = this.Textures[a1].CompVal3;
         Slot.comp = Comp.GetInt(this.Textures[a1].Compression);
         this.compressions.Add(Slot);
     }
 }