The UESPWiki – Your source for The Elder Scrolls since 1995
TES4 BSA Layout[edit]
File Structure[edit]
Name |
Type/Size |
Info |
tag |
char[4] |
"BSA\x00" |
version |
uint32 |
103/104/105 |
header size |
uint32 |
0x24 |
archive flags |
uint32 |
Bit |
Description |
1 << 0 |
directory strings |
1 << 1 |
file strings |
1 << 2 |
compressed |
1 << 3 |
retain directory names |
1 << 4 |
retain file names |
1 << 5 |
retain file name offsets |
1 << 6 |
xbox archive |
1 << 7 |
retain strings during startup |
v104/v105 only |
1 << 8 |
embedded file names |
1 << 9 |
xbox compressed (only works on v104) |
|
|
directory count |
uint32 |
|
file count |
uint32 |
|
directory names length |
uint32 |
includes null terminators |
file names length |
uint32 |
includes null terminators |
archive type |
uint16 |
Bit |
Description |
1 << 0 |
meshes |
1 << 1 |
textures |
1 << 2 |
menus |
1 << 3 |
sounds |
1 << 4 |
voices |
1 << 5 |
shaders |
1 << 6 |
trees |
1 << 7 |
fonts |
1 << 8 |
misc |
|
padding |
uint16 |
|
Directory Entry[edit]
Name |
Type/Size |
Info |
hash |
Hash |
|
file count |
uint32 |
|
|
file entries offset |
uint32 |
subtract "file names length" to get the absolute offset |
|
File Block[edit]
Name |
Type/Size |
Info |
directory name |
bzstring |
only present if "directory strings" is set |
files |
File Entry[...] |
|
File Entry[edit]
Name |
Type/Size |
Info |
hash |
Hash |
|
size |
uint32 |
bit 1 << 30 indicates the file has the opposite compression of the archive
bit 1 << 31 indicates if the file has been checked yet (internal usage)
|
offset |
uint32 |
bit 1 << 31 is used as a flag |
File Data[edit]
Name |
Type/Size |
Info |
v104/v105 only |
name |
bstring |
only present if "embedded file names" is set |
|
decompressed size |
uint32 |
only present if the file is compressed |
data |
uint8[...] |
|
Name |
Type/Size |
Info |
last |
uint8 |
|
last2 |
uint8 |
|
length |
uint8 |
|
first |
uint8 |
|
crc |
uint32 |
|
TES4 BSL Layout[edit]
File Structure[edit]
Directory Entry[edit]
Name |
Type/Size |
Info |
file count |
uint32 |
|
directory name |
dzstring |
|
File Entry[edit]
Name |
Type/Size |
Info |
size |
uint32 |
bits 1 << 31 and 1 << 30 are reserved for flags
see also File Entry -> size
|
last write time |
uint64 |
see also FILETIME |
file name |
dzstring |
|
BA2 Layout[edit]
Files within BA2s are unsorted.
File Structure[edit]
Name |
Type/Size |
Info |
header |
Header |
|
chunks |
Chunk[file count] |
|
file data |
uint8[...] |
|
strings |
wstring[file count] |
|
Name |
Type/Size |
Info |
magic |
char[4] |
"BTDX" |
version |
uint32 |
1/2/3/7/8 |
contents format |
char[4] |
"GNRL" / "DX10" / "GNMF" |
file count |
uint32 |
|
string table offset |
uint64 |
absolute offset, 0 if not present |
v2/v3 only |
unknown |
uint64 |
always set to 1, immediately discarded on load |
|
v3 only |
compression format |
uint32 |
lz4 block format if present and set to 3, else zlib |
|
Name |
Type/Size |
Info |
id |
Hash |
|
data file index |
uint8 |
|
chunk count |
uint8 |
|
chunk header size |
uint16 |
GNRL: 0x10
DX10: 0x18
GNMF: 0x30
|
DX10 Only |
height |
uint16 |
|
width |
uint16 |
|
mip count |
uint8 |
|
format |
uint8 |
|
flags |
uint8 |
|
tile mode |
uint8 |
|
|
GNMF Only |
metadata |
uint32[8] |
see also GNF |
|
Chunk Data[edit]
Name |
Type/Size |
Info |
data file offset |
uint64 |
absolute offset |
compressed size |
uint32 |
0 if not compressed |
decompressed size |
uint32 |
|
DX10/GNMF Only |
mip first |
uint16 |
|
mip last |
uint16 |
|
|
sentinel |
uint32 |
0xBAADF00D |
Name |
Type/Size |
Info |
file |
uint32 |
|
extension |
uint32 |
|
directory |
uint32 |
|