BREFF (File Format)

From Custom Mario Kart
Revision as of 14:24, 4 January 2020 by Atlas (talk | contribs)
Jump to navigation Jump to search

Introduction

Read BREFF and BREFT (File Format) for an introduction.

File Format

The Sub File Item explained here points to this structure.

Offset Size Type Description
0x00 0x04 UInt32 Pointer to effect name (calculated at runtime)
0x04 0x04 UInt32 Size of emitter data.
0x08 Start of Emitter data

Emitter

An emitter usually has size 0x14c.

Offset Size Type Description
0x00 0x04 Unknown flags
0x04 0x04 Unknown flag
0x08 0x02 UInt16 Emitter life
0x0a 0x02 UInt16 Particle life
0x0c 0x01 Byte Particle life random
0x0d 0x01 Bool Inherit child particle translation
0x0e 0x01 Byte Emit interval random
0x0f 0x01 Byte Emit random
0x10 0x04 Float Unknown emission value
0x14 0x02 UInt16 Emit start
0x16 0x02 UInt16 Emit end
0x18 0x02 UInt16 Emit interval
0x1a 0x01 Bool Inherit particle translation
0x1b 0x01 Bool Inherit child emitter translation?
0x1c 0x04 Float Unknown parameter
0x20 0x04 Float Unknown parameter
0x24 0x04 Float Unknown parameter
0x28 0x04 Float Unknown parameter
0x2c 0x04 Float Unknown parameter
0x30 0x04 Float Unknown parameter
0x34 0x02 UInt16 Emit diversion?
0x36 0x01 Byte Velocity random
0x37 0x01 Byte Momentum random
0x38 0x04 Float Power radiation
0x3c 0x04 Float Power y-axis value
0x40 0x04 Float Power random
0x44 0x04 Float Power normal
0x48 0x04 Float Diffison emitter normal
0x4c 0x04 Float Power spec
0x50 0x04 Float Diffusion spec
0x54 0x04 Float3 Emission angle
0x60 0x0C Float3 Scale
0x6C 0x0C Float3 Rotation
0x78 0x0C Float3 Translation
0x84 0x01 Byte LOD nearest distance
0x85 0x01 Byte LOD farthest distance
0x86 0x01 Byte LOD minimal emission
0x87 0x01 Byte LOD alpha
0x88 0x04 UInt32 Random seed
0x8C 0x08 Unknown
0x94 0x02 UInt16 Unknown flags
0x96 0x01 Byte Alpha comparison 0
0x97 0x01 Byte Alpha comparison 1
0x98 0x01 Byte Alpha compare operation
0x99 0x01 Byte Number of TEV stages

Particle

Like the emitter, the particle structure has a UInt32 telling how large this section is.

Offset Size Type Description
0x00 0x04 UInt32 Size of particle data.
0x04 Start of Particle data

Afterwards comes the particle data.

Offset Size Type Description
0x00 0x04 Byte[4] Color1A.
0x04 0x04 Byte[4] Color1B.
0x08 0x04 Byte[4] Color2A.
0x0C 0x04 Byte[4] Color2B.
0x10 0x08 Float[2] Size.
0x18 0x08 Float[2] Scale.
0x20 0x0C Float[3] Rotation.
0x2C 0x08 Float[2] Texture Scale 1.
0x34 0x08 Float[2] Texture Scale 2.
0x3C 0x08 Float[2] Texture Scale 3.
0x44 0x0C Float[3] Texture Rotation.
0x50 0x08 Float[2] Texture Translate 1.
0x58 0x08 Float[2] Texture Translate 2.
0x60 0x08 Float[2] Texture Translate 3.
0x68 0x04 UInt32 mTexture1.
0x6C 0x04 UInt32 mTexture2.
0x70 0x04 UInt32 mTexture3.
0x74 0x02 UInt16 Texture Wrap.
0x76 0x01 Byte Texture Reverse.
0x77 0x01 Byte AlphaCompareRef0.
0x78 0x01 Byte AlphaCompareRef1.
0x79 0x01 Byte Rotate Offset Random 1.
0x7A 0x01 Byte Rotate Offset Random 2.
0x7B 0x01 Byte Rotate Offset Random 3.
0x7C 0x0C Float[3] Rotate Offset.
0x84 0x02 UInt16 L1 = Length of texture reference 1 including the terminating NULL byte.
0x86 L1 String Texture Reference 1 (including a NULL byte).
0x86 + L1 0x02 UInt16 L2 = Length of texture reference 2 including the terminating NULL byte.
0x8C + L1 L2 String Texture Reference 2 (including a NULL byte).
0x8C + L1 + L2 0x02 UInt16 L3 = Length of texture reference 3 including the terminating NULL byte.
0x8E + L1 + L2 L3 String Texture Reference 3 (including a NULL byte).
0x8E + L1 + L2 + L3 End of this structure

