.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 |
|---|---|---|
|
|
Core Flux resources: settings, shaders, UI metadata, material tables, report templates, icons |
|
|
Bend-tool catalog (tool geometries, die/punch definitions) |
|
|
Machine definitions: |
|
|
Lantek-specific machine overrides (higher priority than |
|
|
Bending cell definitions |
|
|
Cell component items |
|
|
Gripper definitions for bending robots |
|
|
Robot arm definitions |
|
|
Unloader definitions |
|
|
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 |
|---|---|---|
|
10 |
A |
|
20 |
A plain folder on disk — used on developer machines |
|
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):
-
Check the prefix matches.
-
Open the
ZipArchivelazily on first call. -
Strip the prefix from the name to get a ZIP entry path.
-
Try
mArchive.Open(entryPath). -
If not found and the WAD was a
.zipwith a top-level subfolder (theme packs), retry withmSubStg/entryPath. -
If still not found, check the
redirect.maptable 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 | |
|---|---|---|
|
|
|
|
|
|
|
|
|
SDK mode |
|
(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 |
|---|---|
|
|
|
|
|
|
|
|