SL2 Analyzer
Read a FromSoftware .sl2 save and report what is in it
Loading...
Searching...
No Matches
sl2.bnd4 Namespace Reference

Classes

class  Bnd4Entry
 One decoded BND4 entry: its index and where its blob lives in the file. More...
 

Functions

 parse_bnd4 (data)
 Parse and validate the BND4 entry table.
 
 checksum_ok (data, entry)
 Does this entry blob carry a valid MD5 checksum wrapper?
 

Variables

int BND4_HEADER_LEN = 64
 Size of the fixed BND4 file header, in bytes.
 
int BND4_ENTRY_LEN = 32
 Size of one BND4 entry header, in bytes.
 

Detailed Description

The BND4 archive every .sl2 is, and its entry table.

Function Documentation

◆ parse_bnd4()

sl2.bnd4.parse_bnd4 (   data)

Parse and validate the BND4 entry table.

Refuses anything that is not a well-formed BND4 archive: bad magic, a silly entry count, or an entry whose blob would fall outside the file. This is the boundary check that lets everything downstream trust its offsets.

Parameters
dataThe full .sl2 bytes.
Returns
A list of Bnd4Entry.
Exceptions
SystemExiton any structural problem.

Definition at line 37 of file bnd4.py.

◆ checksum_ok()

sl2.bnd4.checksum_ok (   data,
  entry 
)

Does this entry blob carry a valid MD5 checksum wrapper?

Every Souls game prefixes each entry with MD5(rest). It is not a game discriminator (they all have it), but it is a cheap integrity check.

Parameters
dataThe full file bytes.
entryThe entry to check.
Returns
True if blob[0:16] equals the MD5 of the remaining blob bytes.

Definition at line 65 of file bnd4.py.

Variable Documentation

◆ BND4_HEADER_LEN

int sl2.bnd4.BND4_HEADER_LEN = 64

Size of the fixed BND4 file header, in bytes.

Definition at line 9 of file bnd4.py.

◆ BND4_ENTRY_LEN

int sl2.bnd4.BND4_ENTRY_LEN = 32

Size of one BND4 entry header, in bytes.

Definition at line 13 of file bnd4.py.