Mod Menu Compiling Error

Describe your problem in as much detail as you can. Other users might help.
User avatar
ShrineFox
Site Admin
Posts: 290
Joined: Mon Oct 07, 2019 3:19 am
Has liked: 277 posts
Been liked: 115 posts

EmreX_Coded wrote: Thu Jan 20, 2022 12:11 pm UPDATE 2:
I used the old fscr015_002_100.bf instead of the new hook and it now works, i have successfully loaded the Mod Menu into the game.

NOW THE NEW PROBLEM:
It seems like the description of EVERY Option in the Menu (sub menus included) is shifted
Example:

When i hover over the "Player" Option (the first option in the Menu) then the Description is blank.
When i hover over the "Battle Select" Option (the second option) then it shows me the Description of the Player Menu Option

So Descriptions are in the wrong order/place. But i can't figure that out sadly :/
But it loaded! So now fixing this problem at everything should work. ^^
Pushed a commit that should fix the descriptions, but I also wrote up an explanation for how I did it and why it works, just in case this kind of thing comes up again.
It's kinda long so I'll put it in a spoiler.
Fixing Offset MSG Descriptions
Basically, each [SEL] option in the Mod Menu .msg file ends with a command like this: [f 4 26 1 94].

In this case, 94 is the ID of the corresponding description message.
So selecting [s]Player[f 4 26 1 94][e] in-game should display the following message:

Code: Select all

[dlg GENERIC_HELP_94]
[s]Edit your Personas, items, stats,[n]money, or even your name.[e]
Problem is, if you add more messages before GENERIC_HELP_94, it's no longer the 94th message.
Then all the GENERIC_HELP_X lines need to be renamed with the new ID, as well as the number in the selection option.
GENERIC_HELP_94 becomes GENERIC_HELP_95
[s]Player[f 4 26 1 94][e] becomes [s]Player[f 4 26 1 95][e]
etc.

To make it even more complicated, there are more messages in the mementos/palace .bf files than in the overworld one.
If you decompile the original field.bf, you get a file called field.bf.msg.h with the ID of each message:
Image
This shows that there are 34 messages in the field.bf.
But if you decompile dungeon.bf, it has 110 messages.
And at_dng.bf has 181.

Since the Mod Menu gets tacked onto the end of these original .bf files, we have to start our Mod Menu .msg at ID 182.
So for example, let's start with field.bf.flow. 181 - 34 = 147, so we need to add 147 placeholder messages.

The placeholder.msg next to the .flow is full of dummy messages like this:

Code: Select all

[dlg msg01]
[s][n][e]

[dlg msg02]
[s][n][e]

...
To fill it out with 147 of these more easily, we can use an online number list generator like this and start at 35, working our way up to 181. The prefix can be [dlg msg and the suffix can be ]\n[s][n][e]\n

Image

Now I can just paste this into notepad++ and replace the \n with an actual new line & save it as the placeholder.msg next to the field.bf.flow.

Image

The placeholder is imported by field.bf.flow before the Mod Menu .flow, but after the original field.bf.

Code: Select all

import( "../build/input/extracted/etc/field.bf" );
import( "placeholder.msg" );
import( "../ModMenu.flow" );
Now I can just repeat this process for dungeon.bf (placeholder messages starting from 111 and ending with 181).
Last step, probably the most inconvenient, is to rename all the GENERIC_HELP_X and [f 4 26 1 x] lines in the Mod Menu .msg to start from 182.

Fortunately I already made a program that automates this, msgReindex.exe.
Image
Ta-daa!
Image

I can tell if it worked by decompiling the field.bf and dungeon.bf output scripts and seeing if the message IDs line up as expected.
Image

Tags:
User avatar
RubyX_Coded
Posts: 31
Joined: Mon Jan 17, 2022 9:09 am
Location: Germany
Has liked: 5 posts
Been liked: 6 posts
Contact:

ShrineFox wrote: Thu Jan 20, 2022 3:52 pm
EmreX_Coded wrote: Thu Jan 20, 2022 12:11 pm UPDATE 2:
I used the old fscr015_002_100.bf instead of the new hook and it now works, i have successfully loaded the Mod Menu into the game.

