Mod:Creation Kit/Fallout 4 Tools

The Fallout 4 Tools are a collection of command-line utilities developed by the Mod:Creation Kit/F4SE team. These tools can be used to extract the contents of Mod:Creation Kit/Archive Files and disassemble Mod:Creation Kit/Script Files. The source code for these utilities is included in the download.

You can download it from the official website here.

ba2extract
A command-line tool to extract the contents of  Mod:Creation Kit/Archive Files. Repacking is not supported, but there is enough information in the source code to write a repacker. The engine may still have some  support in it, but this is untested.

There are two types of ba2 Mod:Creation Kit/Archive Files: General, and Texture.

General archives can contain anything, while texture archives are optimized for storing textures. There is no significant size advantage when comparing the two, but texture archives store textures in a more intelligent way that is friendlier to the runtime texture streamer. When reading a DDS file, finding the lower resolution textures requires seeking to, and therefore decompressing most of the file. This is inefficient, because in most cases you will care about the lower resolution mips first, when the object is off in the distance. Texture archives store any mips higher than 256x256 in their own separate blocks, while the 256x256 and below are all in their own block.

Please note that the values in the DDS header are not present in the original texture archive, and were chosen for compatibility rather than accuracy. Color textures are accurate, but DXGI_FORMAT_BC5_UNORM (normal maps) and DXGI_FORMAT_BC7_UNORM are definitely wrong. Add the  command line option to use the ATI2 format in the DDS header for normal maps, giving you a file that you can open in nvidia's photoshop dds plugin. These files have not tested to work in the game. The game expects a DX10-style header with DXGI_FORMAT_BC5_UNORM explicitly specified.

Usage
The help argument will print usage information.

scriptdump
A command-line tool to disassemble  Mod:Creation Kit/Script Files. An updated version of Skyrim's scriptdump. Adds support for the new opcodes and features added in Papyrus 3.9. This is mostly intended as a code reference rather than a useful tool, unless you enjoy reading huge non-user-friendly disassemblies.

Usage
Invoking the program without any arguments will print the usage information.

Licensing
Anything deriving from this must also have its source available, and may not be used for profit in any way. Redistribution is not allowed. Learn, don't copy.