BREFF (File Format)

From Custom Mario Kart
Revision as of 12:12, 17 January 2017 by Atlas (talk | contribs) (→‎Animation Table: Yeah)
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 Padding?
0x04 0x04 UInt32 Size of emitter data.
0x08 Start of Emitter data

Emitter

Unknown.

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 0xAC.
0x01 0x01 Byte Kind Type.
0x02 0x01 Byte Curve Flag.
0x03 0x01 Byte Kind Enable.
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: