EFTB: Difference between revisions

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
imported>Locke
(→‎Emitter Set (ESET): ESET header - number of descendants)
(Replaced content with "<onlyinclude> <code>EFTB</code> files are PTCL files. </onlyinclude> Category:File formats")
Tag: Replaced
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<onlyinclude>
<onlyinclude>
<code>EFTB</code> files define certain graphical effects of objects such as emissions, particles, and shaders.
<code>EFTB</code> files are [[PTCL]] files.
</onlyinclude>
</onlyinclude>
== EFTB File Layout ==
EFTB files are made up of a header and four arrays that are aligned to 16 bytes.
* Emitter Set Array
* Texture Array
* PRM{{check}} Array
* Shader Array
Each array serves as a root node in a tree structure.
== EFTB Header ==
EFTB's header is 48 bytes and is not yet well-understood.
=== Header Structure ===
{| class="wikitable"
!Offset (h)
!Size
!Data Type
!Description
|-
| 0x00
| 4
| String
| file signature (magic) (<code>45 46 54 42</code> or "EFTB")
|-
| 0x04
| 4
| Unsigned Int
| Unknown (<code>00 00 00 14</code>)
|-
| 0x08
| 4
| String
| Unknown (<code>47 61 6d 65</code> or "Game")
|-
| colspan="4" | ...
|}
== Nodes ==
Each node in an array's tree structure is made up of a header and three optional sections.
* Binary data
* Attribute nodes{{check}}
* Child nodes
=== Node Header Structure ===
Node headers typically have the same 32-byte structure, though some are longer and some calculate certain values differently.
{| class="wikitable"
!Offset (h)
!Size
!Data Type
!Description
|-
| 0x00
| 4
| Unsigned Int
| Signature (magic)
|-
| 0x04
| 4
| Unsigned Int
| Node size. Different node types calculate this differently.
|-
| 0x08
| 4
| Unsigned Int
| Offset to the first child node, or <code>FF FF FF FF</code> if there are no children
|-
| 0x0c
| 4
| Unsigned Int
| Offset to the next sibling node, or <code>FF FF FF FF</code> if there are no more siblings
|-
| 0x10
| 4
| Unsigned Int
| Offset to the first attribute{{check}}, or <code>FF FF FF FF</code> if there are no attributes
|-
| 0x14
| 4
| Unsigned Int
| Offset to the binary data, or the size of the header
|-
| 0x18
| 4
|
| Padding
|-
| 0x1c
| 2
| Unsigned Short
| Number of child nodes. Shaders' use of this value is unknown.
|-
| 0x1e
| 2
| Unsigned Short
| Unknown (<code>00 01</code>)
|}
=== Emitter Sets (ESTA) ===
The Emitter Set Array (ESTA) contains any number of Emitter Sets (ESET) as child nodes.
==== Emitter Set (ESET) ====
Emitter sets (ESET) contain 0x60 bytes of data:
{| class="wikitable"
!Offset (h)
!Size (h)
!Data Type
!Description
|-
| 0x10 || 0x40 || String || 0-terminated string representing the name of the emitter set
|-
| 0x50 || 0x04 || Unsigned Int || Total number of emitters in the set, including all descendant nodes
|-
| 0x5a || 0x02 || Unsigned Short || Unknown
|-
| 0x5f || 0x01 || Byte || Unknown. Can be <code>0x00</code> or <code>0xff</code>
|}
The rest of the data block is padding.
Emitter sets also contain any number of Emitters (EMTR) as child nodes.
==== Emitter (EMTR) ====
Emitters (EMTR) cause an object to cast light on surrounding surfaces. They contain the following data:
{| class="wikitable"
!Offset (h)
!Size (h)
!Description
|-
| 0x00 || 0x60 || Name block, like in ESET
|-
| 0x60 || 0x18 || Six Unsigned Ints specifying the sizes of the color arrays
* Color 0
* Alpha 0
* Color 1
* Alpha 1
* Scale{{check}}
* Unknown
|-
| colspan="2" | ... || Unknown
|-
| 0x420 || 0x80 || Color 0 array (eight sets of four 32-bit floats describing Red, Green, Blue, and Time)
|-
| 0x4a0 || 0x80 || Alpha 0 array
|-
| 0x520 || 0x80 || Color 1 array
|-
| 0x5a0 || 0x80 || Alpha 1 array
|-
| 0x620 || 0x40 || Unknown array
|-
| 0x660 || 0x80 || Scale{{check}} array
|-
| colspan="2" | ... || Unknown
|-
| 0xa08 || 0x10 || Constant Color 0 if Color 0 array is empty
|-
| 0xa18 || 0x10 || Constant Color 1 if Color 1 array is empty
|-
| 0xa28 || 0x30 || Unknown
|-
| 0xa58 || 0x60 || Three 0x20 blocks consisting of a 64-bit Unsigned Long Texture ID and 0x18 bytes padding
|-
| 0xab8 || 0x30 || Unknown
|}
Emitters can also have any number of attribute nodes (e.g. CADP, CSDP, FCSF), the purpose of which is currently unknown, as well as child emitter nodes.
=== Textures (TEXA) ===
The Texture Array (TEXA) contains any number of Textures (TEXR), with each texture containing a single GX2 Texture Block (GX2B). The TEXA tree is flattened such that all TEXR nodes appear first, followed by all of their child GX2B nodes.
=== (PRMA) ===
The PRMA{{check}} contains any number of PRIM{{check}} nodes.
=== Shaders (SHDA) ===
The Shader Array (SHDA) contains a single{{check}} GX2 Shader Block (SHDB).
<references />


[[Category:File formats]]
[[Category:File formats]]

Latest revision as of 01:35, 26 January 2022

EFTB files are PTCL files.