Batch BA2

by KazumaKuun·vV2.1·Updated 2024-04-18

A simple Python script to automatically unpack small BA2 files in the mods directory. Fully configurable. For those who find themselves over the BA2 limit.

About this mod Machine translation

A simple Python script to automatically unpack small BA2 files in the mods directory. Fully configurable. For those who find themselves over the BA2 limit.

Author description:

Here is a simple Python script that extracts all small non-textured ba2 files so that you don't exceed the ba2 limit.

In case you didn't know, the Fallout 4 engine has a hard limit of 256 non-textured BA2 archives that can be loaded (sauce) into your game. If you have more, your game will most likely crash on load, behave erratically, and all kinds of fun stuff.

It has been suggested that Buffout users can use ba2 restriction bypass. However, while this trick allows the game to load, sometimes you get broken atlases (textures) anyway. The best solution is to reduce your ba2 count.

For me, this meant manually extracting hundreds of small ba2 files and backing them up in case something went wrong. oops! This helper script hopes to free you from all the manual work. It only takes 1 minute of simple configuration and the rest is taken care of :)

usage

You will need the following dependencies:

1、Python 3

All recent Python 3 versions should work fine.

  • BSA Browser

Both the installer and portable versions will work; however, if you use the installer version, make sure to check "Install CLI executable".

Before running the script, make sure to edit unpack.py according to your settings. All configurable items are listed at the top of the file. See the next section for details.

Then, run the following command in cmd/Windows Terminal/Any Terminal:

Extraction and backup will occur automatically.

Configuration

The following parameters can be configured according to your needs. Parameters with an asterisk (*) next to them must be changed before running the script. python./unpack.py

·mod_path*: This should be the path to the mod folder in the mod manager. In MO2 it's the Open > Open Mods folder. In Vortex it's Open > Open Mod Staging Folder. Technically, you can provide the Fallout 4 root folder (if you're not using any mod manager), but I haven't tested this method.

· bsab_exe_path*: This should point directly to your installed BSA browser bsab.exe. Make sure it's actually "bsab.exe" and not "BSA Browser.exe"

·Threshold: This is the maximum size (in bytes) of the BSA to be extracted. So, 5 * 1024 * 1024 gives 5MB, and 200 * 1024 gives 200KB. Any files larger than this value will not be touched.

·Suffix: This is the file suffix that should be extracted (case insensitive). In most cases, the default value should be fine. For example, "main.ba2" matches all files ending with "main.ba2" (abcmod - main.ba2, xyzmod - main.ba2, etc.).

Note: You do not need to extract texture BA2 files, they are not restricted by BSA.

·Ignore: If you have any files that should not be extracted, you can list them here (case insensitive). Use standard Python string array format.

Example: ['abcmod - main.ba2', 'xyzmod - main.ba2']

future plans

While this script worked, it was hastily thrown together in an hour and was missing some features I wanted. If I had time to research these areas I would consider them.

Intelligently set thresholds to extract the “just right” ba2

More robust code with features like error handling

Make it interactive?

Your feedback is welcome, please let me know if you have any suggestions or bugs.

You can view the source code for this script on GitHub.

Image source:

AlexxEG for BSA Browser

Update V2.1:

The previous upload was missing some files, this version should include them.

The archive includes BSA Browser and Python, no additional dependencies need to be installed.

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. There is no universal mod manager for this game: some mods replace game files directly, some go into a game-specific Mods folder, and some need a game-specific community loader or tool first — follow the bundled readme.
  3. Place the files exactly as the readme says; mods with listed dependencies need those installed too.
  4. Launch the game to confirm it loaded; some games require enabling mods in settings or an in-game mod menu.

Install locations vary a lot between games and mods — the bundled readme is the most reliable guide.

File & checksum

Filename
3DMmods_Batch BA2 拆包机 - 避免 BA2 限制 (更新)
File size
14.4 MiB