# Texture Cache

```
        // COMPRESSED FILES (each file has a header, the compressed bytes and (optionally) mipmaps
        --------------------------------
        public UInt32 CachedZSizeNoMips; //NOTE not counting appended mipmaps
        public UInt32 CachedSizeNoMips;
        public byte CachedMipsCount; //NOTE count of appended mipmaps
        public byte[CompressedSize] CompressedBytes;

        // (OPTIONAL) MipMaps (appended are any mipmaps, length = rest + (256 * PageCount) as entries: )
        public byte Rest;
        public UInt32 PageCount;
        public UInt16 dim1; //Width or Height
        public UInt16 dim2; //Heightor Width
        public byte[length] CompressedMipmapBytes;

        //INFOTABLE
        --------------------------------

        // MipMapsOffsetTable (4 bytes per entry * total mipmaps count):
        public Uint32 MipmapOffset; //NOTE MipMap offset is relative, counted from the beginning of the compressed file's offset

        // NamesTable (variable bytes per entry):
        public Cr2wString RelativeFilename; //NOTE (string, ended by nullbyte)

        // EntryinfoTable (52 bytes per entry * entries):
        public Int32 Hash;
        public Int32 PathStringIndex;
        public UInt32 PageOffset;
        public UInt32 ZSize;
        public UInt32 Size;
        public UInt32 BaseAlignment;
        public UInt16 BaseWidth;
        public UInt16 BaseHeight;
        public UInt16 TotalMipsCount;
        public UInt16 SliceCount;
        public Int32 MipOffsetIndex;
        public Int32 MipsCount;
        public Int64 TimeStamp;
        public Int16 Type;
        public Int16 IsCube;

        //FOOTER (const 32 bytes)
        --------------------------------
        public UInt64 Crc; //NOTE FNV1a64 over the Infotable (MipsOffsetTable, Namestable and EntryInfoTable)
        public UInt32 UsedPages;
        public UInt32 EntryCount;
        public UInt32 StringTableSize;
        public UInt32 MipEntryCount;
        public byte[4] IDString = { (byte)'H', (byte)'C', (byte)'X', (byte)'T' };
        public UInt32 Version= 6;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.redmodding.org/redengine3-research/formats/game-archives/texture-cache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
