.werkkzeug 4 datafile format
This is description of legendary .wz4 format. Some fields are marked as unknown, but most of them are not really unknown, some fields is reserved for use in future version of wz4 or simply are not used.
/**
* .werkkzeug 4 file format.
* (c) 2011, Sauron.
*
* Comments:
*
* 1. Project, meta and operator structures has its own version formats.
* This document describes following versions:
* - wz4project: 0x0b and 0xc;
* - wz4meta: from 0x2 to 0xd;
* - wz4block: 0x0c only.
*
* 2. All strings in this format is wide (UNICODE-16). It is recommended to
* create function for reading this kind of strings, which must to read length,
* read string, and then align stream to base 0x04.
*/
// .werkkzeug 4 project
struct wz4project {
// start tag (always '<<<<')
uint32 startTag;
// format ID (always 0x00040007)
uint32 formatId;
// format version
uint32 formatVersion;
if (formatVersion<=0x0b) {
// page metadata
struct wz4pageMeta[nrPages] pageMeta;
// ..
uint32 unknown0;
};
// demo metadata
struct wz4meta meta;
// number of pages
uint32 nrPages;
if (formatVersion>=0x0c) {
// page metadata
struct wz4pageMeta[nrPages] pageMeta;
// ..
uint32 unknown0;
};
// pages
struct wz4page[nrPages] pages;
// ..
uint32 unknown1;
// it must be equals to nrPages
uint32 nrPageCaches;
// page name cache
struct wz4pageCache[nrPageCaches] pageCache;
}
// .werkkzeug 4 demo meta data
struct wz4meta {
// start tag (always '<<<<')
uint32 startTag;
// format ID (always 0x0002001f)
uint32 formatId;
// format version
uint32 formatVersion;
// length of project path
uint32 projectPathLength;
// project path
wchar[projectPathLength] projectPath;
align 4;
// length of demo title
uint32 demoNameLength;
// demo title
wchar[demoNameLength] demoName;
align 4;
if (formatVersion>=0x0b) {
// project ID
uint32 projectID;
// ID on www.farbrausch.de
uint32 projectSiteID;
};
// still unknown
if (formatVersion>=0x03) {
uint32 unknown2;
};
if (formatVersion>=0x04) {
uint32 unknown3;
};
if (formatVersion>=0x05) {
// unknown
uint32 unknown04;
// length of soundtrack filename
uint32 sountrackLength;
// soundtrack filename
wchar[soundtrackLength] soundtrack;
align 4;
};
// still unknown
if (formatVersion>=0x0a) {
uint32 unknown6;
};
// still unknown
if (formatVersion>=0x09) {
uint32 unknown7;
};
if (formatVersion>=0x06) {
// default screen resolution
uint32 xresolution;
uint32 yresolution;
};
if (formatVersion>=0x07) {
// length of last page name
uint32 lastPageLength;
// name of page which has been opened recently
wchar[lastPageLength] lastPage;
align 4;
};
if (formatVersion>=0x08) {
// unknown length
uint32 unknown8;
// unknown string
wchar[unknown8] unknown8s;
align 4;
};
// "beat per minute" structures
if () { // ?
struct wz4bpm[32] bpms;
};
if (formatVersion>=0x0d) {
// still unknown
uint32 frequency;
uint32 unknown9;
uint32 unknown10;
};
// end tag (always '>>>>')
uint32 endTag;
}
// "Beat per minute" structure
struct wz4bpm {
float32 unknown01;
float32 unknown02;
float32 unknown03;
float32 unknown04;
}
// .werkkzeug 4 page descriptor
struct wz4pageMeta {
// number of operators layered on this page
uint32 nrBlocks;
uint32 unknown0;
uint32 unknown1;
uint32 unknown2;
uint32 unknown3;
}
// .werkkzeug 4 page
struct wz4page {
// length of page name
uint32 nameLength;
// page name
wchar[nameLength] name;
align 4;
// ???
uint32[3] unknown;
// blocks
struct block[] blocks;
}
// .werkkzeug 4 operator (outer)
struct wz4block {
// position
uint32 xpos;
uint32 ypos;
// width of block
uint32 width;
// still unknown
uint32 unknown011;
// bypass flag
uint32 bypass;
// still unknown
uint32 unknown012;
// contents
struct wz4operator operator;
}
// .werkkzeug 4 operator (inner)
struct wz4operator {
// start tag (always '<<<<')
uint32 startTag;
// format ID (always 0x00040008)
uint32 formatId;
// format version
uint32 formatVersion;
// length of operator name
uint32 nameLength;
// operator name
wchar[nameLength] name;
align 4;
// length of opclass name
uint32 opclassLength;
// opclass name
wchar[opclassLength] opclass;
align 4;
// length of operator category
uint32 categoryLength;
// operator category
wchar[categoryLength] category;
align 4;
//
uint32 unknown02;
// number of regular parameters
uint32 nrDwords;
// regular parameters
uint8[dwords*4] dwords;
// number of string parameters
uint32 nrStrings;
// string parameters
struct wz4stringPara[nrStrings] strings;
// number of links
uint32 nrLinks;
// links
struct wz4link[nrLinks] links;
// size of element of array (measured in dwords)
uint32 arrayParaSize;
// number of elements of array
uint32 arrayParaCount;
// still unknown
uint32[3] unknown04;
// end tag (always '>>>>')
uint32 endTag;
}
// .werkkzeug 4 string parameter
struct wz4stringPara {
// length
uint32 valueLength;
wchar[valueLength] value;
align 4;
}
// .werkkzeug 4 link struct
struct wz4link {
// length of linked parameter name
uint32 nameLength;
// linked parameter name
wchar[nameLength] name;
align 4;
// page contains linked parameter
uint32 page;
// enables alternative (internal) link
uint32 hasBackground;
// internal link
struct wz4operator[hasBackground] background;
}
// .werkkzeug 4 page cache entry
struct wz4pageCache {
uint32 pageNameLength;
wchar[pageNameLength] pageName;
align 4;
}