Skip to main content

Crate halbu

Crate halbu 

Source
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:

§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§

CompatibilityIssue
Compatibility finding for a specific target format.
EncodeError
Save encoding error.
ParseHardError
Hard parse error returned when strict validation fails.
ParseIssue
Detailed parse diagnostic emitted in lax mode.
ParsedSave
Save
Full in-memory save model.
SaveSummary
Lightweight metadata summary extracted from header + character section only.

Enums§

Act
In-game act.
Class
Character class id used by the save format.
CompatibilityChecks
Controls whether compatibility checks are enforced during encoding.
CompatibilityCode
Stable identifier for a save compatibility rule.
Difficulty
In-game difficulty.
ExpansionType
GameEdition
IssueKind
High-level category for a parse issue in lax mode.
IssueSeverity
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.