The DFF File Format

This document describes the DFF file format so that developers may use the format in their own projects.


Tag - Every DFF file begins with the four characters %DF2 to identify it as a DFF file. (In case you're wondering why it's %DF2 and not %DFF: %DFF is an earlier version of DFF that is very limited and no longer used; Resplendence automatically converts such files to %DF2 files. You should never come across a %DFF file, so you don't need to worry about it.)

Count - The tag is followed by a Motorola-style long integer (4 bytes) counting the number of items in the DFF file. The count is one-based; 1 means exactly one item, 0 means no items at all, and -1 means 232-1 items.

Array of Item Headers - Each header is exactly 20 bytes, and there are exactly Count many.

Symbol - Each header starts with an eight character type code, similar to a Macintosh resource type.
ID Number - The symbol is followed by the low short integer (2 bytes) of the ID number.
Data Type - A Motorola-style short integer (2 bytes); no longer used. Applications may use this field for whatever they want.
Flags - 2 bytes of binary flags.
        0 (LSB of 2nd byte) - Locked
        1                   - System
        2                   - Preload
        3                   - Purgable
        4                   - Came From File
        5                   - Came From Mac Resource
        6                   - Hidden
        7 (MSB of 2nd byte) - Disabled
        8 (LSB of 1st byte) - Protected
        9                   - Fixed
        10                  - Reserved
        11                  - Compressed
        12                  - Application Use 1
        13                  - Application Use 2
        14                  - Application Use 3
        15(MSB of 1st byte) - Application Use 4

ID Number High - The flags are followed by the high short integer (2 bytes) of the ID number.
Length - An unsigned Motorola-style long integer (4 bytes) counting the length of the item's data in the data block.

Array of Item Names - The headers are followed by a list of Pascal strings; the items' names. There are exactly Count many strings.

Array of Item Data - The last part of a DFF file contains each item's raw data, right after the previous with no separating characters whatsoever. The headers can be used to calculate the position and length of a specific DFF item's data.


If you need any more help understanding the format, feel free to ask me. You can send an e-mail to me@kreativekorp.cjb.net. Pre-made DFF-handling code is available for RealBasic, HyperCard (not recommended), and C++.