øAslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&topic=1980.60e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index856f.htmlslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&board=17.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index856f.html.zx;õg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0P.dcOKtext/htmlISO-8859-1gzip8:ÖdcÿÿÿÿÿÿÿÿTue, 10 Mar 2020 20:31:13 GMT0ó°° ®0®P®€§²ð®9õg^ÿÿÿÿÿÿÿÿhDdc FF5 Bugs & Glitches

Author Topic: FF5 Bugs & Glitches  (Read 23829 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #60 on: July 02, 2015, 01:32:45 AM »
Also watching streams (and while playing) I noticed that sometimes when you revive a Berserker, it will immediately attack. It seems that after certain amount of time has passed since the Berserked died, the ATB will be set to 1 (Like it happens in this video, although here it's set immediate after getting zombied...)

Also, I had long forgotten about skipping Kelb Town bug. Thanks to EiriasValar for rediscovering it.

A similar bug exists in FFIV and allows speedrunners to skip right past Mist

https://www.youtube.com/watch?v=cDeZ3tINq6Y

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #61 on: July 19, 2015, 05:23:47 PM »
I've been doing some bug-fixing research as a distraction from various projects.  Lately I've been looking at how swapping equipment removes elemental status granted by Mix.

The bug itself is relatively straightforward to understand.  Elemental absorb/evade/immune/half/weak is stored in five bytes, each bit being one element.  In FF5, the elemental status granted by equipment is stored as an index to a table which holds the specific elemental values.  When you swap equipment (in battle or not) the game "rebuilds" the status by looping through the equipment, getting the associated elemental resistances, OR-ing them all together, and saving those five values to the character's elemental resistances.  The bug (in my opinion) is actually with Mix - it modifies those elemental resistances directly.  So when you swap items, the game doesn't know you're supposed to be under the effects of a Mixed potion, and thus you lose the buff.

The fix, unfortunately, is much less straightforward.  One strategy is to catch when the game "unequips" the item, and before it does so XOR the old item's elemental resistances versus the current (to remove them) and then ORA instead of STA against the elemental resistance values.  This is less straightforward than at first blush, since you have to deal with a lot of edge cases (for example, what if you use Absorb Fire and then unequip a Flame Shield). 

A better strategy would be to find an available byte in the RAM and use that as a "temp resistance" slot, holding an index to the table.  This, of course, has it's own host of issues, but ends up being more flexible.  Some decisions would need to be made regarding the implementation scheme.  You could just do one byte holding values for Elemental Absorb and simply OR it with 2030,X.  However, you could also make this byte an index to the aforementioned table of elemental resistances.  This lets you do some interesting stuff modding-wise: you can have a skill that makes a character weak to an element, for example.  Either way, the implementation is relatively easy - simply add whatever you're OR-ing to the function that recompiles the elemental resistance bytes (at C2/9C40).

Anyway, I haven't coded any of this up.

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #62 on: July 19, 2015, 06:13:21 PM »
Separate reply, since it's on a different bug.  The Monster Special not setting Status 1 and 2 at the same time is a lot simpler (note: I believe this also affects setting HP Leak in Status 4).  The function (at C2/8C2F) calls the function to apply status 1 (at C2/8CAC).  I don't know exactly where, but the data pointer in $32 is getting overwritten during the 8CAC call with the target's pointer instead of the monster's pointer.  Luckily, this is a pretty simple fix - remove an LDX $32 and sub in a PHX/PLX.

[EDIT] Now with patches!
« Last Edit: July 19, 2015, 06:47:21 PM by LightPhoenix »

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: FF5 Bugs & Glitches
« Reply #63 on: July 21, 2015, 04:52:00 PM »
So, what was the intended function here in your opinion?

The way I see it is that it was planned that since you can (only) change weapons and some have elemental affinity, it should update its elemental properties accordingly. The simple way for the programmers was to recalculate everything again (reuse same code). They likely realized that it affected the Mirage Vest and made it have only 1 illusion instead of 2, however mixing elemental affinities was a complete oversight so they missed it.

So I would think that both the mix and the vest are bugs, one was worked-around while the other was missed, but both are bugs.


BTW, what's the elemental evade? is it the "Can't Evade" certain type of magic or does it really exist a space for elements always hitting?
I'm the best in the universe! Just remember! [F-zero X]

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #64 on: July 24, 2015, 09:59:07 PM »
Another bugfix update: I've mostly got the Death+Encircle bug figured out, but I don't have a good save to test it with so I haven't coded it.  The main battle loop has code for handling "dead" characters, including a check for handling dead and/or erased characters (at C2/6202).  The bug is that it first checks if the character is Erased, and if so it doesn't set the Dead status (whereas it does if you are not Erased).  This is because an Erased character is not necessarily dead.  This should check the character HP when erasing them to determine if they are dead.  The re-code is pretty simple and could be done in-line with a little consolidation.

EDIT: I went ahead and coded it up, made patches, and zipped it up.  I have not tested this, and would appreciate it if someone with a readily available save could do so.

Quote
So, what was the intended function here in your opinion?

The way I see it is that it was planned that since you can (only) change weapons and some have elemental affinity, it should update its elemental properties accordingly. The simple way for the programmers was to recalculate everything again (reuse same code). They likely realized that it affected the Mirage Vest and made it have only 1 illusion instead of 2, however mixing elemental affinities was a complete oversight so they missed it.

So I would think that both the mix and the vest are bugs, one was worked-around while the other was missed, but both are bugs.

My guess is that, in battle, it was meant for switching out shields.  You still need to check all the armors since you may not flat out lose an absorb from losing a shield (hence my edge case comment).  However, given the state of various bugs related to Mix commands, I think the Mix effect probably weren't tested all that well and this was an oversight.  You should probably be able to retain the benefit, but perhaps it should fade over time.  I say that with the acknowledgement that I almost never use Mix, so I don't know the specifics of how it works.

Quote
BTW, what's the elemental evade? is it the "Can't Evade" certain type of magic or does it really exist a space for elements always hitting?

Elemental "evade" for lack of a better term isn't to my knowledge used, but I'd have to double check my notes to be 100% sure about.  The basic premise is that when you're immune, the attack still counts as a hit even if there's no damage.  The "evade" is basically the same as immune, but counts as a miss.  It's the byte between Absorb and Immunity (7E/2031).  In theory it would be used as a better form of immunity, where immunity only prevents damage and evade prevents damage and secondary effects since it's a miss.  However, I don't believe this ever ends up getting used.
« Last Edit: July 24, 2015, 10:14:57 PM by LightPhoenix »

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #65 on: July 25, 2015, 06:23:16 PM »
Another one bites the dust: I thought the Pray not healing Petrify fix was going to be simple.  Fixing it once I realized the bug was simple... finding it involved me derping a bit on how abilities work.  If I had remembered Revive works on all targets I would have found it quickly.   :isuck:

For each effect in a spell/ability/etc, there's a flag at 7BEB,X (where X = the effect number) that indicates whether the effect should ignore statuses such as dead and petrified.  This is set for Revive and for Magic (ie Heal) but not for Pray.  Therefore Pray fails on a petrified target, even though it should heal them (Heal and Pray use the exact same attack formula/parameters).


:edit: Can someone expand on the Mute bugs?  I'm looking into it since it's next on the list, but I'm not sure the exact issues.  Otherwise I can move on to the Magic Power Underflow bug.


:edit: It wouldn't be bug-fixing if everything was straightforward.  I assumed the Magic Power Underflow bug was simply failing to account for setting something to zero.  Nope!  Close though.  All stat penalties are saved as negative numbers so that they can just be added, avoiding some extra branching.  The only problem is that the addition is 16-bit, and the high byte was being set to #00 instead of #FF.  Oops.  Luckily I was able to fix this inline by moving a REP instruction, due to some shenanigans that I'm not sure as to the purpose of.  The game was adding 1000 to each base stat before adding stuff in, and subtracting it once done, properly zeroing if there's an underflow.  Fuck if I know why it does that, but it's what made this possible.  Note that this probably affected all stat penalties, not just the Barbarian/Thornlet one.  I've uploaded the zip with asm/headered/unheadered patches.


:edit: Another not-so-easy to fix situation.  Power Drink calls attack formula 51, which alters stats.  Unfortunately, the Attack Power it modifies (2044/2045) is for monsters, not players.  Relatively simple to fix, just changing some references.  Except now we run into the same problem as with the Elemental Stats - these get overwritten whenever equipment is swapped.  Ugh.  The best scenario, IMO, is to add 2044 to the attack power when it's calculated into $7A03; I'm not sure how extensive those changes are yet.  At least in this case we have bytes that aren't used elsewhere (2044 is only ever used for Goblin Punch, which is why it's the only skill affected).
« Last Edit: July 29, 2015, 12:05:19 AM by LightPhoenix »

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: FF5 Bugs & Glitches
« Reply #66 on: July 29, 2015, 12:50:07 PM »
I'd tried to reproduce the Death + Circle bug before but I was to over-leveled for it to connect (due to how evasion works) or to weak to try to kill Omega in a quick manner to even try it... (I would need mixed levels, but I've been lazy to set it up :P)

I heard about a similar bug, which I forgot to mention here. It would seem that you can die and be healed with regen at the same time, so you end up death with more than 0 HP. Since timing is crucial & can't remember if you needed to die in a specific way I hadn't mentioned before (probably easiest is to attack a partner)...

As for the elemental evasion, there is a gap between absorb and immunity in the RAM that always bothered me, so it sounds reasonable it should be for that (despite is not used ever AFAIK).

The mute bug is just present on the RPGe version IIRC. Normally there's a parameter in the enemy group formation that determines whether or not you can cast magic (like when fighting Magic Pot), which is labeled as "Casts Void at start" on my editor. What it does it to prevent both sides to cast magic. There's also the Time magic Mute/Void which ideally should silence both sides but it doesn't (There's also the white magic Mute, but that's single target and works fine...).
I'm the best in the universe! Just remember! [F-zero X]

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #67 on: July 29, 2015, 11:31:53 PM »
I'm pretty confident the Death+Circle bug will be fixed with my patch, I'm just overly cautious.

I'll add the regen/death bug to the list; it's probably in the same function.

Neither of the Chemist Item Swap bugs (Elemental Status, Power Drink) are fixable inline.  I'm still debating what the best strategy will be here.  There's an unused attack formula at C2/8261 which I might be able to use, but I'm hesitant to do that.  I could do a long jump to another bank where there is free space, but that involves finding unused space (not as easy in FF5 as later games).  The other option is to work on optimizing some of the code - using JSRs to consolidate duplicate code.  That's not particularly ideal either.  Once I decide on a course of action, my plan is to use $2044,X to store Power Drink's bonus Attack Power and $2045,X to store Mix's added elemental effects.  I think I'm going to move on to some other bugs and come back to these with a clearer head.

:edit: So in my mind, the actual bug here is the whole function at C2/9A6F that recalculates stats when equipment has been changed.  I've been working on this function to see if it can be optimized so I can free up space to make changes necessary for the Chemist Item Swap bugs.  As it turns out, there are a whole class of bugs that are essentially due to this function.  This covers both the Chemist Item Swap bugs, as well as various underflow and overflow bugs, most notably the Berserker Thornlet one.  It turns out that this function performs no apparent overflow check, so while I didn't see any listed, there are probably numerous instances of that.  This will be a lot of work, and while I'm still working on it, I've decided to move on to other bugs so I don't get burned out on it.



The Odin-Magic Lamp-Zantetsuken bug is interesting not because it was hard to debug or is overly hard to fix, but that there are actually a few things here that contribute to the problem.  The first is simple - some bosses don't have the Heavy flag set, including Neo Exdeath Pt. 4 :eek:.  So part of this fix is to go through and set all of those.  That would (I believe) adequately fix the bug, since Zantetsuken's attack formula will "ignore" Heavy targets (they will animate being cleaved, but then come back).  The second problem is that Magic Lamp, unlike Summon, doesn't check for Heavy targets when casting Odin.  Therefore, Odin will never use Gungnir.  So, a simple fix is to make Odin use Gungnir instead of Zantetsuken - change D0/EEE9 from 6A to 6F.  This won't affect the actual summon.  A better fix is to have Magic Lamp check for Heavy targets... which is a 24 byte inclusion there is no room for.  Alternatively, Magic Lamp could just call Summon... but I'm not sure of the full implications of doing that.  A cursory inspection shows they are similar but not exactly the same.  So my plan is to audit the bosses, setting the Heavy flag that should be set on all of them.  That should fix the issue, but if it doesn't then I'll look into routing Magic Lamp into Summon to see what happens.



So I think everyone knows the Scan Bug by now - C2/6C93 should be 10, not 08.  Simple fix, not going to actually release a patch on it.  What I will mention here for completeness is that Observe, Scan, and Analyze all work a little differently.  Observe only returns level and HP, Scan and Analyze both return everything but Analyze works on bosses and Scan does not.  That appears to be the intended behavior unlike some other bugs, so I won't be changing that.



I'm still alive, but I took a couple weeks off from coding, but I'm back in the game now!

SwdSlap, by all accounts, should have a chance to inflict paralysis on the target.  It does not.  All actions, whether commands or spells or whatever, have eight-byte data tables that roughly define how the ability works.  For commands, bytes three and four indicate action flags and damage modifiers that get set in 201E,X and 201F,X respectively.  For example, this is how Defend and Guard set their respective action flags.  SwdSlap sets the damage modifier flag (201F,X) to #02.  However, this is never used in the code; the function that parses these modifiers simply skips over it - there is no code to handle it.  Presumably this flag was to indicate that the attack should paralyze.

