Constrained Motions (exp files) - Kerilk/bayonetta_tools GitHub Wiki
THIS SECTION IS TO BE REWORKED, INFORMATION IS OUTDATED. SEE THE CORRESPONDING BINARY TEMPLATE OR THE CODE OF THE NOESIS BAYONETTA PC PLUGIN.
exp files are the second animation related files, together with mot files. They can be read by using the binary templates Bayonetta exp.bt, Bayonetta WiiU exp.bt and Bayonetta 2 exp.bt.
They go together with a model and define procedural animations of bones that are not referenced in motion files. For instance the animation of cut-scene neck bones (197, 198 and 199) are replicated from the game neck bones (4, 5 and 6). Another example are hip joints, where two bones are located for each leg. One of those bones is animated based on the other's animation.
Bayonetta and Bayonetta 2 greatly differ in their implementation as Bayonetta defines a restrictive set of operators while Bayonetta 2 offers a vastly more flexible system which encodes mathematical expressions and interpolation based transformation functions.
Bayonetta Format
Header
Every exp file starts with a 16 byte header:
offset | size | c type | description |
---|---|---|---|
0x00 | 4 | char[4] | "exp\x00" |
0x04 | 2 | int32_t | unknown (unused?) |
0x08 | 4 | uint32_t | records offset |
0x0C | 4 | uint32_t | record count |
Records
Records of 20 bytes follow at the offset specified in the header and with the given count. They are tightly packed.
offset | size | c type | description |
---|---|---|---|
0x00 | 2 | int16_t | unknown (flags) |
0x02 | 2 | int16_t | bone index |
0x04 | 1 | int8_t | animation track |
0x05 | 1 | int8_t | entry type |
0x06 | 1 | int8_t | unknown |
0x07 | 1 | int8_t | unknown |
0x08 | 4 | int32_t | unknown |
0x0C | 4 | uint32_t | entry offset |
0x10 | 4 | int32_t | unknown |
The records describe the bone and the animation track that will be defined, as well as the type of data to expect.
Entries
Each of the records with a type different than 0 are associated with an entry in the exp file. Those entry describe how the resulting animation value should be computed. They are located at the absolute offset written in the record and are of the given type. The significance of the flags are unknown for now, they may describe situations when those
Track describing rotations are expected in degree.
Entry Type 1: Copy
Those entries (size: 8 bytes) describe which animation track to copy.
offset | size | c type | description |
---|---|---|---|
0x00 | 4 | uint32_t | flags |
0x04 | 2 | int16_t | bone index |
0x06 | 1 | int8_t | animation track |
0x07 | 1 | int8_t | padding |
Entry Type 2: Scaling or Adding
Those entries (size: 16 bytes) describe which animation track to copy multiplied by a factor or offset by a constant.
offset | size | c type | description |
---|---|---|---|
0x00 | 4 | uint32_t | flags |
0x04 | 2 | int16_t | bone index |
0x06 | 1 | int8_t | animation track |
0x07 | 1 | int8_t | padding |
0x08 | 4 | int32_t | operation |
0x0C | 4 | float | value |
Field operation has been seen as 0 for addition, 4 for multiplication and 0x20004 for absolute value of the animation track then multiply.
Entry Type 2: Scaling then Adding (and possibly reverse).
Those entries (size: 24 bytes) describe which animation track to copy multiplied by a factor and then offset by a constant.
offset | size | c type | description |
---|---|---|---|
0x00 | 4 | uint32_t | flags |
0x04 | 2 | int16_t | bone index |
0x06 | 1 | int8_t | animation track |
0x07 | 1 | int8_t | padding |
0x08 | 4 | int32_t | operation1 |
0x0C | 4 | float | value1 |
0x10 | 4 | int32_t | operation2 |
0x14 | 4 | float | value2 |
Field operation has been seen as 0 for addition, 4 for multiplication and 0x20004 for absolute value of the animation track then multiply.