Expand description
§bl4
Borderlands 4 save editor library - encryption, decryption, and parsing.
This library provides functionality to:
- Decrypt and encrypt Borderlands 4 .sav files
- Parse decrypted YAML save data
- Decode item serials (weapons, equipment, etc.)
- Modify save data (level, currency, inventory, etc.)
§Example
use std::fs;
let encrypted = fs::read("1.sav")?;
let steam_id = "76561197960521364";
// Decrypt and parse save file
let yaml_data = bl4::decrypt_sav(&encrypted, steam_id)?;
let mut save = bl4::SaveFile::from_yaml(&yaml_data)?;
// Query and modify save data
println!("Character: {:?}", save.get_character_name());
println!("Cash: {:?}", save.get_cash());
save.set_cash(999999)?;
save.set_character_name("NewName")?;
// Re-encrypt and save
let modified_yaml = save.to_yaml()?;
let encrypted = bl4::encrypt_sav(&modified_yaml, steam_id)?;
fs::write("1.sav", encrypted)?;Modules§
- backup
- Smart backup management with hash tracking.
- crypto
- Borderlands 4 save file encryption and decryption
- manifest
- Manifest data for Borderlands 4 items
- parts
- Parts lookup for Borderlands 4 items
- reference
- Reference data for Borderlands 4 items
- save
- Save file parsing, querying, and modification.
- serial
- Item serial number decoding for Borderlands 4
Structs§
- Change
Set - Represents a set of changes to apply to a save file
- Element
Type - Element type information
- Gear
Type - Gear type information
- Item
Serial - Decoded item serial information
- Legendary
Item - Known legendary item
- Manufacturer
- Manufacturer information
- Rarity
Tier - Rarity tier information
- Save
File - Represents a loaded save file with query/modify capabilities
- Serial
Format - Serial format configuration
- State
Flags - State flags bitmask helper for inventory items.
- Weapon
Type - Weapon type information
Enums§
- Backup
Error - Crypto
Error - Errors that can occur during encryption/decryption
- Save
Error - Serial
Error - Errors that can occur during serial decoding
Constants§
- ELEMENT_
TYPES - All element types
- GEAR_
TYPES - All gear types
- KNOWN_
LEGENDARIES - Known legendary items
- MANUFACTURERS
- All manufacturers
- RARITY_
TIERS - All rarity tiers in order
- WEAPON_
TYPES - All weapon types
Functions§
- all_
categories - Get all category IDs and names
- all_
manufacturers - Get all manufacturer codes and names
- category_
name - category_
name_ for_ type - Get category name with item type awareness For r-type (shields), uses shield-specific category map to avoid conflicts with weapons
- decrypt_
sav - Decrypt a .sav file to YAML bytes
- derive_
key - Derive an AES-256 key from a Steam ID
- element_
by_ code - Get element by code
- encrypt_
sav - Encrypt YAML bytes to a .sav file
- gear_
type_ by_ code - Get gear type by code
- item_
type_ name - Get a human-readable description for a type character
- legendary_
by_ name - Find legendary by display name
- level_
from_ code - Decode level from token (level code)
- manifest_
stats - Get statistics about loaded manifest data
- manufacturer_
by_ code - Get manufacturer by code
- manufacturer_
name - manufacturer_
name_ by_ code - Get manufacturer name by code (convenience function)
- part_
name - Get a part name by category and index
- rarity_
by_ code - Get rarity tier by code
- rarity_
by_ tier - Get rarity tier by tier number
- serial_
format - Get the serial format for a type character
- serial_
id_ to_ parts_ category - Convert serial ID (first varint) to parts database category
- smart_
backup - Perform smart backup if needed
- stat_
description - Get stat description by name
- update_
after_ edit - Update metadata after editing a save file
- weapon_
type_ by_ code - Get weapon type by code