Tes5Mod: File Format Conventions
Listed here are conventions used in describing Skyrim file formats. Many of these conventions are standard c-type conventions, others (e.g., iref) are specific to this subject.
|num||Count of something. E.g. number of records.|
|size||Size in bytes of some data object.|
|?Huh?||Question or speculation.|
|null/empty||0||Field with no data, usually used as a marker or flag.|
|int8||1||8-bit value, signed.|
|uint8||1||8-bit value, unsigned.|
|int16||2||16-bit value, signed.|
|uint16||2||16-bit value, unsigned.|
|int32||4||32-bit value, signed.|
|uint32||4||32-bit value, unsigned.|
|int64||8||64-bit value, signed.|
|uint64||8||64-bit value, unsigned.|
|float32||4||32-bit value, floating-point.|
|float64||8||64-bit value, floating-point.|
|The type names listed in this block should be considered deprecated and you should instead use the type names in the previous block.|
|short||2||Short integer, signed.|
|ushort||2||Short integer, unsigned.|
|long||4||Long integer, signed.|
|ulong||4||Long integer, unsigned.
|float||4||Floating point number|
|vsval||1+??||Variable-sized value, the type of vsval depends on the first byte: the lowest 2 bits represents the type of the vsval:
The value is in the rest of the bits of the value type.
Note: bytes are stored in little-endian format. So, the least significant bytes will come first. (Bits are still most significant first)
Example process for reading a uint16 vsval:
Note: When reading a uint32 value, follow the same procedure except shift the third byte to the left 16 bits and logical or it with the uint16 before shifting the resulting uint32 to the right 2 bits.
|formid||4||A ulong used to identify a data object. May refer to a data object from a mod or new object created in-game.|
|iref||4||A ulong. Use as an index into the FormIDs Array to get the formId.|
|hash||8||A hash of a string. See BSA File Format: Hash Calculation.|
|rgb||4||4 unsigned bytes, containing red, green, blue, ?alpha? values|
|type[num]||num*sizeof(type)||Array of num types.|
|4||'Localized string', a ulong that is used as an index to look up string data information in one of the string tables. Note that the record header for the TES4 record indicates if the file is localized or not. If not, all lstrings are zstrings.|
|bstring||1+??||A string prefixed with a byte length. NOT zero terminated.
|bzstring||1+??||A string prefixed with a byte length and terminated with a zero (\x00).|
|wstring||2+??||A string prefixed with a uint16 length. NOT zero terminated.
|wzstring||2+??||A string prefixed with a uint16 length and terminated with a zero (\x00).|
|zstring||??+1||Zero terminated string.
|string||??||String which is not terminated
|struct||??||Collection of other data types.
|list[len]||??||List of items of variable length, and possibly different types.
This is used for plugin fields.
The version of the form that contains that field. See Records format.