🦊



Basics
Flowscript
Messagescript
Decompiling
Compiling

Features
Importing
↳ Declaring Functions
↳ Declaring Variables
Hooking Functions

P5 Functions
↳ AI
↳ Common
↳ Facility
↳ Field
↳ Net
↳ Social

Hooking Functions

AtlusScriptCompiler is not perfect, and sometimes decompiled data is imprecise (usually float values). This can lead to glitches (weird camera/player positioning and movement) and even crashes in-game when a recompiled script is modded back in.
To get around this, AtlusScriptCompiler has a feature that preserves the original .BF's data, appending only new data to the end from your compiled .FLOW.
You can use this to replace the contents of a specific method or function without screwing up the rest of the file.

Creating the .FLOW

In this example, let's say we wanted to replace ONLY the contents of fld_square_menu, a method in field.bf.
We would have to create a new text document ending with the .FLOW extension, named anything we want. In this example, fieldhook.flow.

Referencing the .BF

In that blank document, let's import the bf. Make sure the .flow is in the same directory as the .bf and follow the instructions from the importing guide, like so:
import( "field.bf" );

Creating the Hook

Next, let's copy the method we want to replace from the decompiled .bf, changing whatever we want. You can even reference external methods you add to your .flow like so:

import( "field.bf" );

void fld_square_menu_hook()
{
    ModMenuDisplay();
}

void ModMenuDisplay()
{
    ALL_ENABLE_SHARE_PLAY(); //Re-enables screen recording
    BIT_OFF( 4099 ); //Removes your "tired" status
...
Note that the replacement method has "_hook" appended to the name. This is important.

Compiling the .FLOW

Follow the same steps as the Compiling guide, except add one extra commandline argument: "-Hook".
For example:
AtlusScriptCompiler.exe fieldhook.flow -Compile -OutFormat V3BE -Library P5 -Encoding P5 -Hook

This should generate fieldhook.bf, an identical copy of field.bf except with the ModMenuDisplay() method replacing the contents of fld_square_menu_hook.

We are not affiliated, associated, authorized, endorsed by, or in any way
officially connected with ATLUS, SEGA, or any of its subsidiaries or its affiliates.
The official ATLUS website can be found at https://atlus.com. "Persona", as well
as all characters referenced on this page are registered trademarks of ATLUS.