BFLAN (File Format)

From Wexos's Wiki
Revision as of 14:26, 27 October 2024 by Atlas (talk | contribs) (→‎Version List)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

BFLAN (Binary caFe Layout ANimation) is a file format used on Wii U and the Nintendo Switch. It is used to animate 2D layout, which is stored in BFLYT files.

File Format

Header

The file starts with the following header:

Offset Type Description
0x00 Char[4] File magic. Always FLAN in ASCII.
0x04 UInt16 Byte-order-mark. FE FF for big endian, FF FE for little endian.
0x06 UInt16 Size of this header in bytes.
0x08 UInt32 Version number.
0x0C UInt32 Size of file in bytes.
0x10 UInt16 Number of sections stored in the file.
0x12 UInt16 Padding.

Pane Animation Tag

The pat1 (Pane Animaion Tag) section stores general information about the animation. It starts with the following structure:

Offset Type Description
0x00 Char[4] Section magic. Always pat1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt16 Tag order.
0x0A UInt16 Number of groups.
0x0C UInt32 Name offset, relative to the start of this section. Points to a null-terminated string.
0x10 UInt32 Group offset, relative to the start of this section. Points to an array of groups with the specified amount.
If version ≥ 8.0.0.0
0x14 UInt32 User data offset, relative to the start of this section.
0x18 Int16 Start frame of this animation.
0x1A Int16 End frame of this animation.
0x1C Byte Flag. xxxx xxxA:

A: Descending bind

0x1D Byte[3] Padding.
Else
0x14 Int16 Start frame of this animation.
0x16 Int16 End frame of this animation.
0x18 Byte Flag.
0x19 Byte[3] Padding.

Group

Each group entry has the following structure:

Offset Type Description
If version ≥ 5.0.0.0
0x00 Char[0x21] Group name.
0x21 Byte Unknown flag.
0x22 Byte[2] Padding.
Else
0x00 Char[0x19] Group name.
0x19 Byte Unknown flag.
0x1A Byte[2] Padding.

User Data

See here. Note that user data is not treated as its own block, and is included in the size of this section.

Pane Animation Share

The pah1 (Pane Animaion sHare) section stores unknown data. The section has never been seen in any game files. It has the following structure:

Offset Type Description
0x00 Char[4] Section magic. Always pah1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt32 Share info offset, relative to the start of this structure.
0x0C UInt16 Number of share infos.

Share Info

Each entry has the following structure:

Offset Type Description
0x00 Char[0x19] Source pane name.
0x19 Char[0x19] Target group name.
0x32 Byte[2] Padding.

Pane Animation Info

The pai1 (Pane Animaion Info) section stores the actual animation data and its key frames. The section starts with the following structure:

Offset Type Description
0x00 Char[4] Section magic. Always pai1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt16 Number of frames in this animation.
0x0A Byte Loop flag. 0 = disabled, 1 = enabled.
0x0B Byte Padding.
0x0C UInt16 Number of texture names (T).
0x0E UInt16 Number of animation contents (C).
0x10 UInt32 Animation contents table offset, relative to the start of this structure. Points to UInt32[C] which are offsets to each animation contents. The offsets are also relative to the start of this structure.
0x14 UInt32[T] Texture name offsets. Each offset points to a null-terminated string. The offsets are relative to the start of this field.

Animation Content

Each animation content has the following structure:

Offset Type Description
0x00 Char[0x1C] Animation name.
0x1C Byte Number of animation infos (N).
0x1D Byte Animation type.
ID Name
0x00 Pane
0x01 Material
0x02 User Data (added in version 8.0.0.0)
0x1E Byte[2] Padding.
0x20 UInt32[N] Animation info offsets. Each offset is relative to the start of this structure.

Animation Info

Each animation info has the following structure:

Offset Type Description
0x00 String Animation kind. See below.
0x04 Byte Number of animation targets (N).
0x05 Byte[3] Padding.
0x08 UInt32[N] Animation target offsets. Each offset is relative to the start of this structure.
Animation Kinds

The following animations are supported:

Kind Description
FLPA caFe Layout PAne SRT animation
FLVI caFe Layout VIsibility animation
FLVC caFe Layout Vertex Color animation
FLMC caFe Layout Material Color animation
FLTS caFe Layout Texture SRT animation
FLTP caFe Layout Texture Pattern animation
FLIM caFe Layout Indirect SRT aniMation
FLAC caFe Layout Alpha Compare animation
FLFS caFe Layout Font Shadow animation
FLCT caFe Layout per Character Transform animation
FLCC caFe Layout per Character transform Curve animation
FLEU caFe Layout Extended User data animation (added in version 8.0.0.0)
Animation Target

Each animation target has the following structure:

Offset Type Description
0x00 Byte Index. Unknown meaning.
0x01 Byte Animation target. This value depends on what animation kind the owning animation info stores. See targets.
0x02 Byte Curve type. 0 = Constant, 1 = Step, 2 = Hermite
0x03 Byte Padding.
0x04 UInt16 Number of key frames.
0x06 UInt16 Padding.
0x08 UInt32 Key frame offset, relative to the start of this structure.
Constant Key Frame

Unknown.

Step Key Frame

A step key frame has the following structure:

Offset Type Description
0x00 Float Key frame index.
0x04 UInt16 Value.
0x06 UInt16 Padding.
Hermite Key Frame

A step key frame has the following structure:

Offset Type Description
0x00 Float Key frame index.
0x04 Float Value.
0x08 Float Slope, used to create a curve.
Targets
FLPA
ID Description
0x00 Translate X
0x01 Translate Y
0x02 Translate Z
0x03 Rotate X
0x04 Rotate Y
0x05 Rotate Z
0x06 Scale X
0x07 Scale Y
0x08 Pane width
0x09 Pane height
FLVI
ID Description
0x00 Visibility
FLVC
ID Description
0x00 Left top red
0x01 Left top green
0x02 Left top blue
0x03 Left top alpha
0x04 Right top red
0x05 Right top green
0x06 Right top blue
0x07 Right top alpha
0x08 Left bottom red
0x09 Left bottom green
0x0A Left bottom blue
0x0B Left bottom alpha
0x0C Right bottom red
0x0D Right bottom green
0x0E Right bottom blue
0x0F Right bottom alpha
0x10 Pane alpha
FLMC
ID Description
0x00 Buffer red
0x01 Buffer green
0x02 Buffer blue
0x03 Buffer alpha
0x04 Constant 0 red
0x05 Constant 0 green
0x06 Constant 0 blue
0x07 Constant 0 alpha
0x08 C0 red
0x09 C0 green
0x0A C0 blue
0x0B C0 alpha
0x0C C1 red
0x0D C1 green
0x0E C1 blue
0x0F C1 alpha
0x10 C2 red
0x11 C2 green
0x12 C2 blue
0x13 C2 alpha
0x14 C3 red
0x15 C3 green
0x16 C3 blue
0x17 C3 alpha
0x18 C4 red
0x19 C4 green
0x1A C4 blue
0x1B C4 alpha
FLTS
ID Description
0x00 Translate U
0x01 Translate V
0x02 Rotate
0x03 Scale U
0x04 Scale V
FLTP
ID Description
0x00 Image
FLIM
ID Description
0x00 Rotate
0x01 Scale U
0x02 Scale V
FLAC
ID Description
0x00 Alpha compare reference
FLFS
ID Description
0x00 Black interpolate red
0x01 Black interpolate green
0x02 Black interpolate blue
0x03 White interpolate red
0x04 White interpolate green
0x05 White interpolate blue
0x06 White interpolate alpha
FLCT
ID Description
0x00 Eval type offset
FLCC
ID Description
0x00 Translate X
0x01 Translate Y
0x02 Translate Z
0x03 Rotate X
0x04 Rotate Y
0x05 Rotate Z
0x06 Left top red
0x07 Left top green
0x08 Left top blue
0x09 Left top alpha
0x0A Left bottom red
0x0B Left bottom green
0x0C Left bottom blue
0x0D Left bottom alpha
FLEU
ID Description
0x00 User data

Version List

Version Found in
2.2.0.0
3.3.0.0
5.0.0.0
5.2.0.0
8.0.0.0
8.2.0.0
8.3.0.0
8.5.0.0
  • Nintendo Switch System BIOS (5.0.2 – 5.1.0)
8.6.0.0
9.0.0.0

Tools

The following tools can handle BFLAN files:

  • (none)