Author Topic: Developing FF4kster: a comprehensive editor for FF4  (Read 224322 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #810 on: June 28, 2014, 09:13:38 PM »
Alright! Now This was such a substantial update! Everything worked perfectly! The ranges, the command additions, and solo battles all worked out fantastically!

Yay!!  :childish:

If I may make one suggestion though... Can Formations show up with the necessary information on that Formation as well?

So say I set "Formation 229" To the side in a separate box it would show "1 Baigan, 1 Right Arm, 1 Left Arm". That way we have a better idea on what we're choosing without constant cross referencing.

Good idea! Added to the to-do list.

The only issue I saw that appeared was that my custom Sing command broke when I saved in this version... which is a bit major to me, for obvious reasons. I should note that I did not touch the Commands section in this test, I thought at first it might have only crashed because of me going to the Command menu and looking at the data, but just saving breaks it. Does the data save default data somewhere to cause this?

When you save with FF4kster, it saves everything, even if you never viewed or changed it. Thus, if you have a rom which has something modified or moved around so that it isn't where FF4kster expects it to be, then even if you just open the rom and just immediately save it without going into any editors or changing anything, it will try to write to all those places, possibly/probably messing up your rom. Now that sing in particular has a lot of things going on (the songs, the messages, and now even the equipment requirements), there are a lot of potential places for it to mess things up.

Granted, a lot of the time you may still be safe because it is mostly just putting back whatever it read even if it doesn't "make sense", but there are also several assumptions it makes; bytes that it assumes should be the same so it will only read from one place but write to several (the feature ranges are a good example of this). If you like I can try my best to help track down where the source of the problem is and whether we can work around it...?
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #811 on: June 29, 2014, 07:54:51 PM »
Yes, it might be best to go over with what could be causing that issue...

Would you like me to send you my in-progress ROM?

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #812 on: June 30, 2014, 06:28:07 AM »
Actually I just had a look at the code for saving and noticed, well, two things. First, I made a mistake in saving the ranges; it's only saving to the locations it read from instead of all the necessary ones (so that's probably not the problem in your case, but I still need to fix it). Second, and I think this is very likely where the problem lies, it's looking at the value it has for the various message pointers for the various songs. If one of those has a value FF, it will write EAEAEA to the appropriate spot to prevent the game from displaying the message; otherwise, if it has any other value besides FF, it writes 8DCA34 to that spot (usually redundant, but needed in case you had blanked the message out earlier). If your modifications moved or otherwise messed with the code for displaying the messages, then FF4kster is writing something (either EAEAEA or 8DCA34) to a spot where it shouldn't be.

If this isn't the problem then by all means send along the rom and I'll do some further digging.

 :edit: The locations to look at to verify this are (headered): 1EB19-1EB1B, 1EB26-1EB28, 1EB33-1EB35
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #813 on: June 30, 2014, 09:14:19 AM »
Right on the mark! All of those locations have 8DCA34, hmm... but how would we go about correcting this so that everytime I save the game doesn't write those to crucial code for my hack?

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #814 on: June 30, 2014, 10:27:10 AM »
Unfortunately I don't think there's much we can really do. You can try to rework the patch to avoid those addresses... The only other option would be to set up FF4kster to look for your patch specifically somehow, but the design scope I've been using is that it assumes the only program you're using to make changes is this one (and maybe some graphic editors or something) and that if you apply any other changes they're at your own risk.
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,234
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #815 on: June 30, 2014, 10:46:25 AM »
Here's a thought, Grimoire:
1) make 2 copies of your (working) ROM
2) Open copy A in FF4kster, do nothing, but save
3) create a patch using copy A (now broken) as the "unchanged" file, and copy B (the one that still works) as your "changed" file
4) every time you make edits in FF4kster, apply this patch afterwards

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #816 on: June 30, 2014, 11:29:59 AM »
Updated again!

This time the command item requirement ranges are being saved in the rest of the locations where they should be (at least I hope), and encounter rates have been added to the Map Info editor. I meant to put those in a long time ago but it sort of fell through the cracks.

There's also one more significant upgrade that will be obvious when you run the program!  :wink:
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #817 on: June 30, 2014, 09:01:26 PM »
Well, looks like the command requirement ranges work properly now, but there's still one piece missing to getting encounters to actually start in towns and I believe that's on a tile type basis.

The new "point and find" gui for choosing a file is nice, but I'd grown so used to the original it'll take some time getting used to, hehe. All in all it is a better way to go about it.

Well I've thoroughly tested all of my abilities and it seems like it breaks more than just my Bardsong command...

It also breaks my Katana Soul (Throw) (Crashes), Coat Weapon (Cry) (Doesn't Function), Hunt (Pray) (Doesn't Function/Crashes), likely because of similar reasons...

I might just have to stick with the older version, it pains me to do so, but it seems the only way to continue with progressing my patch.


Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #818 on: July 03, 2014, 10:29:13 AM »
Yikes! PinkPuff I have a bit of bad news... it seems that Sneak crashes the game when it succeeds in an unmodified ROM. I was going through the commands to see if the program changed any of the default commands and Sneak now crashes. It should be noted that appears to be the only example of this though. Everything else has worked optimally in a default sense.

Though I have to wonder what is causing that specific crash?

 :edit: I did not notice the new 'Menu/Combat" links in magic, a neat touch that has some interesting implications for characters that use spells that might have an undesirable effect outside of battle to be used.
« Last Edit: July 03, 2014, 10:38:03 AM by Grimoire LD »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #819 on: July 04, 2014, 06:10:21 AM »
And fixed!   :banonsmash:

It took a while to find; at first I was poring over the Steal code, unable to find anything wrong. Turns out there was a typo in the addresses for Pray causing it to write the message-showing code into the middle of Steal's execution code!

Anyway that should do 'er; let me know if you find anything else!  :childish:
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,234
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #820 on: July 05, 2014, 10:07:36 AM »
Hey Pinkpuff - I think I discovered something weird (wrong?) going on with the dialogue bank 2 editor...

So I've been noticing for a while that the space allotted for bank 2 seems very limited, so I opened up the dialogue for the last map (a Glitch World). Apparently, this map was set to have over 45 messages (that's about as many as FF4kster will display before running out of room). Most of them were "T," but others were repeated pieces of lunar dialogue (stuff from the Hummingway and Bahamut caves). I don't know whether it was a current version of Ff4kster that did this, or an old one (I've only ever edited dialogue in my ROM with Ff4kster up to this point), but this was clearly not intentional. So as a (I thought) quick fix for this, I opened the ROM up in a hex editor and wrote over all of this data (almost 800 lines in all) with FFs. But now when I open the ROM in Ff4kster it won't save at all - even if I haven't edited dialogue at all - because of "bank 2 overflow." If I open the now single message in the last map and hold backspace for a while, then try to save, it works, but I imagine this is giving me JUST enough space to save, and not necessarily enough to add new dialogue into the bank.

So, in short, it seems that Ff4kster is having problems interpreting where the end of Bank 2 is supposed to be... or at least where the user wants the end of Bank 2 to be.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #821 on: July 05, 2014, 02:00:20 PM »
I'm about to head out to the local anime society's premiere event for the new Sailor Moon so I can't look into this right now but thanks for bringing it to my attention. I'll get out the good ol' smashy-smashy bug hammer in the morning.  :sleep:
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,234
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #822 on: July 06, 2014, 12:14:13 AM »
I'm not sure what your plan is exactly for dealing with the end of Bank 2 - I'm thinking the easiest thing to do would have the editor fill up the end with FFs, and know that any amount of FFs at the end can be removed to make room for what comes before.

At any rate, while you're looking at Bank 2, a request: do you think it would be possible to add the ability to insert and delete messages from a map? It seems like the amount of messages within a given map is limited only by the amount of space devoted to that map (by the pointers, which are already moveable), and the only thing needed to define a new message is a 00 at the end of the previous one.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,676
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #823 on: July 06, 2014, 09:30:31 AM »
Hmm, that would be quite a neat idea Chillyfeez, I second that request as well.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #824 on: July 07, 2014, 06:45:30 AM »
Ok I looked at bank 2 and I see what's going on. When it loads, it reads the pointers for the maps, then map by map it scans across, adding a message for each 00 byte it reads, until it hits the pointer for the next map, or in the case of the last map, the end of the data. When it saves, it writes each map's text and computes the pointers appropriately, but when it gets to the end of the dialogue of the last map, it just stops writing, leaving whatever data was past the (new) end of the text there.

The result of this is, if you deleted a bunch of text without adding new text, it will stop writing short of where the old ending point was, leaving whatever was already there still there. So next time it reads the last map, it thinks there are a TON of messages for the last map (I bet that the 45 or whatever messages will scroll down if you try; it's probably a lot more) because it just goes to the end of the data.

The other result of this is that if you just fill up the end with FFs manually, it will get to its fixed ending point and think that all those FFs are one giant message. FF4kster's bank 2 space limit is not set to quite the very end of that segment (901FE not 901FF) so it thinks it doesn't have room to write that no matter how big it is. I think that's why when you backspaced a bunch of them it worked. In fact, I bet that if you had manually put in a 00 somewhere short of the end (say, 901FB or before) it would have worked as well.

In any case, the last world is a glitch world, and as far as I know we don't yet have a way to turn glitch worlds normal, so, does it really matter whether it has 1 message or a billion? If the issue is purely cosmetic/asthetic then I'm not inclined to mess with it. If there is some functional issue, however, I do have an idea for a stop-gap solution:

Ideally what I would like to have is an extra pointer at the end to indicate the end of the dialogue for the last map. However, there's only enough room in that pointer table for the maps themselves. What I could do, however, is hijack the last two bytes of the data and use it for said pointer. In other words, the room for bank 2 text data would be shrunk by two bytes, which would now be used (by FF4kster only, not by the game) to indicate where the actual "end of data" location is. This may have the side effect of the game interpreting these pointer bytes as part of the last message of the last map, but the last map is a glitch world (absent miscellaneous shenanigans), and even if you do somehow turn it into a real map, it should be easy to avoid showing that particular message if it's a problem.

I'm not sure what your plan is exactly for dealing with the end of Bank 2 - I'm thinking the easiest thing to do would have the editor fill up the end with FFs, and know that any amount of FFs at the end can be removed to make room for what comes before.

At any rate, while you're looking at Bank 2, a request: do you think it would be possible to add the ability to insert and delete messages from a map? It seems like the amount of messages within a given map is limited only by the amount of space devoted to that map (by the pointers, which are already moveable), and the only thing needed to define a new message is a 00 at the end of the previous one.

You know what, I honestly thought I had already implemented that, but I just tried it and you're right, you can't currently add or delete messages from Bank 2! This one I will definitely get on right away! Just be careful to make sure your event triggers and NPCs aren't referencing message indexes that no longer exist or who knows how the game will behave...
Let's dance!