øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1123.msg11513e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index04d4.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1123.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index04d4.html.zxÔ|g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ ‹1…~OKtext/htmlISO-8859-1gzip8:Ö…~ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 11:57:31 GMT0ó°° ®0®P®€§²ð®Ô|g^Ã…~ Final Fantasy IV Advance (E) (M5) Script Dumping/Insertion Package

Author Topic: Final Fantasy IV Advance (E) (M5) Script Dumping/Insertion Package  (Read 2927 times)

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Download



Dumping Instructions:

1. Download Cartographer, place it in the directory where you extracted these files.
2. Place a ROM named Final Fantasy IV Advance (E) (M5).gba in the same directory as these files (or edit the batch file to use your ROM's filename).
3. Run Final Fantasy IV Advance (E) (M5) - Dump Script.bat, you'll get six files:

000: The full script.
001: English script.
002: German script.
003: French script.
004: Italian script.
005: Spanish script.

Let me know of any errors (I'd especially like people who can read the four non-English languages to have a look). I haven't tried inserting this yet, but I don't see any reason why it wouldn't work.



Insertion Instructions

First off, you need to make some changes to the extracted script. Cartographer is good, but it's not 100% perfect, you still need to add an Atlas header and change the pointer writes to use a custom pointer for this game. Also, you can only reinsert Final Fantasy IV Advance (E) (M5) - Script_000.txt (the full script) due to the way this game's pointers work, sorry. If you plan on only supporting English, you'll have to blank out (or simply ignore) the strings for the other languages - if you blank them out be sure to leave the <end> tags in place or you'll completely break the script. This game requires the script to stay in order and every string must be present. The alternative is figuring out how to disable the other languages properly, like in the US version; if you have any experience with GBA ARM assembly, that would definitely be the best option.

Anyway, open up your script, and add this somewhere before the first pointer write. I suggest under the game and block name:

Code: [Select]
#VAR(Table, TABLE)
#ADDTBL("FF4Advance.tbl", Table)
#ACTIVETBL(Table)

#VAR(FF4pointer, CUSTOMPOINTER)
#CREATEPTR(FF4pointer, "LINEAR", $2EA458, 32)

#JMP($3048E0)

Atlas doesn't like table files with spaces in their name, which is why an alternate is included. Also, the original script likes putting linebreaks directly after new page codes (which don't do anything), the first table is set up to dump these to the <page> tag, this table only inserts the page control code, and it doesn't appear to have any negative side effects.

Next, you will need to make the pointer writes use your custom pointer. The easiest way to do this is, if your text editor supports it (if it doesn't, download a new one), a find and replace for every match in the file.

Search for:
Code: [Select]
#W32(
Replace with:
Code: [Select]
#WRITE(FF4pointer,
This will probably take a while, since there are a lot of pointer writes in this file. Save when it finishes, and you're ready to insert! :happy:

1. Download Atlas, and place it in the same directory as your script.
2 .Place a ROM named Final Fantasy IV Advance (E) (M5).gba in the same directory as these files (or edit the batch file to use your ROM's filename).
3. Run Final Fantasy IV Advance (E) (M5) - Insert Script.bat.

If all goes well, this massive block of text will be inserted . Concerning space, since this game uses 32-bit pointers, you can easily place this script anywhere after the pointer table (the pointers are relative, putting them before the table won't work). If you plan on keeping all five languages and expanding the text significantly, I'd suggest expanding the ROM to 16MB, and changing the Atlas #JMP command to an offset in that newly created space.
« Last Edit: July 25, 2009, 04:17:54 PM by Dragonsbrethren »

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Final Fantasy IV Advance (E) (M5) Script Dumping Package
« Reply #1 on: July 25, 2009, 03:58:29 PM »
All of the files needed for insertion are now included. Download the package from the first post again. I'll make my post into some actual documentation and make the package available on RHDN once RedComet finally adds Cartographer to the database.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Final Fantasy IV Advance (E) (M5) Script Dumping/Insertion Package
« Reply #2 on: July 26, 2009, 09:47:50 AM »
I figured out how to remove multiple language support, no assembly is required. The script has a header much like the game's fonts do, which starts with the ASCII string TEXT. Directly after this are two bytes, $0506. Changing the first byte to $01 makes the game use one language, and the second must be changed to $8F to prevent character names from crashing the game. I figured out the first byte on my own, but I got the other byte from the US version, I have no idea what it actually does.

Anyway, if you want to insert a single language, you need to use slightly different steps. First, add this Atlas header before the first pointer write:

Code: [Select]
#VAR(Table, TABLE)
#ADDTBL("FF4Advance.tbl", Table)
#ACTIVETBL(Table)

#VAR(FF4pointer, CUSTOMPOINTER)
#VAR(FF4ptrTable, POINTERTABLE)

#CREATEPTR(FF4pointer, "LINEAR", $2EA458, 32)
#PTRTBL(FF4ptrTable, $2EA468, 4, FF4pointer)

#JMP($3048E0)

Now you need to do a find and replace, like before, but a little different.

Search for:
Code: [Select]
#W32
Replace with:
Code: [Select]
WRITE(FF4ptrTable) //
What this does is replaces the individual, hardcoded pointer offsets Cartographer gives us with writes to a pointer table, then comments out the hardcoded offset. If it wasn't for this you would need to manually update every pointer address, and probably wouldn't bother doing this at all.

Now just edit the batch file to use the correct script number and insert it. Everything will work fine except for the language screen (loads the wrong strings, changing languages will just offset the script by 1 per language) and the bestiary. For some reason the bestiary strings aren't getting dumped into the script, which wasn't obvious until I did this. I'll have to look into what's wrong, probably something simple.

 :edit:

Edit: Package updated, the bestiary strings will now be extracted. As expected the pointer end offset was wrong, $3F0 bytes off. I don't know if it was a typo or what, but it's been corrected now. I also updated the tables with a few characters I forgot to include.
« Last Edit: July 26, 2009, 10:13:57 AM by Dragonsbrethren »