Open AcidicPeridot opened 6 months ago
The actual problem is with the decompilation. The procedure ends up as the following when is clearly incorrect and therefore can't be compiled
void BTL_TAG_RUN()
{
PUTS( "実行" );
EVT_FUNCTION_0018( 4, 9001 );
0;
0;
UNKNOWN_FUNCTION_12707();
60;
1;
UNKNOWN_FUNCTION_12707();
140;
UNKNOWN_FUNCTION_12708();
300;
2;
UNKNOWN_FUNCTION_12707();
BTL_FUNCTION_0198();
}
same problem in event/e800 series .bf files. event/e800/e808_020.bf.flow line 26
......
// Procedure Index: 0
void e808_020()
{
int var0;
EVT_FUNCTION_000F( 1 );
EVT_FUNCTION_0001( -1, -1 );
EVT_FUNCTION_0017( 1 );
EVT_SET_USUAL();
0;
1;
if ( UNKNOWN_FUNCTION_-32764() == 8 )
{
WND_FUNCTION_000C( 0, 1 );
WND_FUNCTION_000B( 2 );
WND_FUNCTION_000B( 3 );
......
and unknown function numer gets negative value, like -32764 of UNKNOWNFUNCTION-32764()
Went and did a look with this alongside Peridot. The initial example with UNKNOWN_FUNCTION
s 12707 and 12708 was the result of the library having no functions at their respective ids (0x31a3 and 0x31a4) and was resolved by adding functions of those ids with the correct number of parameters. They appear to both control the displaying of subtitles during Unison Skills, with 12707 displaying a msg at a certain frame and 12708 controlling how long a msg is displayed for.
However, UNKNOWN_FUNCTION_-32764
appears to already be properly defined in the library. From disassembling the assembly, one can see that its id is 0x8004 and it takes two int parameters, corresponding to CAMP_FUNCTION_0004
. The decompiler appears to be interpreting the function index (a value that should be unsigned) as signed, as -32764 in hex is -7ffc, the two's complement of which is 8004.
This .bf file from Persona Q2 throws an error when attempting to recompile, even when no changes are made.
Command:
"combi01.bf.flow" -Compile -OutFormat V2 -Library PQ2 -Encoding SJ -Hook -SumBits
Error: