BF

BF is the script format used by games developed by Atlus. Dialog in Persona 3 and Persona 4 is completely handled by BF scripts containing BMD messages.

Header
Uses the common header structure used in other files.

Type Table Types
Describes a type of content in the BF file. In most BF files, there's 5 of these entries.

Label or Procedure Entry
Labels and procedures are essentially the same with the only difference being their usage semantics. Procedures, or functions can take in arguments or return values. These however are processed at runtime. Labels, or jump labels are equivalent to goto's in C-like languages. They directly jump to a location in the current procedure.

Instruction Entry
An instruction is made up out of an opcode and operand(s).

Opcodes
The opcode tells the game's interpreter what to do, and the operands are the data the interpreter processes on. Depending on the opcode either no operands are used, the reserved field is used as an operand or the next 4 bytes are used.

AtlusScriptToolchain
TGE'S AtlusScriptToolchain can manage BF files.

AtlusScriptCompiler
By providing the following commandline arguments, for example, you can decompile a BF binary to an editable .flow (flowscript). Any embedded BMD files also get decoded to .msg (messagescript) in the process. AtlusScriptCompiler.exe input.bf -Decompile -Library P5 -Encoding P5 You can then recompile the .flow (and any other included .flow or .msg files referenced in the .flow) into a new BF file using commandline arguments: AtlusScriptCompiler.exe input.bf.flow -Compile -OutFormat V3BE -Library P5 -Encoding P5