• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 27, 2024, 03:11:30 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen, RetroArch, and Duckstation are recommended for playing/testing, pSX is recommended for debugging.


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Grond

1
PSX FFT Hacking / Grond's ASM patches
April 18, 2023, 08:17:51 pm
My ASM patches. XMLs attached at bottom of post.
The 'Half of MP and Short Charge' xml is a couple of old patches, but now fixed up with AI functions.
The 'Random Battle Music' xml lets you choose which four songs you want to play during random battles.

-
ABILITY & STATUS

<Patch name="Enemies use different potions with Auto Potion depending on level">
<Description>This is actually based on the attacker's level, not the target's.
Variables: Hi = Starting Level for Hi-Potion use (default 15), X = Starting Level for X-Potion use (default 30)</Description>
<Location file="BATTLE_BIN" offset="117780">
BA018290 <!-- lbu r2,0x01ba(r4) -->
00000000
30004230 <!-- andi r2,r2,0x0030 -->
13004014 <!-- bne r2,r0,0x0017e7dc ;Branch if unit isn't on player's team -->
00000000
0680013C <!-- lui r1,0x8006 -->
D0972290 <!-- lbu r2,-0x6830(r1) ;Load Potion quantity -->
00000000
0C004014 <!-- bne r2,r0,0x0017e7d4 ;branch if potions are available -->
F0000234 <!-- ori r2,r0,0x00f0 ;Return 0xf0 (potion) -->
D1972290 <!-- lbu r2,-0x682f(r1) ;Load Hi potion quantity -->
00000000
03004010 <!-- beq r2,r0,0x0017e7c0 ;branch if hi potions quantity = 0 -->
00000000
F5F90508 <!-- j 0x0017e7d4 ;Jump to end -->
F1000234 <!-- ori r2,r0,0x00f1 ;Return 0xF1 (Hi Potion) -->
D2972390 <!-- lbu r3,-0x682e(r1);Load X potion quantity -->
00000000
02006014 <!-- bne r3,r0,0x0017e7d4 ;branch if X potions are available -->
F2000234 <!-- ori r2,r0,0x00f2 ;Return X potion -->
FFFF0224 <!-- addiu r2,r0,0xffff ;If no potions are available, return 0xffff -->
0800E003 <!-- jr r31 -->
00000000
00830508 <!-- j 0x00160c00 ;jump to new code -->
1980023C <!-- lui r2,0x8019 -->
</Location>
<Location file="BATTLE_BIN" offset="F9C00">
942D428C <!-- lw r2,0x2d94(r2) ;Load Attacker's Data Pointer -->
00000000
22004290 <!-- lbu r2,0x0022(r2) ;Load Level -->
00000000
</Location>
<Variable file="BATTLE_BIN" offset="F9C10" default="0F" name="Hi" />
<Location file="BATTLE_BIN" offset="F9C11">
  00432C <!-- sltiu r3,r2,0x000F ;set r3 to 1 if Level is < (15) -->
08006014 <!-- bne r3,r0,0x00160c38 ;branch to 'return potion exit' if r3 != 0 -->
00000000
</Location>
<Variable file="BATTLE_BIN" offset="F9C1C" default="1E" name="X" />
<Location file="BATTLE_BIN" offset="F9C1D">
  00432C <!-- sltiu r3,r2,0x001E ;set r3 to 1 if Level is < (30) -->
03006014 <!-- bne r3,r0,0x00160c30 ;branch to 'return hi-potion exit' if r3 != 0) -->
00000000
F5F90508 <!-- j 0x0017e7d4 ;exit while... -->
F2000234 <!-- ori r2,r0,0x00f2 ;Returning 0xf2 (X Potion) -->
F5F90508 <!-- j 0x0017e7d4 ;exit while... -->
F1000234 <!-- ori r2,r0,0x00f1 ;Returning 0xf1 (Hi Potion) -->
F5F90508 <!-- j 0x0017e7d4 ;exit while... -->
F0000234 <!-- ori r2,r0,0x00f0 ;Returning 0xf0 (Potion) -->
</Location>
</Patch>

<Patch name="Potions are X% stronger with Throw Item equipped (READ DESCRIPTION)">
<Description>! Note that with this patch, the base amount healed by Potions is no longer Z*10, just Z. So adjust values accordingly in FFTPatcher.</Description>
<Location file="BATTLE_BIN" offset="123278">
E0820508 <!-- j 0x00160b80 ;Jump to new code section -->
00000000
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;r3 = Current Attack Data Pointer -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9B80">
1980023C <!-- lui r2,0x8019 -->
942D428C <!-- lw r2,0x2d94(r2) ;r2 = Attacker's Current Data Pointer -->
00000000
91004290 <!-- lbu r2,0x0091(r2) ;r2 = 3rd Set of Supports -->
00000000
08004230 <!-- andi r2,r2,0x0008 ;Check for Throw Item -->
05004010 <!-- beq r2,r0,0x00160bb0 ;Branch ahead if no Throw Item -->
</Location>
<Variable file="BATTLE_BIN" offset="F9B9C" bytes="2" default="0600" name="X" >
<Preset name="100%" value="0800" />
<Preset name="85%" value="0767" />
<Preset name="80%" value="0734" />
<Preset name="75%" value="0700" />
<Preset name="70%" value="06CE" />
<Preset name="67%" value="06AF" />
<Preset name="60%" value="0668" />
<Preset name="55%" value="0634" />
<Preset name="50%" value="0600" />
<Preset name="45%" value="05CD" />
<Preset name="40%" value="059A" />
<Preset name="33%" value="0555" />
<Preset name="30%" value="0534" />
<Preset name="25%" value="0500" />
<Preset name="20%" value="04CD" />
<Preset name="15%" value="049A" />
<Preset name="12.5%" value="0480" />
<Preset name="10%" value="0467" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="F9B9E">
    0234 <!-- ori r2,r0,0x0600 ;r2 = Variable (X) [1536] -->
19004300 <!-- multu r2,r3 ;X*Z -->
12100000 <!-- mflo r2 ;r2 = X*Z -->
A0280608 <!-- j 0x0018a280 ;Jump back to original code -->
82120200 <!-- srl r2,r2,0x0a ;r2 = (X*Z)/1024 -->
A0280608 <!-- j 0x0018a280 ;Jump back to original code -->
21100300 <!-- addu r2,r0,r3 ;r2 = Z -->
</Location>
</Patch>

<Patch name="Ethers are X% stronger with Throw Item equipped (READ DESCRIPTION)">
<Description>! Note that with this patch, the base amount healed by Ethers is no longer Z*10, just Z. So adjust values accordingly in FFTPatcher.</Description>
<Location file="BATTLE_BIN" offset="1212B4">
F0820508 <!-- j 0x00160bc0 ;Jump to new code section -->
00000000
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9BC0">
1980023C <!-- lui r2,0x8019 -->
942D428C <!-- lw r2,0x2d94(r2) ;r2 = Attacker's Current Data Pointer -->
00000000
91004290 <!-- lbu r2,0x0091(r2) ;r2 = 3rd Set of Supports -->
00000000
08004230 <!-- andi r2,r2,0x0008 ;Check for Throw Item -->
05004010 <!-- beq r2,r0,0x00160bf0 ;Branch ahead if no Throw Item -->
</Location>
<Variable file="BATTLE_BIN" offset="F9BDC" bytes="2" default="0600" name="X" >
<Preset name="100%" value="0800" />
<Preset name="85%" value="0767" />
<Preset name="80%" value="0734" />
<Preset name="75%" value="0700" />
<Preset name="70%" value="06CE" />
<Preset name="67%" value="06AF" />
<Preset name="60%" value="0668" />
<Preset name="55%" value="0634" />
<Preset name="50%" value="0600" />
<Preset name="45%" value="05CD" />
<Preset name="40%" value="059A" />
<Preset name="33%" value="0555" />
<Preset name="30%" value="0534" />
<Preset name="25%" value="0500" />
<Preset name="20%" value="04CD" />
<Preset name="15%" value="049A" />
<Preset name="12.5%" value="0480" />
<Preset name="10%" value="0467" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="F9BDE">
    0234 <!-- ori r2,r0,0x0600 ;r2 = Variable (X) [1536] -->
19004300 <!-- multu r2,r3 ;X*Z -->
12100000 <!-- mflo r2 ;r2 = X*Z -->
B0200608 <!-- j 0x001882c0 :Jump back to original code -->
82120200 <!-- srl r2,r2,0x0a ;r2 = (X*Z)/1024 -->
B0200608 <!-- j 0x001882c0 :Jump back to original code -->
21100300 <!-- addu r2,r0,r3 ;r2 = Z -->
</Location>
</Patch>

<Patch name="Draw Out Katana break chance is halved">
<Description>! Use this if NOT using the below 'Draw Out doesn't break Katana while Maintenance is equipped' patch.</Description>
<Location file="BATTLE_BIN" offset="12097C">
64000434 <!-- ori r4,r0,0x0064 ;100 = Max Break % (moved) -->
</Location>
<Location file="BATTLE_BIN" offset="12098C">
42280500 <!-- srl r5,r5,0x01 ;r5 = WP (Break %) / 2 -->
</Location>
</Patch>

<Patch name="Draw Out doesn't break Katana while Maintenance is equipped">
<Description> </Description>
<Location file="BATTLE_BIN" offset="1156F4">
6B1E0608 <!-- j 0x001879ac ;Jump from Attack Preparation (Katana Inventory) -->
91006292 <!-- lbu r2,0x0091(r19) ;r2 = 3rd set of Supports -->
</Location>
<Location file="BATTLE_BIN" offset="120910">
1980013C <!-- lui r1,0x8019 -->
8C2D268C <!-- lw r6,0x2d8c(r1) ;r6 = Attacker's Current Action Data Pointer -->
942D278C <!-- lw r7,0x2d94(r1) ;r7 = Attacker's Data Pointer -->
E8FFBD27 <!-- addiu r29,r29,0xffe8 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
0300E390 <!-- lbu r3,0x0003(r7) ;r3 = Attacker's Job -->
5D000234 <!-- ori r2,r0,0x005d ;r2 = 5d (Mime) -->
18006210 <!-- beq r3,r2,0x00187990 ;Branch to end if Attacker is a Mime -->
9100E390 <!-- lbu r3,0x0091(r7) ;r3 = 3rd set of Supports -->
00000000
04006330 <!-- andi r3,r3,0x0004 ;Check for Maintenance -->
18006014 <!-- bne r3,r0,0x001879a0 ;Branch to 'do nothing & exit' if has Maintenance -->
01000234 <!-- ori r2,r0,0x0001 ;r2 = 1 (Hit flag) -->
0000C2A0 <!-- sb r2,0x0000(r6) ;18c Store Hit -->
7601E390 <!-- lbu r3,0x0176(r7) ;r3 = Used Item/Equip Id -->
08000234 <!-- ori r2,r0,0x0008 ;r2 = 8 ('Put Katana Back' flag?) -->
0300C3A0 <!-- sb r3,0x0003(r6) ;18f Store Item Removed?/Returned? -->
0200C2A0 <!-- sb r2,0x0002(r6) ;18e Miss Type? = Put Katana Back? -->
FCF5228C <!-- lw r2,-0x0a04(r1) ;r2 = Damage Display? Action State? -->
00000000
09004014 <!-- bne r2,r0,0x00187988 ;Branch if ??? != 0 (removes katana?) -->
00000000
02392590 <!-- lbu r5,0x3902(r1) ;r5 = Weapon Power -->
3378010C <!-- jal 0x0005e0cc ;Random -->
64000434 <!-- ori r4,r0,0x0064 ;r4 = 100 (chance to NOT break equals 100 - WP) -->
04004010 <!-- beq r2,r0,0x00187988 ;Branch if Katana Removed? -->
00000000
08000234 <!-- ori r2,r0,0x0008 ;r2 = 8 ('Put Katana Back' flag?) -->
641E0608 <!-- j 0x00187990 ;Jump to end if Katana Put Back? -->
1000C2A4 <!-- sh r2,0x0010(r6) ;(19c = 8 store Katana Put Back?) -->
00100234 <!-- ori r2,r0,0x1000 ;('Remove Katana' flag?) -->
1000C2A4 <!-- sh r2,0x0010(r6) ;(19c = 1000 store Remove Katana?) -->
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
641E0608 <!-- j 0x00187990 ;Jump to exit -->
1000C0A4 <!-- sh r0,0x0010(r6) ;Store Katana neither removed nor put back -->
00000000 <!-- ↓Attack Preparation part↓ -->
04004230 <!-- andi r2,r2,0x0004 ;Check for Maintenance -->
02004014 <!-- bne r2,r0,0x001879bc ;Branch over Decrem. Item if has Maintenance-->
00000000
55F2050C <!-- jal 0x0017c954 ;Decrement Item Quantity -->
01000634 <!-- ori r6,r0,0x0001 -->
FFF10508 <!-- j 0x0017c7fc ;Jump back to Attack Preparation -->
00000000
</Location>
</Patch>

<Patch name="Draw Out Katana break chance is halved, for 'Draw Out/Maintenance' patch">
<Description>! Use only if using the above 'Draw Out doesn't break Katana while Maintenance is equipped' patch.</Description>
<Location file="BATTLE_BIN" offset="120964">
64000434 <!-- ori r4,r0,0x0064 ;100 = Max Break % (moved) -->
</Location>
<Location file="BATTLE_BIN" offset="120970">
42280500 <!-- srl r5,r5,0x01 ;r5 = WP (Break %) / 2 -->
</Location>
</Patch>

<Patch name="Spears increase PA when using Jump by X%">
<Description> </Description>
<Variable file="BATTLE_BIN" offset="11EED8" bytes="2" default="0556" name="X">
<Preset name="100%" value="0800" />
<Preset name="85%" value="0767" />
<Preset name="80%" value="0734" />
<Preset name="75%" value="0700" />
<Preset name="70%" value="06CE" />
<Preset name="67%" value="06AF" />
<Preset name="60%" value="0668" />
<Preset name="55% (↑stronger)" value="0634" />
<Preset name="50% (base game)" value="0600" />
<Preset name="45% (↓weaker)" value="05CD" />
<Preset name="40%" value="059A" />
<Preset name="33%" value="0556" />
<Preset name="30%" value="0534" />
<Preset name="25%" value="0500" />
<Preset name="20%" value="04CD" />
<Preset name="15%" value="049A" />
<Preset name="12.5%" value="0480" />
<Preset name="10%" value="0467" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="11EEDA">
    0134 <!-- ori r1,r0,0x0556 ;Variable X -->
19002300 <!-- multu r1,r3 ;X*PA -->
12080000 <!-- mflo r1 -->
BF170608 <!-- j 0x00185efc ;Jump to XA storing -->
82120100 <!-- srl r2,r1,0x0a ;r2 = (X*PA)/1024 -->
</Location>
</Patch>

