АКЦИЯ от www.R3.ru - хостинг сайтов 72р. в месяц. Домен в подарок!

.werkkzeug 1 file format


.werkkzeug 1.201 has two file formats: .k1 (datafile) and .kk1 (exported datafile).

The first one contains project information, and it is the main format of the .werkkzeug1. The second one is «exported» format, it cannot be imported back to .werkkzeug and created to use with player kkino. It is much more complicated and contains smartass data types, so I at this time cannot explain it here.

If you try to open werkkzeug1.exe with WinHEX or other hex editor, you can find .werkkzeug's "operator scheme". This file describes parameter of every operator class in .werkkzeug. If you need parser for this scheme, please contact me. By the way, .werkkzeug 3 main executable does not contain this information in textual format.

There were seven versions of .k1 format. This page describes 7th version.

.k1 file format description

File format described in the special form, it is not C language.

 *  .werkkzeug 1.201 file format
 *  (c) 2010, Sauron
 *  Comments:
 *  1. It is recommended to malloc() 256 bytes for wzblock->para. 
 *  2. Structure of wzblock->para described in configuration file, 
 *     contained in werkkzeug1.exe. The format is easy to understand.
 *  3. It is recommended to malloc() 4*4=16 bytes for wzblock->links.
 *  4. BLOB (binary large object) contains music (V2M, XM, OGG), text in comment,
 *     XSI mesh in XSI operator. It is used because wzblock->para is limited to 
 *     256 bytes.
 *  5. .werkkzeug saves wzblock->para from first bytes to last non-zero byte.
 *     The same idea is used to save anims and links.

const {
    // Operator has a name
    // Operator has a BLOB (binary large object)

// .werkkzeug 1.201 project
struct wzproject {
    // Magic number 'MODK' (K Document Object Model)
    uint32 magic;
    // Version of format (7)
    uint32 version;
    // Number of operators (on all pages)
    uint32 nblocks;
    // Number of pages
    uint32 npages;
    // Unknown
    uint32[4] unknown0;
    // Unknown
    uint32[4] unknown1;
    // Operators
    struct block[nblocks] blocks;
    // Pages
    struct page[npages] page;

// Operator structure
struct block {
    // X position on the page
    uint8 xpos;
    // Y position on the page
    uint8 ypos;
    // Number of page
    uint8 page;
    // Width of block
    uint8 width;
    // Number of links
    uint8 nlinks;
    // Number of "anim" structures
    uint8 nanims;
    // Length of wzblock->para in dwords
    uint8 dwords;
    // Flags
    uint8 flags;
    // Operator class ID (see configuraton)
    uint32 cid;
    if (flags & WZ_HAS_NAME) {
        // Operator name
        char[32] name;
    // Links
    uint32 links[nlinks];
    // "Anim" structs
    struct anim[nanims] anims;
    // Parameters of the operator (see configuraton)
    uint8[dwords*4] para;
    if (flags & WZ_HAS_BLOB) {
        // Size of BLOB
        uint32 blobsize;
        // Binary data
        uint8[blobsize] blob;
        // Align to begin of the next dword
        align 4;

// Descriptor of animated parameters
struct anim {
    // Animation is enabled if this != 0
    unsigned long animated;
    if (animated != 0) {
        // Anim channel
        uint32 channel;
        // Mask (if type of parameter is structured)
        uint32 mask;
        uint32 components;
        // Amplify
        uint32 amplify;
        // Inital values
        uint32[4] para;

// Page descriptor
struct page {
    // Page name (null-terminated, but limited to 32 bytes)
    char[32] name;

parameter types

There are 19 parameter types in .werkkzeug 1.

# Symbolic name Description Storage size
in .k1 in .kk1
1 PT_INT Unsigned integer 32 4 4
2 PT_POWER This is x in 2x. 4 ?
3 PT_FLOAT Float (32 bits) 4 4
4 PT_CYCLE Enumerated parameter, stored as uint32. 4 ?
5 PT_BOOL Boolean value (true/false). ? ?
6 PT_STRING Null-terminated single-line string. MAX ?
7 PT_FXY Float32 vector {x,y} 8 ?
8 PT_FXYZ Float32 vector {x,y,z} 12 ?
9 PT_FXYXY Float32 vector {x1,y1,x2,y2} 16
10 PT_RGB RGB color. 4 3
11 PT_RGBA RGB color with opacity. 4 4
12 PT_LINK It is link to other operator. It stored not in wzblock->para, but in wzblock->links. ?
13 PT_IXY Vector of uint32 {x,y} 8 ?
14 PT_IXYZ Vector of uint32 {x,y,z} 12 ?
15 PT_IXYXY Vector of uint32 {x1,y1,x2,y2} 16 ?
16 PT_FILE Filename for the file stored in BLOB. Usually filename does not packs to the .kk1 file MAX
17 PT_TEXT Null-terminated multi-line string. MAX ?
18 PT_LABEL It is not really parameter, it is only subheader in the parameter window.
19 PT_BLOBTEXT This parameter is stored in BLOB, not in wzblock->para. ?

NT — null-terminated string.

MAX — to determine storage size see the Max field in operator scheme.


No reverse engineering (disassembling or decompilation) of executable files had took part while preparing this documentation. Author is not responsible for using this documentation.