Skip to main content

Module pack

Module pack 

Source
Expand description

The .dzpk binary game pack: one file a shipped game boots from.

game.bundle.json (see crate::bundle) ships every asset as a base64 JSON string — a ~1.33× size inflation plus a full base64 decode on boot, both painful once a project’s graphics and audio grow. A .dzpk pack is the same path → content map as raw bytes:

0..4    magic "DZPK"
4..8    u32 LE  format version (currently 1)
8..12   u32 LE  index JSON byte length
12..    index JSON (UTF-8)
…       data section: every file's raw bytes, concatenated

The index JSON is { "dotzuki": {…export metadata…}, "files": { "<path>": { "offset", "size" } } } with offset relative to the start of the data section. The dotzuki metadata is informational only — nothing enforces it at runtime.

PackFiles reads a pack through the ProjectFiles trait, so a packed project boots through the exact same LoadedProject::load_with_files path as a disk or in-memory project — native (dotzuki-player) and web (WasmRunner.fromPack) alike.

Structs§

PackFiles
A .dzpk pack held in memory, read through ProjectFiles.

Constants§

FORMAT_VERSION
The format version this crate reads and writes.
MAGIC
Pack magic bytes at offset 0.

Functions§

encode_pack
Encode files (path → raw content, iterated in sorted order) into a .dzpk pack. dotzuki_meta rides along as the informational "dotzuki" index member (the CLI stamps tool/version/export time).