texHeaders.bin File Format: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - " (\=+)([a-zA-Z0-9][^ ]+[a-zA-Z0-9])(\=+) " to " $1 $2 $3 ")
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Feature|UnsupportedDoc}}
= intro =
TextHeaders.bin is created by [[BI_Tools_2.5|Binpbo personal edition 2.5]] and greater, or, mikero's dos tools.
It was introduced as of the arrowhead engine and builds an internal structure that was previously done by the engine at exe load time. It's basic use is to have an immediate index (in memory) of all mipmaps of all pax files in the game.
This internal structure is used in multiple ways, not just for pax files directly. Some of the settings therefore are constant and have no direct meaning to the pax file being analysed.
The file itself is placed in the primary folder of the addon.pbo, and comprises information from all pax files encountered in that addon. Unlike all other file\references in bis, the ones used here are relative to the location of the texheaders.bin, not, the beginning if the 'P' drive.
== creation ==
is simple
*BIS:  some\where\binarise  -texheaders  project_folder project_folder
*MIKERO: detex -C  project_folder
== Conventions ==
see [[Generic FileFormat Data Types]]
= File Structure =
  struct TexHeader.bin
  struct TexHeader.bin
  {
  {
   MimeType "0DHT" ;    // NOT asciiz. '0' = 0x30. This is mimetype "TexHeaDer0"
   MimeType "0DHT" ;    // NOT asciiz. '0' = 0x30. This is mimetype "TexHeaDer0"
   ulong    version;    // 1
   ulong    version;    // 1
   ulong    nTextures; //ce 01 00 00
   ulong    nTextures; //  
   TexBody  TexBodies[nTextures];
   TexBody  TexBodies[nTextures];
  };
  };
 
== TexBody ==
 
  TexBody
  TexBody
  {
  {
   TexBegin TexBegin;
   ulong          nColorPallets;     //always 1
   Asciiz   *PaaFile;//"data\icons\m4a3_cco_ca.paa"
  ulong          Pallet_ptr;        //Always0 (there are none)
                    //"fnfal\data\fnfal_smdi.paa"
  floats        AverageColor[r,g,b,a];//[[PAA_File_Format#AVGCTAGG|AVGCTAGG]] floating-point equivalent.
   TexEnd   TexEnd;
  bytes          AverageColor[b,g,r,a];//[[PAA_File_Format#AVGCTAGG|AVGCTAGG]] in PAx file
  bytes          MaxColor[b,g,r,a];    //[[PAA_File_Format#AVGCTAGG|MAXCTAGG]] in PAx file
  ulong          clampflags;        // always 0
  ulong          transparentColor;  // always 0xFFFFFFFF
  byteBool      has_maxCtagg;      // the MaxColor was set by the paa
                isAlpha;     // set if FLAGTAG=1: 'basic transparency'
                isTransparent;     // set if FLAGTAG=2: 'alpha channel is not interpolated'
                isAlphaNonOpaque;  // set if isalpha, AND AverageColor alpha <0x80
  ulong          nMipmaps;          // always same as nMipmapsCopy below
  ulong          pax_format;        // see below Dxt1,2,3 etc
  byteBool      littleEndian;      // Always true;
  byte          isPaa;     //file was a .paa not .pac
   Asciiz         PaaFile[];         // '''Relative''' to the file location of the texheader itself.
                                    //"data\icons\m4a3_cco_ca.paa"
                                    //"fnfal\data\fnfal_smdi.paa"
   ulong          pax_suffix_type;    // _co, _ca, smdi, etc
  ulong          nMipmapsCopy;      // same as nMipmaps above
  MipMap        MipMaps[nMipmaps];  // see below
   ulong          SizeOfPaxFile;     //
  };
  };


* Either BIS have finally learned to use relative file addressing (unlikely), or, more inconsistency for us
where the root is presumed to be \CA\ (or anything else they arbitrarily decide to use).
* It looks like yet-another rule break with lack of ofpec_tags in front of pbo model names, but, it's their game, they can destroy it any way they want to.


TexBegin
===pax_format===(not all values found in a pax file)
{
 
  ulong Always1;
0 Index Pallet (P8),
  ulong Always0;
#Greyscale (AI88),
  float Floats[4];
#RGB565,
  byte  AverageColor[4]; //like AVGCTAGG in PAA file
#ARGB1555,
  byte  MaxColor[4]; //like MAXCTAGG in PAA file
#ARGB4444,
  ulong Always0;
#ARGB8888,
  ulong AlwaysDefault;//0xFFFFFFFF
#DXT1
  ulong FlagBytes;    // 01 01 00 10 typical
#DXT2
  ulong SameCount;    // see note
#DXT3,
  ulong TextureType; // 6 = DXT1, 10 = DXT5
#DXT4,
  byte  Always1;
#DXT5
  byte  Always1;
};


TexEnd
The same value is also repeated in each mipmap
{
  ulong      Flag;
  ulong      nMipmaps;
  MipMap    MipMaps[nMipmaps];
  ushort    SomeShort
  ushort    AnotherShort;
};


* SameCount always == nMipmaps
===pax_suffix_type=== (not all values found in a pax file)


