Skip to content

Var Files

KG edited this page Jun 15, 2023 · 6 revisions

Every var file has two parts: a header and a number of entries, where an entry contains the data for a single variable. Usually, var files contain just one entry; in these cases, there's not much distinction between a var and an entry for the purposes of messing with its data.

TIHeader

Section Subsection Section Offset Length Type Description Notes
Header Magic 0 8 String The file magic for the var
Extra 8 2 Bytes Extra export bytes for the var
  • Exact meaning and interpretation of these bytes is not yet determined
Product ID 10 1 Bytes The product ID for the var
  • The exact meaning and interpretation of these bytes is not yet determined.
  • These bytes are set by different export tools and can often be "incorrect" without causing issues.
Comment 11 42 String The comment attached to the var

TIEntry

Section Subsection Section Offset Length Type Description Notes
Meta Length Meta Length 0 2 Integer The length of the meta section of the entry
  • Indicates if the entry is suitable for a flash chip (13) or not (11).
  • If equal to 13, the entry contains the starred meta subsections.
  • If equal to 11, the entry lacks the starred meta subsections.
Meta Data Length 0 2 Integer The length of the data section of the entry
Type ID 2 1 Bytes The type ID of the entry
  • The type determines how the contents of the data section of the entry are interpreted.
  • Real subtypes have the same type ID.
Name 3 8 Varies The name of the entry
  • Interpretation as text depends on the entry type; see entry pages for details.
Version* 11 1 Integer The version number of the entry
  • Tokenized types set this value to determine OS compatibility.
  • Types exclusive to color models set this value to warn against monochrome transfers.
Archived* 12 1 Boolean Whether the entry is archived
Data Length Data Length 0 2 Integer The length of the data section of the entry
  • This is a repeat of the value found in the meta section.
Data ... ... ... ... The data section of the entry
  • See entry pages for subsections.

TIVar

Section Subsection Section Offset Length Type Description Notes
Header Header 0 53 TIHeader The var's header
Entry Length 53 2 Integer The total length of all entries in the var
  • This should always be 57 less than the total var size.
Entries Entry 1 0 ... TIEntry The first entry in the var
... ... ... TIEntry Subsequent entries in the var
  • Most vars contain only one entry.
Checksum Checksum 0 2 Bytes The checksum for the var
  • This is equal to the lower 2 bytes of the sum of all bytes in the entries.
Clone this wiki locally