BSA Files

From GECK
Jump to: navigation, search

Bethesda Software Archive

Game assets are stored in BSA files. This includes textures (.dds), meshes (.nif, .rdt), menus (.xml), sounds (.wav, .ogg), music (.mp3, .ogg), fonts (.fnt), facegen (.ctl), lipsync data (.dat), text (.txt), speedtree (.spt), and dlod (.dlod) settings. BSA files are archives which are packed in a single file with a directory and file structure, optionally compressed with zlib compression.

By default, the game will load BSAs in the order their associated plugins are ordered, with BSAs loaded first overriding conflicting files in subsequent BSAs, if present. It is possible to override this behavior by using Archive Invalidation, in which loose files containing the same folder structure will override BSA content.

This is opposite of the plugin override rule of one. In the case of BSA the first file loaded wins conflicts (See notes).

BSAs are loaded in the following order. First are those contained in sArchiveList in the Fallout.ini. Any others are loaded in the same order as the plugin load order, and in the case of multiple BSAs per plugin in alpha numeric sub order.

Using existing assets with the GECK

In order to add an asset to a form that is stored in a BSA, the file will need to be extracted from the BSA that it is contained in, and placed in the same relative path in the Data folder. You cannot add assets to forms that are contained in BSA files. You may want to extract all the BSA files you need assets from and place them in your Data folder for easy access in the GECK.

Using new assets with new BSA files

Notes

It is possible to create new BSA files in order to distribute new assets with user-created mods. This has benefits and drawbacks:

  • Easy installation.
    • Users will have to install less files: the ESP or ESM file for your mod, and the BSA file(s) with the assets, which can simply be placed in the Data folder.
  • Changing things is more involved.
    • Since your assets are in a BSA file, editing a file, such as a texture, will be more involved, since the user will have to extract the desired asset from the BSA file first.
  • Less fragmentation
    • Mods can contribute majorly to file system fragmentation. This is often caused by very large numbers of small files. If you have a large mod with a hundred or more assets to go with it, fragmentation can be avoided by putting those assets in BSA files.
  • Less memory use and increased performance
    • BSA files use a hash table internally in the game to lookup files in the BSA rather than keeping the filenames in memory. This requires less memory and also increases performance as less file handles are open and seek times are faster. Using uncompressed BSA (no zlib) will further increase performance on modern systems which have higher throughput than zlib can provide.

Use

You'll want to leave your files as loose assets while creating and editing your mod. Pack the assets into a BSA for release.

It is important to name your BSA files correctly so the game recognizes them, use the same system as the vanilla game. For example if your mod is named NameOfYourMod.esp or NameOfYourMod.esm:

  • NameOfYourMod - Textures.bsa
  • NameOfYourMod - Meshes.bsa
  • NameOfYourMod - Misc.bsa

A single plugin can have any number of BSA files associated with it, it is not necessary to create additional plugins to load more than one BSA.

Archive Flags

There are a number of flags that must be set correctly for your BSA(s) to work properly depending on what kind of assets they contain.

Archive Bits (16 bits)

  • 0b00000000000000001 - Named Directory - always set
  • 0b00000000000000010 - Named Files - always set
  • 0b00000000000000100 - Compressed - use zlib compression
  • 0b00000000000001000 - Retain Directory - never set
  • 0b00000000000010000 - Retain Names - set with sound effects
  • 0b00000000000100000 - Retain Retain File Offset - never set
  • 0b00000000001000000 - XBox 360 - never set
  • 0b00000000010000000 - Startup Strings - set with meshes
  • 0b00000000100000000 - Embed Name - set with textures

File Bits (16 bits)

  • 0b00000000000000001 - NIF - set with .nif models
  • 0b00000000000000010 - DDS - set with .dds, .fnt textures
  • 0b00000000000000100 - XML - not used with Fallout3/New Vegas
  • 0b00000000000001000 - WAV - set with .wav sounds
  • 0b00000000000010000 - MP3 - set with .mp3 and/or .ogg
  • 0b00000000000100000 - TXT - not used with Fallout3/New Vegas
  • 0b00000000001000000 - SPT - set with .spt (speedtree)
  • 0b00000000010000000 - FNT - not used with Fallout3/New Vegas
  • 0b00000000100000000 - MISC - set with .xml, .dat, .dlod, .ctl

Notes

MP3 files will not work in Fallout New Vegas when placed inside BSA files. Use OGG/Vorbis instead.

BSA files can be made to override previous BSA files like newer Bethesda titles by creating an empty text file with the same name as the BSA file and adding the extension .override
This behavior requires the jip_ln NVSE plugin to enable

NameOfYourMod - Textures.override
NameOfYourMod - Meshes.override
NameOfYourMod - Misc.override

Archive Invalidation

This is a term used to describe how to get the game to recognize certain new files placed in the Data folder. Archive invalidation works by creating a new empty BSA with a current date and placing it first in the sArchiveList of Fallout.ini, you'll have to manually edit GECKCustom.ini and put the BSA name first in this setting. This "invalidates" older files and allows loose files with newer creation dates to override the files in the vanilla BSAs.

Tools

You can view, and create BSA files with the following tools:

You can also use Archive.exe from the Skyrim CKIT.