Wii Animations

From WiiBrew
(Redirected from Brlyt)
Jump to navigation Jump to search

Introduction

These are facts, no speculations like before. Thanks to Marcan for his research. I hope someone will find this useful.

-- Dasda 02:59, 26 April 2008 (PDT)


IMPORTANT: MOST VALUES ARE STORED IN BIG ENDIAN!

Textures and Material lists (*.brlyt)

The file starts with this header:

typedef struct
{
  char sig [4]; // "RLYT" in ASCII
  u32 version; // Always 0xFE 0xFF 0x 00 0x08.
  u32 file_size; // Size of whole file, including the header.
  u32 num;  // number of sections
} brlyt_header;

lyt1 section

Comes directly after the header (offset 0x10 in file). Defines main layout attributes.

typedef struct
{
  char sig [4]; // "lyt1" in ASCII.
  u32 size_header;
  u8 layout_centered; // 1 if layout is drawn from center
  u8 pad[3];
  u32 width;
  u32 height;
} lyt1_header;

txl1 section (Texture List)

This is the texture list, holding all textures (*.tpl files stored in the /timg/ folder).

typedef struct
{
  char sig [4]; // "txl1" in ASCII.
  u32 size_section; // Size of the whole section.
  u16 num_textures; // Number of textures in list.
  u16 offset_to_next_section; // Should be 0
} txl1_header;

After that comes an 64-bits entry per each texture in the list. The entry looks like this:

typedef struct
{
  u32 offset_filename; // Offset to a null-terminated ASCII string containing the filename.
                      // The offset-base should be after the txl1-header.
 u32 pad; // Always zero
} txl1_offset;

After the offset list is the names list, all names are null terminated and the section is an even number of bytes in length. An extra '\0' is added to the end if needed.

mat1 section (Material List)

After the txl1-section comes the mat1-section, this contains information about materials used in the animation. It's a list, almost like the texture-list. Edit:WhoDares Dec 08: Corrected field sizes

typedef struct
{
  char sig [4]; // "mat1" in ASCII.
  u32 size_section; // // Size of the whole section.
  u16 num_materials; // 
  u16 size_header; // Offset to list start. Always zero
} mat1_header;

After the mat1-header comes one 32-bits entry per material:

typedef struct
{
  u32 offset; // Offset from beginning of mat1-section.
} mat1_offset;

After the mat1_offset comes info about the materials

typedef struct
{
   char name[20];
   s16 fore_color[4];
   s16 back_color[4];
   s16 tevREG3_color[4];
   u32 tev_kcolor[4];
   u32 flags;
} mat1_material;

After the mat1_material is more material info based upon the bit values in flags.

Flags correspond as follows. Fill in data types for what UAs mean.

 0000 1 0 1 1       1    00010   00      0  00  1    0001    0001  0001
     /   /  |       |    \---/   \-------/  \/  |    \--/    \--/  \--/
  ua5  ua4 uab     uaa    ua9       ua8     ua7 ua6   ua3    ua2   TexRef

fnl1 section (FileName List(?))

WhoDares : Nov 2008 [Updated] : This appears to be an "include" list for using other files in the banner.

Megazig: Aug 2009 [Updated] : This is a font list.

A common item appears to be 'wbf1.brfna'. This file is part of the System Menu, and looks like it might be used for adding text into banners without the need of an image.

typedef struct
{
  char sig [4]; // "fnl1" in ASCII.
  u32 size_section; // Size of the whole section.
  u16 num_fonts; // 
  u16 offset_to_next_section; // 0
} fnl1_header;

After the fnl1 header comes one 64bit record per filename:

typedef struct
{
  u32 offset; // Offset from beginning of a filename (Null terminated ASCII)
  u32 pad; // Always 0
} fnl1_offset;

After the fnl1_offset is the list of filenames null terminated. If the full fnl section is not an even number of bytes, the section is padded with an extra '\0'.

TODO: Section incomplete.

Rest of file

The rest of the file contains multiple pane/picture/group sections.

pan1 sections (Pane Header)

Contains information about a pane.

typedef struct
{
  char sig [4]; // "pan1" in ASCII.
  u32 size_section; 
  u8 visibility;
  u8 pane_origin;
  u8 alpha1;
  u8 padding;
  char pane_name [0x10]; // Pane name in ASCII.
  char user_data [0x08]; // User data
  float xTranslate;
  float yTranslate;
  float zTranslate;
  float xRotate;
  float yRotate;
  float zRotate;
  float xScale;
  float yScale;
  float width;
  float height;
} pan1_header;

pas1 sections (Pane Start)

Starts to define children (could be both pictures and other panes) after the pane-header.

typedef struct
{
  char sig [4]; // "pas1" in ASCII.
  u32 size_section;
} pas1_header;

pae1 sections (Pane End)

Simply ends what pas1 started.

typedef struct
{
  char sig [4]; // "pae1" in ASCII.
  u32 size_section;
} pae1_header;

grp1 sections (Group Header)

Contains information about a group. Note that this *is* speculation, based on inspection of a large number of brlyt files.

typedef struct {
  char sig [4]; // "grp1" in ASCII.
  u32 size_section;
  char name[16];
  u16 numsubs;
  u16 offset_to_next_section; // Should be 0
} grp1_header;

after the grp1_header comes one 16-byte name per numsubs

typedef grp1_name char[16];

Files seem to either use grs1/gre1 sections to delimit the contents of a group, or have nonzero numsubs, but not both, so it is reasonable to assume that they serve the same function, to give the contents, but the namespace of the names in nubsubs has yet to be determined.

pic1 sections (Picture Definition)

Contains information about a picture. Thanks alot, Marcan. This one will be tough to document because the flags change the size of the structure. It's not that tough to document. -Megazig

typedef struct
{
  char sig [4]; // "pic1" in ASCII.
  u32 size_section; 
  u8 visibility;
  u8 pane_origin;
  u8 alpha1;
  u8 alpha2;
  char name[0x18];
  float x;
  float y;
  float z;
  float xFlip;
  float yFlip;
  float angle;
  float xMag;
  float yMag;
  float width;
  float height;
} pic1_header;

txt1

An element for use within a panel structure. Identifies text.

  • Common elements to pan1 (all)
  • <length> Number of characters in hex. Not certain why it repeats it twice.
  • Index number for the font
    • <xsize> Unconfirmed. Suspect spacing in pixels.
    • <ysize> Unconfirmed. Suspect leading in pixels.
    • <charsize> Uncofirmed. Likely size of the characters.
    • <linesize> Unconfirmed. Likely either line maximum dimension or baseline.
    • <unk> Unknown
  • <color> Color in hex. RRBBGGAA, where R = Red, B = Blue, G = Green, and A = Alpha. Not certain why this repeats.
  • <text> The text line in UTF16 Big Endian hex.

bnd1

An element for use within the panel structure. Unknown use.

  • Common elements to pan1 (all)
  • no other tags

pae1

Marks the end of a panel. Nested panels become child panels.

grp1

Defines a group of panels and/or materials.

  • <subs> Contains group members
    • A specific group member, referenced by name.

grs1

Deliminates a group of groups. No tags.

gre1

Defines the end of a group of groups.

Animations (*.brlan)

Always starts with this header:

typedef struct
{
  char sig [4]; // "RLAN" in ASCII.
  u32 unk; // Always 0xFE 0xFF 0x 00 0x08.
  u32 file_size; // Size of whole file, including the header.
  u32 unk2; // Flags?
} brlan_header;

pai1 section

typedef struct
{
  char sig [4]; // "pai1" in ASCII.
  u32 size_section; // Size of section, which is rest of the file.
  u32 unk;
  u32 flags; // Flags?
  if (flags & 0x2000000) {
     u32 unk2;
  }
  u32 num_entries;
  u32 offset_entries; // Offset from the pai1-header.
} pai1_header;

After the header comes each offset:

typedef struct
{
  u32 offset; // Offset to the entry.
} pai1_offset;

The offset points to the following struct:

typedef struct
{
  char name [20];
  u32 unk;
  u32 anim_header_len;
} pai1_entry;

And after this struct, the animation-header is located. It looks like this:

typedef struct
{
  char type [4];
  u32 unk;
} anim_header;

Animation Types

Alpha-Transparency (RLVC/RLMC)

float alpha;

Coordinates (RLPA/RLTS)

todo: description