Difference between revisions of "CHR0 (File Format)"
m (→Tools) |
(→Model Animation Data: Bit Flag) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{under-construction}} |
+ | == Overview == | ||
+ | This page describes the [[Mario Kart Wii]] '''CHR0''' file format, as found within [[BRRES (File Format)|BRRES]] files. They are model movement animation files. | ||
− | |||
− | |||
− | |||
== File Format == | == File Format == | ||
=== File Header === | === File Header === | ||
− | |||
{{BRRES sub file header|CHR0}} | {{BRRES sub file header|CHR0}} | ||
=== CHR0 Header === | === CHR0 Header === | ||
− | + | The CHR0 header follows directly after the file header. For CHR0 version 5, it starts at offset 0x1c and has the following layout: | |
− | The CHR0 header follows directly after the file header. For CHR0 version 5 it starts at offset 0x1c and has the following layout: | ||
{| class="wikitable" | {| class="wikitable" | ||
! offset !! size !! description | ! offset !! size !! description | ||
|- | |- | ||
− | | 0x00 || 4 || {{ | + | | 0x00 || 4 || {{unknown-left|'''Unknown'''.}} |
|- | |- | ||
| 0x04 || 2 || Frame count. | | 0x04 || 2 || Frame count. | ||
Line 24: | Line 21: | ||
| 0x08 || 4 || Looping 0x00=disabled 0x01=enabled. | | 0x08 || 4 || Looping 0x00=disabled 0x01=enabled. | ||
|- | |- | ||
− | | 0x0c || 4 || {{ | + | | 0x0c || 4 || {{unknown-left|'''Unknown'''.}} |
|- | |- | ||
− | | 0x10 || colspan=2 {{unknown|End of header / Start of a filler}} | + | | 0x10 || colspan=2 {{unknown|End of header/Start of a filler}} |
|} | |} | ||
=== Animation Data (Section 0) === | === Animation Data (Section 0) === | ||
− | |||
The start of section 0 is defined in the file header. It contains the animation data for the file. It starts with a [[BRRES Index Group (File Format)|BRRES Index Group]]. Each one of the entries in the index group points to the animation information for one texture. | The start of section 0 is defined in the file header. It contains the animation data for the file. It starts with a [[BRRES Index Group (File Format)|BRRES Index Group]]. Each one of the entries in the index group points to the animation information for one texture. | ||
==== Model Animation Data ==== | ==== Model Animation Data ==== | ||
− | |||
The structure of the model animation data which the index group points to has the following layout: | The structure of the model animation data which the index group points to has the following layout: | ||
Line 65: | Line 60: | ||
|- | |- | ||
! Meaning | ! Meaning | ||
− | | Scale Z Fixed || Scale Y Fixed || Scale X Fixed || | + | | Scale Z Fixed || Scale Y Fixed || Scale X Fixed || Disable Classic Scale || Apply Child Scale Compensate || Apply Scale Compensate || Use Model Translation || Use Model Rotation |
|- | |- | ||
! Bit !! 7 !! 6 !! 5 !! 4 !! 3 !! 2 !! 1 !! 0 | ! Bit !! 7 !! 6 !! 5 !! 4 !! 3 !! 2 !! 1 !! 0 | ||
|- | |- | ||
! Meaning | ! Meaning | ||
− | | | + | | Use Model Scale || Translation Isotropic || Rotation Isotropic || Scale Uniform || Scale Isotropic || Rotation & Translation Isotropic || Use Identity || Always set |
|- | |- | ||
|} | |} | ||
Line 79: | Line 74: | ||
# Translation | # Translation | ||
− | If the value is 'fixed' then the | + | If the value is 'fixed', then the animation data contains a single to set the value to. If the type is 'isotropic', only one piece of data is stored for each type, rather than for each component. If it is not 'fixed', the animation data field contains a pointer to an animation frame data structure data. The structure depends on the value in the format field. |
{| class="wikitable" | {| class="wikitable" | ||
Line 96: | Line 91: | ||
===== Interpolated 4 ===== | ===== Interpolated 4 ===== | ||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
! offset !! size !! description | ! offset !! size !! description | ||
Line 102: | Line 96: | ||
| 0x00 || 2 || Frame count ('''Q'''). | | 0x00 || 2 || Frame count ('''Q'''). | ||
|- | |- | ||
− | | 0x02 || 2 || {{ | + | | 0x02 || 2 || {{unknown-left|'''Unknown'''.}} |
|- | |- | ||
| 0x04 || 4 || Frame scale (float). | | 0x04 || 4 || Frame scale (float). | ||
Line 130: | Line 124: | ||
===== Interpolated 6 ===== | ===== Interpolated 6 ===== | ||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
! offset !! size !! description | ! offset !! size !! description | ||
Line 136: | Line 129: | ||
| 0x00 || 2 || Frame count ('''Q'''). | | 0x00 || 2 || Frame count ('''Q'''). | ||
|- | |- | ||
− | | 0x02 || 2 || {{ | + | | 0x02 || 2 || {{unknown-left|'''Unknown'''.}} |
|- | |- | ||
| 0x04 || 4 || Frame scale (float). | | 0x04 || 4 || Frame scale (float). | ||
Line 164: | Line 157: | ||
===== Interpolated 12 ===== | ===== Interpolated 12 ===== | ||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
! offset !! size !! description | ! offset !! size !! description | ||
Line 170: | Line 162: | ||
| 0x00 || 2 || Frame count ('''Q'''). | | 0x00 || 2 || Frame count ('''Q'''). | ||
|- | |- | ||
− | | 0x02 || 2 || {{ | + | | 0x02 || 2 || {{unknown-left|'''Unknown'''.}} |
|- | |- | ||
| 0x04 || 4 || Frame scale (float). | | 0x04 || 4 || Frame scale (float). | ||
Line 194: | Line 186: | ||
===== Linear 1 ===== | ===== Linear 1 ===== | ||
− | |||
'''Q''' is the frame count which is set in the file header. | '''Q''' is the frame count which is set in the file header. | ||
Line 212: | Line 203: | ||
===== Linear 4 ===== | ===== Linear 4 ===== | ||
− | |||
Linear 4 simply consists of a number of singles representing the value at each of the frames. The frame count is the frame count from the file header. | Linear 4 simply consists of a number of singles representing the value at each of the frames. The frame count is the frame count from the file header. | ||
− | All information about the implementation of these structures is presently | + | All information about the implementation of these structures is presently unknown. |
== Tools == | == Tools == | ||
− | |||
The following tools can handle CHR0 files: | The following tools can handle CHR0 files: | ||
− | * [[BrawlBox]], by | + | * [[BrawlBox]], by Kryal and BlackJax. |
* [[BrawlCrate]], by soopercool101. | * [[BrawlCrate]], by soopercool101. | ||
− | * [[CTools]], by [[Chadderz]] | + | * [[CTools]], by [[Chadderz]] (parsed, but not editable). |
== Links == | == Links == | ||
− | |||
{{BRRES links}} | {{BRRES links}} | ||
[[Category:File Format/Wii]] | [[Category:File Format/Wii]] |
Latest revision as of 07:39, 6 April 2023
Overview
This page describes the Mario Kart Wii CHR0 file format, as found within BRRES files. They are model movement animation files.
File Format
File Header
Offset | Type | Description |
---|---|---|
0x00 | String | The magic "CHR0" to identify the sub file. See »BRRES Sub Files« for other magics. |
0x04 | UInt32 | Length of the sub file. |
0x08 | UInt32 | Sub file version number. The number of sections (N) is dependent of this version number. See »BRRES Sub Files« for details. |
0x0C | Int32 | Offset to outer BRRES File. |
0x10 | Int32[N] | N section offsets. N is implied in the version number (offset 0x08). |
0x10+N*4 | Int32 | String offset to the name of this sub file. This name equal to the name of the entry name of the BRRES Index Group pointing to this data. |
0x14+N*4 | End of this header |
CHR0 Header
The CHR0 header follows directly after the file header. For CHR0 version 5, it starts at offset 0x1c and has the following layout:
offset | size | description |
---|---|---|
0x00 | 4 | Unknown. |
0x04 | 2 | Frame count. |
0x06 | 2 | Animation data count. |
0x08 | 4 | Looping 0x00=disabled 0x01=enabled. |
0x0c | 4 | Unknown. |
0x10 | End of header/Start of a filler |
Animation Data (Section 0)
The start of section 0 is defined in the file header. It contains the animation data for the file. It starts with a BRRES Index Group. Each one of the entries in the index group points to the animation information for one texture.
Model Animation Data
The structure of the model animation data which the index group points to has the following layout:
offset | size | description |
---|---|---|
0x00 | 4 | String offset to the name of the bone to animate. |
0x04 | 4 | Animation type code. Determines how much animation data is required (P). |
0x08 | P*4 | Animation data. |
0x08+P*4 | End of structure |
The animation type code is a 32 bit structure with the following layout (msb first):
Bit | 1f | 1e | 1d | 1c | 1b | 1a | 19 | 18 |
---|---|---|---|---|---|---|---|---|
Meaning | Translation Format | Rotation Format | Scale Format | Has Translation | ||||
Bit | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 |
Meaning | Has Rotation | Has Scale | Z Fixed | Y Fixed | X Fixed | Rotation Z Fixed | Rotation Y Fixed | Rotation X Fixed |
Bit | f | e | d | c | b | a | 9 | 8 |
Meaning | Scale Z Fixed | Scale Y Fixed | Scale X Fixed | Disable Classic Scale | Apply Child Scale Compensate | Apply Scale Compensate | Use Model Translation | Use Model Rotation |
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Meaning | Use Model Scale | Translation Isotropic | Rotation Isotropic | Scale Uniform | Scale Isotropic | Rotation & Translation Isotropic | Use Identity | Always set |
If present, the animation data is stored in the following order:
- Scale
- Rotation
- Translation
If the value is 'fixed', then the animation data contains a single to set the value to. If the type is 'isotropic', only one piece of data is stored for each type, rather than for each component. If it is not 'fixed', the animation data field contains a pointer to an animation frame data structure data. The structure depends on the value in the format field.
Format | Name |
---|---|
0b001 | Interpolated 4. |
0b010 | Interpolated 6. |
0b011 | Interpolated 12. |
0b100 | Linear 1. |
0b110 | Linear 4. |
Interpolated 4
offset | size | description |
---|---|---|
0x00 | 2 | Frame count (Q). |
0x02 | 2 | Unknown. |
0x04 | 4 | Frame scale (float). |
0x08 | 4 | Step (float). |
0x0c | 4 | Base (float). |
0x10 | Q*4 | Frame information. |
0x10+Q*4 | End of structure |
The frame information data each has the following layout:
offset | size | description |
---|---|---|
0x00 | 1 | Frame index. |
0x01 | 1.5 | Step. |
0x02+1/2 | 1.5 | Tangent (/32.0 to get value). |
0x04 | End of structure |
Interpolated 6
offset | size | description |
---|---|---|
0x00 | 2 | Frame count (Q). |
0x02 | 2 | Unknown. |
0x04 | 4 | Frame scale (float). |
0x08 | 4 | Step (float). |
0x0c | 4 | Base (float). |
0x10 | Q*6 | Frame information. |
0x10+Q*6 | End of structure |
The frame information data each has the following layout:
offset | size | description |
---|---|---|
0x00 | 2 | Frame index (/32.0 to get value). |
0x02 | 2 | Step. |
0x04 | 2 | Tangent (/256.0 to get value). |
0x06 | End of structure |
Interpolated 12
offset | size | description |
---|---|---|
0x00 | 2 | Frame count (Q). |
0x02 | 2 | Unknown. |
0x04 | 4 | Frame scale (float). |
0x8 | Q*12 | Frame information. |
0x8+Q*12 | End of structure |
The frame information data each has the following layout:
offset | size | description |
---|---|---|
0x00 | 4 | Frame index (float). |
0x04 | 4 | Value (float). |
0x08 | 4 | Tangent (float). |
0x0c | End of structure |
Linear 1
Q is the frame count which is set in the file header.
offset | size | description |
---|---|---|
0x00 | 4 | Step (float). |
0x04 | 4 | Base (float). |
0x8 | Q*4 | Frame information. |
0x8+Q*4 | End of structure |
The frame information data is a series of singles.
Linear 4
Linear 4 simply consists of a number of singles representing the value at each of the frames. The frame count is the frame count from the file header.
All information about the implementation of these structures is presently unknown.
Tools
The following tools can handle CHR0 files:
- BrawlBox, by Kryal and BlackJax.
- BrawlCrate, by soopercool101.
- CTools, by Chadderz (parsed, but not editable).