WTD — различия между версиями

Материал из GTAModding.ru
Перейти к: навигация, поиск
Строка 10: Строка 10:
 
//--- 010 Editor v3.0.5 Binary Template
 
//--- 010 Editor v3.0.5 Binary Template
 
// File: wtd.bt
 
// File: wtd.bt
// Version: 0.1 beta
+
// Version: 0.1
 
// Author: Dageron  
 
// Author: Dageron  
 
// Site: www.GTAModding.ru
 
// Site: www.GTAModding.ru
Строка 23: Строка 23:
 
     {
 
     {
 
         string s;   
 
         string s;   
 +
        if (f == 0) s="0";
 +
        else     
 +
        if (f >> 28 != 5) s="0"; //wrong offset
 +
        else 
 
         SPrintf( s, "%i", f & 0x0fffffff);
 
         SPrintf( s, "%i", f & 0x0fffffff);
 
         return s;
 
         return s;
    }
+
    }
 
//--------------------------------------
 
//--------------------------------------
 
struct GTA_Windows_Texture {
 
struct GTA_Windows_Texture {
Строка 34: Строка 38:
 
             int VTable;       
 
             int VTable;       
 
             GetOffset BlockMapOffset;
 
             GetOffset BlockMapOffset;
             int ParentDictionary;
+
             int ParentDictionary; // always 0 in file
             int UsageCount;
+
             int UsageCount; // always 1 in file
             GetOffset HashTableOffset;
+
             GetOffset HashTableOffset;        
 
             short TextureCount;
 
             short TextureCount;
 
             short TextureCount2;
 
             short TextureCount2;
Строка 42: Строка 46:
 
             short TextureCount3;  
 
             short TextureCount3;  
 
             short TextureCount4;
 
             short TextureCount4;
 +
                FSeek(BlockMapOffset & 0x0fffffff);
 
                 SetBackColor( cLtGray );
 
                 SetBackColor( cLtGray );
                 struct {                 
+
                 struct  
                 int     zero;
+
                {                 
                local int zero1 = 1;               
+
                 int zero;                            
                while (zero1=1)  //Getting info to grcTexturePC offset
+
     `           byte padding[524];
                  {
+
                  int zero2;      
+
                  if (zero2==0) break;            
+
                  zero1 = zero2;
+
                  }
+
 
                 } BlockMap;     
 
                 } BlockMap;     
        } header;
+
      }Header;      
       FSeek(FTell()-8);
+
       struct
      SetBackColor(cLtYellow);
+
      {
        struct
+
          FSeek(Header.HashTableOffset & 0x0fffffff);  
        {
+
          SetBackColor( cLtGreen );  
        struct
+
          local int i;
        {
+
          local int total = 16-(Header.TextureCount*4%16);
            uint VTable;
+
          for(i = 0; i < Header.TextureCount; i++ )
            GetOffset BlockMapOffset;
+
          {
            uint Unknown1;  
+
          uint Hash;
            uint Unknown2;  
+
          }
            uint Unknown3;
+
          SetBackColor( cLtGray ); byte padding1[total]; SetBackColor( cLtGreen );
            GetOffset m_pszTextureName; //pointer to texture filename
+
      }HashTable;
            uint Unknown4;
+
            ushort m_wWidth;         //texture width (edge length for cube texture)
+
            ushort m_wHeight; SetBackColor(cLtGreen);         //texture height                               
+
            byte m_pixelFormat[4]; SetBackColor(cLtYellow);     //texture pixel format                             
+
            byte m_nbLevels[4];         //number of levels in the texture
+
            float UnknownFloat1;
+
            float UnknownFloat2;
+
            float UnknownFloat3;
+
            float UnknownFloat4;
+
            float UnknownFloat5;
+
            float UnknownFloat6;
+
            GetOffset m_pPrev;          //PrevTextureInfoOffset
+
            GetOffset m_pNext;          //NextTextureInfoOffset
+
            GetOffset RawDataOffset;
+
            uint Unknown6;
+
/*
+
//Getting texture name - first variant - should work but can cause problems.
+
                  local int currentpos = FTell();
+
                  FSeek(m_pszTextureName & 0x0fffffff);
+
                  string Name;
+
                  FSeek(currentpos);
+
*/
+
        } grcTexturePC [header.TextureCount];  
+
  
/*  
+
      struct
//Getting texture name - second variant - works, but texture names are not in right order.
+
      {
         struct
+
          FSeek(Header.TextureListOffset & 0x0fffffff);
         {
+
          SetBackColor( cLtGreen );
         string Name;
+
          local int i;
        } TextureName [ header.TextureCount ];      
+
          local int total = 16-(Header.TextureCount*4%16); 
         } TextureInfo;
+
          for(i = 0; i < Header.TextureCount; i++ )
*/
+
          {
 +
          GetOffset InfoOffsets;
 +
          }
 +
          SetBackColor( cLtGray ); byte padding1[total]; SetBackColor( cLtGreen );
 +
      }TextureListTable;     
 +
 
 +
          struct
 +
          {
 +
          local int i;
 +
          for(i = 0; i < Header.TextureCount; i++ )
 +
          {
 +
          FSeek(TextureListTable.InfoOffsets[i]& 0x0fffffff);
 +
          SetBackColor(cLtYellow);
 +
                  struct
 +
                  {
 +
                    uint VTable;
 +
                    GetOffset BlockMapOffset;
 +
                    uint Unknown1;
 +
                    uint Unknown2;
 +
                    uint Unknown3;
 +
                    GetOffset m_pszTextureName; //pointer to texture filename
 +
                    uint Unknown4;
 +
                    ushort m_wWidth;         //texture width (edge length for cube texture)
 +
                    ushort m_wHeight; SetBackColor(cLtGreen);         //texture height                               
 +
                    byte m_pixelFormat[4];  SetBackColor(cLtYellow);    //texture pixel format                             
 +
                    byte m_nbLevels[4];         //number of levels in the texture
 +
                    float UnknownFloat1;
 +
                    float UnknownFloat2;
 +
                    float UnknownFloat3;
 +
                    float UnknownFloat4;
 +
                    float UnknownFloat5;
 +
                    float UnknownFloat6;
 +
                    GetOffset m_pPrev;          //PrevTextureInfoOffset
 +
                    GetOffset m_pNext;          //NextTextureInfoOffset
 +
                    int RawDataOffset;
 +
                    uint Unknown6;             
 +
                  }TextureInfo;     
 +
          }          
 +
          for(i = 0; i < Header.TextureCount; i++ )
 +
          {
 +
                FSeek(TextureInfo[i].m_pszTextureName& 0x0fffffff);   
 +
                SetBackColor( cLtGreen );
 +
                struct {
 +
                        string Name;  
 +
                        SetBackColor(cLtYellow);
 +
                }TextureName;
 +
          }          
 +
          }grcTexturePC;
 
     }dictionary;
 
     }dictionary;
 
</source>
 
</source>
 
</div></div>
 
</div></div>
 
[[Категория:GTA 4]] [[Категория: Форматы файлов]]
 
[[Категория:GTA 4]] [[Категория: Форматы файлов]]

Версия 02:48, 14 июля 2009

WTD - Windows Texture Dictionary

Формат ПК-текстур GTA 4. Работа с ними поддерживается в OpenIV, SparkIV и G-Texture.

На Xbox360 текстуры имели формат XTD - XENON Texture Dictionary. Просмотр был реализован в ранних версиях OpenIV и SparkIV, но не поддерживается публичными вариантами.