Tes4Mod:Mod File Format/TES4

Oblivion: Tes4Mod: Modding

TES4 is the header record for the mod file. It contains info like author, description, file type, and masters list.

  • Unlike TES3, author and description fields are no longer of fixed size. If you edit their content, you'll almost certainly have to rewrite the entire file.
  • In Progress -- some info may be inaccurate.
C SubRecord Name Type/Size Info
+ HEDR header struct
  • Whether the file is an esm or esp is determined by Flags1 of TES4 record header. If Flags1 & 1, then file is a master. Otherwise, file is a plugin, regardless of what the file extension says.
version float 0.8
numRecords long Number of records and groups (not including TES4 record itself).
nextObjectId ulong Next available object id. ?But large variation has been seen?
- OFST typeOffsets? struct[*]
  • Vestigial—ignored by game executable.
  • Appears in Oblivion.esm. Does not appear in esps. Is not required for esms.
  • You would think that this would be something like offset info.
ubyte[3] Unknown. Looks to be junk data.
  • Not consistent at first, but later in file seem to increment consistently.
  • But is often zero, and if it's supposed to be an offset, it's too small.
byte Incremental index.
char[4] Type name. Includes types from the executable that are no longer in the game data, such as TLOD and SNDG.
ulong Always 0, except for type CELL which is very large.
- DELE deleted?  ??

Unknown. List of deleted formids?

  • Only seen in Oblivion.esm?
  • Note: In Morrowind, DELE records were used to mark data records that had been marked as deleted. This looks different.
- CNAM author zstring
  • Max size: 512 bytes (including terminator).
  • For files regarded as masters, the CS4 Details view will display "Bethesda Game Studios" regardless of the actual content of this field. The Oblivion plugin loader will display "Bethesda Softworks".
- SNAM description zstring
  • Max size: 512 bytes (including terminator).
* MAST master zstring Master filename.
  • Each pair of MAST/DATA subrecords represent a single master of the mod file.
  • Master files are listed in load order at the time the mod was saved.
  • The modindex of formids in the mod file match the order of masters given here.
fileSize uint64
  • Always 0. Probably Vestigial.
  • In Tes3, the file size of the master was recorded here.