FAR File Format
The following information is not based on any proprietary knowledge or restricted documentation—it was entirely derived from observation, experiment, and public information, thus it may be inaccurate or incomplete.
Analyzed by Dave Baum. Documented by Greg Noel.
The FAR format (.far files) are used to bundle (archive) multiple files together.
All numeric values in the header and manifest are stored in little-endian order (least significant byte first).
| FAR File Format | ||
| Offset | Size | Value |
| 0 | 8 | Signature |
| 8 | 4 | Version |
| 12 | 4 | Manifest offset |
| 16 | var | File 1 |
| var | var | File 2 |
| var | var | . . . |
| var | var | File N |
| var | var | Manifest |
The file format is relatively simple, just a header, followed by the contents of the archived files, and then a manifest listing the archived files.
The header is sixteen bytes long and contains some identifying information as well as how to reach the manifest.
The signature is an eight-byte string, consisting literally of "FAR!byAZ" (without the quotes).
The version is always one.
The manifest offset is the byte offset from the beginning of the file to the manifest.
The contents of the archived files are simply concatenated together without any other structure or padding. Caveat: all of the files observed have been a multiple of four in length, so it's possible that the files may be padded to a two-byte or four-byte boundary and the case has simply never been encountered.
| Manifest | ||
| Offset | Size | Value |
| 0 | 4 | Number of files (N) |
| 4 | var | Manifest entry 1 |
| var | var | Manifest entry 2 |
| var | var | . . . |
| var | var | Manifest entry N |
The manifest contains a count of the number of archived files, followed by an entry for each file. In all of the examples examined the order of the entries matches the order of the archived files, but whether this is a firm requirement or not is unknown.
| Manifest Entry | ||
| Offset | Size | Value |
| 0 | 4 | File length |
| 4 | 4 | File length |
| 8 | 4 | File offset |
| 12 | 4 | Filename length |
| 16 | var | Filename |
The file length is stored twice. Perhaps this is because some variant of FAR files supports compressed data and the fields would hold the compressed and uncompressed sizes, but this is pure speculation. The safest thing to do is to leave the fields identical.
The file offset is the byte offset from the beginning of the FAR file to the archived file.
The filename length is the number of bytes in the filename. Filenames are stored without a terminating null. For example, the filename "foo" would have a filename length of three and the entry would be nineteen bytes long in total.
If any of the above is ambiguous or confusing, just pop open a FAR file in a hex editor...a little browsing should clear matters up.
The Sims™ is a trademark of Maxis and Electronic Arts.
This page was last modified Wednesday, 27-Nov-2002 00:25:32 UTC.
