nn::ui2d provides the Binary Cafe Layout file format to define the layout of ui elements.
Standard ui2d header.
There are 23 possible section types:
Name
|
Magic
|
Description
|
User Data
|
usd1
|
User Data for the previous section, can contain special SystemData structures that extend functionality
|
Layout
|
lyt1
|
The headlining section for the Layout
|
Texture List
|
txl1
|
A list of all textures used in the Layout
|
Font List
|
fnl1
|
A list of all fonts used in the Layout
|
Material List
|
mat1
|
All the materials used in the Layout
|
Capture Texture List
|
ctl1
|
A list of all capture textures used in the Layout
|
Vector Graphics Texture List
|
vgl1
|
A list of all vector graphics textures used in the Layout
|
Pane Start
|
pas1
|
The start of a tree of panes, panes become children of last pane
|
Pane End
|
pae1
|
The end of a tree of panes
|
Pane
|
pan1
|
The default pane
|
Picture Pane
|
pic1
|
A pane that can contain images
|
TextBox Pane
|
txt1
|
A pane that can contain text
|
Window Pane
|
wnd1
|
A pane that contain a frame and multiple images
|
Parts Pane
|
prt1
|
A pane that can contain a sub layout
|
Alignment Pane
|
ali1
|
A pane that aligns it's children
|
Capture Pane
|
cpt1
|
A pane that captures it's children
|
Bounding Pane
|
bnd1
|
A pane that can be used in hit detection
|
Scissor Pane
|
scr1
|
A pane the scissors it's children
|
Group Start
|
grs1
|
The start of a group
|
Group End
|
gre1
|
The end of a group
|
Group
|
grp1
|
A group
|
Control Source
|
cnt1
|
The control source class and related for the layout
|
State Machine
|
stm1
|
A state machine
|
Layout (lyt1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Ui2d Section Header
|
Magic: "lyt1"
|
0x8
|
0x1
|
u8
|
Is Centered
|
0x9
|
0x3
|
u24
|
Unknown/Reserved
|
0xc
|
0x4
|
float
|
Width
|
0x10
|
0x4
|
float
|
Height
|
0x14
|
0x4
|
float
|
PartsWidth
|
0x18
|
0x4
|
float
|
PartsHeight
|
0x1c
|
variable
|
char[]
|
Name
|
Layout SystemData
Name
|
EnumValue
|
Description
|
AnimTagName
|
0x0
|
Animation names?
|
AnimTagName
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x4
|
u32
|
String Count
|
0x4
|
0x4 * String Count
|
u32
|
Anim Name String Offset Array
|
Texture List (txl1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Ui2d Section Header
|
Magic: "txl1"
|
0x8
|
0x2
|
u16
|
Texture Count
|
0xa
|
0x2
|
u16
|
Unknown/Reserved
|
0x4
|
0x4 * Texture Count
|
u32
|
Texture Name Offset Array
|
Font List (fnt1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Ui2d Section Header
|
Magic: "fnt1"
|
0x8
|
0x2
|
u16
|
Font Count
|
0xa
|
0x2
|
u16
|
Unknown/Reserved
|
0x4
|
0x4 * Font Count
|
u32
|
Font Name Offset Array
|
Material List (mat1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Ui2d Section Header
|
Magic: "mat1"
|
0x8
|
0x2
|
u16
|
Material Count
|
0xa
|
0x2
|
u16
|
Unknown/Reserved
|
0x4
|
0x4 * Material Count
|
u32
|
Material Data Offset Array
|
Material Memory
The layout of material memory is defined by this bitfield.
Bitfield Size
|
Description
|
0x2
|
Texture Map Count
|
0x2
|
Texture SRT (Scale Rotation Translation) Count
|
0x2
|
Texture Coordinate Gen Count
|
0x3
|
Tev (Texture Environment) Combiner Count
|
0x1
|
Alpha Compare Count
|
0x1
|
Color Blend Mode Count
|
0x1
|
Unknown/Reserved
|
0x1
|
Color And Alpha Blend Mode Count
|
0x1
|
Unknown/Reserved
|
0x1
|
Unknown0
|
0x2
|
Projection Texture Gen Count
|
0x1
|
Unknown1
|
0x1
|
Unknown/Reserved
|
0x1
|
Detailed Combiner Count
|
0x1
|
User Combiner Count
|
0x1
|
Texture Extensions Count
|
0x2
|
Vector Texture Info Count
|
0x2
|
Brick Repeat Shader Info Count
|
0x6
|
Unknown/Reserved
|
The order of appearance of Material Data structures are as follows:
Structure
|
Material Data
|
Texture Map
|
Texture Extensions
|
Texture SRT
|
Texture Coordinate Gen
|
Tev Combiner
|
Alpha Compare
|
Blend Mode
|
Unknown0
|
Projection Texture Gen
|
Unknown1
|
DetailedCombiner
|
User Combiner
|
Vector Texture Info
|
Brick Repeat Shader Info
|
Material Color Type
Name
|
EnumValue
|
Description
|
Color4u8
|
0x0
|
Material Color data offsets point to a Color4u8
|
Color4f
|
0x1
|
Material Color data offsets point to a Color4f
|
Material Color Data
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x1
|
u8
|
Color Type
|
0x1
|
0x1
|
u8
|
Color Count
|
0x2
|
0x1 * Color Count
|
u8
|
Color Offsets
|
|
(Color4u8) 0x4 * Color Count
(Color4f) 0xc * Color Count
|
Color4u8
Color4f
|
Color Array
|
Material Data
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x1c
|
char[0x1c]
|
Material name
|
0x1c
|
0x4
|
Material Memory
|
Material memory bitfield
|
0x20
|
variable
|
MaterialColorData
|
Material color data
|
Texture Map
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x2
|
u16
|
Texture Index
|
0x2
|
0x1
|
Texture UV Options
|
U Options
|
0x3
|
0x1
|
Texture UV Options
|
V Options
|
Texture UV Options
Bitfield Size
|
Description
|
0x2
|
Wrap Mode
|
0x2
|
Filter
|
0x4
|
Unknown/Reserved
|
Texture Extensions
Bitfield Size
|
Description
|
0x1
|
Is Capture Texture
|
0x1
|
Is Vector Graphics Texture
|
0x1e
|
Unknown/Reserved
|
Texture SRT
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Vector2f
|
Translation
|
0x8
|
0x4
|
float
|
Rotation
|
0xc
|
0x8
|
Vector2f
|
Scale
|
Texture Coordinate Gen (TODO)
Tev Combiner (TODO)
Alpha Compare
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x1
|
u8
|
Alpha Test Function
|
0x1
|
0x3
|
u24
|
Unknown/Reserved
|
0x4
|
0x1
|
float
|
Alpha Compare Reference
|
Alpha Test Function
Name
|
Enum Value
|
Description
|
Never
|
0x0
|
|
LessThan
|
0x1
|
|
LessThanEqual
|
0x2
|
|
Equal
|
0x3
|
|
NotEqual
|
0x4
|
|
GreaterEqual
|
0x5
|
|
Greater
|
0x6
|
|
Always
|
0x7
|
|
Blend Mode
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x1
|
u8
|
Blend Equation
|
0x1
|
0x1
|
u8
|
Blend Function Source
|
0x2
|
0x1
|
u8
|
Blend Function Destination
|
0x3
|
0x1
|
u8
|
Logic Operation
|
Blend Equation
Name
|
Enum Value
|
Description
|
Invalid
|
0x0
|
|
Add
|
0x1
|
|
Sub
|
0x2
|
|
ReverseSub
|
0x3
|
|
Min
|
0x4
|
|
Max
|
0x5
|
|
Blend Function
Name
|
Enum Value
|
Description
|
Zero
|
0x0
|
|
One
|
0x1
|
|
Destination Color
|
0x2
|
|
Destination Color Minus One
|
0x3
|
|
Source Alpha
|
0x4
|
|
Source Alpha Minus One
|
0x5
|
|
Destination Alpha
|
0x6
|
|
Destination Alpha Minus One
|
0x7
|
|
Source Color
|
0x8
|
|
Source Color Minus One
|
0x9
|
|
Logic Operation
Name
|
Enum Value
|
Description
|
Invalid
|
0x0
|
|
NoOp
|
0x1
|
|
Clear
|
0x2
|
|
Set
|
0x3
|
|
Copy
|
0x4
|
|
CopyInverted
|
0x5
|
|
Invert
|
0x6
|
|
And
|
0x7
|
|
Nand
|
0x8
|
|
Or
|
0x9
|
|
Nor
|
0xa
|
|
Xor
|
0xb
|
|
Equivalent
|
0xc
|
|
AndReverse
|
0xd
|
|
AndInverted
|
0xe
|
|
OrReverse
|
0xf
|
|
OrInverted
|
0x10
|
|
Unknown0 (TODO)
Projection Texture Gen (TODO)
Unknown1 (TODO)
Detailed Combiner (TODO)
User Combiner (TODO)
Vector Texture Info (TODO)
Brick Repeat Shader Info (TODO)
Capture Texture List (TODO)
Vector Graphics Texture List (TODO)
Pane Start (TODO)
Pane End (TODO)
Pane (pan1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Ui2d Section Header
|
Magic: "pan1"
|
0x8
|
0x1
|
u8
|
Pane Flags
|
0x9
|
0x1
|
u8
|
Origin Bitfield
|
0xa
|
0x1
|
u8
|
Alpha
|
0xb
|
0x1
|
u8
|
FlagEx
|
0xc
|
0x18
|
char[0x18]
|
Pane name
|
0x24
|
0x8
|
char[0x8]
|
User name
|
0x2c
|
0xc
|
Vector3f
|
Translation
|
0x28
|
0xc
|
Vector3f
|
Rotation
|
0x44
|
0x8
|
Vector2f
|
Scale
|
0x4c
|
0x8
|
Vector2f
|
Size
|
Picture Pane (pic1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x54
|
Pane
|
Magic: "pic1"
|
0x54
|
0x4
|
Color4u8
|
Vertex Color Top Left
|
0x58
|
0x4
|
Color4u8
|
Vertex Color Top Right
|
0x5c
|
0x4
|
Color4u8
|
Vertex Color Bottom Left
|
0x60
|
0x4
|
Color4u8
|
Vertex Color Bottom Right
|
0x64
|
0x2
|
u16
|
Material Index
|
0x66
|
0x1
|
u8
|
Texture Count
|
0x67
|
0x1
|
u8
|
Is Shape
|
0x68
|
0x20
|
Texture UV
|
Texture UV Array
|
Texture UV
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x8
|
Vector2f
|
Top Left
|
0x8
|
0x8
|
Vector2f
|
Top Right
|
0x10
|
0x8
|
Vector2f
|
Bottom Left
|
0x18
|
0x8
|
Vector2f
|
Bottom Right
|
TextBox Pane (txt1)
Offset
|
Size
|
Type
|
Description
|
0x0
|
0x54
|
Pane
|
Magic: "pic1"
|
0x54
|
0x2
|
u16
|
Text Buffer Size
|
0x56
|
0x2
|
u16
|
Text Length
|
0x58
|
0x2
|
u16
|
Material Index
|
0x5a
|
0x2
|
u16
|
Font Index
|
0x5c
|
0x1
|
u8
|
Text Origin
|
0x5d
|
0x1
|
u8
|
Line Alignment
|
0x5e
|
0x2
|
u16
|
Flags
|
0x60
|
0x4
|
float
|
Italic Tilt
|
0x64
|
0x4
|
u32
|
Text Offset
|
0x68
|
0x4
|
Color4u8
|
Font Top Color
|
0x6c
|
0x4
|
Color4u8
|
Font Bottom Color
|
0x70
|
0x8
|
Vector2f
|
Font Size
|
0x78
|
0x4
|
float
|
Character Space
|
0x7c
|
0x4
|
float
|
Line Space
|
0x80
|
0x4
|
u32
|
Label Offset
|
0x84
|
0x8
|
Vector2f
|
Shadow Translation
|
0x8c
|
0x8
|
Vector2f
|
Shadow Size
|
0x94
|
0x4
|
Color4u8
|
Shadow Top Color
|
0x98
|
0x4
|
Color4u8
|
Shadow Bottom Color
|
0x9c
|
0x4
|
float
|
Shadow Italic Tilt
|
0xa0
|
0x4
|
u32
|
Line Transform Offset
|
0xa4
|
0x4
|
u32
|
Per Character Transform Offset
|
Line Transform (TODO)
Per Character Transform (TODO)
Window Pane (TODO)
Parts Pane (TODO)
Alignment Pane (TODO)
Capture Pane (TODO)
Bounding Pane (TODO)
Scissor Pane (TODO)
Group Start (TODO)
Group End (TODO)
Group (TODO)
Control Source (TODO)