Between this and the next structure there might be some padding to make the next structure aligned.

Animation Table

Offset Size Type Description
0x00 0x02 UInt16 A = Animation Count.
0x02 0x02 UInt16 PtcllnitTrackCount.
0x04 A * 4 UInt32[A] Padding?
0x04 + A * 4 A * 4 UInt32[A] Animation Sizes.
0x04 + 2(A * 4) 0x02 UInt16 E = Emitter Count
0x06 + 2(A * 4) 0x02 UInt16 EmitlnitTrackCount.
0x08 + 2(A * 4) + E * 4 E * 4 UInt32[E] Padding?
0x08 + 2(A * 4) + 2(E * 4) E * 4 UInt32[E] Animation Sizes.
0x08 + 2(A * 4) + 2(E * 4) End of this structure

Animation

Offset Size Type Description
0x00 0x01 Byte Animation identifier. Always 0xAB or 0xAC.
0x01 0x01 Byte Kind Type.
0x02 0x01 Byte Curve Flag.
0x03 0x01 Byte Kind Enable.
Value Description
0 Disabled
1 X
2 Y
3 XY
4 Z
5 XZ
6 YZ
7 XYZ
0x04 0x01 Byte Process Flag.
0x05 0x01 Byte Loop Count.
0x06 0x02 UInt16 Random Seed.
0x08 0x02 UInt16 Frame Count.
0x0A 0x02 UInt16 Padding.
0x0C 0x04 UInt32 KeyTable Size.
0x10 0x04 UInt32 RangeTable Size.
0x14 0x04 UInt32 RandomTable Size.
0x18 0x04 UInt32 NameTable Size.
0x1C 0x04 UInt32 InfoTable Size.
0x20 End of this structure

It seems like the tables contain the actual animation data. The tables comes directly after this section and they appear in the order KeyTable, RangeTable, RandomTable, NameTable and InfoTable.

KeyTable

RangeTable

Offset Size Type Description
0x00 0x02 UInt16 N = Number of entries.
0x02 0x02 UInt16 Padding?
0x04 End of this structure
Offset Size Type Description
0x00 0x04 Float Unknown.
0x04 0x04 Float Unknown.
0x08 0x04 Float Unknown.
0x0C 0x04 Float Unknown.
0x10 End of this structure

RandomTable

Offset Size Type Description
0x00 0x02 UInt16 N = Number of entries.
0x02 0x02 UInt16 Padding?
0x04 End of this structure
Offset Size Type Description
0x00 0x04 UInt32 Unknown.
0x04 End of this structure

NameTable

This table seems to link to one or more sub file item.

Offset Size Type Description
0x00 0x02 UInt16 N = Number of entries.
0x02 0x02 UInt16 Padding?
0x04 N * 0x04 UInt32[N] Padding?
0x04 + N * 0x04 End of this structure

After comes the sub file item name references. All entries comes after each other and after the last, there might be some padding to align the next structure.

Offset Size Type Description
0x00 0x02 UInt16 L = Length of the sub file item name including a NULL byte.
0x02 L String Sub file item name reference (including a NULL byte).
0x02 + L End of this structure

InfoTable

Tools

The following tools can handle BREFF files: