News: 11 March 2016 - Forum Rules

Author Topic: Final Fantasy Adventure - Text Editing Tool  (Read 2863 times)

Thirteen 1355

  • Hero Member
  • *****
  • Posts: 633
    • View Profile
Final Fantasy Adventure - Text Editing Tool
« on: September 18, 2021, 11:53:12 am »
Heyo,

Me and Rabbitbones are working on a text editor for FFAdventure, based on Tomato's documentation for the game (many thanks Mato!). It's pretty close to being finished now, and excited to see what people will do with it (I'll probably try my best to do a restoration/relocalization).
Helicoptering about till I find some ROM hacking treasure.

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2939
  • 2 + 2 = 5
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #1 on: September 18, 2021, 12:06:45 pm »
That should be cool. I've always found the original US script to be "a product of the times". I even didn't like the character names (feel too western, while the story and game world feel like typical J-RPG fare to me - a mismatch). These personal gripes have always made me want to do a large scale edit. A tool for that task would be rather handy given the "hands-on" nature of formatting text in many old games.
Cigarettes, ice-cream, figurines of the Virgin Mary...

Thirteen 1355

  • Hero Member
  • *****
  • Posts: 633
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #2 on: September 18, 2021, 04:00:43 pm »
Yeah, I've never actually played this game. I played Sword of Mana, but wanted to experience this old title with some updates.

One thing that might be in the way is that there's no way to actually add text (space limitations, box sizes), so you're still stuck with the small amount of space.
Helicoptering about till I find some ROM hacking treasure.

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2939
  • 2 + 2 = 5
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #3 on: September 18, 2021, 04:33:15 pm »
Quote
Yeah, I've never actually played this game. I played Sword of Mana, but wanted to experience this old title with some updates.

Other than the text, I'd say it still stands up today. I don't have any sentimental attachment to it but I'm still excited for the next time I can give it another playthrough.

Quote
One thing that might be in the way is that there's no way to actually add text (space limitations, box sizes), so you're still stuck with the small amount of space.

Yeah, I could imagine the amount of real-estate on the screen and in the ROM are both pretty crowded if not completely stuffed. Assuming the editor keeps track of and modifies the pointers for the text you might be able to make a little bit of room by going through and seeing if any of the text feels poorly/inefficiently worded (which is probably already one of your goals). And while it can be difficult to keep the text looking uniform, you might be able to employ some "squishy tiles" to buy an extra tile or two on screen. Every little bit helps, I suppose. I don't know much about GB hardware but I would assume that compression is probably out of the question due to performance issues (assuming there's any room at all for the extra processing).
Cigarettes, ice-cream, figurines of the Virgin Mary...

Ok Impala!

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Ok Impala!
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #4 on: September 20, 2021, 10:59:12 am »
I do have sentimental attachment to it. So this news makes me very happy! Hopefully there will be an updated script someday thanks to this tool!  :)

arathron123

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #5 on: September 20, 2021, 04:21:11 pm »
Hi! Maybe you would like my script, it allows to edit text, scripts, maps, and music.

https://github.com/arathron123/mystic-editor

Ok Impala!

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Ok Impala!
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #6 on: September 21, 2021, 12:39:53 am »
Hi! Maybe you would like my script, it allows to edit text, scripts, maps, and music.

https://github.com/arathron123/mystic-editor

Wow! This is a really cool program! Why isn't this on RHDN?  :)

Thirteen 1355

  • Hero Member
  • *****
  • Posts: 633
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #7 on: September 21, 2021, 07:37:15 am »
Would like to ask the same lol. We have a nice UI coming with it, but this one seems to edit more.  :banghead:
Helicoptering about till I find some ROM hacking treasure.

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2939
  • 2 + 2 = 5
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #8 on: September 21, 2021, 01:38:18 pm »
Would like to ask the same lol. We have a nice UI coming with it, but this one seems to edit more.  :banghead:

By your powers combined...

