Texture Cache
texture.cache
1
// COMPRESSED FILES (each file has a header, the compressed bytes and (optionally) mipmaps
2
--------------------------------
3
public UInt32 CachedZSizeNoMips; //NOTE not counting appended mipmaps
4
public UInt32 CachedSizeNoMips;
5
public byte CachedMipsCount; //NOTE count of appended mipmaps
6
public byte[CompressedSize] CompressedBytes;
7
8
// (OPTIONAL) MipMaps (appended are any mipmaps, length = rest + (256 * PageCount) as entries: )
9
public byte Rest;
10
public UInt32 PageCount;
11
public UInt16 dim1; //Width or Height
12
public UInt16 dim2; //Heightor Width
13
public byte[length] CompressedMipmapBytes;
14
15
//INFOTABLE
16
--------------------------------
17
18
// MipMapsOffsetTable (4 bytes per entry * total mipmaps count):
19
public Uint32 MipmapOffset; //NOTE MipMap offset is relative, counted from the beginning of the compressed file's offset
20
21
// NamesTable (variable bytes per entry):
22
public Cr2wString RelativeFilename; //NOTE (string, ended by nullbyte)
23
24
// EntryinfoTable (52 bytes per entry * entries):
25
public Int32 Hash;
26
public Int32 PathStringIndex;
27
public UInt32 PageOffset;
28
public UInt32 ZSize;
29
public UInt32 Size;
30
public UInt32 BaseAlignment;
31
public UInt16 BaseWidth;
32
public UInt16 BaseHeight;
33
public UInt16 TotalMipsCount;
34
public UInt16 SliceCount;
35
public Int32 MipOffsetIndex;
36
public Int32 MipsCount;
37
public Int64 TimeStamp;
38
public Int16 Type;
39
public Int16 IsCube;
40
41
//FOOTER (const 32 bytes)
42
--------------------------------
43
public UInt64 Crc; //NOTE FNV1a64 over the Infotable (MipsOffsetTable, Namestable and EntryInfoTable)
44
public UInt32 UsedPages;
45
public UInt32 EntryCount;
46
public UInt32 StringTableSize;
47
public UInt32 MipEntryCount;
48
public byte[4] IDString = { (byte)'H', (byte)'C', (byte)'X', (byte)'T' };
49
public UInt32 Version= 6;
Copied!
Copy link