NOW THE NEW PROBLEM:
It seems like the description of EVERY Option in the Menu (sub menus included) is shifted
Example:

When i hover over the "Player" Option (the first option in the Menu) then the Description is blank.
When i hover over the "Battle Select" Option (the second option) then it shows me the Description of the Player Menu Option

So Descriptions are in the wrong order/place. But i can't figure that out sadly :/
But it loaded! So now fixing this problem at everything should work. ^^
Pushed a commit that should fix the descriptions, but I also wrote up an explanation for how I did it and why it works, just in case this kind of thing comes up again.
It's kinda long so I'll put it in a spoiler.
Fixing Offset MSG Descriptions
Basically, each [SEL] option in the Mod Menu .msg file ends with a command like this: [f 4 26 1 94].

In this case, 94 is the ID of the corresponding description message.
So selecting [s]Player[f 4 26 1 94][e] in-game should display the following message:

Code: Select all

[dlg GENERIC_HELP_94]
[s]Edit your Personas, items, stats,[n]money, or even your name.[e]
Problem is, if you add more messages before GENERIC_HELP_94, it's no longer the 94th message.
Then all the GENERIC_HELP_X lines need to be renamed with the new ID, as well as the number in the selection option.
GENERIC_HELP_94 becomes GENERIC_HELP_95
[s]Player[f 4 26 1 94][e] becomes [s]Player[f 4 26 1 95][e]
etc.

To make it even more complicated, there are more messages in the mementos/palace .bf files than in the overworld one.
If you decompile the original field.bf, you get a file called field.bf.msg.h with the ID of each message:
Image
This shows that there are 34 messages in the field.bf.
But if you decompile dungeon.bf, it has 110 messages.
And at_dng.bf has 181.

Since the Mod Menu gets tacked onto the end of these original .bf files, we have to start our Mod Menu .msg at ID 182.
So for example, let's start with field.bf.flow. 181 - 34 = 147, so we need to add 147 placeholder messages.

The placeholder.msg next to the .flow is full of dummy messages like this:

Code: Select all

[dlg msg01]
[s][n][e]

[dlg msg02]
[s][n][e]

...
To fill it out with 147 of these more easily, we can use an online number list generator like this and start at 35, working our way up to 181. The prefix can be [dlg msg and the suffix can be ]\n[s][n][e]\n

Image

Now I can just paste this into notepad++ and replace the \n with an actual new line & save it as the placeholder.msg next to the field.bf.flow.

Image

The placeholder is imported by field.bf.flow before the Mod Menu .flow, but after the original field.bf.

Code: Select all

import( "../build/input/extracted/etc/field.bf" );
import( "placeholder.msg" );
import( "../ModMenu.flow" );
Now I can just repeat this process for dungeon.bf (placeholder messages starting from 111 and ending with 181).
Last step, probably the most inconvenient, is to rename all the GENERIC_HELP_X and [f 4 26 1 x] lines in the Mod Menu .msg to start from 182.

Fortunately I already made a program that automates this, msgReindex.exe.
Image
Ta-daa!
Image

I can tell if it worked by decompiling the field.bf and dungeon.bf output scripts and seeing if the message IDs line up as expected.
Image
I can now compile it correctly WITHOUT replacing the hook.flow with the old flow script...

Now: The Pop-Up where it should say "The Mod Menu has now been enabled!" was NOT there.
And now the Descriptions for every option are blank.

NONE of the Text work. But it does not matter much, its a small problem.
Atleast all big problems are fixed :D
User avatar
ShrineFox
Site Admin
Posts: 290
Joined: Mon Oct 07, 2019 3:19 am
Has liked: 277 posts
Been liked: 115 posts

Glad to hear it! Btw I finally got around to testing it myself, the descriptions do work for me. I forgot to mention you have to edit the first line in your build_local.bat though.
91 => 182

Code: Select all

msgReindex.exe ModMenu.msg 182
I'll investigate the issue with the Mod Menu not being enabled now
User avatar
RubyX_Coded
Posts: 31
Joined: Mon Jan 17, 2022 9:09 am
Location: Germany
Has liked: 5 posts
Been liked: 6 posts
Contact:

ShrineFox wrote: Sat Jan 22, 2022 11:45 am Glad to hear it! Btw I finally got around to testing it myself, the descriptions do work for me. I forgot to mention you have to edit the first line in your build_local.bat though.
91 => 182

Code: Select all

msgReindex.exe ModMenu.msg 182
I'll investigate the issue with the Mod Menu not being enabled now
No no, it IS enabled, just the prompt was not there. But i played through and it was enabled. I'll test it directly with the edited build.bat^^
User avatar
RubyX_Coded
Posts: 31
Joined: Mon Jan 17, 2022 9:09 am
Location: Germany
Has liked: 5 posts
Been liked: 6 posts
Contact:

EmreX_Coded wrote: Sat Jan 22, 2022 11:55 am
ShrineFox wrote: Sat Jan 22, 2022 11:45 am Glad to hear it! Btw I finally got around to testing it myself, the descriptions do work for me. I forgot to mention you have to edit the first line in your build_local.bat though.
91 => 182

Code: Select all

msgReindex.exe ModMenu.msg 182
I'll investigate the issue with the Mod Menu not being enabled now
No no, it IS enabled, just the prompt was not there. But i played through and it was enabled. I'll test it directly with the edited build.bat^^
UPDATE: Its only the missing prompt, descriptions work again :D
User avatar
ShrineFox
Site Admin
Posts: 290
Joined: Mon Oct 07, 2019 3:19 am
Has liked: 277 posts
Been liked: 115 posts

Awesome, it turns out both problems were oversights with the build.bat.
I forgot to put - Hook after fscr0150_002_100_hook.flow so that the line becomes:

Code: Select all

%COMPILER% .\script\field\fscr0150_002_100_hook.flow -Compile -OutFormat V3BE -Library P5 -Encoding P5 -Out "%OUTPUT_PATH%\script\field\fscr0150_002_100.bf" -Hook
Just tested it and now I see the prompt on a new game, but I can't use the square menu.
So I'm not sure if the flag changed between P5 and P5R:

Code: Select all

BIT_OFF( 8453 );
BIT_OFF( 320 );
When you say you got it enabled, did you play up to the point where it normally is, or was it instant on newgame? That'd be especially curious since the prompt and the flags being enabled are just lines apart on the same script

EDIT: haha I forgot one of the eboot patches is supposed to enable the square menu no matter what, so I guess that’s why. Just a mystery why I don’t have that patch then, maybe I goofed up on the pkgs
User avatar
RubyX_Coded
Posts: 31
Joined: Mon Jan 17, 2022 9:09 am
Location: Germany
Has liked: 5 posts
Been liked: 6 posts
Contact:

ShrineFox wrote: Sat Jan 22, 2022 2:46 pm Awesome, it turns out both problems were oversights with the build.bat.
I forgot to put - Hook after fscr0150_002_100_hook.flow so that the line becomes:

Code: Select all

%COMPILER% .\script\field\fscr0150_002_100_hook.flow -Compile -OutFormat V3BE -Library P5 -Encoding P5 -Out "%OUTPUT_PATH%\script\field\fscr0150_002_100.bf" -Hook
Just tested it and now I see the prompt on a new game, but I can't use the square menu.
So I'm not sure if the flag changed between P5 and P5R:

Code: Select all

BIT_OFF( 8453 );
BIT_OFF( 320 );
When you say you got it enabled, did you play up to the point where it normally is, or was it instant on newgame? That'd be especially curious since the prompt and the flags being enabled are just lines apart on the same script

EDIT: haha I forgot one of the eboot patches is supposed to enable the square menu no matter what, so I guess that’s why. Just a mystery why I don’t have that patch then, maybe I goofed up on the pkgs
Yeah i used the eboot patch use Square Menu Globally and i played till the moment where Joker leaves the train. But thanks! Now everything is fixed. If i find any new problem, i know where i can ask :D

Thank you for your Help ^^
Post Reply
cron

ShrineFox 2020 - 2023
Support | Progress | Labs | Privacy | Terms
This site is NOT affiliated, associated, authorized, endorsed by, or in any way officially connected with Atlus Co., Ltd, Atlus U.S.A., Inc. or Sega Games Co., Ltd, or any of its subsidiaries or its affiliates.