Final Fantasy - Kung Fu - Bug Fix - Version 0.8 (alpha) Archive Contents README.txt This File kung-fu.sav SRAM save file for testing kung-fu-bug-fix.s Fix Source Code kung-fu-bug-fix.o Fix Binary Object kung-fu-bug-fix-nes.ips Fix IPS Patch for ROMs with an iNES header kung-fu-bug-fix-raw.ips Fix IPS Patch for raw ROMs kung-fu-bug-raw.ips Bug IPS Patch for ROMs with an iNES header kung-fu-bug-raw.ips Bug IPS Patch for raw ROMs About The reason for this patch is pretty simple. In Final Fantasy, the Monk type classes (Black Belt and Master), have some special abilities. Firstly, when they are unarmed, their Damage is equal to Twice their Level. This differs from the other classes who's Damage is equal to half their Strength when unarmed. Secondly, when they are unarmored, their Absorb (aka Defense) is equal to their Level. Normal classes have an Absorb of zero when unarmored. These special cases are implemented in the game code in two places. The first is in the equipment subscreens. The second location is in the level up code. The equipment code works the way it's supposed to. However, the level up code does not. The bug is pretty simple. When a Monk type character levels up, the code checks if they are unarmed. If they are, it sets their Damage equal to their Level times two and their Absorb to their Level. This has two effects. The first is that characters who use a weapon, but no armor are denied their monk Absorb bonus. The other effect is that characters who fight hand to hand, but wear armor are given the bonus even when they shouldn't have it. Characters who wear armor and use weapons, and those that do neither, are handled correctly. (Although, it's pretty much a coincidence.) There is an easy workaround for this bug, simply going to the armor subscreen after your Monk(s) level up. You don't even have to do anything once you're there, simply opening and closing the screen will correct their stats. However, this shouldn't be necessary and can have negative effects on gameplay. For instance, if you are unaware of the bug, it can negatively effect your character's battle performance. Also, it can be exploited to gain special effects from armor (such as the Ribbon), while still gaining the Absorb bonus. The way the fix works is equally simple. It merely checks for equipped weapons before applying the Damage bonus. After that, it checks for equipped armor before applying the Absorb bonus. It's pretty basic. Installation To install the patch onto a Final Fantasy ROM image, use your favorite IPS patching utility. As alway, it's recommended that you back up your image first in case something goes horribly wrong. The *.ips patch is for ROM images with a sixteen byte iNES header. The *-raw.ips patch is for ROM images without a header. There is no patch for ROM images in UNIF format at this time. (My apologies.) For more information on other ways to apply the fix, see the Technical Details section below. Uninstallation If, for whatever reason, you decide that to remove the patch, a set of reverse patches has been provided for your convenience. Testing For ease of testing the effects of the bug and/or the fix, an SRAM save file has been provided. It has been modified to make the bug easy to reproduce. To perform the test, simply load the provided save game and select continue. The party consists of four Monk type characters, each with a different combination of armed and armored status. For ease of keeping track of who's who, they all have special names, the meaning of which should be obvious. Now, without changing their equipment, wander around until you hit a random encounter. Beat the monsters (it should be a cake walk) and your entire party will level up. This will trigger the bug in an unpatched version of Final Fantasy. After your party levels, go into the Status subscreen for each character and note what their Damage and Absorb values are. (The bug only effects the middle two characters and only effects Absorb, but this guide is for a thorough test.) Then go into the Armor subscreen and out again. Go back to the Status subscreen and you'll note that two of the characters have had their Absorb value change. (If you want to be really thorough, go to the Weapon subscreen and then check if Damage changed.) Once the patch has been applied, there should be no changes to any of the character's stats when performing this test. Be sure not to save the game when testing, or the test case SRAM will be overwritten. While this patch has been tested and found to work as described, it hasn't undergone extensive testing. It is unknown if it works on the Japanese version of Final Fantasy. It is also unknown if it works on real NES hardware as it's only been tested via emulation. However, there is no reason it shouldn't. (If you have a flash cart and are willing to test this patch on the bare metal, please email me your results at "levi at gis dot net".) For possible issues with compatibility with other FF hacks, see the Technical Details section below. Technical Details The source code of the modified function is provided with this archive. It is written in 6502 assembly and was written for and compiled with the p65 assembler. The code may require modification to work with other assemblers. Also provided is the raw object file produced by the assembler. It can be used with a hex editor to cut and paste the changes into a ROM image, if desired, rather than using the provided patches. The hack was created by disassembling the buggy code, writing a new version, reassembling the results, and pasting them into a ROM image with a hex editor. However, the resulting code was larger than the original, so additional space needed to be found somewhere in the ROM. While looking for blank space in the same bank (B) of the image (to avoid a messy bank switch), the first place I found was at the end of the graphics used by the bridge crossing scene. The last two tiles are blank and unused. So the function was split into two parts. The first was placed where original function was and the second was placed in the unused tiles of the BCS graphics. Nothing else was moved or altered by the patch. This means that the patch should be compatible with other hacks, as long as they don't alter the modified level up code, or the bridge crossing scene. If they do alter the graphics of that scene, then the patch may or may not work as desired, depending on whether the last two tile where utilized or not. If the space where the second piece of code was located is needed for another hack, any sufficiently large space in bank B can be used to hold the code. This will, of course, require modification of the first part of the code so that it jumps to the correct location. The second piece of code should work fine without modification. Change Log v 0.8 Initial public alpha release. Credits Final Fantasy is Copyright 1984 Square Enix. This modification was made by Levi Aho on Friday October 26th, 2007. The tools used where as follows: DCC6502 1.4 by Tennessee Carmel-Veilleux Hexedit 0.9.7 by Adam Rogoyski Romhack Edition by "Prez" P65-Ophis Assembler 0.7.2 by Michael Martin gedit 2.18.1 by The gedit Team Universal IPS by Neill Corlett FF Save Game Patcher by Levi "Karatorian" Aho Ispell 3.1.20 by Pace Willisson & Geoff Kuenning Special Thanx romhacking.net Utilities, community, inspiration "Disch" Save game hacking information, elite FF knowledge "Silver X" Encouragement, documentation Y Dienyddiwr Da FFBytes Portions of this code are Copyright Square Enix and are used without permission. All other contents Copyright 2007 Levi Aho. This code may be freely used. This is not the GNU GPL. If anything breaks, you get to keep the pieces. All documentation All Rights Reserved. It is requested (although not required) that if you use this hack in a larger project or similar compilation that I be notified, be sent a copy of the released hack (patch only please), and be given credit for my contribution. I can be reached at "levi at gis dot net". Hack and enjoy!