One way to fix this would be to code handling for the flag.  However, the better way to do this is to emulate another command that combines a regular attack with a secondary effect - Mug/Capture.  In fact, what I think happened is that SwdSlap was meant to be converted to this method since it is more elegant, but got overlooked during production.  So this is what I'm working on, although it will require some work since C2 is rock solid as far as extra space.

While I'm here, a word on Capture.  I've seen it mentioned on occasion that Mug/Capture is bugged since it doesn't use any other weapon effects.  This is intended behavior.  It deliberately calls a version of Fight (0816 versus 45FF) that ignores added abilities.  I believe the intent is that you either get added effects OR you get the special effect, and I believe this is why FF6 simply overwrites and/or ignores those effects as well.



:edit: An easy one this time that I've actually made a patch for!  What is this madness?!  The Release-Banish bug was a simple one to identify and a simple one to fix.  Moss Fungus and Gel Fish were calling spell index E9, which was a version of XZone that for whatever reason only targeted the caster.  I pointed both of them to spell index 47, which is the Time Magic version of Banish/XZone other enemies use.  I've attached the zip of the (very simple) patch.

Release doesn't parse the targeting flags completely, so targeting is limited to five options.  It only looks at the "Target All" flag (#40) and the "Default Enemy" flag (#08).  This produces four options: target all enemies (48), target all allies (40), target a random enemy (08), and target self (00).  You can also get target a random ally by setting any flag other than those two.  It might be an interesting project to expand this targeting so that there are more options for Release, but beyond the scope of this bug-fixing project.



:edit: As always, bugs can end up being pretty interesting and not always straight forward to fix.  Fixing the various Water spells - Aqua Rake, Tsunami, and Big Tsunami - was still pretty straightforward, but Aqua Rake/Breath required a bit more ingenuity.  The Tsunami spells use attack formula 06 - Magic Attack - and simply didn't have the element flag (parameter 3) set.  It was a simple fix. 

Aqua Breath (AB) on the other hand was a little more interesting.  AB doesn't always do Water damage throughout the series, so I debated whether it was intended behavior for it not to be water-elemental.  It uses a separate attack formula (6C) that does a non-elemental magic attack with bonus damage against certain creature types.  There are two possible solutions - one is to modify formula 6C to look at elemental damage, and the other is to modify formula 06 to look at creature type.  Both formulas do not utilize parameter 1, so either approach is possible.  Ultimately I decided on the second approach, since it involves only changing one other spell (Apollo Harp) and uses much less space.  So this patch changes formula 06 to check for creature type, and changes AB to use the basic magic attack formula.  This has a few consequences.  AB now suffers multi-target penalties, and can now be absorbed, blocked, and otherwise defended against like any normal magic attack.  However, AB now gains bonus damage from enemies weak against water in addition to damage against desert creatures.  I consider this a fair trade-off.
« Last Edit: August 23, 2015, 06:39:44 PM by LightPhoenix »

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #68 on: November 10, 2015, 11:37:20 PM »
Just a quick update on bugfixing:

I have finally finished a large patch that fixes everything wrong with re-equiping items in battle.  I'm doing some final testing but it should be up by the end of the week.  It is not for the faint of heart.

I also have a preliminary fix for the stupendously rare Quick + Mix + XMagic bug.  I'll go into more detail when I release it, but it has to do with the submenus and enemy selection.  In an amazing bit of luck, I was able to fix it inline - yay for crappy compiling!  I do have to test it, but I'm fairly certain this will fix it.

Would it be appropriate for me to create my own thread at this point?

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #69 on: November 11, 2015, 02:28:53 AM »
Quote
Would it be appropriate for me to create my own thread at this point?
I also have a thread for my own patches, so I don't see why not.

C. V. Reynolds

  • Tunnel Armor
  • *
  • Posts: 153
  • RATED TEM OUTTA TEM.
    • View Profile
    • cvreynolds.net
Re: FF5 Bugs & Glitches
« Reply #70 on: December 10, 2015, 04:34:41 PM »
Hey, LightPhoenix. What's going on with that great-sounding patch you were talking about? Did something come up?

Hope you don't think there's no interest. I love that you fix FFV's bugs. :)
I'm the former Hollywood Narrator from GameFAQs.

