XFL - What are the ./bin/*.dat files?
Asked Answered
S

3

5

Uncompressed Adobe's Flash XFL format still keeps a lot of content compressed. Does anybody know specification of these binary *.dat files?

Stubblefield answered 2/11, 2010 at 22:50 Comment(0)
S
8

The *.dat files stores various type of media content. What I can say so far is, that:

  1. images are stored as JPEGs without additional info. That means just renaming *.dat is enough to get the original image. Such a files starts with #{FFD8}
  2. images are stored in some internal RAW format. Using reverse engineering I can say that for example bitmap with raw pixel data #{FFFFFFFF} (1x1) is stored as:
0305     ;raw bitmap identifier?
0400     ;length of decompressed row data
0100     ;width
0100     ;height
00000000 ;unknown
14000000 ;width in twips
00000000 ;unknown
14000000 ;height in twips
00       ;some flags - 01=image has transparency

variant 1.:
01       ;compressed data flag
0200     ;length of compressed chunk
7801     ;compressed chunk
0A00     ;length of compressed chunk
FBFFFFFF7F0009FA03FD ;compressed chunk
0000     ;end of compressed stream

variant 2.:
00       ;data are uncompressed
00000000
00000000 ;unknown data - always zero?
FFFFFFFF ;raw uncompressed ARGB data

where the decompressed data are pixels with storage type: ARGB, so with the size info it should be enough to get the image from it. It's using ZLIB compression (www.zlib.net) Flash is using compression level 1, but it's possible to use any level (but it's not necessary as the sources are normally compressed altogether.

  1. SOUNDS are stored in DAT files in RAW format, it's possible to make WAV files from it easily using the information from the DOMSoundItem.
  2. The rest is unknown yet.

The rest of the *.dat types is unknown yet.

The name of the DAT files is important as well! Flash somehow gets numbers from the name, using name like checksum in hexadecimal form (9BB551621D3E2138FECA2F04469531D7.dat) crashes Flash! Using chars like [_.-] will cause the content unloadable as well (but not crash)

Stubblefield answered 2/11, 2010 at 23:7 Comment(3)
With CS5.5 I have found, that image in DAT file can start with 0303 - I don't know what it means yet:/Stubblefield
Hey Oldes, great info. Wondering if you ever got any further with this.Puny
Unfortunately no, I ended at state, which was enough for my needs. Also these days I usually don't need to extract images from XFL, I rather use JSFL script to export images or sounds from opened document.Stubblefield
S
0

The names of the files are not in their own significant, but you of course need to find the references to the file names in other (usually xml) files.

Storytelling answered 17/2, 2012 at 13:57 Comment(1)
Maybe there are not significant, but you cannot use any name if you want to create a new one - import a new image into XFL automaticallyStubblefield
H
0

About 2 years ago I created a tool in Python that converts proprietary 2d format to fla, and the first specification helped me a lot when creating it, but I am going to rewrite this tool in c++ and so I wanted to know this format deeper to make my code cleaner and more reliable , and I have some findings. I'll just leave this updated spec here

03       ; Media Type. 03 - Bitmap. 01 - Sound.
05/03    ; Depth type. 5 - 16bit, 3 - 8bit.
0400     ; Length of decompressed row data
0100     ; Width
0100     ; Height

The next 16 bytes are read into one RECT structure which is represented in twips. 
It is usually used in image rasterization.
00000000 ; RECT x
14000000 ; RECT width
00000000 ; RECT y
14000000 ; RECT height

00       ; Has alpha boolean
IF image depth is 8bit then this is where the palette structure starts.
This works almost the same as a PLTE chunk in PNG
FB00     ; Number of entries from 1 to 256
FFFFFF...; Entries data. Length of each 3 bytes if alpha boolean is 0, otherwise length is 4 bytes.  

01       ; Data compressed boolean. Data is compressed if: "theClipContext"(?) is null and data length is greater than 0x6400000

Compressed Data:

0020    ; ZLib header length
7801    ; ZLib header
After this, data will simulate a stream by dividing the compressed data into separate blocks.
They are read until block length is 0.
0A00    ; Compressed chunk length
FBFF..  ; Compressed chunk data

I can’t say anything about uncompressed data because my Animate doesn’t save my samples as uncompressed. But most likely they have the same block structure as compressed data, but without a zlib header.

Also, names for these files are generated using this string: "M @0 @1" where @0 is document media element counter and @1 is unix epoch time of the last modification

Hammerskjold answered 16/5 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.