<Patch name="Skillset ID for 'Remove transparent status if Jump is used'">
<Description>You might need this if you changed 12 Jump into a normal skillset, but are keeping the original Jump function playable. By default the check is changed to 34 (Izlude's Jump).</Description>
<Variable file="BATTLE_BIN" offset="123C88" default="34" name="ID" />
</Patch>

<Patch name="Haste status increases effective speed by X%">
<Description> </Description>
<Location file="BATTLE_BIN" offset="11B9F4">
FFFF8430 <!-- andi r4,r4,0xffff -->
64820508 <!-- j 0x00160990  ;Jump to new code section -->
</Location>
<Variable file="BATTLE_BIN" offset="11B9FC" bytes="2" default="0556" name="X" >
<Preset name="100%" value="0800" />
<Preset name="85%" value="0767" />
<Preset name="80%" value="0734" />
<Preset name="75%" value="0700" />
<Preset name="70%" value="06CE" />
<Preset name="67%" value="06AF" />
<Preset name="60%" value="0668" />
<Preset name="55% (↑faster)" value="0634" />
<Preset name="50% (base game)" value="0600" />
<Preset name="45% (↓slower)" value="05CD" />
<Preset name="40%" value="059A" />
<Preset name="33%" value="0556" />
<Preset name="30%" value="0534" />
<Preset name="25%" value="0500" />
<Preset name="20%" value="04CD" />
<Preset name="15%" value="049A" />
<Preset name="12.5%" value="0480" />
<Preset name="10%" value="0467" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="11B9FE">
    0134 <!-- ori r1,r0,0x0556 ;r1 = Variable (X) -->
</Location>
<Location file="BATTLE_BIN" offset="F9990">
19002400 <!-- multu r1,r4 ;X*SP -->
12080000 <!-- mflo r1 ;r1 = X*SP -->
800A0608 <!-- j 0x00182a00 ;Jump back to original code -->
82220100 <!-- srl r4,r1,0x0a ;r4 = (X*SP)/1024 -->
</Location>
</Patch>

<Patch name="Slow status sets effective speed to X%">
<Description> </Description>
<Location file="BATTLE_BIN" offset="11B9E8">
64820508 <!-- j 0x00160990  ;Jump to new code section -->
</Location>
<Variable file="BATTLE_BIN" offset="11B9EC" bytes="2" default="02AF" name="X" >
<Preset name="85%" value="0367" />
<Preset name="80%" value="0334" />
<Preset name="75%" value="0300" />
<Preset name="70%" value="02CE" />
<Preset name="67%" value="02AF" />
<Preset name="60%" value="0268" />
<Preset name="55% (↑faster)" value="0234" />
<Preset name="50% (base game)" value="0200" />
<Preset name="45% (↓slower)" value="01CD" />
<Preset name="40%" value="019A" />
<Preset name="33%" value="0156" />
<Preset name="30%" value="0134" />
<Preset name="25%" value="0100" />
<Preset name="20%" value="00CD" />
<Preset name="15%" value="009A" />
<Preset name="12.5%" value="0080" />
<Preset name="10%" value="0067" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="11B9EE">
    0134 <!-- ori r1,r0,0x02af ;r1 = Variable (X) -->
</Location>
<Location file="BATTLE_BIN" offset="F9990">
19002400 <!-- multu r1,r4 ;X*SP -->
12080000 <!-- mflo r1 ;r1 = X*SP -->
800A0608 <!-- j 0x00182a00 ;Jump back to original code -->
82220100 <!-- srl r4,r1,0x0a ;r4 = (X*SP)/1024 -->
</Location>
</Patch>

<Patch name="Poison damages by X%, Regen heals by Y%">
<Description> </Description>
<Location file="BATTLE_BIN" offset="1267F0">
1980053C <!-- lui r5,0x8019 -->
902DA58C <!-- lw r5,0x2d90(r5) ;r5 = Current Action Data Pointer -->
80006230 <!-- andi r2,r3,0x0080 ;Check for Poison -->
09004010 <!-- beq r2,r0,0x0018d824 ;Branch if no Poison -->
</Location>
<Variable file="BATTLE_BIN" offset="126800" bytes="2" default="00CD" name="X (Poison damage %)" >
<Preset name="50%" value="0200" />
<Preset name="45%" value="01CD" />
<Preset name="40%" value="019A" />
<Preset name="34%" value="015D" />
<Preset name="30%" value="0134" />
<Preset name="25%" value="0100" />
<Preset name="20%" value="00CD" />
<Preset name="15%" value="009A" />
<Preset name="12.5% (base game)" value="0080" />
<Preset name="10%" value="0067" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="126802">
    0634 <!-- ori r6,r0,0x00cd ;r6 = Variable X -->
2A000296 <!-- lhu r2,0x002a(r16) ;r2 = MaxHP -->
00000000
19004600 <!-- multu r2,r6 ;MaxHP*X -->
12300000 <!-- mflo r6 ;r6 = MaxHP*X -->
82120600 <!-- srl r2,r6,0x0a ;r2 = (MaxHP*X)/1024 -->
0400A2A4 <!-- sh r2,0x0004(r5) ;Store HP Damage -->
13360608 <!-- j 0x0018d84c ;Jump to Store Attack Type & Exit -->
80000634 <!-- ori r6,r0,0x0080 ;r6 = HP Damage flag -->
40006230 <!-- andi r2,r3,0x0040 ;Check for Regen -->
09004010 <!-- beq r2,r0,0x0018d850 ;Branch if no Regen -->
</Location>
<Variable file="BATTLE_BIN" offset="12682C" bytes="2" default="00CD" name="Y (Regen healing %)" >
<Preset name="50%" value="0200" />
<Preset name="45%" value="01CD" />
<Preset name="40%" value="019A" />
<Preset name="34%" value="015D" />
<Preset name="30%" value="0134" />
<Preset name="25%" value="0100" />
<Preset name="20%" value="00CD" />
<Preset name="15%" value="009A" />
<Preset name="12.5% (base game)" value="0080" />
<Preset name="10%" value="0067" />
<Preset name="Custom (Y/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="12682E">
    0634 <!-- ori r6,r0,0x00cd ;r6 = Variable Y -->
2A000296 <!-- lhu r2,0x002a(r16) ;r2 = MaxHP -->
00000000
19004600 <!-- multu r2,r6 ;MaxHP*Y -->
12300000 <!-- mflo r6 ;r6 = MaxHP*Y -->
82120600 <!-- srl r2,r6,0x0a ;r2 = (MaxHP*Y)/1024 -->
0600A2A4 <!-- sh r2,0x0006(r5) ;Store HP Healing -->
40000634 <!-- ori r6,r0,0x0040 ;r6 = HP Healing flag -->
2500A6A0 <!-- sb r6,0x0025(r5) ;Store Attack Type -->
2500A290 <!-- lbu r2,0x0025(r5) ;r2 = Attack Type -->
</Location>
</Patch>

<Patch name="Defending status reduces damage by X%">
<Description>Does not alter the evade%-doubling functionality of Defending.</Description>
<Location file="BATTLE_BIN" offset="11F458">
68820508 <!-- j 0x001609a0 ;Jump from Target XA affecting Statuses (Physical) -->
</Location>
<Location file="BATTLE_BIN" offset="11F4F0">
68820508 <!-- j 0x001609a0 ;Jump from Target's Status Affecting XA (Magical) -->
</Location>
<Location file="BATTLE_BIN" offset="F99A0">
1980043C <!-- lui r4,0x8019 ;r4 = 80190000 -->
982D828C <!-- lw r2,0x2d98(r4) ;r2 = Target Current Data Pointer -->
00000000
58004290 <!-- lbu r2,0x0058(r2) ;r2 = 1st Set of Statuses -->
00000000
02004230 <!-- andi r2,r2,0x0002 ;Check for Defending -->
07004010 <!-- beq r2,r0,1609d8 ;Branch to end if not Defending -->
00000000
CE388384 <!-- lh r3,0x38ce(r4) ;r3 = XA -->
</Location>
<Variable file="BATTLE_BIN" offset="F99C4" bytes="2" default="0200" name="X" >
<Preset name="10%" value="039A" />
<Preset name="15%" value="0368" />
<Preset name="20%" value="0334" />
<Preset name="25%" value="0300" />
<Preset name="30%" value="02CE" />
<Preset name="34%" value="02AA" />
<Preset name="40%" value="0268" />
<Preset name="45%" value="0234" />
<Preset name="50%" value="0200" />
<Preset name="55%" value="01CD" />
<Preset name="60%" value="019A" />
<Preset name="66%" value="015D" />
<Preset name="70%" value="0134" />
<Preset name="75%" value="0100" />
<Preset name="80%" value="00CE" />
<Preset name="85%" value="009A" />
<Preset name="90%" value="0067" />
<Preset name="99%" value="0001" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="F99C6">
    0234 <!-- ori r2,r0,0x0040 ;r2 = Variable X -->
19004300 <!-- multu r2,r3 ;XA*X -->
12100000 <!-- mflo r2 ;r2 = XA*X -->
82120200 <!-- srl r2,r2,0x0a ;r2 = (XA*X)/1024 -->
CE3882A4 <!-- sh r2,0x38ce(r4) ;Store new XA -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Defending status no longer doubles evade%">
<Description>The effect is simply moved to Transparent status.</Description>
<Location file="BATTLE_BIN" offset="11E47C">
5A004290
00000000
10004230
</Location>
</Patch>

<Patch name="Attack damage with Two Swords equipped is X% of normal">
<Description>Edit of '2 Swords Penalty' by Emmy. Affects all attacks that refer to the Charge calculation (by default the 'weapon' formulas 01-07). Does not care whether you actually have two weapons equipped, only that the Two Swords support is equipped/innate.</Description>
<Location file="BATTLE_BIN" offset="11EF80">
78820508 <!-- j 0x001609e0 ;Jump from Charge Calculation -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F99E0">
1980013C <!-- lui r1,0x8019 -->
CE382394 <!-- lhu r3,0x38ce(r1) ;r3 = XA -->
E4382490 <!-- lbu r4,0x38e4(r1) ;r4 = Charge's Power -->
942D228C <!-- lw r2,0x2d94(r1) ;r2 = Attacker's Data Pointer -->
21186400 <!-- addu r3,r3,r4 ;r3 = XA + Charge's Power -->
91004290 <!-- lbu r2,0x0091(r2) ;r2 = 3rd Set of Supports -->
CE3823A4 <!-- sh r3,0x38ce(r1) ;Store New XA = XA + Charge's Power -->
01004230 <!-- andi r2,r2,0x0001 ;Check for Two Swords -->
04004010 <!-- beq r2,r0,0x00160a14 ;Branch to end if no Two Swords -->
</Location>
<Variable file="BATTLE_BIN" offset="F9A04" bytes="2" default="0334" name="X" >
<Preset name="90%" value="039A" />
<Preset name="85%" value="0367" />
<Preset name="80%" value="0334" />
<Preset name="75%" value="0300" />
<Preset name="70%" value="02CE" />
<Preset name="66%" value="02AA" />
<Preset name="60%" value="0268" />
<Preset name="55%" value="0234" />
<Preset name="50%" value="0200" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="F9A06">
    0434 <!-- ori r4,r0,0x0334 ;r4 = Variable (X) [820] -->
19008300 <!-- multu r4,r3 ;X*XA -->
12200000 <!-- mflo r4 ;r4 = X*XA -->
821A0400 <!-- srl r3,r4,0x0a ;r3 = (X*XA)/1024 -->
0800E003 <!-- jr r31 -->
CE3823A4 <!-- sh r3,0x38ce(r1) ;Store New XA -->
</Location>
</Patch>

<Patch name="Blade Grasp doesn't trigger on ranged weapon attacks">
<Description>Blade Grasp doesn't work against Gun, Crossbow, Bow, Instrument, and Book (and bare hands). Throw is still graspable.</Description>
<Location file="BATTLE_BIN" offset="126068">
88820508 <!-- j 0x00160a20 ;Jump from Blade Grasp Usability -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9A20">
1980023C <!-- lui r2,0x8019 -->
D8384290 <!-- lbu r2,0x38d8(r2) ;Load Used Weapon ID -->
0680013C <!-- lui r1,0x8006 -->
40180200 <!-- sll r3,r2,0x01 ;ID * 2 -->
21186200 <!-- addu r3,r3,r2 ;ID * 3 -->
80180300 <!-- sll r3,r3,0x02 ;ID * 12 -->
21082300 <!-- addu r1,r1,r3 ;80060000 + ID * 12 -->
BD2E2290 <!-- lbu r2,0x2ebd(r1) ;Load Used Weapon Item Type -->
00000000
08004010 <!-- beq r2,r0,0x00160a68 ;Branch to end if empty-handed (to Grasp punches, change this line to 00000000) -->
F6FF4224 <!-- addiu r2,r2,-0x000a ;Weapon Item Type - 10 (Gun) -->
0500422C <!-- sltiu r2,r2,0x0005 ;Check 5 item types (Guns through Books) -->
05004014 <!-- bne r2,r0,0x00160a68 ;Branch to end if weapon is ranged type -->
64000234 <!-- ori r2,r0,0x0064 ;R2 = 0x64 (or 100) -->
1980043C <!-- lui r4,0x8019 -->
982D848C <!-- lw r4,0x2d98(r4) ;Load Defender's Stats -->
1C340608 <!-- j 0x0018d070 ;Jump back into original Blade Grasp function -->
00000000
36340608 <!-- j 0x0018d0d8 ;Jump to exit -->
00000000
</Location>
</Patch>

<Patch name="Blade Grasp only triggers on blade attacks">
<Description>Blade Grasp only works against Knife, Ninja Blade, Sword, Knight Sword, and Katana. Throw is still graspable.</Description>
<Location file="BATTLE_BIN" offset="126068">
88820508 <!-- j 0x00160a20 ;Jump from Blade Grasp Usability -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9A20">
1980023C <!-- lui r2,0x8019 -->
D8384290 <!-- lbu r2,0x38d8(r2) ;Load Used Weapon ID -->
0680013C <!-- lui r1,0x8006 -->
40180200 <!-- sll r3,r2,0x01 ;ID * 2 -->
21186200 <!-- addu r3,r3,r2 ;ID * 3 -->
80180300 <!-- sll r3,r3,0x02 ;ID * 12 -->
21082300 <!-- addu r1,r1,r3 ;80060000 + ID * 12 -->
BD2E2290 <!-- lbu r2,0x2ebd(r1) ;Load Used Weapon Item Type -->
00000000
08004010 <!-- beq r2,r0,0x00160a68 ;Branch to end if empty-handed (to Grasp punches, change this line to 00000000) -->
FAFF4224 <!-- addiu r2,r2,-0x0006 ;Weapon Item Type - 6 (Axe) -->
0D00422C <!-- sltiu r2,r2,0x000d ;Check 13 item types (Axes to Cloths) -->
05004014 <!-- bne r2,r0,0x00160a68 ;Branch to end if weapon is not blade -->
64000234 <!-- ori r2,r0,0x0064 ;r2 = 0x64 (or 100) -->
1980043C <!-- lui r4,0x8019 -->
982D848C <!-- lw r4,0x2d98(r4) ;Load Defender's Stats -->
1C340608 <!-- j 0x0018d070 ;Jump back into original Blade Grasp function -->
00000000
36340608 <!-- j 0x0018d0d8 ;Jump to exit -->
00000000
</Location>
</Patch>

<Patch name="Damage Split no longer recovers HP; only redirects half of damage">
<Description> </Description>
<Location file="BATTLE_BIN" offset="1241E4">
00000000
00000000
00000000
</Location>
</Patch>

FORMULAS

<Patch name="Swordskill formulas (2D, 2E, 2F, 30) check magical evade instead of physical">
<Description>This covers all base game Holy Sword, Mighty Sword, and Dark Sword skills.
Does nothing unless 'Evadable' is flagged properly in FFTPatcher.</Description>
<Location file="BATTLE_BIN" offset="122B28">
6E
</Location>
<Location file="BATTLE_BIN" offset="122B9C">
6E
</Location>
<Location file="BATTLE_BIN" offset="122C58">
6E
</Location>
<Location file="BATTLE_BIN" offset="122C98">
6E
</Location>
</Patch>

<Patch name="Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine">
<Description>! Note that this has no effect by itself - you also need one or more of the swordskill formula edits below!
This allows negative Y values. 255 = -1, 254 = -2, etc. Watch out for underflow with low WP weapons like Nagrarok, and don't use negative Y on abilities unless they require a weapon (bare hands = 0 WP).</Description>
<Location file="BATTLE_BIN" offset="F9440">
1980013C <!-- lui r1,0x8019 -->
942D248C <!-- lw r4,0x2d94(r1) ;r4 = Attacker's Data Pointer -->
02392290 <!-- lbu r2,0x3902(r1) ;r2 = Weapon Power -->
FA382380 <!-- lb r3,0x38fa(r1) ;r3 = Ability Y -->
37008590 <!-- lbu r5,0x0037(r4) ;r5 = Attacker's MA -->
36008490 <!-- lbu r4,0x0036(r4) ;r4 = Attacker's PA -->
21104300 <!-- addu r2,r2,r3 ;r2 = WP + Y -->
D03822A4 <!-- sh r2,0x38d0(r1) ;Store WP + Y as YA -->
21208500 <!-- addu r4,r4,r5 ;r4 = PA + MA -->
42200400 <!-- srl r4,r4,0x01 ;r4 = (PA + MA) / 2 -->
CE3824A4 <!-- sh r4,0x38ce(r1) ;Store (PA + MA) / 2 as XA -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 2D (Holy Sword) damage becomes ((PA+MA)/2)*(WP+Y)">
<Description>! Requires 'Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine'!</Description>
<Location file="BATTLE_BIN" offset="122B38">
1081050C
</Location>
</Patch>

<Patch name="Formula 2E (Mighty Sword) damage becomes ((PA+MA)/2)*(WP+Y)">
<Description>! Requires 'Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine'!</Description>
<Location file="BATTLE_BIN" offset="122BFC">
1081050C
</Location>
</Patch>

<Patch name="Formula 2E (Mighty Sword) has X% chance to break equipment">
<Description>Also gets PA*(WP+Y) and 100% status like the base game Holy Sword skills.
! The 0-100% chance to break equipment must be set under X for each ability in FFTPatcher, or nothing will ever break.
! This patch does not affect the hardcoding of formula 2E's equipment breaking to ability slots A0-A3. The formula can be used in other slots without equipment breaking, however.
This is an edit/fix of Choto's Mighty Sword Hack. From his description of it: "This makes it so that the mighty swordskills have a % chance to break equipment, but always function as normal damage swordskills. Maintenance prevents item breakage, but not damage. (...) I also (...) divided the damage by 2 to prevent roflstomping." </Description>
<Location file="BATTLE_BIN" offset="122B94">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
1980023C <!-- lui r2,0x8019 -->
982D428C <!-- lw r2,0x2d98(r2) ;Load Target Data Pointer -->
00000000
91004290 <!-- lbu r2,0x0091(r2) ;Load Target's 3rd set of Supports -->
1980053C <!-- lui r5,0x8019 ;Prepare to load Ability X -->
04004230 <!-- andi r2,r2,0x0004 ;Check Maintenance -->
0C004014 <!-- bne r2,r0,0x00189be8 ;Branch if has Maintenance -->
64000434 <!-- ori r4,r0,0x0064 ;Max break % -->
B63B060C <!-- jal 0x0018eed8 ;Random Process -->
F938A590 <!-- lbu r5,0x38f9(r5) ;Load Ability X -->
08004014 <!-- bne r2,r0,0x00189be8 ;Branch if roll to break fails -->
00000000
721E060C <!-- jal 0x001879c8 ;Steal/Break/Might Sword Hard Coding -->
00000000
04004014 <!-- bne r2,r0,0x00189be8 ;Branch if nothing to break -->
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;Load Action Data Pointer -->
04000234 <!-- ori r2,r0,0x0004 ;Equipment broken flag -->
100062A4 <!-- sh r2,0x0010(r3) ;Store special flag - break item -->
4421060C <!-- jal 0x001885b8 ;Physical Evade Calculation -->
00000000
15004014 <!-- bne r2,r0,0x00189c48 ;Branch to end if evaded -->
00000000
9717060C <!-- jal 0x00185e5c ;Store PA and WP + Y -->
00000000
E917060C <!-- jal 0x00185fa4 ;Weapon Element Strengthen -->
00000000
A921060C <!-- jal 0x001886a4 ;Damage Calculation -->
00000000
F41B060C <!-- jal 0x00186fd0 ;Elemental Damage Modification (Prep) -->
00000000
1980043C <!-- lui r4,0x8019 -->
902D848C <!-- lw r4,0x2d90(r4) ;Load Action Data Pointer -->
00000000
00008290 <!-- lbu r2,0x0000(r4) ;Load Hit Flag -->
00000000
06004010 <!-- beq r2,r0,0x00189c48 ;Branch to end if element nulled -->
00000000
04008394 <!-- lhu r3,0x0004(r4) ;Load damage -->
00000000
42180300 <!-- srl r3,r3,0x01 ;Halve damage -->
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
040083A4 <!-- sh r3,0x0004(r4) ;Store new damage -->
DF260608 <!-- j 0x00189b7c ;Jump to formula 2D's status + exit -->
00000000
</Location>
</Patch>

<Patch name="'Formula 2E has X% chance to break equipment' checks magical evade instead of physical">
<Description>Does nothing unless 'Evadable' is flagged properly in FFTPatcher.
This is only for the above 'Formula 2E has X% chance to break equipment' patch.</Description>
<Location file="BATTLE_BIN" offset="122BE8">
6E
</Location>
</Patch>

<Patch name="'Formula 2E has X% chance to break equipment' damage becomes ((PA+MA)/2)*(WP+Y)">
<Description>! Requires 'Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine'!
This is only for the above 'Formula 2E has X% chance to break equipment' patch.</Description>
<Location file="BATTLE_BIN" offset="122BF8">
1081050C
</Location>
</Patch>

<Patch name="'Formula 2E has X% chance to break equipment' damage halving removed">
<Description>This is only for the above 'Formula 2E has X% chance to break equipment' patch.</Description>
<Location file="BATTLE_BIN" offset="122C3C">
00000000
</Location>
</Patch>

<Patch name="Formula 2F (Dark Sword) works like 2D plus MP absorb">
<Description>Makes 2F a clone of 2D plus MP absorption, including WP+Y, weapon elemental (except elemental absorption does 0 damage) and 100% status inflicting.</Description>
<Location file="BATTLE_BIN" offset="122C60">
09004014 <!-- bne r2,r0,0x00189c88 ;Branch to end if evaded -->
00000000
9717060C <!-- jal 0x00185e5c ;Load WP + Y as Y -->
00000000
E917060C <!-- jal 0x00185fa4 ;Element Strengthen Calculation -->
00000000
A921060C <!-- jal 0x001886a4 ;Physical Damage Calculation -->
00000000
20810508 <!-- j 0x00160480 -->
00000000
2F810508 <!-- j 0x001604bc -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9480">
F41B060C <!-- jal 0x00186fd0 ;Elemental Damage Modification (Prep) -->
00000000
1980023C <!-- lui r2,0x8019 -->
902D428C <!-- lw r2,0x2d90(r2) ;Target Current Action Data pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Hit Flag -->
00000000
07004010 <!-- beq r2,r0,0x001604bc ;Branch to end if nulled -->
00000000
3F1C060C <!-- jal 0x 001870fc ;Elemental Absorption -->
00000000
1B1D060C <!-- jal 0x0018746c ;MP Absorb -->
00000000
AD1F060C <!-- jal 0x00187eb4 ;Status Proc -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 2F (Dark Sword) damage becomes ((PA+MA)/2)*(WP+Y)">
<Description>! Requires 'Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine'!</Description>
<Location file="BATTLE_BIN" offset="122C68">
1081050C
</Location>
</Patch>

<Patch name="Formula 30 (Night Sword) works like 2D plus HP absorb">
<Description>Makes 30 a clone of 2D plus HP absorption, including WP+Y, weapon elemental (except elemental absorption does 0 damage) and 100% status inflicting.</Description>
<Location file="BATTLE_BIN" offset="122CA0">
09004014 <!-- bne r2,r0,0x00189cc8 ;Branch to end if evaded -->
00000000
9717060C <!-- jal 0x00185e5c ;Load WP + Y as Y -->
00000000
E917060C <!-- jal 0x00185fa4 ;Element Strengthen Calculation -->
00000000
A921060C <!-- jal 0x001886a4 ;Physical Damage Calculation -->
00000000
34810508 <!-- j 0x001604d0 -->
00000000
43810508 <!-- j 0x0016050c -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F94D0">
F41B060C <!-- jal 0x00186fd0 ;Elemental Damage Modification (Prep) -->
00000000
1980023C <!-- lui r2,0x8019 -->
902D428C <!-- lw r2,0x2d90(r2) ;Target Current Action Data pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Hit Flag -->
00000000
07004010 <!-- beq r2,r0,0x0016050c ;Branch to end if nulled -->
00000000
3F1C060C <!-- jal 0x 001870fc ;Elemental Absorption -->
00000000
921C060C <!-- jal 0x00187248 ;HP Absorb -->
00000000
AD1F060C <!-- jal 0x00187eb4 ;Status Proc -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 30 (Night Sword) damage becomes ((PA+MA)/2)*(WP+Y)">
<Description>! Requires 'Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine'!</Description>
<Location file="BATTLE_BIN" offset="122CA8">
1081050C
</Location>
</Patch>

<Patch name="Abilities 8F,90,91,C5,C6,C7 (stat breaks/ruins) reduce stat by X% as set in FFTPatcher">
<Description> </Description>
<Location file="BATTLE_BIN" offset="120860">
1980013C <!-- lui r1,0x8019 -->
D6382394 <!-- lhu r3,0x38d6(r1) ;Used Ability ID -->
90000234 <!-- ori r2,r0,0x0090 ;Power Break ID -->
03006210 <!-- beq r3,r2,0x0018787c ;Branch if used ability is 'Power Break' -->
C6000234 <!-- ori r2,r0,0x00c6 ;Power Ruin ID -->
08006214 <!-- bne r3,r2,0x00187898 ;Branch if used ability is not 'Power Ruin' -->
91000234 <!-- ori r2,r0,0x0091 ;Mind Break ID -->
982D228C <!-- lw r2,0x2d98(r1) ;Load Target's Data Pointer -->
00000000
36004390 <!-- lbu r3,0x0036(r2) ;Load Target's PA -->
00000000
F9382290 <!-- lbu r2,0x38f9(r1) ;Load Ability X -->
48810508 <!-- j 0x00160520 ;Jump to new code 1 -->
FFFF6324 <!-- addiu r3,r3,0xffff ;Target's PA -1 -->
03006210 <!-- beq r3,r2,0x001878a8 ;Branch if used ability is 'Mind Break' -->
C7000234 <!-- ori r2,r0,0x00c7 ;Mind Ruin ID -->
08006214 <!-- bne r3,r2,0x001878c4 ;Branch if used ability is not 'Mind Ruin' -->
8F000234 <!-- ori r2,r0,0x008f ;Speed Break ID -->
982D228C <!-- lw r2,0x2d98(r1) ;Load Target's Data Pointer -->
00000000
37004390 <!-- lbu r3,0x0037(r2) ;Load Target's MA -->
00000000
F9382290 <!-- lbu r2,0x38f9(r1) ;Load Ability X -->
5C810508 <!-- j 0x00160570 ;Jump to new code 2 -->
FFFF6324 <!-- addiu r3,r3,0xffff ;Target's MA -1 -->
02006210 <!-- beq r3,r2,0x001878d0 ;Branch if used ability is 'Speed Break' -->
C5000234 <!-- ori r2,r0,0x00c5 ;Speed Ruin ID -->
0E006214 <!-- bne r3,r2,0x00187908 ;Branch if used ability is not 'Speed Ruin' -->
982D228C <!-- lw r2,0x2d98(r1) ;Load Target's Data Pointer -->
00000000
38004390 <!-- lbu r3,0x0038(r2) ;Load Target's SP -->
00000000
F9382290 <!-- lbu r2,0x38f9(r1) ;Load Ability X -->
FFFF6324 <!-- addiu r3,r3,0xffff ;Target's SP -1 -->
19006200 <!-- multu r3,r2 ;Target's SP * X -->
EB51033C <!-- lui r3,0x51eb -->
12100000 <!-- mflo r2 -->
1F856334 <!-- ori r3,r3,0x851f -->
63004224 <!-- addiu r2,r2,0x0063 -->
19004300 <!-- multu r2,r3 -->
70810508 <!-- j 0x001605C0 ;Jump to new code 3 -->
00000000
0800E003 <!-- jr r31 -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9520">
19006200 <!-- multu r3,r2 ;Target's PA * X -->
EB51033C <!-- lui r3,0x51eb -->
12100000 <!-- mflo r2 -->
1F856334 <!-- ori r3,r3,0x851f -->
63004224 <!-- addiu r2,r2,0x0063 -->
19004300 <!-- multu r2,r3 -->
902D238C <!-- lw r3,0x2d90(r1) ;Current Action Data Pointer -->
00000000
25006290 <!-- lbu r2,0x0025(r3) ;Load Attack Flag (unnecessary?) -->
F8FFBD27 <!-- addiu r29,r29,-0x0008 -->
01004234 <!-- ori r2,r2,0x0001 ;Pseudo-Status change flag -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Type as Pseudo-Status -->
10100000 <!-- mfhi r2 -->
43110200 <!-- sra r2,r2,0x05 -->
0100442C <!-- sltiu r4,r2,0x0001 ;set r4 to 1 if r2 (PA dmg) = 0 -->
25008014 <!-- bne r4,r0,0x001605f4 ;branch to nulling & exit if r4 = 1 -->
00000000
140062A0 <!-- sb r2,0x0014(r3) ;Store PA Change -->
261E0608 <!-- j 0x00187898 ;Return to main -->
0800BD27 <!-- addiu r29,r29,0x0008 -->
19006200 <!-- multu r3,r2 ;Target's MA * X -->
EB51033C <!-- lui r3,0x51eb -->
12100000 <!-- mflo r2 -->
1F856334 <!-- ori r3,r3,0x851f -->
63004224 <!-- addiu r2,r2,0x0063 -->
19004300 <!-- multu r2,r3 -->
902D238C <!-- lw r3,0x2d90(r1) ;Current Action Data Pointer -->
00000000
25006290 <!-- lbu r2,0x0025(r3) ;Load Attack Flag (unnecessary?) -->
F8FFBD27 <!-- addiu r29,r29,-0x0008 -->
01004234 <!-- ori r2,r2,0x0001 ;Pseudo-Status change flag -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Type as Pseudo-Status -->
10100000 <!-- mfhi r2 -->
43110200 <!-- sra r2,r2,0x05 -->
0100442C <!-- sltiu r4,r2,0x0001 ;set r4 to 1 if r2 (MA dmg) = 0 -->
11008014 <!-- bne r4,r0,0x001605f4 ;branch to nulling & exit if r4 = 1 -->
00000000
150062A0 <!-- sb r2,0x0015(r3) ;Store MA Change -->
311E0608 <!-- j 0x001878c4 ;Return to main -->
0800BD27 <!-- addiu r29,r29,0x0008 -->
902D238C <!-- lw r3,0x2d90(r1) ;Current Action Data Pointer -->
00000000
25006290 <!-- lbu r2,0x0025(r3) ;Load Attack Flag (unnecessary?) -->
F8FFBD27 <!-- addiu r29,r29,-0x0008 -->
01004234 <!-- ori r2,r2,0x0001 ;Pseudo-Status change flag -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Type as Pseudo-Status -->
10100000 <!-- mfhi r2 -->
43110200 <!-- sra r2,r2,0x05 -->
0100442C <!-- sltiu r4,r2,0x0001 ;set r4 to 1 if r2 (SP dmg) = 0 -->
03008014 <!-- bne r4,r0,0x001605f4 ;branch to nulling & exit if r4 = 1 -->
00000000
120062A0 <!-- sb r2,0x0012(r3) ;Store SP Change -->
421E0608 <!-- j 0x00187908 ;Return to main (EXIT) -->
0800BD27 <!-- addiu r29,r29,0x0008 -->
000060A0 <!-- sb r0,0x0000(r3) ;Store Attack miss -->
07000234 <!-- ori r2,r0,0x0007 -->
020062A0 <!-- sb r2,0x0002(r3) ;Store if attack was Guarded or missed -->
421E0608 <!-- j 0x00187908 ;Return to main (EXIT) -->
2A0060A4 <!-- sh r0,0x002a(r3) ;set chance to hit = 0 -->
</Location>
</Patch>

<Patch name="Formula 04 (magic gun) gains 100% status inflicting">
<Description> </Description>
<Location file="BATTLE_BIN" offset="121C24">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
CC1D060C <!-- jal 0x00187730 ;Magic Gun Ability Decision -->
00000000
1980013C <!-- lui r1,0x8019 -->
02392290 <!-- lbu r2,0x3902(r1) ;Load WP -->
FA382390 <!-- lbu r3,0x38fa(r1) ;Load Ability Power -->
00000000
CE3822A4 <!-- sh r2,0x38ce(r1) ;XA = WP -->
D03823A4 <!-- sh r3,0x38d0(r1) ;YA = Ability Power -->
E017060C <!-- jal 0x00185f80 ;Charge Calculation -->
00000000
E917060C <!-- jal 0x00185fa4 ;Weapon Element Strengthen -->
00000000
D121060C <!-- jal 0x00188744 ;Magical Support/Status/Compat -->
00000000
DF21060C <!-- jal 0x0018877c ;Elemental XA * YA -->
00000000
07004014 <!-- bne r2,r0,0x00188c8c ;Branch if element was nulled -->
00000000
541C060C <!-- jal 0x00187150 ;Faith Calculation -->
00000000
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
00000000
AD1F060C <!-- jal 0x00187eb4 ;Status -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 05 works like 03 but evadable and with 100% knockback">
<Description>Uses the standard gun damage formula of WP*WP.
Knockback still fails against units immune to it without a patch to change that behavior.</Description>
<Location file="BATTLE_BIN" offset="121C9C">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
4421060C <!-- jal 0x00188510 ;Physical Evade Calculation -->
00000000
0D004014 <!-- bne r2,r0,0x00188ce4 ;Branch to end if evaded -->
1980013C <!-- lui r1,0x8019 -->
02392290 <!-- lbu r2,0x3902(r1) ;Load WP -->
00000000
CE3822A4 <!-- sh r2,0x38ce(r1) ;Store WP as XA -->
D03822A4 <!-- sh r2,0x38d0(r1) ;Store WP as YA -->
E017060C <!-- jal 0x00185f80 ;Charge Calculation -->
00000000
A921060C <!-- jal 0x001886a4 ;Damage Calculation -->
00000000
FB10060C <!-- jal 0x001843ec ;Knockback Calculation -->
00000000
00000000
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 11 becomes Y% damage, LVL -1, 100% status, hit at MA+X">
<Description>'Dark Spark' formula. Fails against units with ??? Stats. Has typical element properties, ignores Faith, magic evadable.</Description>
<Location file="BATTLE_BIN" offset="128654"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
A00A1680
</Location>
<Location file="BATTLE_BIN" offset="F9AA0">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
6E21060C <!-- jal 0x001885b8 ;Magical Evade Calculation -->
00000000
28004014 <!-- bne r2,r0,0x00160b54 ;Branch to end if evaded -->
00000000
A122060C <!-- jal 0x00188a84 ;MA + X without faith -->
00000000
24004014 <!-- bne r2,r0,0x00160b54 ;Branch to end if fail to hit -->
00000000
1980013C <!-- lui r1,0x8019 -->
982D228C <!-- lw r2,0x2d98(r1) ;Load Target's Data Pointer -->
00000000
06004390 <!-- lbu r3,0x0006(r2) ;r3 = ??? Stats flag (0005 to check for Immortal) -->
00000000
04006330 <!-- andi r3,r3,0x0004 ;Check for ??? Stats -->
20006014 <!-- bne r3,r0,0x00160b64 ;Branch to nullification if has ??? Stats -->
00000000
22004290 <!-- lbu r2,0x0022(r2) ;r2 = Level -->
00000000
0200422C <!-- sltiu r2,r2,0x0002 ;Set r2 to 1 if Level is 1 -->
06004014 <!-- bne r2,r0,0x00160b10 ;Branch ahead if Level is 1 -->
00000000
902D228C <!-- lw r2,0x2d90(r1) ;Load Current Action Data Pointer -->
00010334 <!-- ori r3,r0,0x0100 ;r3 = 256 (-1) -->
100043A4 <!-- sh r3,0x0010(r2) ;Store Level change -->
01000334 <!-- ori r3,r0,0x0001 ;Pseudo-Status flag -->
250043A0 <!-- sb r3,0x0025(r2) ;Store Attack Type as Pseudo-Status -->
8919060C <!-- jal 0x00186624 ;Calculate % of damage -->
00000000
B41B060C <!-- jal 0x00186ed0 ;Weather Elemental effects -->
00000000
FE1B060C <!-- jal 0x00186ff8 ;Apply Elemental -->
00000000
1980023C <!-- lui r2,0x8019 -->
902D428C <!-- lw r2,0x2d90(r2) ;Load Current Action Data Pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Load Hit Flag -->
00000000
05004010 <!-- beq r2,r0,0x00160b54 ;Branch to end if nulled -->
00000000
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
00000000
AD1F060C <!-- jal 0x00187eb4 ;Apply status (Preserve hit status, evade type, hit %) -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
9013060C <!-- jal 0x00184e40 ;Nullify stuff -->
00000000
D5820508 <!-- j 0x00160b54 ;Jump to exit -->
00000000
</Location>
</Patch>

<Patch name="Formula 13 becomes Damage=(PA*(WP+Y))+Absorb HP+MP">
<Description>'Lancet' formula. MP absorption is half that of HP absorption. Basically a combination of formulas 2F and 30, plus the WP+Y and weapon elemental properties of 2D (although absorbed elements result in 0 damage).</Description>
<Location file="BATTLE_BIN" offset="12865C"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
10061680
</Location>
<Location file="BATTLE_BIN" offset="F9610">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
4421060C <!-- jal 0x00188510 ;Physical Evade Calculation -->
00000000
14004014 <!-- bne r2,r0,0x00160674 ;Branch to end if evaded -->
00000000
9717060C <!-- jal 0x00185e5c ;Store PA and WP + Y -->
00000000
E917060C <!-- jal 0x00185fa4 ;Weapon Element Strengthen -->
00000000
A921060C <!-- jal 0x001886a4 ;Damage Calculation -->
00000000
F41B060C <!-- jal 0x00186fd0 ;Weapon Elemental routine -->
00000000
1980023C <!-- lui r2,0x8019 -->
902D428C <!-- lw r2,0x2d90(r2) ;Load Current Action Data Pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Load Hit Flag -->
00000000
05004010 <!-- beq r2,r0,0x00160674 ;Branch to end if element nulled -->
00000000
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
00000000
A481050C <!-- jal 0x00160690 ;Lancet effect routine -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9690">
1980023C <!-- lui r2,0x8019 -->
982D428C <!-- lw r2,0x2d98(r2) ;Load Defender's Stats -->
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
58004290 <!-- lbu r2,0x0058(r2) ;Load 1st set of Current Status -->
1000BFAF <!-- sw r31,0x0010(r29) -->
10004230 <!-- andi r2,r2,0x0010 ;Check for Undead -->
03004010 <!-- beq r2,r0,0x001606b8 ;Branch if target is not undead -->
00000000
9B1C0608 <!-- j 0x0018726c ;Undead reverse & exit -->
00000000
912E060C <!-- jal 0x0018ba44 ;Set some data for current attack -->
00000000
1980043C <!-- lui r4,0x8019 -->
902D848C <!-- lw r4,0x2d90(r4) ;Load Defender Current Action Data Pointer -->
00000000
00008290 <!-- lbu r2,0x0000(r4) ;Load Defender Hit Flag -->
00000000
0F004010 <!-- beq r2,r0,0x00160714 ;Branch to end if Attack missed -->
00000000
1980033C <!-- lui r3,0x8019 -->
8C2D638C <!-- lw r3,0x2d8c(r3) ;Load Attacker Current Action Data Pointer -->
04008294 <!-- lhu r2,0x0004(r4) ;Load Defender HP Damage -->
00000000
060062A4 <!-- sh r2,0x0006(r3) ;Store Defender HP Damage as HP Recovery for Attacker -->
42100200 <!-- srl r2,r2,0x01 ;Defender HP Damage/2 -->
080082A4 <!-- sh r2,0x0008(r4) ;Store Defender HP Damage/2 as MP Damage for Defender -->
0A0062A4 <!-- sh r2,0x000a(r3) ;Store Defender HP Damage/2 as MP Recovery for Attacker -->
50000234 <!-- ori r2,r0,0x0050 ;40: HP Recovery + 10: MP Recovery -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Flag as HP & MP Healing for Attacker -->
01000234 <!-- ori r2,r0,0x0001 ;1 = Hit -->
000062A0 <!-- sb r2,0x0000(r3) ;Store Attacker Hit Flag as Hit -->
A0000234 <!-- ori r2,r0,0x00a0 ;80: HP Damage + 20: MP Damage -->
250082A0 <!-- sb r2,0x0025(r4) ;Store Attack Flag as HP & MP Damage for Defender -->
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="'Formula 13...Absorb HP+MP' checks magical evade instead of physical (READ DESCRIPTION)">
<Description>! Do not try to apply this at the same time as the main Formula 13 patch above, or FFTorgASM may detect a 'conflict' (that is intentional in this case) and move the patch out of the space intended for it!
Does nothing unless 'Evadable' is flagged properly in FFTPatcher.
This is only for the above 'Formula 13 becomes Damage=(PA*(WP+Y))+Absorb HP+MP' patch.</Description>
<Location file="BATTLE_BIN" offset="F9618">
6E
</Location>
</Patch>

<Patch name="'Formula 13...Absorb HP+MP' damage becomes ((PA+MA)/2)*(WP+Y) (READ DESCRIPTION)">
<Description>! Do not try to apply this at the same time as the main Formula 13 patch above, or FFTorgASM may detect a 'conflict' (that is intentional in this case) and move the patch out of the space intended for it!
! Requires 'Swordskill damage becomes ((PA+MA)/2)*(WP+Y) - Master routine'!
This is only for the above 'Formula 13 becomes Damage=(PA*(WP+Y))+Absorb HP+MP' patch.</Description>
<Location file="BATTLE_BIN" offset="F9628">
1081050C
</Location>
</Patch>

<Patch name="Formula 18 becomes Weapon Attack: Damage+X% from the back, +Y% from the sides">
<Description>'Sneak Attack' formula. Performs a weapon attack with increased damage based on target facing. No change to evade rates, but always fails from the front. Can poach if Secret Hunt is equipped.</Description>
<Location file="BATTLE_BIN" offset="128670"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
F00E1680
</Location>
<Location file="BATTLE_BIN" offset="F9EF0">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
01000234 <!-- ori r2,r0,0x0001 ;r2 = Default to attack flag -->
1980013C <!-- lui r1,0x8019 -->
E93822A0 <!-- sb r2,0x38e9(r1) ;Store Default to attack flag -->
562B060C <!-- jal 0x0018ad58 ;Perform weapon attack routine -->
00000000
CC83050C <!-- jal 0x00160f30 ;Sneak Attack function routine -->
00000000
281F060C <!-- jal 0x00187ca0 ;Formula 01 - 06 Aftermath (Poach) -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F9F30"> <!-- Most of this is cloned from Facing Evade Calculation -->
1980053C982DA58C1980043C942D848C4700A390470082900000000023406200
480082900200010521200001232004004800A390FF008430233862000200E104
2110E00023100200FF0043302B1064001D004010010006340C00001900000000
4800A29400000000000F4330000102340300621400030234EF83050821300000
02006214000000000200063458000105000000001980023C982D428C00000000
4800429400000000000F43300003023448006210000102344D00621400000000
48840508020006342B1083001C004010000000000B00E018000000004800A294
00000000000F433003006014000202340D840508213000000200621400000000
020006343A00E104000000001980023C982D428C000000004800429400000000
000F4330000202342A006210000000002F006014000000004884050802000634
06000019000103344800A29400000000000F42301F0043100000000009000105
000303341980023C982D428C000000004800429400000000000F423015004310
000000000900E018000000001980023C982D428C000000004800429400000000
000F42300B004010000000000B00E104000203341980023C982D428C00000000
4800429400000000000F42300300431400000000488405082130000004000015
000000000200E01400000000020006341980033CE2386324000066A0
1980013C <!-- lui r1,0x8019 -->
902D218C <!-- lw r1,0x2d90(r1) ;r1 = Current Action Data Pointer -->
02000234 <!-- ori r2,r0,0x0002 ;r2 = 2 (Back) -->
0600C210 <!-- beq r6,r2,0x00161154 ;Branch ahead if Facing Mod = 2 (Back) -->
00000000
01000234 <!-- ori r2,r0,0x0001 ;r2 = 1 (Sides) -->
0B00C210 <!-- beq r6,r2,0x00161174 ;Branch ahead if Facing Mod = 1 (Sides) -->
05000334 <!-- ori r3,r0,0x0005 ;Miss Type = Nullified -->
65840508 <!-- j 0x00161194 ;Jump to more nulling & exit -->
000020A0 <!-- sb r0,0x0000(r1) ;Store Unable to Hit Flag -->
04002294 <!-- lhu r2,0x0004(r1) ;r2 = Damage -->
</Location>
<Variable file="BATTLE_BIN" offset="FA158" bytes="2" default="0100" name="X (damage increase from the back)">
<Preset name="100%" value="0400" />
<Preset name="85%" value="0367" />
<Preset name="80%" value="0334" />
<Preset name="75%" value="0300" />
<Preset name="70%" value="02CE" />
<Preset name="66%" value="02AA" />
<Preset name="60%" value="0268" />
<Preset name="55%" value="0234" />
<Preset name="50%" value="0200" />
<Preset name="45%" value="01CD" />
<Preset name="40%" value="019A" />
<Preset name="34%" value="015D" />
<Preset name="30%" value="0134" />
<Preset name="25%" value="0100" />
<Preset name="20%" value="00CD" />
<Preset name="15%" value="009A" />
<Preset name="12.5%" value="0080" />
<Preset name="10%" value="0067" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="FA15A">
    0334 <!-- ori r3,r0,0x0100 ;r3 = Variable (X) [256] -->
19004300 <!-- multu r2,r3 ;Damage*X -->
12180000 <!-- mflo r3 ;r3 = Damage*X -->
821A0300 <!-- srl r3,r3,0x0a ;r3 = (Damage*X)/1024 -->
21106200 <!-- addu r2,r3,r2 ;r2 = ((Damage*X)/1024)+Damage -->
0800E003 <!-- jr r31 ;exit -->
040022A4 <!-- sh r2,0x0004(r1) ;Store New Damage [125%] -->
04002294 <!-- lhu r2,0x0004(r1) ;r2 = Damage -->
</Location>
<Variable file="BATTLE_BIN" offset="FA178" bytes="2" default="0080" name="Y (damage increase from the sides)">
<Preset name="85%" value="0367" />
<Preset name="80%" value="0334" />
<Preset name="75%" value="0300" />
<Preset name="70%" value="02CE" />
<Preset name="66%" value="02AA" />
<Preset name="60%" value="0268" />
<Preset name="55%" value="0234" />
<Preset name="50%" value="0200" />
<Preset name="45%" value="01CD" />
<Preset name="40%" value="019A" />
<Preset name="34%" value="015D" />
<Preset name="30%" value="0134" />
<Preset name="25%" value="0100" />
<Preset name="20%" value="00CD" />
<Preset name="15%" value="009A" />
<Preset name="12.5%" value="0080" />
<Preset name="10%" value="0067" />
<Preset name="0%" value="0000" />
<Preset name="Custom (Y/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="FA17A">
    0334 <!-- ori r3,r0,0x0080 ;r3 = Variable (Y) [128] -->
19004300 <!-- multu r2,r3 ;Damage*Y -->
12180000 <!-- mflo r3 ;r3 = Damage*Y -->
821A0300 <!-- srl r3,r3,0x0a ;r3 = (Damage*Y)/1024 -->
21106200 <!-- addu r2,r3,r2 ;r2 = ((Damage*Y)/1024)+Damage -->
0800E003 <!-- jr r31 ;exit -->
040022A4 <!-- sh r2,0x0004(r1) ;Store New Damage [112.5%] -->
020023A0 <!-- sb r3,0x0002(r1) ;Store Miss Type: Nullified -->
040020A4 <!-- sh r0,0x0004(r1) ;Store HP Damage = 0 -->
2A0020A4 <!-- sh r0,0x002a(r1) ;Store Hit% = 0 -->
100020A4 <!-- sh r0,0x0010(r1) ;Store Special Effect? = 0 -->
0800E003 <!-- jr r31 -->
250020A0 <!-- sb r0,0x0025(r1) ;Store cleared Attack Type Flags -->
00000000
</Location>
</Patch>

<Patch name="Formula 19 becomes Weapon Attack: Damage+X% to monsters">
<Description>'Sidewinder' formula. Performs a weapon attack with increased damage if the target is of the Monster gender. Always fails against targets with ??? Stats and non-monsters. Can poach if Secret Hunt is equipped.</Description>
<Location file="BATTLE_BIN" offset="128674"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
30071680
</Location>
<Location file="BATTLE_BIN" offset="F9730">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
1980023C <!-- lui r2,0x8019 -->
982D428C <!-- lw r2,0x2d98(r2) ;r2 = Target's Stats -->
00000000
06004390 <!-- lbu r3,0x0006(r2) ;r3 = Target's Gender Byte -->
00000000
04006230 <!-- andi r2,r3,0x0004 ;Check if Target's Gender Includes ??? Stats -->
04004014 <!-- bne r2,r0,0x00160764 ;Branch to Force Miss if Target has ??? Stats -->
00000000
20006230 <!-- andi r2,r3,0x0020 ;Check if Target's Gender = Monster -->
04004014 <!-- bne r2,r0,0x00160770 ;Branch past Force Miss if Unit is a Monster -->
00000000
C310060C <!-- jal 0x0018430c ;Force Miss routine -->
00000000
EC810508 <!-- j 0x001607b0 ;Jump to end -->
01000234 <!-- ori r2,r0,0x0001 ;r2 = Default to attack flag -->
1980013C <!-- lui r1,0x8019 -->
E93822A0 <!-- sb r2,0x38e9(r1) ;Store Default to attack flag -->
562B060C <!-- jal 0x0018ad58 ;Perform Weapon Attack routine -->
00000000
1980013C <!-- lui r1,0x8019 -->
902D218C <!-- lw r1,0x2d90(r1) ;r1 = Current Action Data Pointer -->
00000000
04002294 <!-- lhu r2,0x0004(r1) ;r2 = Damage -->
</Location>
<Variable file="BATTLE_BIN" offset="F9794" bytes="2" default="0555" name="X">
<Preset name="100%" value="0800" />
<Preset name="85%" value="0767" />
<Preset name="80%" value="0734" />
<Preset name="75%" value="0700" />
<Preset name="70%" value="06CE" />
<Preset name="67%" value="06AF" />
<Preset name="60%" value="0668" />
<Preset name="55%" value="0634" />
<Preset name="50%" value="0600" />
<Preset name="45%" value="05CD" />
<Preset name="40%" value="059A" />
<Preset name="33%" value="0555" />
<Preset name="30%" value="0534" />
<Preset name="25%" value="0500" />
<Preset name="20%" value="04CD" />
<Preset name="15%" value="049A" />
<Preset name="12.5%" value="0480" />
<Preset name="10%" value="0467" />
<Preset name="Custom (X/400h [1024] )" modify="true" />
</Variable>
<Location file="BATTLE_BIN" offset="F9796">
    0334 <!-- ori r3,r0,0x0555 ;r3 = Variable (X) [1365] -->
19004300 <!-- multu r2,r3 ;Damage*X -->
12100000 <!-- mflo r2 ;r2 = Damage*X -->
82120200 <!-- srl r2,r2,0x0a ;r2 = (Damage*X)/1024 -->
040022A4 <!-- sh r2,0x0004(r1) ;store new damage amount -->
281F060C <!-- jal 0x00187ca0 ;Formula 01 - 06 Aftermath (Poach) -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 21 (Bizen Boat) gains 100% status inflicting">
<Description> </Description>
<Location file="BATTLE_BIN" offset="122614">
1980013C <!-- lui r1,0x8019 -->
CE382394 <!-- lhu r3,0x38ce(r1) ;r3 = XA -->
D0382294 <!-- lhu r2,0x38d0(r1) ;r2 = YA -->
00000000
19006200 <!-- multu r3,r2 ;XA * YA -->
902D238C <!-- lw r3,0x2d90(r1) ;r3 = Target Current Action Data Pointer -->
20000234 <!-- ori r2,r0,0x0020 ;r2 = MP Damage flag -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Type as MP Damage -->
12100000 <!-- mflo r2 ;r2 = XA * YA -->
080062A4 <!-- sh r2,0x0008(r3) ;Store XA * YA MP Damage -->
AD1F060C <!-- jal 0x00187eb4 ;Apply status (Preserve hit status, evade type, hit %) -->
00000000
</Location>
</Patch>

<Patch name="Formula 27 (Gil Taking) becomes Damage=(SP/2)*((PA+WP)/2)+Steal Gil">
<Description>'Mug' formula. Has weapon elemental, Attack/Defense Up, Martial Arts, and critical hits.</Description>
<Location file="BATTLE_BIN" offset="122828">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
4421060C <!-- jal 0x00188510 ;Physical Evade Calculation -->
00000000
0B004014 <!-- bne r2,r0,0x00189868 ;Branch to end if evaded -->
00000000
D119060C <!-- jal 0x00186744 ;Steal Gil routine -->
00000000
1980013C <!-- lui r1,0x8019 -->
942D228C <!-- lw r2,0x2d94(r1) ;r2 = Attacker's Data Pointer -->
02392390 <!-- lbu r3,0x3902(r1) ;r3 = WP -->
36004490 <!-- lbu r4,0x0036(r2) ;r4 = PA -->
38004290 <!-- lbu r2,0x0038(r2) ;r2 = SP -->
21188300 <!-- addu r3,r4,r3 ;r3 = PA+WP -->
F4810508 <!-- j 0x001607d0 ;Jump to new code section -->
42100200 <!-- srl r2,r2,0x01 ;r2 = SP/2 -->
0A820508 <!-- j 0x00160828 ;Jump to exit -->
00000000
</Location>
<Location file="BATTLE_BIN" offset="F97D0">
42180300 <!-- srl r3,r3,0x01 ;r3 = (PA+WP)/2 -->
CE3822A4 <!-- sh r2,0x38ce(r1) ;XA = SP/2 -->
D03823A4 <!-- sh r3,0x38d0(r1) ;YA = (PA+WP)/2 -->
E917060C <!-- jal 0x00185fa4 ;Weapon Element Strengthen -->
00000000
7E21060C <!-- jal 0x001885f8 ;Physical XA Modifying Statuses/Support -->
00000000
3E19060C <!-- jal 0x001864f8 ;Critical Hit Calculation -->
00000000
5A19060C <!-- jal 0x00186568 ;XA * YA Calculation -->
00000000
F41B060C <!-- jal 0x00186fd0 ;Weapon Elemental routine -->
00000000
1980023C <!-- lui r2,0x8019 -->
902D428C <!-- lw r2,0x2d90(r2) ;Load Current Action Data Pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Load Hit Flag -->
00000000
03004010 <!-- beq r2,r0,0x00160828 ;Branch to end if element nulled -->
00000000
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 27 stolen Gil amount is doubled">
<Description>From (CasterLevel*Speed) to (CasterLevel*Speed)*2</Description>
<Location file="BATTLE_BIN" offset="11F788">
40801000
</Location>
</Patch>

<Patch name="Formula 27 stolen Gil amount is quadrupled">
<Description>From (CasterLevel*Speed) to (CasterLevel*Speed)*4</Description>
<Location file="BATTLE_BIN" offset="11F788">
80801000
</Location>
</Patch>

<Patch name="Formula 36 (Accumulate) boosts PA by Y, MA by X">
<Description> </Description>
<Location file="BATTLE_BIN" offset="11F8F0">
1980013C <!-- lui r1,0x8019 -->
F9382290 <!-- lbu r2,0x38f9(r1) ;r2 = Ability X -->
FA382390 <!-- lbu r3,0x38fa(r1) ;r3 = Ability Y -->
902D218C <!-- lw r1,0x2d90(r1) ;r1 = Current Action Data Pointer -->
80004234 <!-- ori r2,r2,0x0080 ;Set r2 as negative -->
150022A0 <!-- sb r2,0x0015(r1) ;Store r2 as MA change -->
80006334 <!-- ori r3,r3,0x0080 ;Set r3 as negative  -->
140023A0 <!-- sb r3,0x0014(r1) ;Store r3 as PA change -->
01000234 <!-- ori r2,r0,0x0001 ;Load Pseudo-Status Flag -->
0800E003 <!-- jr r31 -->
250022A0 <!-- sb r2,0x0025(r1) ;Store Attack Type as Pseudo-Status -->
</Location>
</Patch>

(continued; post size exceeded)
2
PSX FFT Hacking / Buggy ASM hacks
March 24, 2014, 02:00:32 pm
Hello, FFHacktics regulars! Does anyone have fixed versions of these, or would anyone care to fix these? I would like to use them in a major mod I am working on; otherwise I will have to design around not being able to use them.

To verify that the problems I'm having with them aren't the result of conlicts with other patches, I tested them all individually with pSX v1.13 on a clean/vanilla ISO (except for changes necessary for an ASM to be usable in-game).

Disable Move hack by FFMaster
   http://ffhacktics.com/smf/index.php?topic=5658.msg155233#msg155233
   Just doesn't work more often than not, but occasionally it will function correctly.

Units with reaction between Counter and Distribute have front evasion for sides and back by FFMaster
   Seems to affect everyone and is not limited to units using the ability, as described.

Learning Support Hack by pokeytax
   Technically works, but also screws up equipment and/or stats.
Test scenario 1:
   I set up the patch to utilize the blank support ability under Non-charge and using job Calculator and skillset Math Skill. Made the new 'learning' ability cost 0 JP and added it to Math Skill skillset. Added Flame Attack to Math Skill skillset and make it 100% learn-on-hit, non-learnable with JP, and cost 9999 JP. Added Flame Attack to Bomb's skillset. In-game, equipped 'learning' on a weaponless non-Calculator and let a Bomb hit him with Flame Attack. Result: learned Flame Attack as expected, but also ended up with an Asura Knife mysteriously equipped in the right hand.
Test scenario 2:
   Same as 1, but I sent the unit in as a Calculator without the 'learning' ability and ended up with a Yoichi Bow in my hands out of nowhere.
Test scenario 3:
   Same basic setup as 1, but changed from Calculator to Mediator, a more ordinary job/skillset in hopes that it wouldn't bug out like Calculator. Ended up with a Rod equipped in the body armor slot.
Test scenario 4:
   Same as 3, but I sent the unit in as a Mediator without the 'learning' ability and ended up with a Spell Edge in the body armor slot.
I stopped this test here, but I've had this patch give me many hundreds of MP in the past instead of (or in addition to) altering equipment.

Multiplier Editor in Raven's Workbooks
   Tested these with the default values provided. Using the "Haste, Slow Edits" portion caused battles to start out stuck in some sort of infinite loop with everyone walking in slow motion. In the "Element Fixes and Edits" portion, elemental weakness is completely broken. I didn't test any further with that part. In the "Attack Up, (etc.) Edits" portion, Attack Up tested with a Mithril Gun (64 base dmg) against a freshly-hired neutral-compatibility Squire deals 80 dmg (125%) instead of the expected 85dmg (133%). I stopped testing here.

Blank support ability over Short Charge adds 25% bonus skill hit by Xifanie
   I noticed there are two* different versions of this, one in Xifanie's ASM thread and one in an xml included in v483 of the patcher suite. The former seems to work okay, actually, though I haven't tested it a lot. The latter version doesn't seem to do anything at all. Why does the (newer?) version in the xml exist? Is it supposed to be fixed to work on a real PS1 or something?
   *Choto has a modification of this patch that also has issues, but I posted about that in his ASM thread (which is still active unlike most) so hopefully he can fix it.
Version A (working):

0x0011F5D8
1980013C
CE382294
CE3830A4
D03822A4
D0382394
CE382294
92006492
10008430
03000410
21104300
82180200
21106200
902D248C

Version B (non-working):

0x0011F5D8
1980013C
CE382294
942D248C
CE3830A4
92008490
D03822A4
10008430
03000410
21100202
82181000
21106200
902D248C
00000000