øA slickproductions.org /forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&action=printpage;topic=1887.0 e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index4cfa-2.html slickproductions.org /forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1887.0 e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index4cfa-2.html.z x 2g^ ÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ 1^ {B OK text/html ISO-8859-1 gzip @øÕ {B ÿÿÿÿÿÿÿÿ Tue, 10 Mar 2020 06:38:47 GMT 0ó° °® 0® P® €§² ð® 2g^ {B
Print Page - Fixing the Infinite Arrow Glitch
Board of Slick
Library of the Ancients => Final Fantasy IV Research & Development => Topic started by: Grimoire LD on September 28, 2013, 10:35:30 AM
Title: Fixing the Infinite Arrow Glitch
Post by: Grimoire LD on September 28, 2013, 10:35:30 AM
I had thought a topic such as this (bug fixes and the like) deserve their own topics for ease of use for people that are looking purely for the fixes (not to mention fixes in general are a larger deal than disassembling)
Okay, well I finally have the means to fix the Arrow Glitch. Just yesterday I was disassembling the Attack Routines and saw references to Arrows. For our purposes here is the relevant information...
03/C97238 SECA:0001X:0008Y:0000P:envMxdiZc - Set Carry Flag. $03/C973BD DC 32LDA $32DC,x[$7E:32E4]A:0001X:0008Y:0000P:envMxdiZC - Load A from Right Hand Quantity. $03/C976E9 01SBC #$01A:0032X:0008Y:0000P:envMxdizC - -1 to A. (-1 Arrow) $03/C978D0 0EBNE $0E [$C988]A:0031X:0008Y:0000P:envMxdizC - If not 00 branch to 03C988. ---------------------------------------------------------------------------------------------------------- $03/C97AA5 CDLDA $CD [$00:00CD]A:0000X:0008Y:0000P:envMxdiZC - Load A from CD. $03/C97CAA TAXA:0001X:0008Y:0000P:envMxdizC - Transfer A to X. $03/C97DBD DC 38LDA $38DC,x[$7E:38DD]A:0001X:0001Y:0000P:envMxdizC - Load A from 7E38DD. $03/C9801A INC AA:0000X:0001Y:0000P:envMxdiZC - +1 to A. $03/C98105 ABORA $AB [$00:00AB]A:0001X:0001Y:0000P:envMxdizC - Check it against address AB. $03/C9839D DC 38STA $38DC,x[$7E:38DD]A:0001X:0001Y:0000P:envMxdizC - Store A in 7E38DD. (This will make the game realize next turn to decrement the arrow and quantity to 0) $03/C98680 03BRA $03 [$C98B]A:0001X:0001Y:0000P:envMxdizC - Branch to 03C98B
As can be seen the game goes Out Of Its Way to keep that +1 Arrow in the quantity (this is likely to prevent a reset-byte glitch which would make it 255 Arrows) . But they never had to take this path in the first place. When a character's turn starts the game checks if a 01 Arrow has been used and if it has it erases both Arrow and Quantity in a separate location (7E32XX section). Then it adds 1 to the value at 7E38DX (Dependent on Slot) and if that is 1 erases Arrow and Quantity. A more efficient way to do this would have just been to write a JSR to the erasing value at 03A848. The only problem with this is that the game read the Empty Hand after the damage but before the graphics processing so you will be attacking with Fists, dealing appropriate Weapon Damage, but that's the only glitch associated with this and a lot less gamebreaking if someone wanted to make a Saga Style mod where all weapons have "durability". I'll take a small graphical glitch over that nonsense anyday
To make this work correctly change...
$03/C97A A5 CD LDA $CD [$00:00CD] A:0000 X:0008 Y:0000 P:envMxdiZC - Load A from CD. $03/C97C AA TAX A:0001 X:0008 Y:0000 P:envMxdizC - Transfer A to X.
The rest of that "wait and see" routine past the 00 Arrow check above is unnecessary if this is taken into account. And can be modified to include anything the hacker would like.
While it's not perfect. It's better than what is in place currently, I would say.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: Grimoire LD on January 02, 2015, 01:31:11 PM
Very late update but I've discovered a glitch with my fix that I should have noticed a long time ago!
I didn't properly nullify the "turn-start check" for the Arrows and this was causing an error where the character in the first slot would lose their weapon because a value that was set for the arrow-user (to lose the last arrow on the next turn) was never cleared.
To fix this all you need to do is null
$03/C983 9D DC 38 STA $38DC,x[$7E:38DC] A:0019 X:0000 Y:0001 P:envMxdizc
And that will fix the error.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: JCE3000GT on January 02, 2015, 05:23:43 PM
Title: Re: Fixing the Infinite Arrow Glitch
Post by: Grimoire LD on January 02, 2015, 06:12:37 PM
Umm... let's find out...
No, no it did not. That is a rather strange phenomenon. Clearly something wrong is being written into the amount of either hand. I'll check that out, but since this is somewhat menu based, I doubt it will be a simple fix.
Yeah, what a complicated piece of work... it looks to be some screw up in the decrement, but nothing I do will actually show me what is going on. According to the system it is being neither Read or Written to, when I'm seeing it actively seen as both (because it is read when the value is recorded because every time you repeat the glitch in the same battle the game decrements the FF to FE and FD and so on.
The easiest solution would be to just not allow an already selected cursor up to the hand menu, but only can be manipulated from within the hand menu itself. That would require a very specific check. Granted this is a bit difficult to make happen accidentally so I'm not too concerned about it.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: JCE3000GT on January 02, 2015, 07:25:09 PM
Intetesting analysis! The only reason to really fix this is abuse if someone makes a rom hack where they want a challenge and it a very hard difficulty. I wasn't able to fix this while working on my FF2us HardType. :(
Funny thing about my glitch is you can only do it if the items in the menu are even horizontally. It works with either hand but you cannot leave the R/L-hand menu and go back in during/in-the-middle of the removal. Make sense?
Title: Re: Fixing the Infinite Arrow Glitch
Post by: Grimoire LD on January 02, 2015, 07:30:10 PM
Intetesting analysis! The only reason to really fix this is abuse if someone makes a rom hack where they want a challenge and it a very hard difficulty. I wasn't able to fix this while working on my FF2us HardType. :(
Funny thing about my glitch is you can only do it if the items in the menu are even horizontally. It works with either hand but you cannot leave the R/L-hand menu and go back in during/in-the-middle of the removal. Make sense?
Indeed, but why it happens is absolutely beyond me, I've also noticed sometimes that the item that I started with and put away would duplicate itself as well. Why this only happens when the two are lined up next to one another is so peculiar.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: JCE3000GT on January 02, 2015, 08:05:28 PM
^ This is also a mystery to me. Interestingly I found this glitch completely by accident shortly after I bought the game new. I may be old but my memory is sharp, I actually remember where in the game I was when I did it, needless to say it was odd.
Another aspect of this is if you have exactly 256 of that item in the current item list and use -Sort- they all disappear.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: Grimoire LD on January 02, 2015, 08:12:10 PM
^ This is also a mystery to me. Interestingly I found this glitch completely by accident shortly after I bought the game new. I may be old but my memory is sharp, I actually remember where in the game I was when I did it, needless to say it was odd.
Another aspect of this is if you have exactly 256 of that item in the current item list and use -Sort- they all disappear.
I had noticed that as well. I imagine because FF is some sort of terminator in the normal coding it would cause the item to disappear. I imagine it's not included as anything more than a safeguard of sorts.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: JCE3000GT on January 02, 2015, 09:43:12 PM
I agree. I usually did that for Excaliburs for Edge to throw so I would sell or trash at least one so I would lose them when I sorted.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: Grimoire LD on January 29, 2015, 06:47:13 PM
Well as it turns out it seems that my Infinite Arrow Fix only ended up creating more bugs... so as sad as I am to say it, none of it is a valid alternative, the game looks at too much and focuses too much on certain numbers in this case to safely change. If I could just make the original code to look at the Bow-Wielder as soon as the attack is used and not at their next turn, I could accomplish this, but for now I have to say that this was a failure.
Title: Re: Fixing the Infinite Arrow Glitch
Post by: JCE3000GT on January 31, 2015, 07:34:46 PM