Guide:BSA Extraction and Optimization
A quick guide to using BSAopt and DDSopt to extract loose files from a BSA archive. -- by STEP Team (Updated 18:58:42 16 July 2014 (UTC))
Both BSAopt and DDSopt are built off of the same architecture, but DDSopt has a different primary purpose: optimizing textures. The difference between the programs is that because DDSopt is primarily used to alter the files it is extracting, it requires an extra step to use purely as an extraction tool. If you don't mind having another application installed, BSAopt is easier to use and doesn't require potential configuration changes every time it's used. Instructions for installation and initial setup of BSAopt are available here, and instructions for setup of DDSopt are found in DDSopt Configuration. Instructions for extracting BSAs using either program are as follows:
- (Optional but recommended for general use) Set BSA archives to be opened with BSAopt or DDSopt by default. This only needs to be done once and then BSAs can be opened by simply double-clicking them.
- Right-click a BSA file and selecting [Open with...].
- Next choose "Select a program from a list of installed programs" and click [OK].
- Click [Browse...] then find and select "BSAopt.exe" or "DDSopt.exe".
- BSAopt or DDSopt should then appear highlighted in the "Open with" dialog box. Make sure "Always use this selected program to open this kind of file" is selected and click [OK]
- Now that the BSA is opened in your program of choice, DDSopt users will need to click the [Ignore] menu on the top bar and select [Don't process any of the known file types at all].
- You must next specify where to extract the files. Generally one would extract the files to the same directory the BSA is located in. To achieve this, all you need to do is type "." (a singular period without quotes) in the bottom text box. Otherwise, click [Browse] and navigate to the desired directory.
- Click [Unpack] (BSAopt) or [Process] (DDSopt) and another window should appear with two progress bars. Once that disappears the extracted files should appear in the destination folder.
- If using this process during mod installation, rename or delete the source BSA so that the associated ESP doesn't use it and instead relies on the newly extracted loose files.
Mod Organizer Special Instructions
Mod Organizer has a built-in BSA extraction feature. In v0.12 of Mod Organizer it will ask whether you want to extract a BSA when you install a mod with one. When the "Extract BSA" prompt appears when installing a mod, simply click [Yes]. Deleting the BSA after extraction is a good thing, it forces the associated ESP to rely on the newly extracted loose files.
To extract a BSA that's already installed in MO:
- Open the "BSAs" tab on the right side of the screen.
- Right-click the BSA you wish to extract and click [Extract...].
- Browse to the desired destination and click [Select Folder].
- Usually you'll want to extract the BSA to the mod's folder. The wizard should open initially to the "ModOrganizer" directory. The mod folders are found under the "\mods\" subfolder, so browse there to find the correct folder.
- Unfortunately using this method doesn't automatically delete the BSA. Instead just deselect the BSA in Mod Organizer, this achieves the same effect.
Using BSA to Identify Redundant ESPs
Mods with resources (e.g. textures and scripts) can use either a BSA or loose files for these resources. If a BSA file is used, then an ESP file is needed so that Skyrim can load the BSA. There are several mods that utilize an ESP only to "activate" the provided BSA. In these cases, by extracting the BSA into a set of loose files, the ESP will no longer be needed. In order to maximize compatibility and reduce possible engine trouble associated with a high number of ESPs, it is useful to eliminate these files whenever possible. Mod Organizer does this automatically, so those using MO typically do not need to use the following instructions.
To determine whether the ESP in a mod with a BSA is only present so Skyrim will extract the BSA and thus can be safely removed, do the following. Of course, if a mod has more than one ESP then it automatically does not fall under this category. Mod Organizer generally puts a broom icon in the plugins list if the plugin is only present to cause the BSA to be loaded.
- Load the mod into TES5Edit:
- Start TES5Edit.
- When the "Master/Plugin Selection" window is shown, right-click in the window and click [Select None].
- Scroll through the list and select the mod(s) you are interested in.
- Click [OK] at the bottom of the window.
- TES5Edit will load the mod(s) and any required master files. This process is complete when "Background Loading finished" appears in the right window.
- Now the mod can be examined:
- Click the [+] box next to the mod name. This will expand the mod information to show what is included in the ESP.
- The first line is "File Header". If there are no other lines, the ESP can safely be removed once the BSA is extracted.
Once the mod's BSA is extracted (per the previous tab's instructions), it is safe to delete both the BSA and ESP files and only use the extracted loose files. Note that any mod extracted in this manner should still be installed in the order specified on the STEP Guide.
The STEP guide includes a list of which mods have esp plugins that are redundant.
Creating Optimized Vanilla BSAs
The DDSopt Guide discusses how to optimize the Skyrim textures contained in BSAs and loose files. That guide includes optimization of Skyrim - Textures.bsa, the three High Resolution Texture Pack BSAs (which contain only textures), and the textures contained in ht eaddon DLC BSAs that contain a mixture of textures and other resources (Dawnguard.bsa, Hearthfies.bsa, and Dragonborn.bsa). Skyrim also has 8 other vanilla BSAs that do not contain textures. Prior to Skyrim version 1.8 it was possible to use BSAopt to optimize some of the vanilla BSAs that contain resources other than textures, but with the current version of Skyrim there are all too frequent problems when this is done. The full set of reasons for this are not well understood, but one of the reasons is that Skyrim no longer expects compression on many of the resource types used in Skyrim as discussed in this thread in the STEP forums.
Mod Organizer, the mod manager generally recommended for use with STEP, can automatically extract resources from BSA if necessary so even if it were feasible to optimize the non-texture BSAs it often would not provide any practical advantage. It is usually best to avoid extracting BSAs with a mod manager, particularly with Mod Organizer, since there are some known issues with some mods when this is done.
Using BSAopt to optimize non-texture BSAs is thus not recommended.
Repairing Skyrim files with Steam
Note that the following guidance is not needed when using Mod Organizer since it preserves the vanilla Skyrim files in their default location.
One reason for having copies of the original and any BSAs whose textures are optimized with DDSopt in two folders is to use when there's a corrupted Skyrim game file. If this happens, use Steam to validate the game files in the Skyrim directory. Before using the [Verify integrity of game cache] command in Steam, copy all of the files in the "Original Vanilla BSAs" folder (or whatever name was used for the folder with copies of the original BSAs) into the Data directory, overwriting any optimized ones. This step is necessary because Steam is going to replace all the game files with their original versions, and if there are different versions of the vanilla BSAs Steam will need to download all the original BSAs from scratch - a slow process if you have a low BW connection. By copying back the original BSAs the Steam validation will typically proceed quickly.
After Steam completes any necessary repairs and validates the game files, it is time to return the optimized BSAs to the "Data directory". Copy all 6 of the optimized BSAs from the "Optimized Vanilla BSAs" folder (or equivalent) into the Data directory, overwriting the 6 original BSAs. Then do the same for any additional vanilla BSAs you have.
Setup of BSAopt
To reduce potential issues on Windows OS, the following should be considered:
- The user must have Administrative access on the system (this allows BSAopt settings to be saved for later use),
- Applications installed within User Access Controlled (UAC) directories (e.g., Program Files, Program Files (x86)) may not behave as expected, so consider installing BSAopt and Steam into other directory locations (e.g., C:\Games\BSAopt and C:\Games\Steam)
- Before using BSAopt the first time make sure that step 1.B. of the current STEP guide has been completed. BSAopt uses a registry value created during this process.
- Make sure the 2012 Visual C++ redistributable from Microsoft is installed on the system; the current 32 bit and 64 bit versions are available here. When using a 64 bit version of windows installing both the 32 and 64 bit versions is recommended.
- Download BSAopt-beta (version 2.0.0) from the Nexus.
- Since BSAopt is completely portable, there is no installer, so extract the files into a folder (e.g., C:\Games\DDSopt).
- Create a shortcut to the applicable executable (32-bit or 64-bit, depending on which version of Windows is being used).
- Right click on the shortcut, go to the "Compatibility" tab, and check the box labeled "Run this program as an administrator", then click "Apply" and "OK". This ensures that BSAopt is run with administrative privileges so the chosen settings will "stick" between sessions.
- The first time BSAopt is used, it is suggested that the Game menu selection be set to Automatic.
This page describes the format of the BSAs used for the Elder Scrolls games including Skyrim, and this thread in the STEP forums has additional details on the BSA format and the options used in the vanilla Skyrim BSAs. Note that when creating BSAs BSAopt will set the flag for compressed or uncompressed, but it does not set the other flags mentioned in this post. It is not known how Skyrim uses these flags or whether there are problems with BSAs that do not have these flags set to the Bethesda default values for the resource type. Note that vanilla Bethesda BSAs containing multiple resource types (e.g., the DLC BSAs) are always uncompressed. BSAopt does not have an option to enter the types of resources included in a BSA, and if a BSA is going to include any of the resources for which the corresponding Skyrim vanilla BSA is uncompressed, then the BSAopt Compression value must be manually set to 0(off). Any BSA with a single resource type of textures, meshes, or animations resources can be a compressed BSA, but if the BSA includes any other resource type it must be uncompressed. If this is not done then there will be CTDs with Skyrim when these BSAs are used.
When creating a BSA with resources that include duplicate copies (based on the CRC of the resource) with different file/path names, BSAopt will include all of the file names in the BSA but only one copy of the resource file itself.
When BSAopt starts up it scans the last directory that was used for input. If this directory has a large set of files, it can take BSAopt a long time to complete this scan before it accepts user input. It is recommended that before closing BSAopt the upper (input) Browse window be set to a directory that has few files so the initial scan will be quick. BSAopt can also get into a loop if it failed to load an archive and the user forces BSAopt to close. For advanced users the following tip (taken from a post in the Nexus BSAopt forum) can be used:
There is this usability issue where if the binary fails to load some archive and the user forces the process to shut down, the program will resume loading the same archive next time it is started. The only way to resolve this loop is by manually changing the Input Location under the registry key:
The desired functionality would be being able to change the read-from location upon start before the binary starts "skimming".
If anyone else needs to here is how to set the path from cmd: reg ADD "HKLM\SOFTWARE\Bethesda Softworks\BSAopt" /v "Input Location" /t REG_EXPAND_SZ /d "C:\DonkeyKong.bsa" /f
BSAopt/DDSopt can be used to create BSAs, but the safest way to create BSAs for Skyrim is to use the Archive.exe program that is loaded into the Skyrim directory when the Creation Kit is installed using Steam. Arthmoor created a useful page Using BAIN and Archive.exe to Package a Skyrim Mod on using Archive.exe that includes examples and screenshots. For older Bethesda games such as Fallout New Vegas, Fallout 3, Oblivion, and Morrowind the FOMM (Fallout Mod Manager program) can be used to create BSAs. The most recent version of FOMM is available here.
The Archive.exe program has a simple GUI. The Root Dir: can be set to Data or to the root directory on one of the system drives (e.g., D:\). If RootDir: is set to Data then all the files being added to the BSA must be in the current Skyrim\Data directory. If RootDir: is set to a root directory then the resource folders being added to the BSA (e.g., the textures folder) need to be in this root directory. Folders and even individual files can be added to the BSA by dragging and dropping them onto the large window in Archive.exe. The files to be included in the BSA should be checked; the Edit menu includes an option to Check All Items which will check all the boxes. When all the files are entered and checked, click on the File menu and select Save As, then enter the name of the new BSA including the ".bsa" extension.
Installing the Creation Kit
- Highlight Library in the menu in the upper part of the Steam window by clicking on Library.
- Right-click on Library and select Tools.
- Right Click on Creation Kit in the TOOLS menu and select Properties.
- Select the LOCAL FILES tab and click on the VERIFY INTEGRITY OF TOOL CACHE button.
Steam will begin downloading and installing the Creation Kit in the Skyrim directory, and will provide a notification when this is complete.