.afdesign file format¶
Values are stored in little-endian format
I haven’t seen anything that actually looks like a flags field, usually there are a few boolean feilds so idk what some of these fields are for
Header¶
Size: 68 bytes? Variable length?
name | Count | Type | Description |
---|---|---|---|
signature | 1 | uint32_t | Signature? |
version | Poseinfo | ||
unused | 4 | char | Prsn? (Personas?) |
info | #Inf - File offsets? | ||
FAT_offset | 1 | uint64_t | See Notes on offset |
FAT_length | See Notes on offset | ||
zlib_length | See Notes on offset | ||
unused | See Notes on offset | ||
creation | uint32_t | Date | |
unused | for some reason zero | ||
fat_entries | uint64_t | Fat or info sections | |
fil_entries | Number of #fil secions? |
#FAT section¶
Ok so, the data ends in the file name or something? a short will indicate the length of the filename?
It looks like this section will define the offset of the #Fil sections and their length
Looks like a entry starts with one byte, a 64 bit nubmer and a timestap
It looks like each section starts with 1 byte for flags, then a 8 byte timestamp
↓ This might be the FAT header? ↓
name | count | Type | description |
---|---|---|---|
flags | 1 | uint64_t | Flags? |
date | uint32_t | UNIX timestamp | |
flags | more flags | ||
offsets | 4 | uint64_t | offsets |
fat_length | 1 | uint16_t | The length of the fat section |
idk | 3 | char | |
idk | 2 |
^ I am pretty sure this is misaligned, there are more pad/flag bytes than I want, so I’m probably missing something. Also doc.dat occurs at the end of the file so this might be half a entry?
Also, the last offset could very well be the number of entries
Sometimes the timestamp seems to be wildly off, but was the file creation date for the doc.dat
it looks like only one file will have a reliable name (“doc.dat”), and other files will be in a directory structure (d/a, d/c, b/a...)
name | count | type | description |
---|---|---|---|
idk | 1 | uint32_t | idk. It’s always zero? |
idk_Again | bool | looks like a bitfield or a number... | |
data_offset | uint64_t | The offset of the data | |
real_len | uncompressed length | ||
data_len | The lengh of the chunk | ||
date | uint32_t | the date | |
compressed | bool | if the chunk is compressed | |
fname_len | uint16_t | The filename length | |
filename | fname_len | char | The filename |
doc.dat¶
It looks like the tags are strings, but where stored in 32-bit integers when saved. The names of each chunk are reversed and are each characters long.
They were probably stored something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <stdio.h>
#include <stdint.h>
int main(){
union {
uint32_t tag;
char name[4];
};
strncpy(name, "Prsn", 4);
printf("0x%X\n", tag);
// On a little endian system, this should output
// 0x6E737250
return 0;
}
|
It looks like the capitalization of the chunks do not matter to indicate flags, like the PNG format does.. So that’s cool.
SprB (Document properties?)¶
Total size: 36 bytes
name | count | type | description |
---|---|---|---|
BrpS | 1 | uint32_t | Dimension info |
? | 2 | double | Idk? looks to be zero usually Maybe some offset info like x and y offset maybe w×h+x+y |
width | 1 | Width | |
height | Height |
Opac¶
Total size: 8 bytes
name | count | type | Descrpition |
---|---|---|---|
Opac | 1 | uint32_t | Tag |
opacity | float | The opacity of the element |
Visi¶
Total Size: 5 Bytes
name | count | type | Descrpition |
---|---|---|---|
Visi | 1 | uint32_t | The tag |
visible | bool | visibility of the element |
Desc¶
Total Size: variable (smallest is 6 bytes)
name | count | type | Descrpition |
---|---|---|---|
Desc | 1 | uint32_t | The tag |
size | uint16_t | Length of the name | |
name | size | char | The name of the Desc |
Mrgn¶
This field is speculation, I haven’t gotten time to look at it yet But, based on the size of the data I am assuming.
Total size: 36bytes
name | count | type | Descrpition |
---|---|---|---|
Mrgn | 1 | char | The Tag |
left | double | left margin | |
top | top margin | ||
right | right margin | ||
bottom | bottom margin |
Data¶
Total Size: variable (smallest is 6 bytes)
name | count | type | Descrpition |
---|---|---|---|
Data | 1 | uint32_t | The tag |
size | uint16_t | Length of the data | |
data | size | byte | The data |
Root¶
Speculation, again. Presumably the offset of the root node Total Size: 8 bytes
name | count | type | Descrpition |
---|---|---|---|
Root | 1 | uint32_t | The tag |
offset | Offset to Root node |
NgoL (Logarithm in base N?)¶
Ok, to be honest I have no clue what this means. I don’t know how long it is, as I can’t figure out where the length is specified
UOrg (???)¶
User organization? maybe the layers?
BmpW (Bitmap width)¶
Width of a bitmap
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | WpmB |
width | 1 | uint32_t | Width |
BmpH (Bitmap Height)¶
Height of a bitmap
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | HpmB |
height | 1 | uint32_t | Height |
Bitm (Bitmap)¶
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | Bitm |
flag | bool | boolean | |
size? | uint32_t |
Frmt (Format)¶
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | Frmt |
flag | 1 | unit32_t | Format? |
Shap (Shape)¶
Shape info? I tried creating a test document with several shapes. But there were only one of these....
Stri (String)¶
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | Stri |
FOpc (F? Opacity)¶
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | FOpc |
opacity | 1 | float |
Blnd (Blend)¶
Layer mode? Blending mode? Blendy blend blend.
XMPD (XMP Data)¶
The XMP Data
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | XMPD |
length | 1 | uint32_t | Length of the XMP data |
data | length | char | XML String |
Symb (Symbol)¶
Post (Postscript)¶
Post script name of a font
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | Post |
length | 1 | uint32_t | Length of the font name |
name | length | char |
Famy (Font Family)¶
Font family of a font
name | count | type | Descrpition |
---|---|---|---|
tag | 1 | uint32_t | Famy |
length | 1 | uint32_t | Length of the font family name |
Family | length | char |
Rect (Rect)¶
Rectangle, 4 32-bit integers, order x, y, w, h
Chld (Children)¶
Looks like it indicates how many children a field has