Modifying FF4kster to work with relocated dialogue banks

Started by Tzepish, April 24, 2023, 07:29:23 PM

Previous topic - Next topic

Tzepish

Now that FF4kster is open source (https://github.com/pinkpuff/ff4kster), I'm trying to modify it to read/write dialogue in an expanded FF4 ROM, and I'm running into weird roadblocks that I can't figure out!

I've got it opening the ROM by modifying the file size in readdata.bas, and I've modified the start positions of the pointer tables and dialogues for Banks 1 through 3 in readdialogues.bas and savedialogues.bas to correspond with their new locations in the expanded ROM (I moved them to the bottom, in the expanded space).

The ROM itself is fine - I've verified that the three pointer tables and three dialogue banks are functioning properly in their new locations. And everything appears to be fine when I open the ROM in the modified editor as well - it will correctly read and write pointer tables and dialogue to the new addresses. However, when I save I get the following problems:
* Bank2 complains about overflowing, even though my script is nowhere close to the limits I set in savedialogues.bas
* The pointer tables aren't calculated correctly, so when I play the ROM, several of the dialogues are skewed.

Does anyone out there have any insights into these problems? (Including you PinkPuff, if you're out there - your inbox is full!) I'm wondering if something is happening to the math under the hood that isn't playing nice with the larger hex addresses at play?

For reference, the only code changes in FF4kster are changing the hex addresses. Bank2, for example, normally starts at h88500 but I've moved it to h120200.

Brutapode89

Quote from: Tzepish on April 24, 2023, 07:29:23 PMNow that FF4kster is open source (https://github.com/pinkpuff/ff4kster), I'm trying to modify it to read/write dialogue in an expanded FF4 ROM, and I'm running into weird roadblocks that I can't figure out!

I've got it opening the ROM by modifying the file size in readdata.bas, and I've modified the start positions of the pointer tables and dialogues for Banks 1 through 3 in readdialogues.bas and savedialogues.bas to correspond with their new locations in the expanded ROM (I moved them to the bottom, in the expanded space).

The ROM itself is fine - I've verified that the three pointer tables and three dialogue banks are functioning properly in their new locations. And everything appears to be fine when I open the ROM in the modified editor as well - it will correctly read and write pointer tables and dialogue to the new addresses. However, when I save I get the following problems:
* Bank2 complains about overflowing, even though my script is nowhere close to the limits I set in savedialogues.bas
* The pointer tables aren't calculated correctly, so when I play the ROM, several of the dialogues are skewed.

Does anyone out there have any insights into these problems? (Including you PinkPuff, if you're out there - your inbox is full!) I'm wondering if something is happening to the math under the hood that isn't playing nice with the larger hex addresses at play?

For reference, the only code changes in FF4kster are changing the hex addresses. Bank2, for example, normally starts at h88500 but I've moved it to h120200.

Is it even to we can easily port english and other languages texts from GBA, PSP and Steam versions?

Tzepish

That's not why I'm doing this, but yes, this would allow for using ff4kster for that. However, this can be theoretically done without ff4kster anyhow - a project that large probably wants a faster method of importing the script than typing it all by hand.

Brutapode89

Is it with a 8 Mo like Final Fantasy II (SNES) ROM? Have you used this utility for that?
https://www.romhacking.net/utilities/1638/

Tzepish

I was sort of able to figure it out BTW. Turns out the ROM is very fragile when it comes to Bank2 text (town dialogue). I don't know why, but editing it would cause the pointer tables for Banks1 and Bank3 to go out of whack, even though that doesn't make sense. Returning Bank2 to its original location and only relocating Banks1 and 3 to the expanded space did the job.

Rodimus Primal

Quote from: Tzepish on April 27, 2023, 08:01:13 PMI was sort of able to figure it out BTW. Turns out the ROM is very fragile when it comes to Bank2 text (town dialogue). I don't know why, but editing it would cause the pointer tables for Banks1 and Bank3 to go out of whack, even though that doesn't make sense. Returning Bank2 to its original location and only relocating Banks1 and 3 to the expanded space did the job.

This is super interesting. So would this allow for this feature to be made for other projects? I was aware how finicky Bank 2 was, but if dialog in Banks 1 and 3 can be relocated using FF4kster, what would be awesome.

Also, if there were other features to be added to it (since its now open source), I'd love to see compatibility with a Japanese FFIV ROM, and in a similar fashion to FF3USME of dumping a script from a game in a txt file that can easily be edited and then re-inserted.

Tzepish

Quote from: Rodimus Primal on April 28, 2023, 03:57:34 PMThis is super interesting. So would this allow for this feature to be made for other projects? I was aware how finicky Bank 2 was, but if dialog in Banks 1 and 3 can be relocated using FF4kster, what would be awesome.

Yes - since FF4Kster is open source, I was able to modify the code to check for a different size ROM (1.5mb instead of 1.0mb) and to read/write dialogue banks 1 and 3 based on different locations (in the expanded space). I also had to modify the ROM itself to expand it and move the dialogue banks, of course (using this ancient document written by J2e on how to do just that: http://sql123.narod.ru/docs/arh.htm). This frees up a ton of space for Bank 3 in particular, allowing for longer scripts. But in order to make full use of the space you'd also need to event edit as you go in order to move some windows from Bank 1 to Bank 3.

Rodimus Primal

Quote from: Tzepish on May 16, 2023, 05:17:20 PMYes - since FF4Kster is open source, I was able to modify the code to check for a different size ROM (1.5mb instead of 1.0mb) and to read/write dialogue banks 1 and 3 based on different locations (in the expanded space). I also had to modify the ROM itself to expand it and move the dialogue banks, of course (using this ancient document written by J2e on how to do just that: http://sql123.narod.ru/docs/arh.htm). This frees up a ton of space for Bank 3 in particular, allowing for longer scripts. But in order to make full use of the space you'd also need to event edit as you go in order to move some windows from Bank 1 to Bank 3.

Yeah I realized that when editing Namingway Edition. I moved two long strings of dialog from Bank 1 to 3, which required figuring out where they were in the Events. Still, more room for the dialog in general is always a welcome feature.