I'm a published novelist. My novels "Universe Eleven Series - Blue Ruin" Part 1, Part 2, and Part 3 are for sale on Amazon (check my website) in print and ebook formats.

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: FF5 Bugs & Glitches
« Reply #71 on: December 13, 2015, 04:49:52 PM »
I've been busy with work (inspection + training new people) and the holidays, and frankly been a little burned out for the last month or so despite a small vacation over Thanksgiving.  What little coding time I've had I've been wrapped up in understanding and solving the three "casting" bugs (Quick/Mix/Dualcast Targeting, the Phoenix 0 MP bug, and the XMagic 0 MP bug).  Plus, honestly, I like the investigation part more than the actual coding/testing/collating part, so I tend to be lax on that end.

I've tested the Equip rewrite, it's working well.  There are a few edge cases that still could use some testing.  It changes some stuff, so it's not strictly inline.

The targeting bug was fixed inline (luckily), and was a bug in the menu code where a flag for Mix wasn't getting cleared for X-Magic if both were used in the same turn via Quick. 

The Phoenix/0MP bug is (AFAIK) an edge case with Phoenix where a spell can have a "secondary" spell.  far as I'm aware, Phoenix is the only spell that uses this secondary spell method.  This uses a different mechanism than X-Magic, since you could in theory cast Phoenix twice.  When you cast a spell the basic flow is: the data is loaded, effects and animations loaded, and in another function altogether the MP check happens, and the effects and animations are altered after the fact.  There's no MP check in the actual casting function (although it *does* check Mute/Void/Toad).  The bug is that the MP Check doesn't account for Phoenix, so it never cancels the second part (which by this point is its own effect and animation).  I'm debating the best way to go about fixing it, but it won't be inline.

The XMagic/0MP bug is simply that you can select two spells even if you don't have enough MP.  The code *does* catch this and prevents you from casting the second spell (unless it's Phoenix, see above).  However, this doesn't prevent Mimic from copying it, for example.  This is another bug in the menu code where a flag for if a spell can be cast is not recalculated between selections.  I think I have this solved (the recalc code is simple), but again it won't be inline so I have to figure out where to put it.

Anyway, that's where I'm at.

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: FF5 Bugs & Glitches
« Reply #72 on: December 20, 2015, 03:04:56 PM »
Found a new bug while playing on the GBA. When you get to see the scene of the King Tycoon in Gohn and get the Airship, when you go back to that place usually an scene triggers, right? Well, you have 1 frame to land before triggering the scene and you can the watch again that scene with the King. The good thing is that the airship gets brought back, so you don't get stuck in there.

It's most likely that it works on prior versions too, not sure about future ones (mobile).

Forgot to mention it only works if you reach the town from the right like shown here:
« Last Edit: December 20, 2015, 03:11:13 PM by samurai goroh »
I'm the best in the universe! Just remember! [F-zero X]

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FF5 Bugs & Glitches
« Reply #73 on: December 20, 2015, 05:55:11 PM »
regarding Capture: it's one thing to skip an add-on effect, like a spell.  it's something else to change the fundamental nature of the weapon strike itself just because it's being done at close range.  in FF6: why should Dice lose their custom damage formula, Drainer no longer drain, or Heal Rod suddenly become damaging, etc., just because you're trying to steal?  game difficulty isn't a suitable answer, as weapons' special effects do not necessarily make the strike more damaging to start with; for instance, the omission actually makes Atma Weapon stronger for much of the WoB.  that's in contrast with a bonus spell, which is almost always in your favor.

throwing out weapon strikes' inherent characteristics is nonsense, and was easily fixed in FF6 by adding a second byte to temporarily hold an additional special effect ID, and making a second call.

i don't know much FF5, but from what i've read on this matter before and what i'm reading in your post, the game is more measured and sensible than FF6 in what Capture throws out.  that is, it doesn't temporarily re-forge the damn weapons. :P  (it keeps their various damage formulas, correct?)

pardon the lack of quoting..  the iPad's inability/refusal to highlight blocks of text does not mix with your giant post.  i'd be thrown off the forum for quoting the whole thing, so i'll just refer to it. :P
« Last Edit: December 20, 2015, 06:15:04 PM by assassin »

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FF5 Bugs & Glitches
« Reply #74 on: December 20, 2015, 08:08:33 PM »
samurai goroh: that's weird.. Does it matter how fast you walk into the town, or only how fast you land?

I would've thought that the game would change the necessary event flags during the cutscene (preferably at the beginning).  Does the game somehow need you to leave a town to "finalize" any event bytes altered therein?  If so, maybe rapid screen changing interrupts that process..