Havok: Difference between revisions
Jump to navigation
Jump to search
→Havok File Specification: Added section header details
imported>Zephenryus m (→Usage: Added rigid body location) |
imported>Zephenryus (→Havok File Specification: Added section header details) |
||
Line 78: | Line 78: | ||
== Havok File Specification == | == Havok File Specification == | ||
Havok files serve as a data container for multiple Havok classes per file and sometimes multiple Havok files per file<ref>Static Compound files ([[hksc]]) include two Havok file definitions. The first file defines <code>StaticCompoundInfo</code> and the second defines <code>hkpPhysicsData</code> (which includes <code>hkpRigidBody</code>, <code>hkpStaticCompoundShape</code>, <code>hkpBvCompressedMeshShape</code>, <code>hkpConvexVerticesShape</code>, et. al.).</ref>. The class names are defined in each file. | |||
Note that this specification only applies to version 2014.2.0-r1 | Note that this specification only applies to version 2014.2.0-r1 | ||
=== File Structure === | |||
[[File:Havok-file-structure.png|thumb|File structure]] | |||
Each file contains a header and three sections: classnames, types and data | |||
==== classnames ==== | |||
The classnames section (<code>__classnames__</code> internally) contains a list of Havok classes used by the file to correctly decompile the binary data into a usable data structure. | |||
==== types ==== | |||
The types section (<code>__types__</code> internally) does not appear to be used by ''Breath of the Wild''. | |||
==== data ==== | |||
the data section (<code>__data__</code> internally) contains binary data to be serialized into Havok data structures for use by the Havok engine. | |||
=== Header === | === Header === | ||
The header seems to have a 16-byte alignment and can be 64-bytes (short header) or 80-bytes (long header) in length, depending on if '''Unknown 13''' equals 0 (short header) or 16 (long header). | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
Header Specification | |||
!Offset (h) | !Offset (h) | ||
!Size | !Size | ||
Line 96: | Line 113: | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 00 | |Unknown 00 (always 0; possibly padding) | ||
|- | |- | ||
|<code>0x0c</code> | |<code>0x0c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 01 | |Unknown 01 (always 11) | ||
|- | |- | ||
|<code>0x10</code> | |<code>0x10</code> | ||
|1 | |1 | ||
|Byte | |Byte | ||
|Unknown 02 | |Unknown 02 (always 4) | ||
|- | |- | ||
|<code>0x11</code> | |<code>0x11</code> | ||
|1 | |1 | ||
|Byte | |Byte | ||
|Unknown 03 | |Unknown 03 (always 0) | ||
|- | |- | ||
|<code>0x12</code> | |<code>0x12</code> | ||
|1 | |1 | ||
|Byte | |Byte | ||
|Unknown 04 | |Unknown 04 (always 0) | ||
|- | |- | ||
|<code>0x13</code> | |<code>0x13</code> | ||
|1 | |1 | ||
|Byte | |Byte | ||
|Unknown 05 | |Unknown 05 (always 1) | ||
|- | |- | ||
|<code>0x14</code> | |<code>0x14</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 06 | |Unknown 06 (always 3) | ||
|- | |- | ||
|<code>0x18</code> | |<code>0x18</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 07 | |Unknown 07 (always 2) | ||
|- | |- | ||
|<code>0x1c</code> | |<code>0x1c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 08 | |Unknown 08 (always 0) | ||
|- | |- | ||
|<code>0x20</code> | |<code>0x20</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 09 | |Unknown 09 (always 0) | ||
|- | |- | ||
|<code>0x24</code> | |<code>0x24</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown 10 | |Unknown 10 (always 75) | ||
|- | |- | ||
|<code>0x28</code> | |<code>0x28</code> | ||
Line 152: | Line 169: | ||
|String | |String | ||
|Havok version <code>hk_2014.2.0-r1</code> for BotW files | |Havok version <code>hk_2014.2.0-r1</code> for BotW files | ||
|- | |||
|<code>0x38</code> | |||
|4 | |||
|Unsigned Int | |||
|Unknown 11 (always 0; possibly padding) | |||
|- | |||
|<code>0x3c</code> | |||
|2 | |||
|Short | |||
|Unknown 12 (always 21) | |||
|- | |||
|<code>0x3e</code> | |||
|2 | |||
|Short | |||
|Unknown 13 (0 or 16; if 16, the header is 16 bytes longer) | |||
|} | |} | ||
==== Optional Header Bytes ==== | |||
There are optional header bytes for a long header. If Unknown 13 equals 16, an additional 16 bytes are added to the header for a total of 80 bytes. | |||
{| class="wikitable" | |||
|+Optional Header Bytes | |||
!Offset (h) | |||
!Size | |||
!Data Type | |||
!Description | |||
|- | |||
|0x40 | |||
|2 | |||
|Short | |||
|Unknown 14 (always 20) | |||
|- | |||
|0x42 | |||
|2 | |||
|Short | |||
|Unknown 15 (always 0; possibly padding) | |||
|- | |||
|0x44 | |||
|4 | |||
|Int | |||
|Unknown 16 (always 0; probably padding for alignment) | |||
|- | |||
|0x48 | |||
|4 | |||
|Int | |||
|Unknown 17 (always 0; probably padding for alignment) | |||
|- | |||
|0x4c | |||
|4 | |||
|Int | |||
|Unknown 18 (always 0; probably padding for alignment) | |||
|} | |||
=== Section Headers === | |||
[[File:Havok-class-header-delimits.png|thumb|<code>FF</code> bytes indicate section header boundaries]] | |||
Each section has a 64-byte header which includes the section name, absolute offset to the section start and six relative offsets to segments within the section. All three section headers follow the file header and are delimited by 16 <code>ff</code> bytes. | |||
{| class="wikitable" | |||
|+Section Header Specification | |||
!Offset (h) | |||
!Size | |||
!Data Type | |||
!Description | |||
|- | |||
|<code>0x00</code> | |||
|20 | |||
|String | |||
|Section name | |||
|- | |||
|<code>0x14</code> | |||
|4 | |||
|Unsigned Int | |||
|Absolute offset | |||
|- | |||
|<code>0x18</code> | |||
|4 | |||
|Unsigned Int | |||
|Relative offset 1 | |||
|- | |||
|<code>0x1c</code> | |||
|4 | |||
|Unsigned Int | |||
|Relative offset 2 | |||
|- | |||
|<code>0x20</code> | |||
|4 | |||
|Unsigned Int | |||
|Relative offset 3 | |||
|- | |||
|<code>0x24</code> | |||
|4 | |||
|Unsigned Int | |||
|Relative offset 4 | |||
|- | |||
|<code>0x28</code> | |||
|4 | |||
|Unsigned Int | |||
|Relative offset 5 | |||
|- | |||
|<code>0x2c</code> | |||
|4 | |||
|Unsigned Int | |||
|Relative offset 6 | |||
|} | |||
==== Section Name ==== | |||
There are only three section names: <code>__classnames__</code>, <code>__types__</code> and <code>__data__</code>. The section name is a null-terminated string with a delimiter byte of FF in byte 20. | |||
==== Absolute Offset ==== | |||
The absolute offset to the section. | |||
==== Relative Offsets ==== | |||
The relative offsets point to different large structures within the section. There are usually a few unique offsets and then multiple duplicated offsets. It is unknown if only unique offsets are significant at this time. | |||
For example, given the following section header: | |||
<syntaxhighlight> | |||
5F 5F 64 61 74 61 5F 5F 00 00 00 00 00 00 00 00 | __data__........ | |||
00 00 00 FF 00 00 01 60 00 00 3C 00 00 00 3C 10 | .......`..<...<. | |||
00 00 3C 10 00 00 3C 20 00 00 3C 20 00 00 3C 20 | ..<...< ..< ..< | |||
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ................ | |||
</syntaxhighlight>The section name is <code>__data__</code>. The absolute offset is <code>0x160</code> with the relative offsets | |||
* <code>0x3c00</code> | |||
* <code>0x3c10</code> | |||
* <code>0x3c10</code> | |||
* <code>0x3c20</code> | |||
* <code>0x3c20</code> | |||
* <code>0x3c20</code> | |||
<references /> | <references /> | ||
[[Category:File formats]] | [[Category:File formats]] |