Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler and decompiler bug fixes #74

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

matelgaard
Copy link
Contributor

@matelgaard matelgaard commented Apr 15, 2024

Contains two bug fixes:

  • Fixes Error Saving Certain BMD Files #64, a bug with the encoding of loops in the relocation tables of BMD files, caused by the number of loops being greater than the amount that can be encoded in a single byte (FF).
    A good example of this is P5R's EN.CPK\EVENT_DATA\MESSAGE\E000\E090_001.BMD. This contains the dialogue each persona says after you fuse them ("I am Jack Frost", etc.). The number of speakers in this script is in the hundreds, since there is a speaker for each persona, and the relation table encodes the addresses for the speaker table incorrectly in this case.
    The compiler used to output the following (example still from EN.CPK\EVENT_DATA\MESSAGE\E000\E090_001.BMD from P5R):
    010Editor_7KZkoWUNdQ
    where the correct encoding is:
    010Editor_YCzaTwfq1y
    This has been fixed to produce the correct encoding.
  • Fixes the decompiler writing the minimum integer as -2147483648, and instead writes it in hexadecimal instead. This seems to have been intended, but failed previously due to a >= 16 check, which fails since the value is actually negative. This change also makes sure the decompiled script can later be recompiled without issues, since the compiler otherwise fails to parse the literal -2147483648. Perhaps this should also be fixed in its own right at some point
    There are examples from P5R's BF files where this literal appears. Here is a snippet from the decompiled EN.CPK\FIELD\HIT\FHIT_009_002.flow:
    Code_fJCjoaFUtS
    From the context alone it makes sense that these would be written as 0x80000000 instead

@tge-was-taken tge-was-taken merged commit 5aafe25 into tge-was-taken:master Apr 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Saving Certain BMD Files
2 participants