IFF 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 Interchange File Format (IFF) collects various resources into a single file. By convention, this format is used when the resources are related to each other in some way. Objects in The Sims are stored in IFF files.
| Several file types use the IFF file format: | ||
| .flr | This file type specializes in floors and contains the images and catalog strings for each floor. | |
| .wll | This file type specializes in walls and contains the images and catalog strings for each wall. | |
| .spf | This file type is occasionally encountered in files released directly from development. It apprears to be a way to detach graphical components (sprites, draw groups, images, and their corresponding palettes) from the rest of the information. The speculation is that it allows the development of the graphical components to proceed relatively independently of the development of the object itself. The game will act as if the .spf file is part of the corresponding .iff file. | |
| .stx | In a similar way to .spf, this file type appears to separate out some of the strings. It's possible it's intended to allow translations to occur independently of other development, except that in the very few cases encountered, not all of the strings needing translation had been extracted. | |
| .iff | And the IFF files, themselves, of course. These are the workhorses of the game, and contain objects, characters, career descriptions, control strings, options, and many other types of information. | |
All numeric values in IFF structures are big-endian (most significant byte first).
The format for an IFF file is a header followed by one or more IFF resources.
| IFF File Format | ||
| Offset | Size | Value |
| 0 | 60 | Signature |
| 60 | 4 | Offset of resource map |
| 64 | var | IFF Resource 1 |
| var | var | IFF Resource 2 |
| var | var | . . . |
| var | var | IFF Resource N |
The IFF header is 64 bytes long.
The first 60 bytes are the signature,
which consists of two strings:
"IFF FILE 2.5:TYPE FOLLOWED BY SIZE"
" JAMIE DOORNBOS & MAXIS 1"
(without the quote marks).
The first string is terminated by a null byte;
the second string is not.
The game checks all sixty bytes to determine if it's a valid IFF file.
Only the last four bytes of the header are dependent on the actual contents of the file. This value is the offset of the resource map and is the number of bytes from the begining of the file to the rsmp resource.
One of the resources, the resource map, is special. It is the mechanism that maps names/IDs to the individual resources. It is stored just like any other resource and has type 'rsmp'. The last four bytes of the header point to the offset within the file for the rsmp resource.
IFF files occasionally occur without resource maps, but this is rare. An IFF file without a resource map has a zero in the offset field.
The IFF resources are simply catenated together and continue to the end of the file. There is no count or end sentinel.
| IFF Resource | ||
| Offset | Size | Value |
| 0 | 4 | Type code |
| 4 | 4 | Size |
| 8 | 2 | ID |
| 10 | 2 | Flags |
| 12 | 64 | Name string |
| 76 | size−76 | Resource content |
A resource consists of a 76-byte header followed by the resource content.
The type code is the four-character resource type, such as STR#, FWAV, or BHAV. Each different resource type contains different types of information used by the game.
The size field is the size of the resource, including both header and contents.
The ID must be unique per resource type within a given file.
The flags field is either 0x0000 or 0x0010. The meaning of the flag bits is unknown.
The name string is not used by the game. Almost all resource types put human-readable information in this field, but a few do not. As a result, the field can contain garbage. If there is information in the field, it will be null-terminated if it is less than 64 bytes long.
The resource content is the payload. The data contained in this portion is interpreted according to the type code.
The Sims™ is a trademark of Maxis and Electronic Arts.
This page was last modified Tuesday, 05-Nov-2002 18:16:02 UTC.
