BF

BF is a binary format compiled from scripts created by Atlus. Logic during gameplay in almost all Persona games and several other Atlus entries is completely handled by BF files. For example, enemy AI, setting and checking flags for displaying dialog, starting scripted battles etc. BF files usually also contain and reference BMD files (Atlus's compiled message format).

AtlusScriptToolchain
TGE'S AtlusScriptToolchain can manage BF files.

AtlusScriptCompiler
AtlusScriptCompiler is a commandline program that is part of the AtlusScriptToolchain. By providing the following 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. Both can be modified using a text editor like Notepad++. 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 The compiler can be downloaded here as part of AtlusScriptToolchain, along with a GUI that allows you to drag and drop files to compile/decompile them automatically without needing to use commandline arguments.

BFMessageScriptEditor
The compiler is a perpetual work in progress and does not always recompile flowscripts with 100% accuracy. As a result, unexpected glitches may occur ingame. One workaround, if you're only interested in editing the script's text, is to use the BFMessageScriptEditor program. Simply drag a BF file onto the exe to extract a .msg (messagescript), edit it with your text editor of choice, and drag it onto the exe when you're done. This will replace the embedded BMD in the BF without recompiling the script itself.

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.