WTD — различия между версиями
Материал из GTAModding.ru
Dageron (обсуждение | вклад) |
Dageron (обсуждение | вклад) |
||
Строка 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 | + | // 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 | + | { |
− | + | int zero; | |
− | + | ` byte padding[524]; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} BlockMap; | } BlockMap; | ||
− | + | }Header; | |
− | FSeek( | + | struct |
− | + | { | |
− | + | FSeek(Header.HashTableOffset & 0x0fffffff); | |
− | + | SetBackColor( cLtGreen ); | |
− | + | local int i; | |
− | + | local int total = 16-(Header.TextureCount*4%16); | |
− | + | for(i = 0; i < Header.TextureCount; i++ ) | |
− | + | { | |
− | + | uint Hash; | |
− | + | } | |
− | + | SetBackColor( cLtGray ); byte padding1[total]; SetBackColor( cLtGreen ); | |
− | + | }HashTable; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | struct | |
− | // | + | { |
− | + | FSeek(Header.TextureListOffset & 0x0fffffff); | |
− | + | SetBackColor( cLtGreen ); | |
− | string Name; | + | local int i; |
− | + | local int total = 16-(Header.TextureCount*4%16); | |
− | } | + | 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, но не поддерживается публичными вариантами.
Вывод структуры в 010 Editor
//--- 010 Editor v3.0.5 Binary Template // File: wtd.bt // Version: 0.1 // Author: Dageron // Site: www.GTAModding.ru //-------------------------------------- // Based on: //http://public.sannybuilder.com/GTA4/rsc_en.txt //http://gtaivtools.googlecode.com/ //-------------------------------------- //Simple function to get offset typedef int GetOffset <read=GetOffsetRead>; string GetOffsetRead(GetOffset f) { string s; if (f == 0) s="0"; else if (f >> 28 != 5) s="0"; //wrong offset else SPrintf( s, "%i", f & 0x0fffffff); return s; } //-------------------------------------- struct GTA_Windows_Texture { LittleEndian(); struct pgDictionary { SetBackColor( cLtGreen ); int VTable; GetOffset BlockMapOffset; int ParentDictionary; // always 0 in file int UsageCount; // always 1 in file GetOffset HashTableOffset; short TextureCount; short TextureCount2; GetOffset TextureListOffset; short TextureCount3; short TextureCount4; FSeek(BlockMapOffset & 0x0fffffff); SetBackColor( cLtGray ); struct { int zero; ` byte padding[524]; } BlockMap; }Header; struct { FSeek(Header.HashTableOffset & 0x0fffffff); SetBackColor( cLtGreen ); local int i; local int total = 16-(Header.TextureCount*4%16); for(i = 0; i < Header.TextureCount; i++ ) { uint Hash; } SetBackColor( cLtGray ); byte padding1[total]; SetBackColor( cLtGreen ); }HashTable; struct { FSeek(Header.TextureListOffset & 0x0fffffff); SetBackColor( cLtGreen ); local int i; local int total = 16-(Header.TextureCount*4%16); 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;