tge-was-taken / Atlus-Script-Tools

A set of tools for working with scripts used in various game developed by Atlus.
GNU General Public License v3.0
65 stars 40 forks source link

Hooking a Hooked File Breaks The Original Hooks #65

Open Primogenitor33 opened 1 year ago

Primogenitor33 commented 1 year ago

After attempting to make my QT+ and Fuuka's Expanded BGM mods compatible with Aemulus' Flowscript merging, I discovered an issue with the compiler. If you try adding hooks to a BF file that already contains hooks, the original hooks break. For example, in QT+, I hook field_order_party. If I compile that, it works great. With Fuuka's, I hook order_for_huka and order_to_change_bgm. Again, if I compile that on it's own, it also works fine. If I compile the QT+ hook first, then follow it with compiling the Fuuka's hooks onto that newly compiled QT+ bf file, then the QT+ goes out of wack, however the code for Fuuka's works perfectly. This is also true in the reverse. The way QT+ works is that it hooks the main field script function, checks your current location with a Switch statement, then displays the appropriate Quick Travel menu for that area. After compiling Fuuka's on top of it, it always shows the menu for the last location in the Switch. If I add both mods hooks to one file and compile them all at once, both mods work together perfectly, but this makes them incompatible with Aemulus' flow script merging and therefore incompatible with other mods that modify the field script. I and a few others talked about this, and we believe the cause is if you're adding a goto where another goto is, the address is probably changing and breaking it and the compiler isn't updating the original go to.

I have attached the files for the mods for testing. The procedure would be compiling FIELD.flow from Quick Travel Plus TEST, taking that BF file to Fuuka's Expanded BGM TEST and compiling it's FIELD.flow

https://cdn.discordapp.com/attachments/1147062856144138372/1147070081529032704/Mods.zip