Breakable Tools - Need Help - Printable Version +- FF6 Hacking (https://www.ff6hacking.com/forums) +-- Forum: Discussion Forums (https://www.ff6hacking.com/forums/forum-5.html) +--- Forum: Magitek Research Facility (https://www.ff6hacking.com/forums/forum-9.html) +--- Thread: Breakable Tools - Need Help (/thread-4124.html) |
Breakable Tools - Need Help - PowerPanda - 07-05-2021 Divergent Paths has been out for several weeks now, and ther is one pretty big bug that is affecting the game, having to do with the breakable Tools asm that Subtraction helpfully coded for me. Gi Nattak figured out a way to reproduce it, and I have been able to refine that method, but I can't figure out how to fix it. Here is the ASM Code: Code: check_command: Here is the bug, and how to reproduce it: 1. Before the battle, sort your inventory. This step isn't necessary, but it makes it easier to find the glitched items in step 3. 2. You must use Tools 12 times. It doesn't matter if the Tool is a breakable one or not, but if a Tool breaks, it doesn't count towards the 12 count. So, your best bet is to use the Debilitator. It also doesn't matter whether Edgar or Gogo is the one that uses Tools, so bring Gogo along to make this go faster. 3. After using the Debilitator 12 times, you will still have the Debilitator, but you will also have 1-2 glitched items in your inventory. We've seen this be either "Dirk: 01" or "Cat Hood: 96, Scimitar: ,6". These items will be lit up as if you can use them as an item. If you get the Scimitar, it will also be classified as a "Tool", and will show up in your Tool menu. Basically, garbage items. 4. At this point, use any Tool. Regardless of whether it breaks or not, it will be deducted from your inventory. This includes the unbreakable tools (Debilitator and Air Anchor), which cannot be obtained again in the game. 5. Finish the battle. The glitched items will still be in your inventory. The bug, as far as I can tell, is in the section of code labeled "no_break", since it doesn't occur when the Tool breaks. In fact, a Tool breaking most often doesn't count towards the 12 uses, but sometimes it actually resets the 12 count. I looked through the code, and thought that issue might be that the "SEP #$20", setting the X/Y accumulators back to 8-bit, never occurs on the "no_break" branch. I tried adding that into the "no_break" section of code, both at the beginning and the end, but it did not seem to affect this issue. Any insight would be immensely helpful. I did not intend to ever do a Divergent Paths v1.1, but this bug is big enough that it's necessary. RE: Breakable Tools - Need Help - C-Dude - 07-05-2021 Well, you don't need to worry about the SEP #$20 in this case. Serity's been teaching me about the stack variables and the accumulator and because you used PHP to push it, all that accumulator stuff will be reset with the PLP to pull it back. I'm inclined to suggest that maybe you should explicitly set $32F4,X with the tool identity in the no_break branch. That would involve preserving that first A, though, before you even multiply it by 30... either in a scratch variable or by loading its value from the stack. The later requires an intimate knowledge of what's on the stack and how tall it is, though, so I'm not sure what value you'd use. It uses the first in last out method, though... so perhaps it's as simply as LDA $02,S, because A was pushed onto the stack in the subroutine and then P was. So... you could maybe try this for no_break: Code: no_break: RE: Breakable Tools - Need Help - PowerPanda - 07-05-2021 Thanks C-Dude. Unfortunately that crashes the whole battle. RE: Breakable Tools - Need Help - C-Dude - 07-05-2021 Dang, I was really hoping it'd be something simple like that. Sorry. I do think that it's something to do with not setting $32F4,X in the fail branch (the "don't break this"), because if there's a wrong value in there (like a tools-indexed item instead of the item itself) that could explain why the game is adding in garbage instead of the tool that was used. RE: Breakable Tools - Need Help - SirNewtonFig - 07-05-2021 If someone can toss me a valid save with a collection of tools to play with, I can fire this up in a debugger later and have a sniff around. RE: Breakable Tools - Need Help - PowerPanda - 07-05-2021 (07-05-2021, 06:50 PM)SirNewtonFig Wrote: If someone can toss me a valid save with a collection of tools to play with, I can fire this up in a debugger later and have a sniff around. Download Divergent Paths, from the link in my signature. In the "Extras" folder, there is a save repository of my final playthrough. You can pick pretty much any of those. I'd recommend taking the final save file, then fighting on the world map surrounding Kefka's Tower. I know that Celes has Stop magic, so if you cast Stop on any of those enemies, you can pretty much just sit there and spam Tools with Edgar and Gogo. Applying Divergent Paths to your rom will also let you play with this code, which begins at C2/6490. There's a bunch of free space after this code, so you can make your fix as long as it needs to be. Thank you so much for taking a look. RE: Breakable Tools - Need Help - C-Dude - 07-06-2021 I just tested the fix I proposed 256 times with Debilitator (between Tools and Mimic) and I did not encounter the glitch. Here's the raw HEX version of it, try pasting this at C2/6490 in a hex editor and give it a shot. Code: C2/6490: (Unheadered) EDIT (7-6-2021): Accidentally pointed one of the No_Breaks to the wrong spot, which was causing 100% tool breakage for fragile tools. The pointer has been corrected in the above block to D0 19, please apply it again. EDIT (7-7-2021): For people reading through this thread seven years down the line, do NOT stop here! My suggestion was not the solution and this hex will not solve a breakable tools problem. RE: Breakable Tools - Need Help - Gi Nattak - 07-06-2021 It seems that with this code change, when you use a Tool which has a chance to break, such as the Noiseblaster, it removes/deducts the tool each use from the inventory 100%, every time, even if the tool didn't break (when the 'tool is broken' text happens at the top), which is not how it's supposed to work... Before, how it was, is that it would deduct the tool after use, and if it didn't break, would give it back to the player on Edgar's next turn, and if it did break, would not give it back - you could see this happening in the inventory between the turn of Edgar using a tool, and his next turn. RE: Breakable Tools - Need Help - C-Dude - 07-06-2021 (07-06-2021, 12:41 AM)Gi Nattak Wrote: It seems that with this code change, when you use a Tool which has a chance to break, such as the Noiseblaster, it removes/deducts the tool each use from the inventory 100%, every time, even if the tool didn't break (when the 'tool is broken' text happens at the top), which is not how it's supposed to work... Before, how it was, is that it would deduct the tool after use, and if it didn't break, would give it back to the player on Edgar's next turn, and if it did break, would not give it back - you could see this happening in the inventory between the turn of Edgar using a tool, and his next turn. Oops, I messed up the BNE when I was updating the pointers, it's going to the wrong spot! I fixed it, and I'll edit it into the code block of the other post. RE: Breakable Tools - Need Help - PowerPanda - 07-06-2021 Thanks, C-Dude. In my quick test, this produced the same results. I wonder if the use of "Mimic" was resetting the counter somehow. Did you test without Mimic? I'll do further testing later on today, to make sure it wasn't something on my side. |