Final Fantasy IV SNES - Critical Hit Bug Fix?

Started by 8.bit.fan, November 15, 2018, 03:12:31 AM

Previous topic - Next topic

Grimoire LD

Thanks, let's see here...

Yep, crit is dead for both Cecil and Rydia. I take it that Tellah was in that last slot that Edward is now currently in? (As he normally tends to be) well, this might be trickier than I thought... its too late to look into it now, but at least I know I solved it for the dead-in-next-battle problem.

8.bit.fan

In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

chillyfeez

Got it!

So, long story short, if The character's ID/Handedness is 00 at the start of a battle (As inactive characters' will be during an autobattle), the game skips copying their basic critical hit percentage (7E:202D,x) into their effective critical hit percentage (7E:2041,x). The number at 2041 gets copied back to 202D, which gets copied back to 102D regardless at the end of the battle. So if 2041 is never changed from zero, then that zero gets copied into the permanent character record. So, within the instructions of how to handle a blanked-out character, there is a JMP instruction that jumps right past what we want:
$03/94E7 4C 70 95    JMP $9570  [$03:9570]   
What we want to do is jump to the point where that value is copied into 2041, so we just change the "70" at 394E8 to a "23." The end result is this:
$03/94E7 4C 23 95    JMP $9523  [$00:9523]   
Anyway, that will fix our issue with inactive characters losing their critical.
In regular ROM (unheadered), this change will be at 01/94E8.
:thumbsup:
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo

Grimoire LD

Grand work Chillyfeez! I almost bet that these weird "death-start-of-battle" and Auto-battle glitch killed Crits long before anyone really noticed and as a result they came up with alternative reasons why that may have happened with more reasonable ideas like an unknown weapon bit.

chillyfeez

Yeah, Rydia's crit would be permanently killed right after the octomamm battle. If nothing else, most of the rest of the final party would lose it during edge's debut.
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo

8.bit.fan

Amazing work Chillyfeez!!  :D :thumbsup:

So, please bear with me as I'm not very proficient with hex, do I only need to make the change you just posted by changing the "70" at 394E8 to a "23"? Or would I need to also make the change posted by Grimoire LD earlier by changing 0x194F0 to 00?

Any pointers would be much appreciated!! :)

Oh and also, this wouldn't 'revive' a critical-dead characters right? I'd have to start a new game?

This is amazing! You should submit a patch to the site!  :thumbsup:
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

chillyfeez

I think you'd have to do both Grimoire's thing and my thing to fix both issues (he fixed start-dead, I fixed blanked-during-autobattle). But yeah, changing the one byte for each fix should do the trick. For all known critical-killing situations.

As before, you will have to start a new game to enjoy the benefits of this fix.
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo

8.bit.fan

Awesome and thanks chillyfeez!! :D

Will check it out when I get the chance tonight or this weekend.

Will you and/or Grimoire LD submit a patch for the fix? Would be a great addition to all the other bug fix patches for FF4 already. ;)
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

chillyfeez

As it's only two isolated bytes, I don't think I'd make a patch just for that. It could easily be bundled into an existing bug fix patch though.
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo

8.bit.fan

Ok just got a chance to test this out quickly last night.
I went all the way up to Tellah vs Edward again and I was able to critical with Cecil afterwards! So looks like the autobattle issue is fixed as well! :)

I'll do more extensive testing later when I have the time...

Thanks again for the great work chillyfeez and Grimoire LD!! :D

Cheers!! :beer:
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

FlamePurge

I read all the way through the thread, and I'm a little confused as to what bytes to change. Do I need to do this in ASM at all? I'd like to implement this in Project II.
Check out and discuss my projects

8.bit.fan

Hey vivify93! :)

Yes, you'll need to make the 2 changes in a HEX editor.
Let me know if you need help. Feel free to send me the rom file then I can edit and send it back to you. :)

Cheers! :beer:
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

chillyfeez

Quote from: vivify93 on December 04, 2018, 01:30:13 PM
I read all the way through the thread, and I'm a little confused as to what bytes to change. Do I need to do this in ASM at all? I'd like to implement this in Project II.

You'll need to open your ROM (no header) in a hex editor and change the following two bytes:

0194E8
change from "70" to "23"

0194F0
change from "C0" to "00"

Changing these two bytes is changing ASM. When you edit a ROM you're either editing data or assembly. When you edit the text, or a graphical tile, or a tile arrangement within a town, or character stats, etc., those are data edits. Changing the way the console interprets those data is changing assembly. This happens to be the latter.
:thumbsup:
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo

FlamePurge

Thanks Chillyfeez! I'll launch a new version of Project II in a bit. Does Rodimus know about this fix btw?
Check out and discuss my projects

chillyfeez

I think? I posted on the namingway topic that we had been working on this and had figured it out. He said he had seen but was waiting to be sure it worked. I assured him that it would, but the conversation sort of stopped there.
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo

POWCo-op

Even though it's only two bytes, I think it affects so many people that I would be hugely appreciative if someone made a patch for this.
Now you're playing in... three dimensions.

FlamePurge

If Chillyfeez isn't really feelin' it, I could make the patch and credit him?
Check out and discuss my projects

8.bit.fan

Credit Grimoire LD also for fixing the first part of the bug. :)
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/
FF4 Ultima Discord: https://discord.gg/4MqjwJt

chillyfeez

That's fine. If there's demand for it there's no need to withhold a patch. Grimoire definitely deserves equal credit.
Ongoing project: "Final Fantasy IV: A Threat From Within"

Latest Demo