DBPF

From Niotso Wiki
Jump to: navigation, search
Database-Packed File
Type of format Archive
Filename extension .dbpf, .package, .dat, .sc4 (SimCity 4)
Magic number DBPF
Byte order Little endian
First appeared The Sims Online (2002)
The database-packed file (DBPF) is a format used to store data for pretty much all Maxis games after The Sims, including The Sims Online (the first appearance of this format), SimCity 4, The Sims 2, Spore, MySims, The Sims 3, SimCity 2013, and The Sims 4.

Version occurrence[edit]

Game DBPF archive version DBPF index version
The Sims Online 1.0 7.0
SimCity 4 1.0 7.0
The Sims 2 1.0, 1.1 7.1
MySims 2.0 n/a
Spore 2.0 n/a
The Sims 3 2.0 n/a
SimCity 2013 3.0 n/a
The Sims 4 2.0 n/a

Header[edit]

  • Magic number - A 4-byte string (not null-terminated), consisting of the ASCII characters "DBPF"
  • Major version - A 4-byte unsigned integer specifying the DBPF major version number
  • Minor version - A 4-byte unsigned integer specifying the DBPF minor version number
  • Reserved - Unknown 12 bytes set to 0
  • Date created (1.0 only) - A 4-byte Unix timestamp specifying when the archive was created
  • Date modified (1.0 only) - A 4-byte Unix timestamp specifying when the archive was last modified
  • Index major version (<2.0 only) - A 4-byte unsigned integer specifying the major version of the index format used in the archive
  • Index entry count - A 4-byte unsigned integer specifying the number of entries contained in the index
  • Index offset (<2.0 only) - A 4-byte unsigned integer specifying the offset from the beginning of the archive to the first entry of the index
  • Index size - A 4-byte unsigned integer specifying the size in bytes of the index
  • Trash Index entry count (<2.0 only) - A 4-byte unsigned integer specifying the number of trash entries in the Trash Index of the archive
  • Trash Index offset (<2.0 only) - A 4-byte unsigned integer specifying the offset from the beginning of the archive to the first entry of the Trash Index; should be 0 if there is no Trash Index
  • Trash Index size (<2.0 only) - A 4-byte unsigned integer specifying the size in bytes of the Trash Index
  • Index Minor Version (<2.0 only) - A 4-byte unsigned integer specifying the minor version of the index format used in the archive
  • Index Offset (2.0 only) - 4-byte unsigned integer
  • Unknown (2.0 only) - 4-byte unsigned integer
  • Reserved - 32 bytes of padding are traditionally used here

Index[edit]

There are three types of DBPF indexes: the regular index, the Trash Index, and the DIR Index. All indexes follow the same format as defined by the index version specified in the header.

Entry structure[edit]

  • Type ID - A 4-byte integer describing what type of file is held
  • Group ID - A 4-byte integer identifying what resource group the file belongs to
  • Instance ID - A 4-byte ID assigned to the file which, together with the Type ID and the second instance ID (if applicable), is assumed to be unique all throughout the game
  • Second instance ID (Index >=7.1 only) - A 4-byte integer specifying the high-order Instance ID of the entry
  • File offset - A 4-byte unsigned integer specifying the offset to the entry's data from the beginning of the archive
  • File size - A 4-byte unsigned integer specifying the size of the entry's data

Regular Index[edit]

The regular index contains all regular files in the archive. It is made up of a successive series of entries, as many as defined by the Index entry count parameter in the archive's header.

Trash Index[edit]

The Trash Index may be used in all DBPF archive versions before 2.0. The Trash Index contains the list of all files marked deleted in the archive. It is made up of a successive series of entries, as many as defined by the Trash Index entry count parameter in the archive's header.

DIR Index[edit]

All DBPF archives that use compression against their entry data make use of an additional DIR Index, which is itself stored as an entry inside the regular index of the archive under the Type ID 0xE86B1EEF.

The DIR Index duplicates all the entries found in both the regular index and the trash index but specifies the decompressed file size of each entry for the File size parameter, rather than compressed.