Expand description
Diablo II save-file library focused on practical editing workflows.
halbu parses, edits, and writes D2R save data while preserving unknown/raw bytes
so saves can round-trip through the library.
Supported top-level save layouts:
Parsing modes:
Strictness::Strict: fail fast on invalid/truncated dataStrictness::Lax: continue parsing and collectParseIssuevalues
§Quick start
use halbu::{CompatibilityChecks, Save, Strictness};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes = std::fs::read("Hero.d2s")?;
let parsed = Save::parse(&bytes, Strictness::Strict)?;
let mut save = parsed.save;
let target_format = save.format();
save.character.name = "Demo".to_string();
save.set_level(10);
let output = save.encode_for(target_format, CompatibilityChecks::Enforce)?;
let reparsed = Save::parse(&output, Strictness::Strict)?;
Ok(())
}Modules§
- attributes
- Attributes/stat section model and bit-level serializer. Attributes/stat section model.
- character
- Character section model and per-format codecs. Character section model and format-specific codecs.
- format
- Save-layout detection and top-level encode/decode glue. Top-level save layout detection and orchestration.
- items
- Item section placeholder/raw-preserving support. Items section placeholder support.
- npcs
- NPC section placeholder/raw-preserving support. NPC section placeholder support.
- quests
- Quest section model.
- skills
- Skill section model and default D2R name mapping. Skills section model.
- utils
- Internal byte utilities shared across sections.
- validation
- Backend-owned save validation rules and issue model.
- waypoints
- Waypoint section model.
Structs§
- Compatibility
Issue - Compatibility finding for a specific target format.
- Encode
Error - Save encoding error.
- Parse
Hard Error - Hard parse error returned when strict validation fails.
- Parse
Issue - Detailed parse diagnostic emitted in lax mode.
- Parsed
Save - Save
- Full in-memory save model.
- Save
Summary - Lightweight metadata summary extracted from header + character section only.
Enums§
- Act
- In-game act.
- Class
- Character class id used by the save format.
- Compatibility
Checks - Controls whether compatibility checks are enforced during encoding.
- Compatibility
Code - Stable identifier for a save compatibility rule.
- Difficulty
- In-game difficulty.
- Expansion
Type - Game
Edition - Issue
Kind - High-level category for a parse issue in lax mode.
- Issue
Severity - Severity classification for a parse issue in lax mode.
- Strictness
- Controls parse behavior when malformed data is found.
Functions§
- calc_
checksum - Compute save checksum using D2 save algorithm.