ROM Hack Final Fantasy IV DS Hacking question(s)

xkappax

Member
OP
Newcomer
Joined
Aug 9, 2008
Messages
17
Trophies
0
XP
15
Country
United States
Hello everyone.
I'm not a new member, but I haven't been active here in quite some time. Many years ago, I decided I wanted to edit Final Fantasy IV DS's script. And while it was a personal project, it was (and still is!) something I'm very serious about doing. My aim all those years ago was to change small things like the character names (as I grew up in a time where naming your characters was very much commonplace in games) but, of course, those changes turned out being not so "small" at all.

When I first set out to make the changes, a member named Fast6191 helped us out GREATLY. With their advice and with the help of my husband, we ripped apart pretty much the entire game and put it back together, but something went wrong when the script was recompressed and reinserted and halfway through the game, it froze. It was a real bummer after working on it for that long, and we couldn't figure out what one it was that was doing it.

I've decided, fourteen years later, to revisit this project and see if I can do it right this time.

I've spent most of the day picking apart the rom to try to remember what we did, and I think I have a handle on it, but I have a few things that I need some help with/insight on.

I've unpacked the rom and using a hex editor, I basically have gotten all of the characters names changed in battle (with the exception of above the window where it has the battle commands, I CANNOT find those names for the life of me). I also have the speculation text changed (the little character thought bubbles on the world map) and all of the in battle text that I needed to change, where the characters speak during a battle.

The bulk of the script is found in a file that is called CAST_EVENT_MSD.dat and I guess I was wondering if anyone here had any insight on how to get the script out of there so I can work with it. When we initially started working on this years ago, I remember my husband cutting and pasting every single piece of hex that had text in it individually, decompressing it with gbalzss, making the changes and then reinserting it. I was wondering if there was a better (faster) way to do this.

The issue is that not all of it is compressed, so you cannot just decompress the entire file, you have to do it in bits and pieces.

So, the tldr version of this is:
1. Does anyone know where the in battle names are located (the ones that appear above the battle menus that say "fight" "darkness" "item" or can anyone help me find them?

2. Is there an easier/faster way to decompress (and then recompress) the compressed bits of CAST_EVENT_MSD.dat so I can edit that script?

3. Does anyone have any idea where the names that appear on screen when you first meet a character are located? I don't NEED to edit those (I'm sure they're most likely graphics), but if I can edit them, I'd like to try.

Thank you so much in advance for anyone who reads this and offers any insight/advice/wisdom/help/etc. I really appreciate it. :)

ps - Here are two screen shots of the places I can't locate the text. The 2nd image, where it's over the menu box, probably bothers me the most.

Screen Shot 2022-05-02 at 5.13.04 PM.pngScreen Shot 2022-05-02 at 5.14.27 PM.png
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,795
Trophies
3
XP
28,452
Country
United Kingdom
Decompressing sections? Odd, though if it is a whole script then OK.
There are a bunch of command line options for compression these days (probably were back then as well).
Most compression will be indicated by starting the section with 10h or 11h and the size of the decompressed section, especially if it plays nicely with some of the GBA tools (though they might be more robust than I give them credit for).
Anyway Cue's tools https://www.romhacking.net/utilities/826/ and dsdecmp https://www.romhacking.net/utilities/789/ are probably what I would link now. The latter I have used when decompressing files in archives, some of which were not compressed, though again to see text like that is very odd.

Offhand I am not sure where the names might be. If they can be edited in some capacity in the game then they might be placeholders which would make the usual relative search tricks harder. You might even have go in for tracing/assembly routes*. That or if the names change between regions (NA to Europe probably being better than Japan to elsewhere, though there are reasons to look there too) then see what files also change and focus on those, possibly including some corruption of said files.

"but something went wrong when the script was recompressed and reinserted and halfway through the game"
You probably had that as the learning experience. Copy paste working files/ROMs into other backup directories at milestones -- easier usually to redo a small piece of work/track down the offending change when you can follow along the little steps along the way.

*DS tracing is annoying compared to some older systems. Older systems will just read the cartridge and you can react accordingly. DS stuff however funnels it all through a b7 command http://problemkaputt.de/gbatek.htm#dscartridgeprotocol so you instead want to find the code in memory/graphics in memory (the large Cecil is probably a different font which is nice for you) and then figure out what references those, and work backwards again from that to what informs it, and so on and so on until you either get something you can search the ROM for or end up back at the ROM read itself.
 
  • Like
Reactions: xkappax

xkappax