0 diffuse color, SRGB color space. the default for anything else
# diffuse color, linear color space: (_sky, _lco)
#detail texture, linear color space:(_detail,_cdt,_dt,_mco)
#normal map: (_nXXX)
#irradiance map
#Map with random values from interval <0.5, 1>
#tree crown calculation texture
#'macro' object color, SRGB color space: (_mc)
#ambient shadow layer:  (_as)
#Specular: amount of layer: (_sm, _smdi)
#dithering: texture
#detail specular: (_dtsmdi) amount of layer
#mask: (_mask) used for texture selection in the multi-shader
#Thermal Image: (_ti_ca) texture
=== Color float ===
anyfloat= anybyte/255.0;
*note the order of floats is reverse to the rgba equivalent
=== mipmap ===
  MipMap
  MipMap
  {
  {
   ushort width;//typical 0040,0200
   ushort width,height;           //as per same mipmap in the pax
  ushort height;//typical 0020,0100
   ushort Always0;
   ushort Always0;
   ushort value3;//generally 0x030a
   byte  pax_format;             //same value as above
   ulong  dataOffset; //position of mipmap data in paa file
  byte  Always3;
   ulong  dataOffset;             //[[PAA_File_Format#AVGCTAGG|OFFSTAGG]] in PAx file. position of mipmap data in pax file
  };
  };
[[Category:BIS_File_Formats]]

Latest revision as of 15:41, 17 November 2021

bi symbol white.png
Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.

This page contains unofficial information.

Some usage of this information may constitute a violation of the rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.
Bohemia Interactive is not willing to tolerate use of such tools if it contravenes any general licenses granted to end users of this community wiki or BI products.

intro

TextHeaders.bin is created by Binpbo personal edition 2.5 and greater, or, mikero's dos tools.

It was introduced as of the arrowhead engine and builds an internal structure that was previously done by the engine at exe load time. It's basic use is to have an immediate index (in memory) of all mipmaps of all pax files in the game.

This internal structure is used in multiple ways, not just for pax files directly. Some of the settings therefore are constant and have no direct meaning to the pax file being analysed.

The file itself is placed in the primary folder of the addon.pbo, and comprises information from all pax files encountered in that addon. Unlike all other file\references in bis, the ones used here are relative to the location of the texheaders.bin, not, the beginning if the 'P' drive.

creation

is simple

  • BIS: some\where\binarise -texheaders project_folder project_folder
  • MIKERO: detex -C project_folder

Conventions

see Generic FileFormat Data Types

File Structure

struct TexHeader.bin
{
 MimeType "0DHT" ;    // NOT asciiz. '0' = 0x30. This is mimetype "TexHeaDer0"
 ulong    version;    // 1
 ulong    nTextures;  // 
 TexBody  TexBodies[nTextures];
};

TexBody

TexBody
{
 ulong          nColorPallets;      //always 1
 ulong          Pallet_ptr;         //Always0 (there are none)
 floats         AverageColor[r,g,b,a];//AVGCTAGG floating-point equivalent.
 bytes          AverageColor[b,g,r,a];//AVGCTAGG in PAx file 
 bytes          MaxColor[b,g,r,a];    //MAXCTAGG in PAx file
 ulong          clampflags;         // always 0
 ulong          transparentColor;   // always 0xFFFFFFFF
 byteBool       has_maxCtagg;       // the MaxColor was set by the paa
                isAlpha;	     // set if FLAGTAG=1: 'basic transparency'
                isTransparent;	     // set if FLAGTAG=2: 'alpha channel is not interpolated'
                isAlphaNonOpaque;   // set if isalpha, AND AverageColor alpha <0x80
 ulong          nMipmaps;           // always same as nMipmapsCopy below
 ulong          pax_format;         // see below Dxt1,2,3 etc
 byteBool       littleEndian;       // Always true;
 byte           isPaa; 	     //file was a .paa not .pac
 Asciiz         PaaFile[];          // Relative to the file location of the texheader itself.
                                    //"data\icons\m4a3_cco_ca.paa"
                                    //"fnfal\data\fnfal_smdi.paa"
 ulong          pax_suffix_type;    // _co, _ca, smdi, etc
 ulong          nMipmapsCopy;       // same as nMipmaps above
 MipMap         MipMaps[nMipmaps];  // see below
 ulong          SizeOfPaxFile;      //
};


===pax_format===(not all values found in a pax file)

0 Index Pallet (P8),

  1. Greyscale (AI88),
  2. RGB565,
  3. ARGB1555,
  4. ARGB4444,
  5. ARGB8888,
  6. DXT1
  7. DXT2
  8. DXT3,
  9. DXT4,
  10. DXT5

The same value is also repeated in each mipmap

===pax_suffix_type=== (not all values found in a pax file)

0 diffuse color, SRGB color space. the default for anything else

  1. diffuse color, linear color space: (_sky, _lco)
  2. detail texture, linear color space:(_detail,_cdt,_dt,_mco)
  3. normal map: (_nXXX)
  4. irradiance map
  5. Map with random values from interval <0.5, 1>
  6. tree crown calculation texture
  7. 'macro' object color, SRGB color space: (_mc)
  8. ambient shadow layer: (_as)
  9. Specular: amount of layer: (_sm, _smdi)
  10. dithering: texture
  11. detail specular: (_dtsmdi) amount of layer
  12. mask: (_mask) used for texture selection in the multi-shader
  13. Thermal Image: (_ti_ca) texture

Color float

anyfloat= anybyte/255.0;
  • note the order of floats is reverse to the rgba equivalent

mipmap

MipMap
{
 ushort width,height;            //as per same mipmap in the pax
 ushort Always0;
 byte   pax_format;              //same value as above
 byte   Always3;
 ulong  dataOffset;              //OFFSTAGG in PAx file. position of mipmap data in pax file
};