Skip to content

alexzielenski/artFileTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

artFileTool for Mountain Lion

artFileTool is a command line tool for encoding and decoding the ArtFile.bin found in /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/ArtFile.bin. It its current state it can flawlessly decode the ArtFile.bin into a directory. Command line usage is still in the works.

You can find the SArtFile.bin counterpart here!

Specification

The file format for the ArtFile.bin is in five parts:

  • Master header
  • Tag descriptors
  • Tag names
  • File Descriptors
  • Art Headers + File Data

Note: It is vital that the order of the resources in the ArtFile.bin is identical to the one in the original. It seems that the system expects some sort of tag order

Master Header

The master header includes some vital information about the ArtFile.bin like file amounts and offsets. It is contained in the first 24 bytes of data in the file.

Offset Length Purpose
0 2 Amount of image resouces included in the ArtFile
2 2 Bit-depth of the image data. Should be 8.
4 4 Amount of tags in the artfile. Tags are strings used to describe each resource
8 4 Offset of the tag descriptors. Should be 24, right after the master header
12 4 Offset of the tag names. These are detailed below.
16 4 Offset for the file descriptors.
20 4 Offset for the file data.

Tag descriptors

There is a list of tag descriptors directly after the master offset. Each descriptor is 8 bytes.

Offset Length Purpose
0 4 Offset for the name of the tag relative to the offset specified in the master header
4 4 Tag index. A unique number assigned to the tag to be reference by the file descriptors. The first index should start at 1.

Tag Names

There is a list of tag names directly after the tag descriptors (the offset is in the master header) which includes all of the tags in alphabetical order separated by a byte of 0.

File Descriptors

The file descriptor is a 12 byte group of data descripting a resource in the file. It contains information about the offset of the data as well as a list of the tags that apply to it.

Offset Length Purpose
0 4 Offset of the file data for this tag relative to the one specified in the master header.
4 8 8 bytes of 1 byte indices matching the tag for this resource, if not all 8 spots are used the rest is filled in with 0.

At the end of the file descriptor a few bytes of 0 should be appended until the total size of the file at that point is a multiple of 4

Art Headers

A 44-byte group of data (104 bytes on Lion and below, but who cares?) describing the image resource following it. The header is located at the file data offset specified by its corresponding descriptor. The real image data follows this header in Unpremultiplied major-row indexed, ARGB (BGRA because it is litle endian) data. The image data is just a single image all connected nicely.

CoreUI splits these images up into parts–they can be 1, 3, 6, or 9 (usually). The art header describes all of the parts used to split the image up into pieces for CoreUI.

Offset Length Purpose
0 2 The amount of 'rows' in the image resource.
2 2 The amount of 'columns' in the image resource.
4 24 3 groups of 4 groups of 2-byte ints representing a rectangle with x, y, width, height, respectively. The purpose for these rectangles is not yet clear. Essentially this part of the data is just 3 rectangles
28 2 Unknown. Believed to be a type or state of the control used by the system.
30 6 2-byte height of row 0, 1, and 2, respectively
36 6 2-byte width of column 0, 1, and 2, respectively
42 2 Unknown. Referred two as buffer1 within the code. For all of the files so far but 3, the hex of this value is DD 77 which is 30685 in decimal or if you split it up into 2 shorts, it is 221, 119

To get the length of the image data that follows the header, you must add up the widths of the rows and add the heights of the columns. The length of the image data is 4 * width * height.

License

artFileTool is license under the Simplified BSD License – modified to forbid any commercial redistribution because I would prefer people not make commercial applications based off of this code. The theming community is supposed to be open and as the name implies: A community. The license in its entirety applies to all works in this GitHub repository and reproduced in its entirety as follows:

Copyright (c) 2011-2012, Alex Zielenski
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    * Any redistribution, use, or modification is done solely for personal benefit and not for any commercial purpose or for monetary gain

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.