Difference between revisions of "Sims 3:DBPF"
Inge Jones (Talk | contribs) |
m (→The Index: Explicitly refer (non-link) to the Index Type subsection) |
||
(30 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{TS3AdvancedModdingHeader}} | |
− | + | ==DBPF Packages== | |
− | + | Sims 3 stores [[Sims 3:PackedFileTypes|multiple resource types]] in an archive format known by it's [http://en.wikipedia.org/wiki/Magic_number_%28programming%29 magic number] of "DBPF". On disk, these archives have one of a number of extensions: | |
− | + | {| class="wikitable" border="1" | |
− | + | |- | |
− | + | |*.package | |
− | + | |General collection of resources | |
− | + | |- | |
− | + | |*.world | |
− | + | |Resources comprising a "world" | |
− | + | |- | |
− | + | |*.dbc | |
− | + | |Collection of DBPF archives in a single archive | |
− | + | |} | |
− | + | == Package Header == | |
− | DWORD ;; | + | 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 | ||
− | The | + | == 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|Package Header]] '''excludes''' the Index Header.'' | |
− | + | ||
− | Each DWORD in | + | Each Index Entry (and the Index Header) contains a variable number of '''DWORD''' fields in the following order: |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ( | + | {|class="wikitable" |
+ | |- | ||
+ | ![[#Index Type|Bitfield]] | ||
+ | !colspan=2|Field | ||
+ | |- | ||
+ | |style="text-align: center;"|0 | ||
+ | |'''ResourceType''' | ||
+ | | | ||
+ | |- | ||
+ | |style="text-align: center;"|1 | ||
+ | |'''ResourceGroup''' | ||
+ | |Top byte is a set of flags | ||
+ | |- | ||
+ | |style="text-align: center;"|2 | ||
+ | |'''InstanceHi''' | ||
+ | | | ||
+ | |- | ||
+ | |style="text-align: center;"|3 | ||
+ | |'''InstanceLo''' | ||
+ | | | ||
+ | |- | ||
+ | |style="text-align: center;"|4 | ||
+ | |'''Chunkoffset''' | ||
+ | |Absolute location in package | ||
+ | |- | ||
+ | |style="text-align: center;"|5 | ||
+ | |'''Filesize''' (lo 31bits), '''Unknown1''' (hi bit) | ||
+ | |Length of data in package | ||
+ | |- | ||
+ | |style="text-align: center;"|6 | ||
+ | |'''Memsize''' | ||
+ | |Length of uncompressed data | ||
+ | |- | ||
+ | |style="text-align: center;"|7 | ||
+ | |'''Compressed''' (lo WORD), '''Unknown2''' (hi WORD) | ||
+ | |Compressed is '''0x0000''' or '''0xFFFF''' | ||
+ | |} | ||
− | + | === Index Type === | |
+ | |||
+ | This is a ''bitfield'' that determines which DWORD fields exist in the Index Header and the Index Entries. | ||
+ | |||
+ | |||
+ | === 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)] | ||
+ | |||
+ | |||
+ | === 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.'' | ||
+ | |||
+ | ==Chunk Compression== | ||
+ | See [[Sims 3:DBPF/Compression]]. | ||
+ | |||
+ | |||
+ | ==Credits== | ||
+ | Above documented by Peter Jones based on [[Spore:DBPF|Spore package format]] | ||
+ | |||
+ | |||
+ | {{TS3AdvancedModdingHeader}} |
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 |