# krayoristine/ozpacker-rs architecture

> Architecture diagram of the GitHub repository krayoristine/ozpacker-rs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krayoristine/ozpacker-rs
- Repository: https://github.com/krayoristine/ozpacker-rs

## Overview

OzPacker is a Windows-focused Warcraft III map packing CLI. The visible workflow accepts map and configuration paths, validates configuration and MPQ input, and uses the StormLib wrapper for archive operations. The README also documents map-building, Lua preprocessing, optimization, and protection capabilities, but their implementation is not represented in the sampled source; they are shown as documented product stages without inferred connections. Source evidence is limited, so the graph omits unverified runtime links.

Main entry points: [`src/main.rs`](https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs) (CLI entry), [`src/storm/mod.rs`](https://github.com/krayoristine/ozpacker-rs/blob/main/src/storm/mod.rs) (MPQ wrapper), [`src/storm/bindings.rs`](https://github.com/krayoristine/ozpacker-rs/blob/main/src/storm/bindings.rs) (StormLib FFI), [`src/mimalloc/mod.rs`](https://github.com/krayoristine/ozpacker-rs/blob/main/src/mimalloc/mod.rs) (Global allocator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and configuration"]
  node_entry["CLI entry<br/>[main.rs]"]
  node_config["Configuration<br/>[config.rs]"]
end

subgraph group_archive["Map archives"]
  node_mpq["MPQ wrapper<br/>[mod.rs]"]
  node_stormffi["StormLib FFI<br/>[bindings.rs]"]
  node_stormlib["StormLib archive engine<br/>[StormLib.h]"]
end

subgraph group_memory["Memory allocation"]
  node_allocator["Global allocator<br/>[mod.rs]"]
  node_mibindings["Allocator bindings<br/>[mod.rs]"]
  node_milib["mimalloc runtime<br/>[mimalloc.h]"]
end

subgraph group_capabilities["Documented capabilities"]
  node_mapbuild["Map building<br/>[main.rs]"]
  node_luaprep["Lua preprocessing<br/>[main.rs]"]
  node_mapopt["Map optimization<br/>[main.rs]"]
  node_mapprotect["Map protection<br/>[main.rs]"]
end

node_user(("CLI user"))

node_user -->|"provides inputs"| node_entry
node_entry -->|"loads and verifies"| node_config
node_entry -->|"validates archive"| node_mpq
node_mpq -->|"calls archive API"| node_stormffi
node_stormffi -->|"binds native API"| node_stormlib
node_entry -->|"sets global allocator"| node_allocator
node_allocator -->|"calls allocation API"| node_mibindings
node_mibindings -->|"declares native API"| node_milib
node_mapbuild -->|"includes preprocessing"| node_luaprep
node_mapbuild -->|"includes optimization"| node_mapopt
node_mapbuild -->|"includes protection"| node_mapprotect

click node_entry "https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs"
click node_config "https://github.com/krayoristine/ozpacker-rs/blob/main/src/config.rs"
click node_mpq "https://github.com/krayoristine/ozpacker-rs/blob/main/src/storm/mod.rs"
click node_stormffi "https://github.com/krayoristine/ozpacker-rs/blob/main/src/storm/bindings.rs"
click node_stormlib "https://github.com/krayoristine/ozpacker-rs/blob/main/external/stormlib/StormLib.h"
click node_allocator "https://github.com/krayoristine/ozpacker-rs/blob/main/src/mimalloc/mod.rs"
click node_mibindings "https://github.com/krayoristine/ozpacker-rs/blob/main/src/mimalloc/bindings/mod.rs"
click node_milib "https://github.com/krayoristine/ozpacker-rs/blob/main/external/mimalloc/include/mimalloc.h"
click node_mapbuild "https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs"
click node_luaprep "https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs"
click node_mapopt "https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs"
click node_mapprotect "https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_config,node_user toneBlue
class node_mpq,node_stormffi,node_stormlib toneAmber
class node_allocator,node_mibindings,node_milib toneMint
class node_mapbuild,node_luaprep,node_mapopt,node_mapprotect toneRose
```

## Components

### CLI and configuration

- [CLI entry](https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs): `src/main.rs`
- [Configuration](https://github.com/krayoristine/ozpacker-rs/blob/main/src/config.rs): `src/config.rs`

### Map archives

- [MPQ wrapper](https://github.com/krayoristine/ozpacker-rs/blob/main/src/storm/mod.rs): `src/storm/mod.rs`
- [StormLib FFI](https://github.com/krayoristine/ozpacker-rs/blob/main/src/storm/bindings.rs): `src/storm/bindings.rs`
- [StormLib archive engine](https://github.com/krayoristine/ozpacker-rs/blob/main/external/stormlib/StormLib.h): `external/stormlib/StormLib.h`

### Memory allocation

- [Global allocator](https://github.com/krayoristine/ozpacker-rs/blob/main/src/mimalloc/mod.rs): `src/mimalloc/mod.rs`
- [Allocator bindings](https://github.com/krayoristine/ozpacker-rs/blob/main/src/mimalloc/bindings/mod.rs): `src/mimalloc/bindings/mod.rs`
- [mimalloc runtime](https://github.com/krayoristine/ozpacker-rs/blob/main/external/mimalloc/include/mimalloc.h): `external/mimalloc/include/mimalloc.h`

### Documented capabilities

- [Map building](https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs): `src/main.rs`
- [Lua preprocessing](https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs): `src/main.rs`
- [Map optimization](https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs): `src/main.rs`
- [Map protection](https://github.com/krayoristine/ozpacker-rs/blob/main/src/main.rs): `src/main.rs`

### Other components

- **CLI user**

## Connections

- CLI user → CLI entry: provides inputs (evidence: `src/main.rs`)
- CLI entry → Configuration: loads and verifies (evidence: `src/main.rs`)
- CLI entry → MPQ wrapper: validates archive (evidence: `src/main.rs`)
- MPQ wrapper → StormLib FFI: calls archive API (evidence: `src/storm/mod.rs`)
- StormLib FFI → StormLib archive engine: binds native API (evidence: `src/storm/bindings.rs`)
- CLI entry → Global allocator: sets global allocator (evidence: `src/main.rs`)
- Global allocator → Allocator bindings: calls allocation API (evidence: `src/mimalloc/mod.rs`)
- Allocator bindings → mimalloc runtime: declares native API (evidence: `src/mimalloc/bindings/mod.rs`)
- Map building → Lua preprocessing: includes preprocessing (evidence: `README.md`)
- Map building → Map optimization: includes optimization (evidence: `README.md`)
- Map building → Map protection: includes protection (evidence: `README.md`)
