Difference between revisions of "Sims 3:DBPF"
m |
m (Wikification) |
||
Line 1: | Line 1: | ||
+ | == Package Header == | ||
+ | 96 bytes: "standard" DBPF 2.0 format; DBBF not seen; DPPF is encrypted. | ||
<pre> | <pre> | ||
− | |||
− | |||
− | |||
− | |||
DWORD magic ;; "DBPF" | DWORD magic ;; "DBPF" | ||
DWORD major ;; 2 | DWORD major ;; 2 | ||
Line 13: | Line 11: | ||
BYTE[12] unknown3 | BYTE[12] unknown3 | ||
DWORD index_version ;; always 3 | DWORD index_version ;; always 3 | ||
− | DWORD ;; position of index (absolute) | + | DWORD ;; ''position'' of index (absolute) |
BYTE[28] unknown4 | BYTE[28] unknown4 | ||
− | + | </pre> | |
− | If position is not zero, at that position: | + | == The Index == |
− | DWORD ;; Index type | + | If ''position'' is not zero, at that position: |
+ | <pre>DWORD ;; Index type</pre> | ||
The count of set bits in the index type is the number of additional DWORD entries in index header: | The count of set bits in the index type is the number of additional DWORD entries in index header: | ||
− | DWORD[(for each bit in Index type)] | + | <pre>DWORD[(for each bit in Index type)]</pre> |
The number of DWORDs in an actual index entry is 8. The entry is stored in two parts - the index header and then the entry on disk. The header provides the data that is constant to all entries, essentially a kind of compression. | The number of DWORDs in an actual index entry is 8. The entry is stored in two parts - the index header and then the entry on disk. The header provides the data that is constant to all entries, essentially a kind of compression. | ||
;; For each index entry on disk: | ;; For each index entry on disk: | ||
− | DWORD[(8 - number of bits in Index type)] | + | <pre>DWORD[(8 - number of bits in Index type)]</pre> |
Each DWORD in an actual index entry can either come from the header or from the index entry on disk, depending on the bits set in the index type. The order of the DWORDs in an index entry is (with matching bit number): | Each DWORD in an actual index entry can either come from the header or from the index entry on disk, depending on the bits set in the index type. The order of the DWORDs in an index entry is (with matching bit number): | ||
− | + | {| class="wikitable" border="1" | |
− | + | |- | |
− | + | |0 | |
− | + | |ResourceType | |
− | + | | | |
− | + | |- | |
− | + | |1 | |
− | + | |ResourceGroup | |
+ | | | ||
+ | |- | ||
+ | |2 | ||
+ | |InstanceHi | ||
+ | | | ||
+ | |- | ||
+ | |3 | ||
+ | |InstanceLo | ||
+ | | | ||
+ | |- | ||
+ | |4 | ||
+ | |Chunkoffset | ||
+ | |Absolute location in package | ||
+ | |- | ||
+ | |5 | ||
+ | |Filesize | ||
+ | |Length of data in package | ||
+ | |- | ||
+ | |6 | ||
+ | |Memsize | ||
+ | |Length of uncompressed data | ||
+ | |- | ||
+ | |7 | ||
+ | |Compressed(lo WORD) , Unknown2(hi WORD) | ||
+ | |Compressed is 0x0000 or 0xFFFF | ||
+ | |} | ||
(That's a total of 32 bytes per entry.) | (That's a total of 32 bytes per entry.) | ||
Line 41: | Line 66: | ||
By Peter Jones | By Peter Jones | ||
− | |||
− |
Revision as of 09:40, 9 June 2009
Package Header
96 bytes: "standard" DBPF 2.0 format; DBBF not seen; DPPF 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 Index
If position is not zero, at that position:
DWORD ;; Index type
The count of set bits in the index type is the number of additional DWORD entries in index header:
DWORD[(for each bit in Index type)]
The number of DWORDs in an actual index entry is 8. The entry is stored in two parts - the index header and then the entry on disk. The header provides the data that is constant to all entries, essentially a kind of compression.
- For each index entry on disk
DWORD[(8 - number of bits in Index type)]
Each DWORD in an actual index entry can either come from the header or from the index entry on disk, depending on the bits set in the index type. The order of the DWORDs in an index entry is (with matching bit number):
0 | ResourceType | |
1 | ResourceGroup | |
2 | InstanceHi | |
3 | InstanceLo | |
4 | Chunkoffset | Absolute location in package |
5 | Filesize | Length of data in package |
6 | Memsize | Length of uncompressed data |
7 | Compressed(lo WORD) , Unknown2(hi WORD) | Compressed is 0x0000 or 0xFFFF |
(That's a total of 32 bytes per entry.)
(Possibly confusingly, in my implementation, I actually store the index type along with the entries - keeps the data structure simpler..!)
By Peter Jones