Module ba2::tes3

source ·
Expand description

TES III: Morrowind

“Ahh yes, we’ve been expecting you. You’ll have to be recorded before you’re officially released. There are a few ways we can do this, and the choice is yours.”

This format debuted and sunset with Morrowind. It is the simplest of all the formats, using no compression or special tricks to organize the data.

§Reading

use ba2::{
    prelude::*,
    tes3::{Archive, ArchiveKey},
};
use std::{fs, path::Path};

fn example() -> Option<()> {
    let path = Path::new("path/to/morrowind/Data Files/Morrowind.bsa");
    let archive = Archive::read(path).ok()?;
    let key: ArchiveKey = b"icons/gold.dds".into();
    let file = archive.get(&key)?;
    let mut dst = fs::File::create("gold.dds").ok()?;
    file.write(&mut dst).ok()?;
    Some(())
}

§Writing

use ba2::{
    prelude::*,
    tes3::{Archive, ArchiveKey, File},
};
use std::fs;

fn example() -> Option<()> {
    let file: File = b"Hello world!\n".into();
    let key: ArchiveKey = b"hello.txt".into();
    let archive: Archive = [(key, file)].into_iter().collect();
    let mut dst = fs::File::create("example.bsa").ok()?;
    archive.write(&mut dst).ok()?;
    Some(())
}

Structs§

  • Represents the TES3 revision of the bsa format.
  • A key for indexing into the relevant mapping.
  • Represents a file within the TES3 virtual filesystem.
  • See also Hash.
  • The underlying hash object used to uniquely identify objects within the archive.

Enums§

Functions§

Type Aliases§