News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Final Fantasy IV SNES - Critical Hit Bug Fix?  (Read 9928 times)

8.bit.fan

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/

Grimoire LD

  • Sr. Member
  • ****
  • Posts: 376
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #41 on: November 30, 2018, 02:09:15 am »
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

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #42 on: November 30, 2018, 02:14:08 am »
Yup, Edward is in Tellah's spot.
Hmmm...
In the year of 200X, a super robot named Mega Man...
http://www.8bitfan.info/

chillyfeez

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #43 on: November 30, 2018, 04:41:32 pm »
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:
Code: [Select]
$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:
Code: [Select]
$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

  • Sr. Member
  • ****
  • Posts: 376
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #44 on: November 30, 2018, 04:56:50 pm »
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

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #45 on: November 30, 2018, 05:15:35 pm »
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

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #46 on: November 30, 2018, 05:20:43 pm »
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/

chillyfeez

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #47 on: November 30, 2018, 05:57:49 pm »
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

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #48 on: November 30, 2018, 06:01:38 pm »
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/

chillyfeez

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #49 on: November 30, 2018, 06:20:11 pm »
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

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #50 on: December 04, 2018, 01:20:49 pm »
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/

vivify93

  • Hero Member
  • *****
  • Posts: 997
  • Summoner
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #51 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.
All my life I've tried to fight what history has given me.

8.bit.fan

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #52 on: December 04, 2018, 04:19:30 pm »
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/

chillyfeez

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #53 on: December 04, 2018, 04:30:07 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

vivify93

  • Hero Member
  • *****
  • Posts: 997
  • Summoner
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #54 on: December 04, 2018, 10:04:48 pm »
Thanks Chillyfeez! I'll launch a new version of Project II in a bit. Does Rodimus know about this fix btw?
All my life I've tried to fight what history has given me.

chillyfeez

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #55 on: December 04, 2018, 11:35:54 pm »
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

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #56 on: December 05, 2018, 03:39:56 am »
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.

vivify93

  • Hero Member
  • *****
  • Posts: 997
  • Summoner
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #57 on: December 05, 2018, 09:17:48 am »
If Chillyfeez isn't really feelin' it, I could make the patch and credit him?
All my life I've tried to fight what history has given me.

8.bit.fan

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • 8-bit fan's Hacking Projects
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #58 on: December 05, 2018, 11:44:17 am »
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/

chillyfeez

  • Hero Member
  • *****
  • Posts: 777
    • View Profile
Re: Final Fantasy IV SNES - Critical Hit Bug Fix?
« Reply #59 on: December 05, 2018, 02:10:53 pm »
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