Well building new formulas isn't terrible difficult, and yes we can replace those blank formulas with new custom formulas. In terms of making what programs we use, I use Xifanie's Spreadsheet but we can just use a text editor like Notepad or Notepad++, FFTorgASM, and MassHexASM if you're not super familiar with excel or you don't have it. So first we need to a spot to place a this new hack. Allocated Space has sections of BATTLE.bin that are being used or planned on being used by ASMers. If you don't plan on using a hack from one of these hackers we can take spot from there or take a spot in the kanji space that isn't being used. We'll borrow the start of Sentinal Blade's section (0xEA0E4) for this example. We'll add 0x67000 to this offset so we can get its proper place in RAM or 0x801510E4 (see Offset Conversion).
Now that we have where the hack will go, we'll change the pointer found on the Formula Table. We'll change the pointer for Formula 18 at 0x0018F670 to E4101580. Remember we have to flip these bytes or you'll end up somewhere you don't want to be and just crash the game when you try to use an ability with this formula. As a note, we can move these pointers for formulas that we aren't going to use anyways and write new code; I'm just using formula 18 since you mentioned the blank ones but I could move the pointer to any of the others. Now, we might as well set up our new xml at this time too.
<?xml version="1.0" encoding="utf-8" ?> <Patches> <Patch name="Formula 18 Edit"> <Location file="BATTLE_BIN" offset="128670"> #Offset to table location; remember this is saving to the file and not RAM so we -0x67000 from the offset E4101580 #new pointer </Location> <Location file="BATTLE_BIN" offset="EA0E4"> #Offset to new formula routine
Now that we have all our set up done, let's take a look at how formulas are set up. We can look at vanilla formulas to see how they normally go through the modifier routines and all that. Formula 31 or Formula 08 are good examples to see how the game normally processes these. Typically they'll go Evasion Routines -> Set Base XA & YA -> XA Modifiers -> XA */+ YA -> Elemental Half, Resist, and Immunity -> Faith -> Elemental Absorb -> Status. You can also do stuff like putting the dragon check or steals equipment at the start of the routine. Here's a list of some commonly used routines or if you want to look at most of the routines in BATTLE.BIN check here.
01 80188510 Physical Evasion 02 801885b8 Magical Evasion 03 80185a9c Base Weapon XA & YA 04 80185c94 Store MA and Y 05 80185cc0 Base XA and YA for MA + Y / 2 06 80185d00 Store PA and PA + Y / 2 07 80185d40 Store MA and PA + Y / 2 08 80185d80 Store MA and X 09 80185dac Store PA and X 10 80185dd8 Store PA and WP 11 80185e04 Store PA and Y 12 80185e30 Store Speed and X 13 80185e5c Store PA and WP + Y 14 80185e94 Formula 64 or Jump Base XA / YA 15 80186568 XA * YA 16 8018659c XA + YA 17 80187510 Store Accuracy from XA + YA 18 80185f80 Charge Calculation 19 80185fa4 Weapon Elemental Boost 20 80185ffc Ability Elemental Boost 21 80184964 Compat 22 80186054 Attack Up/Two Hands/Martial Arts 23 8018614c Attack Up/Martial Arts 24 80186204 Magic Attack Up 25 80186254 Attacker Berserk/Frog Check 26 801862cc Defense Up 27 8018631c Magic Defense Up 28 8018636c Protect/Frog/Chicken/Sleeping/Charging 29 80186460 Shell/Frog/Chicken 30 801864f8 Critical Hit 31 80186ed0 Weather Effects 32 80186ff8 Elemental Effects (Oil, Float, Weak, etc) 33 801870fc Absorb Element 34 80187eb4 Status Roll 35 80187150 Faith Calculation 36 80187f24 Status Ability Inflict 37 8018acdc Cancel: Dead for Raise skills 38 80186624 Deal % (Y/100) HP Damage 39 80187350 Undead Reversal
Now lets make a simple PA * Y formula that uses Physical Evasion, Faith (?), and inflicts Status. Let's put in the basic frame work. You'll need this for most formulas and you shouldn't change it unless you know what you're doing.
addiu r29,r29,-0x0018 sw r31,0x0010(r29)
lw r31,0x0010(r29) addiu r29,r29,0x0018 jr r31 nop
Now let's add in physical evasion and a check to make sure the attack hit
addiu r29,r29,-0x0018 sw r31,0x0010(r29) jal 0x80188510 #Physical Evasion nop bne r2,r0,END #Jump to end if attack was evaded nop
END: lw r31,0x0010(r29) addiu r29,r29,0x0018 jr r31 nop
The END is a tag to let FFTorgASM and MassHexASM know where you want this branch to go. Alright, now we can follow the little outline and add in the rest of the functions I wanted to put in.
addiu r29,r29,-0x0018 sw r31,0x0010(r29) jal 0x80188510 #Physical Evasion nop bne r2,r0,END #Jump to end if attack was evaded nop jal 0x80185e04 #Get PA & Y nop jal 0x80186568 #XA * YA or in this case PA * Y nop jal 0x80187150 #Calculate Faith nop jal 0x80187eb4 #Status Roll nop END: lw r31,0x0010(r29) addiu r29,r29,0x0018 jr r31 nop
Hopefully you can follow exactly where I got these values off the list and why they are in the places that they are. We can compile this code in MassHexASM, take the hex values it outputs and add them to our xml but let's add in some other modifiers as well.
addiu r29,r29,-0x0018 sw r31,0x0010(r29) jal 0x80188510 #Physical Evasion nop bne r2,r0,END #Jump to end if attack was evaded nop jal 0x80185e04 #Get PA & Y nop jal 0x80185ffc #Ability Elemental Strengthen Routine (XA Modifier) nop jal 0x80186204 #Magic Attack Up (XA Modifier) nop jal 0x801862cc #Defense Up (XA Modifier) nop jal 0x80186568 #XA * YA or in this case PA * Y nop jal 0x80187150 #Calculate Faith nop jal 0x80187eb4 #Status Roll nop END: lw r31,0x0010(r29) addiu r29,r29,0x0018 jr r31 nop
Well it takes Magic Attack Up and Defense Up but that's fine, it'll just be some wacky physical/magical hybrid attack. But we added elemental strengthen but not half/resist/immunity/absorb, and that's cause we cant just link to the absorb routine, we need to set up a check specifically for the immunity part.
addiu r29,r29,-0x0018 sw r31,0x0010(r29) jal 0x80188510 #Physical Evasion nop bne r2,r0,END #Jump to end if attack was evaded nop jal 0x80185e04 #Get PA & Y nop jal 0x80185ffc #Ability Elemental Strenghten Routine nop jal 0x80186204 #Magic Attack Up nop jal 0x801862cc #Defense Up nop jal 0x80186568 #XA * YA or in this case PA * Y nop jal 0x80186ff8 #Elemental Half/Resist/Immunity nop lui r2,0x8019 lw r2,0x2d90(r2) #Load Defender's Data nop lbu r2,0x0000(r2) #Load byte that stores if the attack will hit nop beq r2,r0,END #Jump to end if attack was affected by Immunity nop jal 0x80187150 #Calculate Faith nop jal 0x801870fc #Elemental Absorb nop jal 0x80187eb4 #Status Roll nop END: lw r31,0x0010(r29) addiu r29,r29,0x0018 jr r31 nop
Okay now I'm happy with this code and we can put it into MassHexASM and get the output and place that into our xml and save that.
This would be good enough to change the formula entirely. For some of the stuff you want you would need to write new XA & YA storage routines, like in this example instead of jal 0x80185e04 you would do jal 0x80?????? to the new section where you write your code to store these values. Or you could write it inline with the rest of the code. Regardless I hope this information helps.
That error looks like your windows doesn't like it but I'm not computer savvy enough to know any sort of fix to this.
But you can still apply patches without FFTorgASM, if you have excel you can use Xifanie's Spreadsheet template to upload the .xml and it can apply the patches to the iso or savestate. Or the old fashion way with a hex editor and cdmage.