Member
OP
Newcomer
Joined
Aug 9, 2008
Messages
17
Trophies
0
XP
15
Country
United States
Hello, Fast6191! You're the one who helped us last time and I really appreciated it then, and I really appreciate it now.

I actually don't know if you can decompress the whole file or not. Back in the day when we did it, the whole thing didn't decompress when we used gbalzss ... but like you said, there are newer, better utilities now. I have that one made by Cue for decompression, I just haven't tried that one yet. dsdecmp would NOT work on my computer when I tried it the other day no matter what I did, but I'm going to play around with it a bit more, see if I can get it working.

I've attached images of what file that contains the script looks like in the hex editor. The beginning part seems to be referencing a bunch of files that have .lz as their extension. Then you go down a ways and at about 4D08 is where the actual compressed script seems to be. I seem to be able to cut out that block, run it through a decompressor and then reinsert it after I change the name, but doing that for 365 files is kind of ... crazy. But if that's the way it has to be done, I'll attempt to do it.

I've done a lot of SNES hacking, but DS hacking is a completely different monster, so if I'm doing something really wrong or stupid, or if there's a better way to do things, please let me know. I want to learn.

This old thread from many years ago explains what we were doing. I have no idea if it was the right way to do it or not, but it seemed to work until we hit that critical snag. https://gbatemp.net/threads/final-fantasy-iv-ds-tabling-compression-script-question.100894/
 

Attachments

  • Screen Shot 2022-05-02 at 7.01.19 PM.png
    Screen Shot 2022-05-02 at 7.01.19 PM.png
    77.1 KB · Views: 68
  • Screen Shot 2022-05-02 at 7.01.56 PM.png
    Screen Shot 2022-05-02 at 7.01.56 PM.png
    82.3 KB · Views: 68

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,795
Trophies
3
XP
28,452
Country
United Kingdom
Other than file systems being in the mix the SNES and DS should not be so radically different. File systems, other than the annoyance with tracing, being a perk as you get file/directory names at times, extensions and file sizes. For my money pointers are simpler as well with them being file level rather than memory level most of the time compared to SNES where banks and switching thereof makes life more annoying.

Anyway that would look something like an archive file, though I apparently sorted that one last time (usually in among the names will be file locations/lengths)

The compression tools might search for indicators but that is more of a GBA thing (still one big ROM). To that end if you don't want to code up a tool to do things (most things here are read section, do some basic maths, copy section to new file, repeat until end of section/file... maybe not hello world but not so very much further down the programming tutorials for most language) I would probably make a nice spreadsheet (bonus here is the archive aspect appears to be fixed length so you should be able to get one entry per line by resizing the viewer section and maybe deleting or inserting a bit to bump things around) and then make a batch file to instruct something like https://web.archive.org/web/20170218180937/http://min.midco.net/cracker/filecutter.zip to slice up the format for you (filecutter is a command line program that will cut a length of file out with options to do that at a given offset). If the devs have helpfully indicated compression with a .lz extension then can move those to another directory or add another section to the batch file for cue's tools (though if dsdecmp can be got working then it had a nice batch option), though such tools should also happily say "not compressed" and then move on.

Similarly if editing things you might change file sizes before long and if you don't alter the pointers then you will start getting crashes as locations change and computers don't tend to deal with that very well (I usually liken pointers to contents page of a book and what happens to someone counting pages when you rip a bunch out or stuff more in, and worse in this case is pages are ripped and stuffed all throughout the file).
 
  • Like
Reactions: xkappax

xkappax

Member
OP
Newcomer
Joined
Aug 9, 2008
Messages
17
Trophies
0
XP
15
Country
United States
Thank you so much for all of this. I tried Cue's tools last night and it just kept telling me that the file wasn't compressed, but I'm going to try a few more things.

I definitely don't want to change the lengths of the names, nothing fancy like that, because I know that pointers can be very finicky if you try to change the length of something. I've chosen names for the characters that are exactly the same length. The only character who I could drastically change the name of is Cecil for some reason, but only in the battle. Obviously in the text it is a different story, so I'm keeping his name to 5 or fewer.

Coding is a bit beyond my realm of expertise right now I think, I'm a cartoonist who hacks video games for fun, so my brain isn't as mathematically wired as I'd like it to be. That said, I'm going to keep messing around with it and see what I can do. I really wish I could figure out what was wrong with dsdecmp, because that was my first choice and i could not get it to do anything I wanted it to do. I will continue to mess with it.

I am going to make a spreadsheet to try to organize all of this, I'll probably start on that today.

Thank you again! :)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: @AncientBoi, Bad bad *sprays holy water*