An Amiga icon file starts with the Workbench DiskObject structure as the
68000 lays it out in memory: 78 bytes, big-endian, with 16-bit alignment. Pointer fields
hold whatever address the structure had when it was saved; in the file only zero or
non-zero matters, and non-zero means the data it points to follows the header.
Fields
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | u16 | do_Magic | E3 10, WB_DISKMAGIC |
| 2 | 2 | u16 | do_Version | 1, WB_DISKVERSION |
| 4 | 44 | Gadget | do_Gadget | the icon’s size, highlight mode, image flags and revision (below) |
| 48 | 1 | u8 | do_Type | the kind of icon (below) |
| 49 | 1 | u8 | padding | 0, to align the next field |
| 50 | 4 | pointer | do_DefaultTool | non-zero: a default tool string follows. For a project, the program that opens it; for a disk, the program that copies it |
| 54 | 4 | pointer | do_ToolTypes | non-zero: tool type strings follow |
| 58 | 4 | i32 | do_CurrentX | the icon’s position in its drawer window, or 80000000 (below) |
| 62 | 4 | i32 | do_CurrentY | as above |
| 66 | 4 | pointer | do_DrawerData | non-zero: drawer window settings follow the header |
| 70 | 4 | pointer | do_ToolWindow | reserved for future use; non-zero: a string follows |
| 74 | 4 | i32 | do_StackSize | for a tool, the stack size in bytes to run it with; 0 means Workbench’s default |
What follows the header, and in what order, is on Images, drawer data and strings.
Icon types
| Value | Name | Meaning |
|---|---|---|
| 1 | WBDISK | the root of a disk: Disk.info |
| 2 | WBDRAWER | a directory |
| 3 | WBTOOL | a program |
| 4 | WBPROJECT | a data file, opened with its default tool |
| 5 | WBGARBAGE | the Trashcan directory |
| 6 | WBDEVICE | a device; used by Workbench internally |
| 7 | WBKICK | a Kickstart disk |
| 8 | WBAPPICON | an AppIcon: an object a program puts on the Workbench that is not a file, such as a print spooler |
Disks, drawers and the Trashcan have drawer data, because they open a window.
The Gadget
Workbench treats each icon as an Intuition gadget, and the file keeps the whole
44-byte Gadget structure. Offsets below are from the start of the
file.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 4 | 4 | pointer | NextGadget | ignored |
| 8 | 2 | i16 | LeftEdge | usually 0 |
| 10 | 2 | i16 | TopEdge | usually 0 |
| 12 | 2 | i16 | Width | the width of the icon’s hit area, in pixels |
| 14 | 2 | i16 | Height | the height of the hit area |
| 16 | 2 | u16 | Flags | image and highlight flags (below) |
| 18 | 2 | u16 | Activation | should be 3: RELVERIFY (1) and IMMEDIATE (2) |
| 20 | 2 | u16 | GadgetType | should be 1, BOOLGADGET |
| 22 | 4 | pointer | GadgetRender | non-zero: the normal image follows |
| 26 | 4 | pointer | SelectRender | non-zero: the selected image follows the normal one |
| 30 | 4 | pointer | GadgetText | unused; 0 |
| 34 | 4 | i32 | MutualExclude | unused; 0 |
| 38 | 4 | pointer | SpecialInfo | unused; 0 |
| 42 | 2 | u16 | GadgetID | unused; 0 |
| 44 | 4 | u32 | UserData | low byte: the icon revision (below) |
Flags
| Bits | Value | Name | Meaning for an icon |
|---|---|---|---|
| 2 | 0004 | GADGIMAGE | the gadget is drawn with an image; always set for icons |
| 1–0 | 0000 | GADGHCOMP | when selected, the icon’s area is drawn in complementary colours |
| 1–0 | 0001 | GADGBACKFILL | like complement, but without a ring around the selected image (the Intuition value GADGHBOX, renamed for icons) |
| 1–0 | 0002 | GADGHIMAGE | when selected, the second image is shown |
Revision
The low byte of UserData is the icon revision. 0 is an original
Workbench 1.x icon. 1, WB_DISKREVISION, marks an icon written by
Workbench 2.0 or later; for a disk, drawer or Trashcan it means 6 more bytes of drawer
settings follow the strings. AROS reads those extra bytes only when the revision is
exactly 1.
Position
do_CurrentX and do_CurrentY place the icon within its
drawer window, in pixels from the window’s top left. The value
80000000, NO_ICON_POSITION, tells Workbench to pick a free
place itself; an icon that was never snapshotted has it.
Example
The header of a project icon, Workbench 2 style, with two images, a default tool and no fixed position:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 0 | E3 10 00 01 | magic, version | 1 |
| 4 | 00 00 00 00 | NextGadget | |
| 8 | 00 00 00 00 00 2E 00 17 | left, top, width, height | 0, 0, 46 × 23 |
| 16 | 00 06 00 03 00 01 | flags, activation, type | GADGIMAGE + GADGHIMAGE, 3, 1 |
| 22 | two non-zero longs | render pointers | two images follow |
| 30 | 12 × 00, then 00 00 | text, exclude, special info, ID | |
| 44 | 00 00 00 01 | UserData | revision 1 |
| 48 | 04 00 | type, padding | WBPROJECT |
| 50 | non-zero, then 00 00 00 00 | default tool, tool types | a tool string follows, no tool types |
| 58 | 80 00 00 00 80 00 00 00 | position | NO_ICON_POSITION |
| 66 | 8 × 00 | drawer data, tool window | none |
| 74 | 00 00 10 00 | stack size | 4,096 bytes |