Difference between revisions of "Sims 3:DBPF"
(→The Index: Nearly total rewrite. I got bitten and misled by the original description. Careful analysis of a lot of .package files (and testing using code) has been performed.) |
m (→The Index: Explicitly refer (non-link) to the Index Type subsection) |
||
Line 32: | Line 32: | ||
If ''position'' is not zero, at that position: | If ''position'' is not zero, at that position: | ||
− | DWORD ;; Index Type | + | DWORD ;; Index Type, see subsection below |
<Index Header> | <Index Header> | ||
<Index Entry>[number of index entries] | <Index Entry>[number of index entries] |
Latest revision as of 18:00, 10 February 2015
Modding Reference by Category | |
---|---|
Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference |
Contents |
[edit] DBPF Packages
Sims 3 stores multiple resource types in an archive format known by it's magic number of "DBPF". On disk, these archives have one of a number of extensions:
*.package | General collection of resources |
*.world | Resources comprising a "world" |
*.dbc | Collection of DBPF archives in a single archive |
[edit] Package Header
96 bytes: "standard" DBPF 2.0 format; DBBF not seen; DBPP is encrypted.
DWORD magic ;; "DBPF" DWORD major ;; 2 DWORD minor ;; 0 BYTE[24] unknown1 DWORD ;; number of index entries - if zero, size and position also zero BYTE[4] unknown2 DWORD ;; size of index on disk in bytes BYTE[12] unknown3 DWORD index_version ;; always 3 DWORD ;; position of index (absolute) BYTE[28] unknown4
[edit] The Index
If position is not zero, at that position:
DWORD ;; Index Type, see subsection below <Index Header> <Index Entry>[number of index entries]
Note: The [number of index entries] value in the Package Header excludes the Index Header.
Each Index Entry (and the Index Header) contains a variable number of DWORD fields in the following order:
Bitfield | Field | |
---|---|---|
0 | ResourceType | |
1 | ResourceGroup | Top byte is a set of flags |
2 | InstanceHi | |
3 | InstanceLo | |
4 | Chunkoffset | Absolute location in package |
5 | Filesize (lo 31bits), Unknown1 (hi bit) | Length of data in package |
6 | Memsize | Length of uncompressed data |
7 | Compressed (lo WORD), Unknown2 (hi WORD) | Compressed is 0x0000 or 0xFFFF |
[edit] Index Type
This is a bitfield that determines which DWORD fields exist in the Index Header and the Index Entries.
[edit] Index Header
The header provides the data that is constant to all entries, essentially a kind of compression. However not all data is valid to be included in the index header for all entries.
DWORD[(for each SET bit in Index Type)]
[edit] Index Entry
DWORD[(for each UNSET bits in Index Type)]
Note: Because of the different treatment of the bitfield, fields that exist in the Index Header will NOT exist in all Index Entries, and vice versa.
[edit] Chunk Compression
[edit] Credits
Above documented by Peter Jones based on Spore package format
Modding Reference by Category | |
---|---|
Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference |