Guides/04
Archives
Read, check, extract and pack BSA and BA2 files.
esx reads, checks, extracts and packs these formats:
| Game | Format |
|---|---|
| Morrowind | TES3 BSA |
| Oblivion, Fallout 3, Skyrim | BSA 103, 104 and 105 |
| Fallout 4 | GNRL and DX10 BA2, versions 1, 7 and 8 |
| Starfield | GNRL and DX10 BA2, versions 2 and 3 |
Inspect
esx archive info 'MyMod - Main.ba2'
esx archive list 'MyMod - Main.ba2' --pattern '*.dds'
esx archive check 'MyMod - Main.ba2'
check decompresses every entry and reports corrupt entries with their offsets.
Extract
esx archive extract 'MyMod - Main.ba2' -o extracted
DX10 entries become complete DDS files. Use --overwrite to replace existing files.
Extraction rejects parent traversal, duplicate targets and symlinked directories.
A corrupt entry can stop a full extraction after earlier files are written.
Pack
esx archive pack ./assets -o 'MyMod - Main.ba2'
esx archive pack ./assets -o 'MyMod - Textures.ba2' --archive-format fo4-dds
Choose the format with --archive-format. The values are fo4-dds, tes3, tes4, fo3, sse, sf and sf-dds.
esx skips plugin, archive and executable files. It publishes the output after all inputs pack without error.
To pack one Fallout 4 directory into the two archives of a mod, give --textures-output:
esx archive pack ./Data -o 'MyMod - Main.ba2' --textures-output 'MyMod - Textures.ba2' --share-data
DDS files go to the DX10 archive at --textures-output. Other assets go to the archive at -o.
esx finishes packing both archives before publication starts. A packing error publishes neither.
If an archive would be empty, esx skips it and warns with ARCHIVE_EMPTY.
For a project folder, esx build is the one command that stages the assets, packs both archives and checks the release.
--include and --exclude select files by path. You can repeat each option:
esx archive pack ./Data -o 'MyMod - Main.ba2' --include 'Meshes/' --include '*.bgsm' --exclude '*.txt'
A file must match an --include pattern, if supplied, and no --exclude pattern.
Patterns ignore letter case and accept / and \. Without * or ?, a pattern is a
path prefix. With wildcards, it must match the full path. * also matches separators.
With --file-list, esx validates the list before filtering it. Directory scans skip excluded
files without checking them. This lets --exclude omit files that esx cannot pack, such as
a file in the directory root.
| Option | Use |
|---|---|
--textures-output FILE |
Pack the DDS files into a second, DX10 archive. Fallout 4 only. |
--include GLOB, --exclude GLOB |
Select files by path prefix or glob. |
--share-data |
Reuse identical payloads. |
--split-size BYTES |
Write numbered parts. One asset larger than the limit stays whole. |
--archive-flags, --file-flags |
Set BSA flags. Use decimal or 0xHEX. |
--max-chunks, --single-mip-width, --single-mip-height |
Control texture chunks. |
--target xbox |
Pack tiled Xbox DDS files. The output name must end in _xbox.ba2. |
DX10 textures and SSE textures with embedded names always use compression.
Folder names with different letter case
The game reads Meshes/actors and Meshes/Actors as one folder. A Linux directory can contain both.
Directory scans warn with ARCHIVE_PATH_CASE and name both paths. With --file-list,
esx rejects a path below such a folder and names both spellings.
Move the files into one folder and remove the other.
Check a release
release check checks a plugin and its packaged assets, then combines the results in one report:
esx --data '/path/to/Fallout 4/Data' release check release/MyMod.esp
| Section | Check |
|---|---|
roundtrip |
debug roundtrip: each record encodes to its bytes. |
plugin_check |
plugin check: unresolved FormIDs, wrong reference types and decoding errors. |
archive_check |
archive check on each archive: each entry reads and decompresses. |
assets |
plugin assets --recursive --include-companions: each asset of the plugin resolves. |
behavior_verify |
behavior verify: each file of the behavior build is in the release with the same bytes. |
scripts |
plugin check-scripts: each script binding agrees with its compiled Papyrus file. |
seq |
The file Seq/<Name>.seq of the release has the start-game-enabled quests of the plugin. |
overrides |
The list of the records of the plugin that override a record of a master. |
Without --archive, esx uses MyMod - Main.ba2 and MyMod - Textures.ba2 in the folder of the plugin, when they exist.
The behavior check runs when behavior.lock.json is in the folder of the plugin, or when you give --behavior-lock FILE. Without a lock, the section says that esx skipped the check.
For a plugin in the release folder or the candidate folder of esx build, esx uses the lock that the build keeps for that folder (build/release.behavior.lock.json or build/candidate.behavior.lock.json) by default. This lock lists the files of each behavior source.
Each section has an issues count and the report of its command. The assets and behavior_verify sections list only the items that have a problem.
The top-level issues value is the total. When the total is not 0, the exit code is 7 and the report is in error.details.
The report also has requirements.masters: the masters of the plugin. official is true for
Fallout4.esm, a DLC master and a Creation Club plugin.
Files that are not in the release
A file of the mod must come from the release or from an archive that the game loads. On the
computer of the author, the Data folder can have the same file as a loose file, for example
from a test install. A player does not have that file. So a path that only a loose file of
the Data folder gives is the issue ASSET_NOT_IN_RELEASE. The assets section and the
scripts section list each such file in not_in_release.
- A loose file beside the plugin is a file of the release.
- A loose file of the Data folder over a copy in an archive is not an issue: the player has the copy of the archive.
--loose-dependency PATTERNdeclares loose files that the mod needs from another mod. The pattern is a Data path, where*is any text in one name and**is any number of folders. Repeat the option for more patterns.--allow-data-looseaccepts each loose file of the Data folder.
esx --data '/path/to/Fallout 4/Data' release check release/MyMod.esp --loose-dependency 'Scripts/F4SE/**'
provenance in the two sections counts the files of each origin. It tells which archives of
the game the mod needs:
{ "Fallout4 - Materials.ba2": 2, "Fallout4 - Sounds.ba2": 2, "release": 43 }
Key of provenance |
Origin |
|---|---|
release |
An archive of the release, or a loose file beside the plugin. |
| The file name of an archive | An archive of the game or of a master. |
loose_dependency |
A loose file of the Data folder that a pattern declares. |
data_loose |
A loose file of the Data folder, with --allow-data-loose. |
The SEQ file
| Code | Severity | Meaning |
|---|---|---|
SEQ_STALE |
Issue | The release has Seq/<Name>.seq, and its bytes are not the start-game-enabled quests of the plugin. |
SEQ_MISSING |
Warning | The plugin has such a quest, and the release has no SEQ file. |
state in the section is current, stale, missing or not_needed. esx build writes the
file; see Startup quests.
Overrides
The overrides section lists each override record with its FormID, signature and editor ID.
--override PATTERN names an override that the mod makes on purpose. A pattern is a signature
(RACE) or a signature and an editor ID (LVLI:LL_Vendor_*), where * is any text. With the
option, each override that matches no pattern is in the warning OVERRIDE_UNDECLARED, and its
entry has declared: false. The warning is not an issue.
esx --data '/path/to/Fallout 4/Data' release check release/MyMod.esp --override 'LVLI:LL_Vendor_*' --override RACE
In a project folder, the [release] table of esx.toml gives the patterns of
--loose-dependency and --override, and esx build gives them to its check step. See
The rules of the release.
Meshes and face bones
The assets section also has two lists that give warnings and are not issues:
| Warning | List | Meaning |
|---|---|---|
MESH_UNREFERENCED |
unreferenced_meshes |
A packed mesh that no record and no other mesh uses. A <mesh>_faceBones.nif file counts as used when its mesh is used. |
FACEBONES_FLAG_MISSING |
face_bones |
The release has <mesh>_faceBones.nif, and the model field that names <mesh>.nif has no Has FaceBones Model flag. The game then does not load the file, and a hat or mask does not follow the face. |
FACEBONES_FILE_MISSING |
face_bones |
A model field has the flag, the release has its mesh, and <mesh>_faceBones.nif is not in the release and not in the game data. |
Each face_bones entry has the record, the path of the model field (model) and the path of its flags field (flags), as batch takes them. The flags field of MOD2 is MO2F, and so on for MOD3 to MOD5; the flags field of MODL is MODF.
When has_flags_field is false, add the field before you set the flag:
{ "op": "add", "record": "edid:MyHatAddon", "path": "Biped Model\\Male\\MO2F" },
{ "op": "set_flag", "record": "edid:MyHatAddon", "path": "Biped Model\\Male\\MO2F",
"flag": "Has FaceBones Model", "value": true }
Find assets
A resource lookup searches loose files and archives together.
Loose files in --data win. Between archives, a later archive wins.
esx resource where 'strings/MyMod_en.STRINGS' --data ./Data --archive 'MyMod - Main.ba2'
esx resource list --data ./Data --pattern 'strings/*'
esx resource extract 'meshes/example.nif' --archive 'MyMod - Main.ba2' -o example.nif
resource where lists every copy, with the highest priority first.
resource dependencies PATH --recursive lists the files that a mesh, a material or a compiled script needs. See Meshes and materials.
plugin assets MyMod.esp --recursive --fail-on-missing checks record paths and
mesh/material dependencies. Sound records can name a .wav file while the archive
contains its compiled .xwm. The scan tries the XWM when no WAV exists, and
plugin collect-assets copies it with its actual extension. IDLE animation queries
with $(Subgraph), * or ? depend on the selected animation context and are
excluded from the literal-file scan. Concrete IDLE filenames are still checked.