BFEVFL

From ZeldaMods (Breath of the Wild)
Revision as of 17:28, 12 September 2018 by imported>Leoetlino
Jump to navigation Jump to search

bfevfl is a binary file format for event flows.

Structures

bfevfl is a little endian format, so values are stored in little endian even on Wii U.

bfevfl uses pointers very heavily to refer to strings, to other sections, etc. All pointers are always 64 bit long -- since the same format is used on the Switch which is a 64 bit platform. They must be present in the #Relocation table if the file is to be loaded correctly by the official bfevfl code.

As a direct consequence, most sections don't have any fixed order. Therefore, this article will only document the data structures and mention the order Nintendo places sections in. For more details, it is recommended to look at the evfl library directly.

Header

Offset Type Description
0x0 char[8] Magic ("BFEVFL\x00\x00")
0x8 u16 Version (0x0300)
0xa u8 Unknown (must be zero)
0xb u8 Unknown
0xc u16 Byte order mark
0xe u8 Alignment (to get the actual value: 1 << raw_value)
0xf u8 Unknown
0x10 u32 File name offset
0x14 u16 Is relocated flag (set in memory)
0x16 u16 First block offset
0x18 u32 Relocation table offset
0x1c u32 File size
0x20 u16 Number of flowcharts
0x22 u16 Number of timelines
0x24 u32 Padding
0x28 Flowchart* Flowchart (nullptr if no flowchart)
0x30 Dictionary* Flowchart name dictionary
0x38 Timeline* Timeline (nullptr if no timeline)
0x40 Dictionary* Timeline name dictionary

Relocation table

Dictionary

Container

Flowchart

Timeline

Section order

File

  • Header (0x48 bytes)
  • Flowchart* array if it exists
  • Flowchart dictionary (always)
  • Timeline* array if it exists
  • Timeline dictionary (always)
  • Timeline
  • Flowchart
  • String pool (STR )
  • Relocation table (RELT)

Timeline

Flowchart

  • Flowchart header
  • Actors
  • Argument name is put in the string pool.
  • Events
  • Entry point dictionary
  • Entry points
  • Event param containers, fork structs, etc. (in order)
  • Actor param containers, string pointer arrays (in order)
  • Entry point extra data
  • Sub flow event index arrays are written here
  • ptr_x10 data may be written here? (ptr_x10 has always been a nullptr in files that have been checked by leoetlino.)
  • The size for each entry point is sizeof(event_idx_array) rounded up to the nearest multiple of 8 + 0x18 bytes.

Container

  • Container header (variable size)
  • Container dictionary
  • Container items (+ values)

Tools

  • evfl: Python library for parsing and writing event flows
  • EventEditor: graphical editor for event flows