Skip to main content

Crate dayzmake_core

Crate dayzmake_core 

Source
Expand description

File format handling for DayZ: PBO archives, rapified configs, P3D models, PAA textures and BI keys and signatures, plus the preprocessor and __EVAL evaluator the config pipeline needs.

§Modules

  • pbo: read, build, pack, unpack and selectively read PBO archives (pbo::PBO).
  • extract: extract a whole install or mod into one tree by prefix.
  • config, preprocess: config parsing, rapification and derapification.
  • p3d: MLOD model reading and inspection (ODOL is only detected there).
  • odol: binarized ODOL v56 models, read for what a listing needs (LODs, textures, materials, proxies).
  • paa: PAA textures, with conversion from and to images (feature image).
  • sign: BI keys and .bisign signatures (feature sign).
  • navmesh: DayZ navmesh generation: data-server client, tile builder and .nm reader and writer (feature navmesh).
  • binarize: BI’s binarize.exe, natively on Windows or under Proton.
  • warning: the warnings library calls raise.

The library never prints and never exits the process; every reader treats its input as hostile and returns errors instead of panicking.

§Warnings

Calls that can warn take a &mut dyn warning::WarningSink. warning::Warnings is the ready-made sink: it collects warning::Warnings (and plain notes), can mute warnings by name and caps repeats. Warnings are never global: give every thread or job its own sink and its warnings stay with it.

§Binarizing

binarize::Binarizer owns the Proton sandbox, if any. Pass it to pbo::PBO::from_directory and call binarize::Binarizer::close when done so the sandbox is removed and its warnings reach your sink; dropping it also cleans up, but cannot report.

§Features

  • sign (default): the sign module.
  • image (default): Paa::from_dynamic_image, Paa::to_dynamic_image and the re-exported image crate.
  • navmesh (default): the navmesh module.

§Licence

GPL-2.0-or-later, inherited from armake2. Projects under GPLv3 or AGPL-3.0 may link it.

§Example

Generate a key, convert an image to PAA, pack and sign a mod folder, and verify the result:

use std::fs::{self, File};
use dayzmake_core::image::{DynamicImage, RgbaImage};
use dayzmake_core::paa::{Paa, PaaFormat};
use dayzmake_core::pbo::{PBO, PackOptions};
use dayzmake_core::sign::{BIPrivateKey, BISignVersion, signature_path};
use dayzmake_core::warning::Warnings;

let tmp = tempfile::tempdir()?;
let stage = tmp.path().join("stage");
fs::create_dir_all(stage.join("data"))?;

// A satellite tile as DXT1.
let image = DynamicImage::ImageRgba8(RgbaImage::new(64, 64));
let paa = Paa::from_dynamic_image(&image, PaaFormat::Dxt1)?;
paa.write(&mut File::create(stage.join("data/s_0.paa"))?)?;

// Pack, sign, verify. Each job has its own warnings.
let mut warnings = Warnings::new();
let pbo = PBO::from_directory(&stage, &PackOptions::pack(), None, &mut warnings)?;
let key = BIPrivateKey::generate(1024, "example".to_string())?;
let signature = key.sign(&pbo, BISignVersion::V3)?;
let pbo_path = tmp.path().join("example.pbo");
pbo.write(&mut File::create(&pbo_path)?)?;
signature.write(&mut File::create(signature_path(&pbo_path, key.name())?)?)?;
key.to_public_key()?.verify(&pbo, &signature)?;

Re-exports§

pub use image;image

Modules§

binarize
Binarization through BI’s binarize.exe (Windows or Proton). Functions for calling BI’s binarize.exe (on Windows, or under Proton on Linux)
config
Config parsing and rapification/derapification. Functions for rapifying and derapifying Arma configs
error
Error types and the error! macro.
extract
Extracts a whole DayZ install, a mod or a single PBO into one tree organised by prefix.
fileid
File identity (the same file under different spellings). File identity: whether two paths name the same file, whatever their spelling.
navmeshnavmesh
Navmesh generation for DayZ: the data-server client and wire format, captures, the Recast/Detour tile builder, the .nm reader and writer, and the generator that ties them together (generate).
odol
Binarized ODOL v56 model reading. Reading binarized ODOL models (version 56), the format of every .p3d in the DayZ game files.
p3d
P3D model reading and inspection. Reading, writing and inspecting P3D models.
paa
PAA texture conversion. Functions for working with PAA files.
pbo
PBO archive packing, unpacking and inspection.
preprocess
Config preprocessing (macros, includes, conditionals). Functions for preprocessing Arma configs and scripts
signsign
BI signature (.bisign) creation and verification. Functions for creating and working with BI keys and signatures
warning
Warnings raised by library calls and the sinks that receive them. Warnings raised by the library. A function that can warn takes a WarningSink; the library never prints, and nothing is shared between calls.

Macros§

error
Creates an std::io::Error with ErrorKind::Other from a formatted message.