Cigarettes, ice-cream, figurines of the Virgin Mary...

arathron123

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #9 on: September 21, 2021, 03:19:04 pm »
Wow! This is a really cool program! Why isn't this on RHDN?  :)

I wasn't going to upload my script as I still consider it far from finished.  But when I saw Thirteen message about he making a text editor for it, I thought I should post my script as it is, because it can already be useful.  So I registered yesterday both to github and here.  For a (far) future release I would like to make the scripting language (which I call mystic-script or short mscript) to be compatible to some subset of the lua language and exportable both back to gameboy rom and to the solarus engine https://www.solarus-games.org/.

To submit to RHDN do I have to zip it, or can I just upload the link?  After that will I have to mantain both github and this zip?  (It would be more practical to just post the link) 

I also found someone is working on a dissasembly for this game https://github.com/daid/FFA-Disassembly.

As SunGod said, we should join our forces!

Thirteen 1355

  • Hero Member
  • *****
  • Posts: 633
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #10 on: October 02, 2021, 12:45:43 pm »
Whoops, haven't responded in a while. Currently I'm also checking out for options to update the translations for FF1 and 2 on PS1 (since I'm not very satisfied by the Pixel Remasters after all). Mostly focusing on that now, but creating a tool for that is on a much higher level than this, and there's no tools I can find for even extracting these .bin files.
Helicoptering about till I find some ROM hacking treasure.

ElwinBran

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #11 on: October 02, 2021, 02:04:01 pm »
I wasn't going to upload my script as I still consider it far from finished.  But when I saw Thirteen message about he making a text editor for it, I thought I should post my script as it is, because it can already be useful.  So I registered yesterday both to github and here.  For a (far) future release I would like to make the scripting language (which I call mystic-script or short mscript) to be compatible to some subset of the lua language and exportable both back to gameboy rom and to the solarus engine https://www.solarus-games.org/.

To submit to RHDN do I have to zip it, or can I just upload the link?  After that will I have to mantain both github and this zip?  (It would be more practical to just post the link) 

I also found someone is working on a dissasembly for this game https://github.com/daid/FFA-Disassembly.

As SunGod said, we should join our forces!

Thanks for the information and work so far! As Thirteen said, I am developing a tool to easily edit the text of FFA, for retranslation purposes. It is finished, at least as a 'beta' version (have yet to release the C# source code). Unlike your tool it only edits text files, not the ROM and I relied on Tomato's utility for acquiring all the text of the game.

I tried your tool and it sadly did not work for me, or it worked but still threw an error... "UnicodeEncodeError: 'cp932' codec can't encode character '\xb7' in position 60: illegal multibyte sequence" To which I proceeded some simple fix by forcing utf-8 encoding. After which I kept getting "ValueError: binary mode doesn't take an encoding argument", still I get quite a few sprites and data in the result folder. Perhaps it's just my weird locale settings that make Python go weird.

At any rate, are there any platforms/channels were we could further discuss possible collaboration?

arathron123

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #12 on: October 06, 2021, 06:06:39 pm »
I tried your tool and it sadly did not work for me, or it worked but still threw an error... "UnicodeEncodeError: 'cp932' codec can't encode character '\xb7' in position 60: illegal multibyte sequence" To which I proceeded some simple fix by forcing utf-8 encoding. After which I kept getting "ValueError: binary mode doesn't take an encoding argument", still I get quite a few sprites and data in the result folder. Perhaps it's just my weird locale settings that make Python go weird.

I had only tested my script in linux (ubuntu 20.04) and android (with termux).  I still had not tried it on windows or mac.  The problem seems to be some unicode/utf-8 related.  In principle the script supports the english, german, french and japanese original roms, and I use some emojis to represent the icons for the items and weapons from the game, that's why unicode characters are being used.

At any rate, are there any platforms/channels were we could further discuss possible collaboration?

Today I created a discord server for this project: https://discord.gg/mdTDMKh5FR 
All the people interested in this project is invited to join!

Brutapode89

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #13 on: October 07, 2021, 10:48:22 pm »
Isn't there a .tbl file for Final Fantasy Adventure, in fact?

xenophile

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: Final Fantasy Adventure - Text Editing Tool
« Reply #14 on: December 12, 2021, 04:08:44 pm »
Hello All! Just found this thread and wanted to chime in. I gave an update to the forum last night on what's going on with my FFA rom hack: Final Fantasy Adventure Gender Swap (GB) and Ok Impala! saw it and poked me towards this.

Quote from: Thirteen 1355
One thing that might be in the way is that there's no way to actually add text (space limitations, box sizes), so you're still stuck with the small amount of space.

There is actually a fair amount of free space in this game. Both of the script banks (0x0d and 0x0e) have a fair amount of free space at the end. When I first started dumping scripts I speculatively dumped what was after the last known script, and found (in at least one) that it was a partial fragment of a previous script.

Since then I recently a way to be somewhat confident of where the real data ends in each bank. I was doing a comparison of FFA with MQ UK and noticed that the end of most banks differed, with both versions looking a lot like useless trash. It looks like whatever tool they were using to write the original roms would write some combination of whatever was in its memory and increasingly random bit patterns when it completed writing the real data. Here are the offsets I'm using at this point:

00:3ffd Bank_0_Trash
02:7ffe Bank_2_Trash
03:7fce Bank_3_Trash
04:7f79 Bank_4_Trash
05:7f5d Bank_5_Trash
06:7ff5 Bank_6_Trash
07:7fba Bank_7_Trash
08:59a5 Bank_8_Trash
08:59a5 .data:5b
09:48d0 Bank_9_Trash
09:48d0 .data:30
0d:7fb3 Bank_d_Trash
0e:7b3c Bank_e_Trash
0f:7eb4 Bank_f_Trash

I believe a lot of those are conservative (meaning they underestimate free space) but am very confident that those regions are unused.

So far I haven't done much with this knowledge, with one exception: My heal bug fix patch uses 02:7ff5 through 02:7ffd. Yes, that's outside of the range I mentioned; as I said, these are quite conservative estimates of free space.

I think the main interest is in expanding script space. Sounds like there are at least two tools in progress to edit scripts so far, but what we really need is one that allows relocating scripts (automatically of course). This is something I've been thinking about, but I'm not confident that scripts are always referred to by their index in the scripts table. I know the "call" (0x02) opcode just uses an offset from the beginning on bank_d, and I think rooms and npcs do too. If anyone knows where in the room/npc tables the script pointer/offsets are I'd love to know about it!

Quote from: arathron123
Hi! Maybe you would like my script, it allows to edit text, scripts, maps, and music.

I've been looking at your script, but haven't run it yet. While I'm using Python for my own scripts related to this, I really do not like package management in Python and use PIP only with great reluctance. My Spanish is also not great so I've been pasting a lot of comments into Translate. Still, it's really interesting. It looks like you've gone a lot further into some parts (like NPCs) than I have and I'd love to share notes... Especially if all my notes weren't in half finished Python files.

I also was not aware there was a disassembly started. That might have prevented me from starting my own.

Quote from: Brutapode89
Isn't there a .tbl file for Final Fantasy Adventure, in fact?

I'm not sure what actually constitutes a .tbl file. Is there any standard format? Are there tools that use them? So far I think we've all just been using Tomato's source dump as reference.

One of the problems with this game is there are at least two (probably three) different text tables: the standard text table is all one byte per character, the script text table adds in double character combos, and the ending scripts seem to handle some things differently (three spaces in one character?!?) but I haven't looked into that much.

I have hacked mgbdis with two hardcoded tables and a simple rule on when to use each. It would be good to engage with the author on extending mgbdis to be able to pass these in, but given that the mgbdis PR list has not changed since I've been working on this, I'm so far betting that would be waisted effort.

Anyways, I haven't really used Discord before but will try to pop in sometime soon.