Metamation Developer Notes

  • Developer Notes
  • Resource Map
  • Tools
    • Code Formatting
    • Configuring Git
    • Assignments
    • Testing with Windows Sandbox
    • Single Binary Applications
    • Self-Updating Applications
  • Flux Workflow
    • Flux Workflow
    • Flux Development Style Guide
    • Release notes for Flux
    • SonarCloud analysis for Flux
    • Build a Flux SDK Program
    • Shipping Flux
    • Flux.Test
      • BasicBendAuto Test
      • LaserAuto.cs Detailed Documentation
      • Laserexample:Test1
  • Technical Notes
    • File formats
      • .FX File Format
      • Au(Gold) streams
      • .GEO File Format
      • .LST File Format
      • .LST file - technology
      • .BNC File Format
      • .WAD Files: Flux Resource Packages
      • .Curl Files: ASCII config information
    • Folders App
      • Data\Bendtools
      • Data\Machines
    • FluxCode
      • Welcome & Repo Map
      • Architecture & System Context
      • Subsystem *Bend* (Press Brake)
      • Subsystem *BCell* (Bend Cell Automation)
      • API Maps
      • Data Model Catalog
      • Design Patterns -- A Reader's Guide
      • Tests and Golden Paths
      • Guided Code Tours
      • CAM Glossary with Code Mapping
      • Assignments
      • Flux Onboarding Handbook
    • Data flow
      • Part
        • Part.Dwg
        • Part.Load
        • Part.Load to Part.Dwg
      • BendTech.cs
      • Bend Technology
      • Laser Cutting Technology
    • LTS (Long term support mechanism)
    • Machine ID Scheme
  • FluxTester
    • Commands and Scripts
    • Command Cookbook
    • Script Commands
    • BendTooling.cs Test Inventory
    • LaserTooling.cs Test Steps
    • Fluxtester Recipe Book
    • Nesting.cs Overview
    • Nesting.cs Recipe Book
    • Job.cs Overview
    • Job.cs Recipe Book
  • Software license
  • 3d party software
    • Python
  • Documentation
    • Bento documentation
      • Structure of a Bento page
      • Attributes
    • Software
      • Software Requirement
      • Installation
      • Git workflow for documentation contributors
    • Quick start guide
    • Workflow
      • Roles and responsibilities
      • Analyze
      • Edit
      • Proofread
      • Pre-Publish
      • Publish
      • Release cycle
      • Information required for Documentation Team
      • Checklist for Documenters
    • Styleguide
    • Flavoring
    • Translation
      • Ordering translation for a new document
    • Citations
    • Annotation
Technical Notes
/
File formats
/
.WAD Files: Flux Resource Packages

.WAD Files: Flux Resource Packages

A .wad file is Flux’s shipping format for read-only resource packages. Internally it is a standard ZIP archive — no custom binary header, no special encoding. The .wad extension is a naming convention that distinguishes these immutable distribution bundles from other ZIP files (.fx, .ftjob, etc.) used by Flux.

Entry point: Base/StmLocator.cs — class ZipStmLocator Registration: Core/FX.cs:895 — method FX.Init()

Purpose

Flux ships with a set of WAD files that together contain all of its read-only resources:

WAD file Prefix Contents

flux.wad

wad:

Core Flux resources: settings, shaders, UI metadata, material tables, report templates, icons

BendTools.wad

btool:

Bend-tool catalog (tool geometries, die/punch definitions)

Machines.wad

mc:

Machine definitions: machine.curl, mechanisms, 3D models for all press-brakes

LantekMachines.wad

mc:

Lantek-specific machine overrides (higher priority than Machines.wad)

Cells.wad

cell:

Bending cell definitions

CellItems.wad

cellitem:

Cell component items

BGrippers.wad

bgrip:

Gripper definitions for bending robots

Robots.wad

robot:

Robot arm definitions

Unloaders.wad

unloader:

Unloader definitions

FoldTools.wad

ftool:

Fold-tool definitions

WAD files are never written at runtime. Flux only reads from them. Any user- or machine-specific data (custom tools, adjusted machine settings, recent files) goes to the home: locator which points to a writable folder on disk.

File Structure

A WAD file is a ZIP archive created with standard deflate compression. Open any .wad file with 7-Zip, unzip, or Python’s zipfile to inspect its contents.

BendTools.wad  (ZIP archive)
 ├── redirect.map          ← optional deduplication index (plain text)
 ├── 100/
 │    ├── tool.curl        ← tool definition (CURL format)
 │    └── model.igs        ← 3D geometry
 ├── 101/
 │    ├── tool.curl
 │    └── model.igs        ← may be → redirected to 100/model.igs
 └── …

The ZIP entry paths directly correspond to the virtual path after the prefix is stripped. A request for btool:101/model.igs opens the ZIP entry 101/model.igs.

The redirect.map File

When many resources inside a WAD share identical content (e.g. fifty machine variants that all use the same 3D body model), the StreamlineWAD developer tool removes the duplicate files and writes a redirect.map file instead. This cuts WAD size substantially.

redirect.map is a plain UTF-8 text file at the root of the ZIP:

101/model.igs|100/model.igs
200/model.igs|100/model.igs

Each line is VIRTUAL_PATH|CANONICAL_PATH. When a request for VIRTUAL_PATH would otherwise produce a file-not-found, ZipStmLocator looks it up in the redirect table and opens CANONICAL_PATH instead.

File: Base/StmLocator.cs:224 — ZipStmLocator.ReadRedirectionMap()

// Called once at construction time; stored in mRemap dictionary
internal static Dictionary<string, string> ReadRedirectionMap (Stream stm) {
    var dict = new Dictionary<string, string> (StringComparer.OrdinalIgnoreCase);
    using var sr = new StreamReader (stm);
    for (;;) {
        string s = sr.ReadLine (); if (s == null) break;
        var w = s.Split ('|');
        if (w.Length == 2) dict[w[0].Trim ()] = w[1].Trim ();
    }
    return dict;
}

The Stream-Locator Abstraction

WAD files plug into Flux through the IStmLocator interface. All resource access goes through BA.OpenRead(name) / FX.OpenRead(name), which walks a priority-ordered list of registered locators until one returns a stream.

File: Base/StmLocator.cs:21 — IStmLocator interface

public interface IStmLocator {
    int Priority { get; }          // lower number = checked first
    string Prefix { get; }         // e.g. "wad:", "mc:", "btool:"
    Stream Open (string name, FileAccess access);
    IEnumerable<string> EnumFiles (string spec);
    IList<string> EnumFolders (string spec);
    DateTime? GetTime (string name);
}

Three concrete implementations exist:

Class Default priority Backed by

ZipStmLocator

10

A .wad (or any .zip) file on disk — used in release builds

FileStmLocator

20

A plain folder on disk — used on developer machines

ResStmLocator

20

Deflate-compressed data embedded in the assembly — used for headless/MetaCAM sessions

Lower priority numbers are tried first, so WAD files (priority 10) are checked before the writable home: folders (priority 20). User overrides work by registering a FileStmLocator with priority 5 for the same prefix, placing it ahead of the WAD.

File: Core/FX.cs:982-984

// User's own bend tools take priority over the WAD catalog
AddStmLocator (new FileStmLocator ("btool:", dataDir + "/BendTools") { Priority = 5 });
AddStmLocator (new FileStmLocator ("ftool:", dataDir + "/FoldTools") { Priority = 5 });
AddStmLocator (new FileStmLocator ("mc:",    dataDir + "/Machine")   { Priority = 5 });

Opening a Resource

// Caller code — identical whether backed by WAD or folder:
using var stm = FX.OpenRead ("mc:125/machine.curl");
using var stm = FX.OpenRead ("wad:core/settings.curl");
using var stm = FX.OpenRead ("btool:1234/tool.curl");

Inside ZipStmLocator.Open() (file: Base/StmLocator.cs:287):

  1. Check the prefix matches.

  2. Open the ZipArchive lazily on first call.

  3. Strip the prefix from the name to get a ZIP entry path.

  4. Try mArchive.Open(entryPath).

  5. If not found and the WAD was a .zip with a top-level subfolder (theme packs), retry with mSubStg/entryPath.

  6. If still not found, check the redirect.map table and retry with the canonical path.

The (zip) suffix on a name is a special marker: if the name ends in (zip), only ZipStmLocator will match it, never FileStmLocator. This lets callers force reading from the WAD even when a file-system override exists (used for settings.curl inside machine ZIPs).

Developer vs. Release Mode

File: Core/FX.cs:904-920

On developer machines (Permit.Developer == true) Flux registers FileStmLocator instances pointing to folders instead of ZIP files. This allows editing resources without repacking a WAD.

Developer build Release build

wad:

FileStmLocator → %FLUXWAD% (default: X:\Wad)

ZipStmLocator → flux.wad next to the executable

mc:

FileStmLocator → %FLUXDATA%\Archive\Machines

ZipStmLocator → Machines.wad

btool:

FileStmLocator → %FLUXDATA%\Archive\BendTools

ZipStmLocator → BendTools.wad

SDK mode

ZipStmLocator → path from %SDKWAD% env var

(same)

The calling code is unaware of the difference — all access is via FX.OpenRead().

Creating and Maintaining WAD Files

WAD files are built by zipping the resource folder. Two developer console commands manage the deduplication step:

StreamlineWAD <dir>

File: Console/Commands.cs:508

Scans a folder for duplicate files (byte-for-byte identical content), deletes the duplicates, and writes a redirect.map mapping each deleted path to its surviving canonical copy. Run before zipping the folder into a WAD to minimise archive size.

Console> StreamlineWAD X:\Wad\Archive\Machines
5823 files, 3241 unique

UnstreamlineWAD <dir>

File: Console/Commands.cs:707

The reverse: reads redirect.map and copies the canonical file back to every redirected path, restoring the full directory structure. Useful when you need to edit a file that was deduplicated away.

Key Files

File Responsibility

Base/StmLocator.cs

IStmLocator interface; ZipStmLocator, FileStmLocator, ResStmLocator implementations

Core/FX.cs:895

FX.Init() — registers all WAD files and directory locators at startup

Base/Base.cs

BA.OpenRead() / BA.AddStmLocator() — the global locator chain

Console/Commands.cs

StreamlineWAD, UnstreamlineWAD developer tools

Contents

  • Purpose
  • File Structure
  • The redirect.map File
  • The Stream-Locator Abstraction
  • Opening a Resource
  • Developer vs. Release Mode
  • Creating and Maintaining WAD Files
  • StreamlineWAD <dir>
  • UnstreamlineWAD <dir>
  • Key Files
.BNC File Format .Curl Files: ASCII config information

      Copyright © 2025 TRUMPF Metamation. All rights reserved.

    Compiled by Bento