Difference between revisions of "BRCTR (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
(Revamp the article and add new tool)
Line 8: Line 8:
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || String || '''File magic'''. Always ''bctr'' in ASCII.
+
| 0x00 || String || File magic. Always ''bctr'' in ASCII.
 
|-
 
|-
| 0x04 || UInt16 || '''Probably number of Sub-Headers'''. Always 00 02.
+
| 0x04 || UInt16 || Number of Sub-Headers. Always 2.
 
|-
 
|-
| 0x06 || UInt16 || Offset to the BRLYT name (relative to the start of the Name Table).
+
| 0x06 || UInt16 || Offset to the main [[BRLYT]] name (relative to the start of the Name Table).
 
|-
 
|-
| 0x08 || UInt16 || Offset to the BMG name (relative to the start of the Name Table). 0 if not used.
+
| 0x08 || UInt16 || Offset to the [[BMG]] name (relative to the start of the Name Table).
 
|-
 
|-
| 0x0A || UInt16 || Offset to the BRLYT name of the icon source (relative to the start of the Name Table). 0 if not used.
+
| 0x0A || UInt16 || Offset to the picture source [[BRLYT]] name (relative to the start of the Name Table).
 
|-
 
|-
| 0x0C || UInt16 || Offset to [[#Sub-Header 1|Sub-Header 1]].
+
| 0x0C || UInt16 || Offset to the [[#Animation Sub-Header|Animation Sub-Header]].
 
|-
 
|-
| 0x0E || UInt16 || Offset to [[#Sub-Header 2|Sub-Header 2]].
+
| 0x0E || UInt16 || Offset to [[#Layout Sub-Header|Layout Sub-Header]].
 
|-
 
|-
 
| 0x10 || UInt16 || Offset to [[#Name Table|Name Table]].
 
| 0x10 || UInt16 || Offset to [[#Name Table|Name Table]].
 
|-
 
|-
| 0x12 || UInt16 || {{Unknown-left|'''Unknown'''.}}
+
| 0x12 || UInt16 || Padding.
 
|}
 
|}
  
== Sub-Header 1 ==
+
== Animation Sub-Header ==
  
 
{|class=wikitable
 
{|class=wikitable
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || UInt16 || '''Offset''' to start of [[#Section 1|section 1]] (relative to the start of this header).
+
| 0x00 || UInt16 || Offset to the first [[#Group|Group]] (relative to the start of this header).
 
|-
 
|-
| 0x02 || UInt16 || '''Number of''' [[#Section 1|section 1]] entries.
+
| 0x02 || UInt16 || Number of [[#Group|Groups]].
 
|-
 
|-
| 0x04 || UInt16 || '''Offset''' to start of [[#Section 2|section 2]] (relative to the start of this header).
+
| 0x04 || UInt16 || Offset to the first [[#Animation|Animation]] (relative to the start of this header).
 
|-
 
|-
| 0x06 || UInt16 || '''Number of''' [[#Section 2|section 2]] entries.
+
| 0x06 || UInt16 || Number of [[#Animation|Animations]].
 
|}
 
|}
  
=== Section 1 ===
+
=== Group ===
Section 1 configure a [[BRLYT (File Format)#grp1|BRLYT group]] with animations.
 
  
 
{|class=wikitable
 
{|class=wikitable
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x02 || UInt16 || '''[[BRLAN (File Format)#pat1|BRLAN internal name]] offsets''' (0 = no name).
+
| 0x00 || UInt16 || Offset to the Group name (relative to the start of the Name Table).
 
|-
 
|-
| 0x00 || UInt16 || '''[[BRLYT (File Format)#grp1|BRLYT group name]] offset''' (0 = no name). Unknown if this only can be a group.
+
| 0x02 || UInt16 || Offset to the [[BRLYT]] group pane name (relative to the start of the Name Table).
 
|-
 
|-
| 0x04 || UInt16 || This value refers to a [[#Section 2|section 2]] ID.
+
| 0x04 || UInt16 || Index of the first [[#Animation|Animation]].
 
|-
 
|-
| 0x06 || UInt16 || '''Number of''' [[#Section 2|section 2]] entries to use.
+
| 0x06 || UInt16 || Number of [[#Animation|Animations]].
 
|}
 
|}
  
=== Section 2 ===
+
=== Animation ===
Section 2 stores data about [[BRLAN]] animations.
 
  
 
{|class=wikitable
 
{|class=wikitable
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || UInt16 || '''[[BRLAN (File Format)#pat1|BRLAN internal name]] offsets''' (0 = no name).
+
| 0x00 || UInt16 || Offset to the Animation name (relative to the start of the Name Table).
 
|-
 
|-
| 0x02 || UInt16 || '''[[BRLAN]] file name offsets''' (0 = no name). Links to the filename of the [[BRLAN]].
+
| 0x02 || UInt16 || Offset to the [[BRLAN]] name (relative to the start of the Name Table).
 
|-
 
|-
| 0x04 || UInt16 || {{Unknown-left|'''[[BRLAN (File Format)#pat1|BRLAN internal name]] offset'''. Of not 00 00, it links to a BRLAN. Unknown usage, could be next animation.}}
+
| 0x04 || UInt16 || Offset to the [[BRLAN]] name of the next animation (relative to the start of the Name Table).
 
|-
 
|-
| 0x06 || UInt16 || {{Unknown-left|'''Name offset'''.}}
+
| 0x06 || Bool16 || Whether the Animation is reversed.
 
|-
 
|-
| 0x08 || Float || {{Unknown-left|'''Unknown'''.}}
+
| 0x08 || Float || Speed of the Animation.
 
|}
 
|}
  
== Sub-Header 2 ==
+
== Layout Sub-Header ==
  
 
{|class=wikitable
 
{|class=wikitable
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || UInt16 || '''Offset''' to start of [[#Section 3|section 3]] (relative to the start of this header).
+
| 0x00 || UInt16 || Offset to the first [[#Variant|Variant]] (relative to the start of this header).
 
|-
 
|-
| 0x02 || UInt16 || '''Number of''' [[#Section 3|section 3]] entries.
+
| 0x02 || UInt16 || Number of [[#Variant|Variants]].
 
|-
 
|-
| 0x04 || UInt16 || '''Offset''' to start of [[#Section 4|section 4]] (relative to the start of this header).
+
| 0x04 || UInt16 || Offset to the first [[#Message|Message]] (relative to the start of this header).
 
|-
 
|-
| 0x06 || UInt16 || '''Number of''' [[#Section 4|section 4]] entries.
+
| 0x06 || UInt16 || Number of [[#Message|Messages]].
 
|-
 
|-
| 0x08 || UInt16 || '''Offset''' to start of [[#Section 5|section 5]] (relative to the start of this header).
+
| 0x08 || UInt16 || Offset to the first [[#Picture|Picture]] (relative to the start of this header).
 
|-
 
|-
| 0x0A || UInt16 || '''Number of''' [[#Section 5|section 5]] entries.
+
| 0x0A || UInt16 || Number of [[#Picture|Pictures]].
 
|}
 
|}
  
=== Section 3 ===
+
=== Variant ===
This is the section that is best known. It contains float data specifying where to set the final position of a BRLYT pane, in 4:3 and 16:9 aspect ratios.
 
  
 
{|class=wikitable
 
{|class=wikitable
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || UInt16 || {{Unknown-left|'''Name offset'''.}}
+
| 0x00 || UInt16 || Offset to the Variant name (relative to the start of the Name Table).
 
|-
 
|-
| 0x02 || UInt16 || Alpha channel (0xFF = opaque, 0x00 = transparent).
+
| 0x02 || UInt16 || Transparency.
 
|-
 
|-
| 0x04 || UInt16 || 0 = don't use animation, 1 = use animation.
+
| 0x04 || Bool16 || Whether the Variant is animated.
 
|-
 
|-
 
| 0x06 || UInt16 || Padding.
 
| 0x06 || UInt16 || Padding.
 
|-
 
|-
| 0x08 || Float || '''Delay time''' for the animation. When going back, the delay works inverse.
+
| 0x08 || Float || Delay time for the animation. When going back, the delay works inverse.
 
|-
 
|-
 
| 0x0C || Float || Translation X (4:3).
 
| 0x0C || Float || Translation X (4:3).
Line 127: Line 124:
 
| 0x30 || Float || Scale Y (16:9).
 
| 0x30 || Float || Scale Y (16:9).
 
|-
 
|-
| 0x34 || UInt16 || This value refers to a [[#Section 4|section 4]] ID.
+
| 0x34 || UInt16 || Index of the first [[#Message|Message]].
 
|-
 
|-
| 0x36 || UInt16 || '''Number of''' [[#Section 4|section 4]] entries to use.
+
| 0x36 || UInt16 || Number of [[#Message|Messages]].
 
|-
 
|-
| 0x38 || UInt16 || This value refers to a [[#Section 5|section 5]] ID.
+
| 0x38 || UInt16 || Index of the first [[#Picture|Picture]].
 
|-
 
|-
| 0x3A || UInt16 || '''Number of''' [[#Section 5|section 5]] entries to use.
+
| 0x3A || UInt16 || Number of [[#Picture|Pictures]].
 
|}
 
|}
  
=== Section 4 ===
+
=== Message ===
This section refers to a message ID found in [[BMG]] files.
 
  
 
{|class=wikitable
 
{|class=wikitable
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || UInt16 || '''[[BRLYT#txt1|BRLYT text pane]] name offset'''. Links to the [[BRLYT]] text pane to use with the message (0 if used in all text panes => links to no name).
+
| 0x00 || UInt16 || Offset to the [[BRLYT]] pane name (relative to the start of the Name Table).
 
|-
 
|-
| 0x02 || UInt16 || {{Unknown-left|'''Name offset'''.}}
+
| 0x02 || UInt16 || Offset to the Message name (relative to the start of the Name Table).
 
|-
 
|-
| 0x04 || UInt32 || [[BMG#Message IDs|Message ID]].
+
| 0x04 || UInt32 || [[BMG#Message IDs|BMG Message ID]].
 
|}
 
|}
  
=== Section 5 ===
+
=== Picture ===
This section consists of two name offsets to the [[#Name Table|Name Table]]. Each entry in this section sets the texture source of a material inside the BRLYT, this source is the name of a pane in the linked icon BRLYT.
 
  
 
{|class="wikitable"
 
{|class="wikitable"
 
! Offset !! Type !! Description
 
! Offset !! Type !! Description
 
|-
 
|-
| 0x00 || UInt16 || {{Unknown-left|'''Material name'''.}}
+
| 0x00 || UInt16 || Offset to the destination [[BRLYT]] pane name (relative to the start of the Name Table), which must be contained in the main BRLYT.
 
|-
 
|-
| 0x02 || UInt16 || {{Unknown-left|'''Texture name'''.}}
+
| 0x02 || UInt16 || Offset to the source [[BRLYT]] pane name (relative to the start of the Name Table), which must be contained in the picture source BRLYT.
 
|}
 
|}
  
 
== Name Table ==
 
== Name Table ==
At the end of the file, there is a section with null-termined strings. All name offsets in a BRCTR file is relative to the start of the name table. The first byte is always 00, because of the offsets in the sections that doesn't have a name should be zero. It contains references to [[BRLYT]] pane names, functions found in [[Filesystem/rel/StaticR.rel|StaticR.rel]], [[BRLAN]] files and [[BRLAN (File Format)#pat1|BRLAN pat1 names]], which probably establish a link between them (they're configured in the previous sections) to load correctly in the game. The amount is not stored, so null-terminated strings should be read until the end of the file.
+
At the end of the file, there is a section with null-terminated strings. The first string is always an empty one, such that unused fields can use an offset of zero.
  
 
= Tools =
 
= Tools =
 
The following tools can handle BRCTR files:
 
The following tools can handle BRCTR files:
 +
* [https://github.com/stblr/wuj5 wuj5], by [[stebler]]
 
* [[Wexos's Toolbox]], by [[Wexos]]
 
* [[Wexos's Toolbox]], by [[Wexos]]
  
 
[[Category:File Format/MKW]]
 
[[Category:File Format/MKW]]

Revision as of 12:38, 21 November 2021

The BRCTR (Binary Revolution ConTRol) filetype applies specific settings for BRLYT files and makes possible the use of BRLAN animation files in Mario Kart Wii's User Interface elements, such as buttons, backgrounds and layouts. This kind of file is always found into the UI directory from the game's filesystem, and specifically into U8 files. They're located into ctrl folders.

File Format

File Header

The file starts with a header that is 0x14 byte long.

Offset Type Description
0x00 String File magic. Always bctr in ASCII.
0x04 UInt16 Number of Sub-Headers. Always 2.
0x06 UInt16 Offset to the main BRLYT name (relative to the start of the Name Table).
0x08 UInt16 Offset to the BMG name (relative to the start of the Name Table).
0x0A UInt16 Offset to the picture source BRLYT name (relative to the start of the Name Table).
0x0C UInt16 Offset to the Animation Sub-Header.
0x0E UInt16 Offset to Layout Sub-Header.
0x10 UInt16 Offset to Name Table.
0x12 UInt16 Padding.

Animation Sub-Header

Offset Type Description
0x00 UInt16 Offset to the first Group (relative to the start of this header).
0x02 UInt16 Number of Groups.
0x04 UInt16 Offset to the first Animation (relative to the start of this header).
0x06 UInt16 Number of Animations.

Group

Offset Type Description
0x00 UInt16 Offset to the Group name (relative to the start of the Name Table).
0x02 UInt16 Offset to the BRLYT group pane name (relative to the start of the Name Table).
0x04 UInt16 Index of the first Animation.
0x06 UInt16 Number of Animations.

Animation

Offset Type Description
0x00 UInt16 Offset to the Animation name (relative to the start of the Name Table).
0x02 UInt16 Offset to the BRLAN name (relative to the start of the Name Table).
0x04 UInt16 Offset to the BRLAN name of the next animation (relative to the start of the Name Table).
0x06 Bool16 Whether the Animation is reversed.
0x08 Float Speed of the Animation.

Layout Sub-Header

Offset Type Description
0x00 UInt16 Offset to the first Variant (relative to the start of this header).
0x02 UInt16 Number of Variants.
0x04 UInt16 Offset to the first Message (relative to the start of this header).
0x06 UInt16 Number of Messages.
0x08 UInt16 Offset to the first Picture (relative to the start of this header).
0x0A UInt16 Number of Pictures.

Variant

Offset Type Description
0x00 UInt16 Offset to the Variant name (relative to the start of the Name Table).
0x02 UInt16 Transparency.
0x04 Bool16 Whether the Variant is animated.
0x06 UInt16 Padding.
0x08 Float Delay time for the animation. When going back, the delay works inverse.
0x0C Float Translation X (4:3).
0x10 Float Translation Y (4:3).
0x14 Float Translation Z (4:3).
0x18 Float Scale X (4:3).
0x1C Float Scale Y (4:3).
0x20 Float Translation X (16:9).
0x24 Float Translation Y (16:9).
0x28 Float Translation Z (16:9).
0x2C Float Scale X (16:9).
0x30 Float Scale Y (16:9).
0x34 UInt16 Index of the first Message.
0x36 UInt16 Number of Messages.
0x38 UInt16 Index of the first Picture.
0x3A UInt16 Number of Pictures.

Message

Offset Type Description
0x00 UInt16 Offset to the BRLYT pane name (relative to the start of the Name Table).
0x02 UInt16 Offset to the Message name (relative to the start of the Name Table).
0x04 UInt32 BMG Message ID.

Picture

Offset Type Description
0x00 UInt16 Offset to the destination BRLYT pane name (relative to the start of the Name Table), which must be contained in the main BRLYT.
0x02 UInt16 Offset to the source BRLYT pane name (relative to the start of the Name Table), which must be contained in the picture source BRLYT.

Name Table

At the end of the file, there is a section with null-terminated strings. The first string is always an empty one, such that unused fields can use an offset of zero.

Tools

The following tools can handle BRCTR files: