Difference between revisions of "Wii Animations"

From WiiBrew
Jump to navigation Jump to search
m (→‎pan1 sections (Pane Header): added a missing field to the struct for pan1_header)
Line 109: Line 109:
 
   float xFlip;
 
   float xFlip;
 
   float yFlip;
 
   float yFlip;
 +
  float zFlip;  //rotate
 
   float xMag;
 
   float xMag;
 
   float yMag;
 
   float yMag;

Revision as of 02:12, 27 April 2009

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 unk; // 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). Unknown purpose.

typedef struct
{
  char sig [4]; // "lyt1" in ASCII.
  u32 size_header;
  u32 unk2;
  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 unk2; // Always zero?
} 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 unk; // 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 tev_color[4];
   s16 unk_color[4];
   s16 unk_color_2[4];
   u32 tev_kcolor[4];
   u32 flags;
} mat1_material;

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

fnl1 section (FileName List(?))

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

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_filenames; // 
  u16 unk; // 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 unk; // Hi-order word for the offset?
} 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; 
  u32 unk; // Always 01 04 FF 00?
  char pane_name [0x18]; // Pane name in ASCII.
  float x;
  float y;
  float z;
  float xFlip;
  float yFlip;
  float zFlip;  //rotate
  float xMag;
  float yMag;
  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 unk1;
} 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.

typedef struct
{
  char sig [4]; // "pic1" in ASCII.
  u32 size_section; 
  u16 flags;
  u16 alpha;
  char name[0x18];
  float coords[10]; // x, y, unk, unk, unk, angle, xmag, ymag, width, height.
} pic1_header;

TODO: Section incomplete.

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