• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
May 03, 2024, 04:59:21 am

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.

Messages - Grond

1
PSX FFT Hacking / Re: ASM Requests
April 18, 2023, 10:01:07 pm
Maybe some of these belong more in the ASM Hack Proposals thread, but it hasn't been posted in for years and I don't want to bump it.

•Halve X & Y values (i.e. power & hit rate) of abilities when using them through Math Skill
•Make 'Move-etc Up' abilities up work when stacked (& work properly with Cancel Movement QoL patch)
•Stop your units from getting free CT at unit changeover in 2-part battles (e.g. Velius, Altima fights)
•Stop Throw being affected by Blade Grasp
•Make Float status negate fall damage
•Make Counter Magic not use MP
•Restrict Teleport vertical range by Move (or Jump), like horizontal range is

Bugfixes & similar:
•Prevent units from going 'Missing' on propositions at chapter change (call back automatically)
•Prevent AI from pointlessly re-selecting performances (Although I think the 'Save CT' checkbox in FFTPatcher may reduce this)
•Fix 'poaching doesn't remove corpse in deep water' bug
•Fix game hang when using Jump while mounted in deep water
•Fix getting stuck in air if jumping with magic gun equipped on a Blade Grasp-user
•Bow animation glitch fix (hide arrow/bolt & don't show damage twice if using an animation other than FFFF)
•Cancel out of menu for 'prompted' battles like Lionel/Riovanes/Bethla

Lower priority:
•Allow AI to choose to mount chocobos
•Implement Class M-Evade
•Unlearn abilities & get (0-100%, configurable) of JP cost back
•Remove redundant movement ability column when using 'Combine Support and Movement' patch
•Allow multiple units to learn ability 'Blue Mage style' when hit all at once
•Enable custom palettes for monsters only for palettes 03-07
•Hide date & war funds displays when panning world map with square button
•Create an ability (active or passive?) that highlights tiles containing Move-Find items/traps
•Invisibly(?) increase success %s of actions by 1% if between 1-99%
2
Site Submission / Re: Sprites
April 18, 2023, 09:40:26 pm
Archpriest
Archpriest_T1.spr
100%
Squaresoft, Seushiro, Grond
Type1
NOTES:Edit of Seushiro's 'thin Rudvich'

-

Barnaba
Barnaba_T2.spr
100%
Squaresoft, Grond
Type2

-

Besrodio
Besrodio_T1.spr
100%
Squaresoft, Grond
Type1

-

Lamia v2 (FFT Advance/A2)
Lamia_v2_MON.spr
100%
Square-Enix & Kagebunji (sprite); Twinees (portrait); Grond (revision)
MON
NOTES:Walking frames completed, attack animation changed, no SP2
3
PSX FFT Hacking / Re: Grond's ASM patches
April 18, 2023, 08:56:55 pm
FORMULAS (continued)

<Patch name="Formula 42 (Work skills) gain damage modifiers, crits, and 100% status">
<Description>Damage is now modified by presence of Attack/Defense Up, Martial Arts, Charging, Protect, Sleep, Chicken, Frog.
Inflict Status ID on Compress should probably be changed from 29 to 77 (assuming them unchanged from the base game) to avoid a 100% Death infliction rate.</Description>
<Location file="BATTLE_BIN" offset="12317C">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
8117060C <!-- jal 0x00185e04 ;Store PA and Y as XA and YA -->
00000000
5318060C <!-- jal 0x0018614c ;Formula 32-35 Attack Up and Martial Arts -->
00000000
B722060C <!-- jal 0x00188adc ;Cluster of Physical Routines -->
00000000
3E19060C <!-- jal 0x001864f8 ;Critical Hit Calculation -->
00000000
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 -->
12100000 <!-- mflo r2 ;r2 = XA * YA -->
040062A4 <!-- sh r2,0x0004(r3) ;Store XA * YA Damage to Target -->
00140200 <!-- sll r2,r2,0x10 ;r2 = (XA * YA)*65536 -->
F9382390 <!-- lbu r3,0x38f9(r1) ;r3 = Ability X -->
03140200 <!-- sra r2,r2,0x10 ;r2 = ((XA * YA)*65536)/65536 -->
1A004300 <!-- div r2,r3 ;(XA * YA)/ X -->
12100000 <!-- mflo r2 ;r2 = (XA * YA)/ X -->
8C2D248C <!-- lw r4,0x2d8c(r1) ;r4 = Attacker Current Action Data Pointer -->
01000334 <!-- ori r3,r0,0x0001 ;r3 = Hit flag = Hit -->
000083A0 <!-- sb r3,0x0000(r4) ;Store Hit on Attacker -->
040082A4 <!-- sh r2,0x0004(r4) ;Store (XA * YA)/ X Damage to Attacker -->
902D228C <!-- lw r2,0x2d90(r1) ;r2 = Target Current Action Data Pointer -->
80000334 <!-- ori r3,r0,0x0080 ;r3 = HP Damage flag -->
250043A0 <!-- sb r3,0x0025(r2) ;Store Attack Type as HP Damage on Target -->
8C2D228C <!-- lw r2,0x2d8c(r1) ;r2 = Attacker Current Action Data Pointer -->
00000000
250043A0 <!-- sb r3,0x0025(r2) ;Store Attack Type as HP Damage on Attacker -->
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
</Location>
</Patch>

<Patch name="Formula 46 becomes Y% Damage, Status at SP+X%; no damage if status fails">
<Description>A physical formula with Attack/Defense Up, Martial Arts, elemental (but not weapon elemental); physically evadable.</Description>
<Location file="BATTLE_BIN" offset="128728"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
40081680
</Location>
<Location file="BATTLE_BIN" offset="F9840">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
4421060C <!-- jal 0x00188510 ;;Physical Evade Calculation -->
00000000
2A004014 <!-- bne r2,r0,0x001608fc ;Branch to end if evaded -->
00000000
8C17060C <!-- jal 0x00185e30 ;Store Speed and X -->
00000000
7E21060C <!-- jal 0x001885f8 ;Physical XA Modifying Statuses/Support -->
00000000
6719060C <!-- jal 0x0018659c ;Set XA + YA for Status Formulas -->
00000000
441D060C <!-- jal 0x00187510 ;Set XA * YA as hit% -->
00000000
1980023C <!-- lui r2,0x8019 -->
902D428C <!-- lw r2,0x2d90(r2) ;Load Action Data Pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Load Hit Flag -->
00000000
1B004010 <!-- beq r2,r0,0x001608fc ;Branch to end if missed -->
00000000
FF17060C <!-- jal 0x00185ffc ;Elemental Strengthen -->
00000000
8919060C <!-- jal 0x00186624 ;Calculate Y% 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 Action Data Pointer -->
00000000
00004290 <!-- lbu r2,0x0000(r2) ;Load Hit Flag -->
00000000
0C004010 <!-- beq r2,r0,0x001608fc ;Branch to end if element nulled -->
00000000
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
00000000
AD1F060C <!-- jal 0x00187eb4 ;Apply status (Preserve hit status, evade type, hit %) -->
00000000
25004290 <!-- lbu r2,0x0025(r2) ;r2 = Attack Type -->
00000000
08004230 <!-- andi r2,r2,0x0008 ;Check status change -->
03004014 <!-- bne r2,r0,0x001608fc ;Branch to end if status change -->
00000000
9013060C <!-- jal 0x00184e40 ;Nullification -->
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 5F becomes X*(TargetLevel+1) damage">
<Description>'Flare Star'/'Chocobuckle' formula. 'X' is Ability X in FFTPatcher. Raw damage--no elemental, (M)Attack/Defense Up, compatibility, Faith, or evasion.</Description>
<Location file="BATTLE_BIN" offset="12878C"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
10091680
</Location>
<Location file="BATTLE_BIN" offset="F9910">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
1980013C <!-- lui r1,0x8019 -->
982D228C <!-- lw r2,0x2d98(r1) ;r2 = Target's Data Pointer -->
F9382390 <!-- lbu r3,0x38f9(r1) ;r3 = Ability X -->
22004290 <!-- lbu r2,0x0022(r2) ;r2 = Target's Level -->
CE3823A4 <!-- sh r3,0x38ce(r1) ;Store Ability X as XA -->
01004224 <!-- addiu r2,r2,0x0001 ;r2 = Level+1 -->
5A19060C <!-- jal 0x00186568 ;XA * YA Calculation -->
D03822A4 <!-- sh r2,0x38d0(r1) ;Store Level+1 as YA -->
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 60 becomes X*Injured damage">
<Description>'Everyone's Grudge' formula. 'X' is Ability X in FFTPatcher. 'Injured' is the game's weird name for the number of enemies you have allowed to decay into Crystal/Treasure Box. Raw damage--no elemental, (M)Attack/Defense Up, compatibility, Faith, or evasion.</Description>
<Location file="BATTLE_BIN" offset="128790"> <!-- Consult ffhacktics.com/wiki/Formula_Table to use a different formula -->
50091680
</Location>
<Location file="BATTLE_BIN" offset="F9950">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
64ED040C <!-- jal 0x0013b590 ;Get Script Variable... -->
61000434 <!-- ori r4,r0,0x0061 ;With r2 = 'Injured'  -->
1980013C <!-- lui r1,0x8019 -->
F9382390 <!-- lbu r3,0x38f9(r1) ;r3 = Ability X -->
D03822A4 <!-- sh r2,0x38d0(r1) ;Store 'Injured' as YA -->
5A19060C <!-- jal 0x00186568 ;XA * YA Calculation -->
CE3823A4 <!-- sh r3,0x38ce(r1) ;store ability X as XA -->
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 63 (Throw) damage becomes (SP+(PA/2))*WP">
<Description>Also gains elemental strengthen, Attack Up/Martial Arts, and crits.</Description>
<Location file="BATTLE_BIN" offset="123B98">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
EB20060C <!-- jal 0x001883ac ;Catch routine -->
00000000
4421060C <!-- jal 0x00188510 ;Physical Evade Calculation -->
00000000
20004014 <!-- bne r2,r0,0x00123c34 ;Branch to end if evaded -->
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 -->
42200400 <!-- srl r4,r4,0x01 ;r4 = PA/2 -->
21104400 <!-- addu r2,r2,r4 ;r2 = SP+(PA/2) -->
D03823A4 <!-- sh r3,0x38d0(r1) ;YA = WP -->
CE3822A4 <!-- sh r2,0x38ce(r1) ;XA = SP+(PA/2) -->
E917060C <!-- jal 0x00185fa4 ;Weapon Element Strengthen -->
00000000
5318060C <!-- jal 0x0018614c ;Formula 32-35 Attack Up and Martial Arts -->
00000000
B722060C <!-- jal 0x00188adc ;Cluster of Physical Routines -->
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
05004010 <!-- beq r2,r0,0x00123c34 ;Branch to end if element nulled -->
00000000
3F1C060C <!-- jal 0x001870fc ;Elemental Absorption -->
00000000
00000000
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

<Patch name="Formula 63 (Throw) gains 19% status inflicting (READ DESCRIPTION)">
<Description>! Requires the above Formula 63 edit to be applied first.
Has a fairly major quirk: if the thrown weapon normally casts an ability on-strike, it will interpret the Ability ID as an 'Inflict Status' ID, if the Ability ID is between 0-7F (range of Inflict Status IDs).
For example, an Ice Brand, which casts Ice 2 (Ability ID 19) will add Innocent (Inflict Status ID 19) when thrown.
This can be worked around by not having throwable weapons cast an ability between 0-7F, or by nulling out (unchecking all boxes) the Inflict Status ID that matches up with the Ability ID. Or you could perhaps get creative and e.g. have thrown Ice Brands add Stop (to simulate freezing) by changing Inflict Status ID 19 to Stop.</Description>
<Location file="BATTLE_BIN" offset="123BB0">
22004014 <!-- bne r2,r0,0x00123c3c ;Update branch to exit -->
</Location>
<Location file="BATTLE_BIN" offset="123C1C">
07004010 <!-- beq r2,r0,0x00123c3c ;Update branch to exit -->
</Location>
<Location file="BATTLE_BIN" offset="123C24">
C721060C <!-- jal 0x0018871c ;Elemental Absorb and status roll -->
00000000
03004014 <!-- bne r2,r0,0x0018ac3c ;Branch to end if status roll fails -->
00000000
AD1F060C <!-- jal 0x00187eb4 ;Apply status (Preserve hit status, evade type, hit %) -->
00000000
192B0608 <!-- j 0x0018ac64 ;Jump to Formula 64's exit -->
00000000
</Location>
</Patch>

<Patch name="Formula 64 (Jump) gains weapon elemental, Attack Up/Martial Arts, and crits">
<Description> </Description>
<Location file="BATTLE_BIN" offset="123C44">
E8FFBD27 <!-- addiu r29,r29,-0x0018 -->
1000BFAF <!-- sw r31,0x0010(r29) -->
A517060C <!-- jal 0x00185e94 ;Formula 64 or Jump Base XA / YA -->
00000000
94210608 <!-- j 0x00188650 ;Jump into Weapon Damage Calculation -->
00000000
00000000
00000000
1000BF8F <!-- lw r31,0x0010(r29) -->
1800BD27 <!-- addiu r29,r29,0x0018 -->
0800E003 <!-- jr r31 -->
00000000
</Location>
</Patch>

EVENTS

<Patch name="Stop game calendar from advancing by a year after meeting Rafa">
<Description>At the end of event 10E (exploding frog event), changes a CallFunction(x02) (make a year pass) instruction to CallFunction(x04) (remove enemy units).</Description>
<Location file="EVENT_TEST_EVT" offset="21C800">
04
</Location>
</Patch>

<Patch name="Make game calendar advance by a year at the start of Chapter 3">
<Description>At the end of event C9 (Delita killing Gelwan event), changes a CallFunction(x06) (bring up the Save screen) instruction to CallFunction(x02) (make a year pass).</Description>
<Location file="EVENT_TEST_EVT" offset="192BA0">
02
</Location>
</Patch>

<Patch name="Fix palette of zodiac stones during Riovanes Rooftop event">
<Description>About halfway through event 124, changes an EVTCHRPalette instruction to call palette 06 instead of 03. This makes the stones the correct red (Scorpio) and yellow (Taurus). However, they are still referred to as a single stone in the event dialog.</Description>
<Location file="EVENT_TEST_EVT" offset="24865A">
06
</Location>
</Patch>

<Patch name="Mustadio not required for chapter 4 Goug events">
<Description>Instead of 16 Mustadio, checks for 03 Ramza.</Description>
<Location file="WORLD_WLDCORE_BIN" offset="30B00">
03
</Location>
<Location file="WORLD_WLDCORE_BIN" offset="30B22">
03
</Location>
<Location file="WORLD_WLDCORE_BIN" offset="30B44">
03
</Location>
<Location file="WORLD_WLDCORE_BIN" offset="30B6C">
03
</Location>
</Patch>

OTHER

<Patch name="Degenerator Traps turned into another status trap">
<Description>For those who want to get rid of Degenerators, but would like to keep four trap types. Changed to 'Sticky Trap' (Don't Act + Don't Move). Also makes Steel Needle do 1/4 Max HP damage instead of 1/5.</Description>
<Location file="BATTLE_BIN" offset="126C34">
18006210 <!-- beq r3,r2,0x0018dc98 -->
02006228 <!-- slti r2,r3,0x0002 -->
05004010 <!-- beq r2,r0,0x0018dc54 -->
00000000
0A006010 <!-- beq r3,r0,0x0018dc70 -->
01000234 <!-- ori r2,r0,0x0001 -->
4A370608 <!-- j 0x0018dd28 -->
FF001134 <!-- ori r17,r0,0x00ff -->
02000234 <!-- ori r2,r0,0x0002 -->
19006210 <!-- beq r3,r2,0x0018dcc0 -->
03000234 <!-- ori r2,r0,0x0003 -->
28006210 <!-- beq r3,r2,0x0018dd04 -->
00000000
4A370608 <!-- j 0x0018dd28 -->
FF001134 <!-- ori r17,r0,0x00ff -->
21200000 <!-- addu r4,r0,r0 -->
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;r3 = Current Action Data Pointer -->
0C000234 <!-- ori r2,r0,0x000c ;r2 = Status(es) to inflict (Don't Act+Move) -->
C912060C <!-- jal 0x00184b24 ;Check if Unit is immune to status -->
1F0062A0 <!-- sb r2,0x001f(r3) ;Store in Attack's Status Infliction 5 -->
1A004010 <!-- beq r2,r0,0x0018dcf4 ;Branch if no status is inflicted -->
00000000
38370608 <!-- j 0x0018dce0 ;Jump to store attack type -->
00000000
21200000 <!-- addu r4,r0,r0 -->
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;r3 = Current Action Data Pointer -->
01000234 <!-- ori r2,r0,0x0001 ;r2 = Status(es) to inflict (Death Sentence) -->
C912060C <!-- jal 0x00184b24 ;Check if Unit is immune to status -->
1F0062A0 <!-- sb r2,0x001f(r3) ;Store in Attack's Status Infliction 5 -->
10004010 <!-- beq r2,r0,0x0018dcf4 ;Branch if no status is inflicted -->
00000000
38370608 <!-- j 0x0018dce0 ;Jump to store attack type -->
00000000
21200000 <!-- addu r4,r0,r0 -->
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;r3 = Current Action Data Pointer -->
10000234 <!-- ori r2,r0,0x0010 ;r2 = Status(es) to inflict (Sleep) -->
C912060C <!-- jal 0x00184b24 ;Check if Unit is immune to status -->
1F0062A0 <!-- sb r2,0x001f(r3) ;Store in Attack's Status Infliction 5 -->
06004010 <!-- beq r2,r0,0x0018dcf4 ;Branch if no status is inflicted -->
00000000
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;r3 = Current Action Data Pointer -->
08000234 <!-- ori r2,r0,0x0008 ;r2 = Status Change flag -->
4A370608 <!-- j 0x0018dd28 -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Type as Status Change -->
C310060C <!-- jal 0x0018430c -->
00000000
4B370608 <!-- j 0x0018dd2c -->
21102002 <!-- addu r2,r17,r0 -->
1980033C <!-- lui r3,0x8019 -->
902D638C <!-- lw r3,0x2d90(r3) ;r3 = Current Action Data Pointer -->
80000234 <!-- ori r2,r0,0x0080 ;r2 = HP Damage flag -->
250062A0 <!-- sb r2,0x0025(r3) ;Store Attack Type as HP Damage -->
2A000296 <!-- lhu r2,0x002a(r16) ;r2 = Max HP -->
00000000
82100200 <!-- srl r2,r2,0x02 ;r2 = Max HP / 4 -->
040062A4 <!-- sh r2,0x0004(r3) ;Store (Max HP / 4) HP Damage -->
00000000
</Location>
</Patch>

<Patch name="Units with ??? stats start with a maxed CT gauge">
<Description>Still doesn't seem to prevent you from going first in multi-part battles (like Velius) but should work as expected in single-part battles.</Description>
<Location file="BATTLE_BIN" offset="11B874">
9C820508 <!-- j 0x00160a70 ;Jump from 'In between turn control routine' -->
</Location>
<Location file="BATTLE_BIN" offset="F9A70">
06006490 <!-- lbu r4,0x0006(r3) ;r3 = Gender byte -->
00000000
04008430 <!-- andi r4,r4,0x0004 ;Check for ??? stats -->
03008014 <!-- bne r4,r0,0x00160a8c ;Branch ahead if ??? stats on -->
00000000
390060A0 <!-- sb r0,0x0039(r3) ;If not, store 0 CT as usual -->
1F0A0608 <!-- j 0x0018287c ;Jump back to original code -->
FF000434 <!-- ori r4,r0,0x00ff ;r4 = 255 -->
1F0A0608 <!-- j 0x0018287c ;Jump back to original code... -->
390064A0 <!-- sb r4,0x0039(r3) ;...while storing 255 (Quick) CT -->
</Location>
</Patch>

<Patch name="Shields use correct graphics in battle">
<Description>! Use only if your shields are still using the base game graphics!
In the weapon+shield battle graphics lookup table, there is a couple bytes of junk data wedged in between the weapon and shield locations, offsetting all the shield graphics. This fixes that by nudging the shields back to where they should be.</Description>
<Location file="BATTLE_BIN" offset="2D4E4" mode="DATA">
E000E0063000A006F0008006700060066000D006D000D0067000300680008006
</Location>
</Patch>
4
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)
5
Posting these two patches in here as requested.
<Patch name="Half of MP multiplies MP cost by XX / 128">
<Description>Make sure to fill in both X values for the drop-down box below
(with the same value; one affects displayed MP cost and the other affects actual MP cost).

90% is X = 74
83% is X = 6B
80% is X = 67
75% is X = 60
70% is X = 5A
66% is X = 56
60% is X = 4D
50% is X = 40 (default)
40% is X = 34
33% is X = 2B
30% is X = 27
25% is X = 20
20% is X = 1A
17% is X = 16
10% is X = 0D
If you want the multiplier to be greater than 100%, add 0x80 to the above number.</Description>
<Location file="BATTLE_BIN" offset="f2f90">
f800a88f
0d009190
05000011
</Location>
<Variable name="X" file="BATTLE_BIN" offset="f2f9c"/>
<Location file="BATTLE_BIN" offset="f2f9d">
  000234
19005100
00000000
12100000
c2890200
92060608
00000000
</Location>
<Location file="BATTLE_BIN" offset="f3000">
80004230
06004010
00000000
</Location>
<Variable name="X" file="BATTLE_BIN" offset="f300c"/>
<Location file="BATTLE_BIN" offset="f300d">
  000234
00000000
19004400
12100000
c2210200
dcf60508
00000000
</Location>
<Location file="BATTLE_BIN" offset="116b60">
00680508
00000000
00000000
00000000
</Location>
<Location file="BATTLE_BIN" offset="11aa34">
e4670508
00000000
00000000
00000000
00000000
</Location>
</Patch>


<Patch name="Short Charge multiplies ability CT by XX / 128">
<Description>Make sure to fill in both X values for the drop-down box below
(with the same value; one affects displayed CT and the other affects actual CT).

90% is X = 74
83% is X = 6B
80% is X = 67
75% is X = 60
70% is X = 5A
66% is X = 56
60% is X = 4D
50% is X = 40 (default)
40% is X = 34
33% is X = 2B
30% is X = 27
25% is X = 20
20% is X = 1A
17% is X = 16
10% is X = 0D
If you want the multiplier to be greater than 100%, add 0x80 to the above number.</Description>
<Location file="BATTLE_BIN" offset="f3028">
f000a98f
01000234
05002215
</Location>
<Variable name="X" file="BATTLE_BIN" offset="f3034"/>
<Location file="BATTLE_BIN" offset="f3035">
  000234
19005000
00000000
12100000
c2810200
9d060608
00000000
</Location>
<Location file="BATTLE_BIN" offset="f3050">
05004010
</Location>
<Variable name="X" file="BATTLE_BIN" offset="f3054"/>
<Location file="BATTLE_BIN" offset="f3055">
  000234
19005200
00000000
12100000
c2910200
1cf20508
00000000
</Location>
<Location file="BATTLE_BIN" offset="115864">
14680508
00000000
00000000
</Location>
<Location file="BATTLE_BIN" offset="11aa6c">
0a680508
00000000
00000000
00000000
00000000
</Location>
</Patch>
6
PSX FFT Hacking / Re: Buggy ASM hacks
May 14, 2015, 09:07:03 pm
Okay, I seem to have things working properly now.

I've attached fixed versions of the above hacks as an xml, and I'll post them in the FFTPatcher thread also, as requested.
7
PSX FFT Hacking / Re: Buggy ASM hacks
May 08, 2015, 05:54:24 pm
Since this old topic of mine has been conveniently bumped (and the relevant ASM thread is dead), I'll post this in here:

I discovered an issue with another ASM hack that I wished to use (one of pokeytax's).

The problem is that his "Half of MP multiplies MP cost by XX/YY" hack currently does not actually affect the amount of MP consumed, but only affects the MP cost displayed in the ability selection menu.

The existing version only makes changes to this section of code.
Similar changes also needed to be made in this section to make the hack work fully.
(There is also another bit of code concerning Half of MP in this section, but I didn't mess with it because I'm not sure when/if it's used (perhaps in the A.I.'s decision-making process?)

Basically, this hack should now work as intended, and hopefully without bugs.*


(Actual cost only, not displayed. REQUIRES pokeytax's hack, found in his ASM topic, to properly display cost.)
BATTLE.BIN = 116b60-f:
00680508
00000000
00000000
00000000

BATTLE.BIN = f3000-27:
80004230
06004010
00000000
XX000234
00000000
19004400
12100000
c2210200
dcf60508
00000000


Using similar methods, I also made the following hack (which oddly doesn't seem to have been done before).
NOTE: This currently does not work in pSXfin (or on a real PS1?), but does work in ePSXe. I have no idea why :\ Perhaps one of the ASMers here can fix it.

BATTLE.BIN = 115868-f:
0a68050c
00000000

BATTLE.BIN = 11aa78-f:
1168050c
00000000

BATTLE.BIN = f3028-43:
XX000234
00000000
19005200
12100000
c2910200
0800e003
00000000

BATTLE.BIN = f3044-5f:
XX000234
00000000
19005000
12100000
c2810200
0800e003
00000000


*Full disclosure: I didn't do any real coding to make this. I basically just swiped some code from nates1984.xml and changed the addresses & registers as necessary. And credit also goes to pokeytax for the other (original) part of the hack.

Edit: Forgot something important. Choto's "R/S/M designates Learn on Hit" a couple posts back actually conflicts with pokeytax's Half of MP hack in its current form, so I advise making these changes to the Learning hack:

One section of it needs to be nudged forward 8 bytes. Change
<Location file="BATTLE_BIN" offset="F2Fb0">
to
F2Fb8

...and update the jump address like so:
<Location file="BATTLE_BIN" offset="127868">
EC670508
to
EE670508
8
PSX FFT Hacking / Re: ASM Requests
March 06, 2015, 12:26:11 pm
QuoteHow much are you willing to bet Grond?

l i t t l e   m o n e y
:)
Good job (and fast!), but for some reason it seems the back view is handled separately and was still bugged:

Kiyomori front vs back view

However I seem to have fixed that by changing the next 3 5c's in that code sequence into 1c's.

Masamune correct'd


Thanks, and hopefully this resolves the issue once and for all:
9
PSX FFT Hacking / Re: ASM Requests
March 03, 2015, 12:01:18 pm
This is a bugfix request, but I suppose it fits in here. Who else has noticed that all Draw Out abilities call up the wrong weapon graphic tiles? For most of them, the only visible problem is that the katana 'wraps' (or whatever the thing near the base of the blade is called) aren't right. However for Bizen Boat, Kiyomori, and Masamune, it actually reads past the katana graphic tiles and pulls up a rod graphic instead! I don't know whether this bug exists in the Japanese or PSP versions of the game.

This shows what tiles the code is calling vs what it should be.

Bizen Boat as an example. Photo on left is of retail game on real hardware (rod graphic outlined for clarity). Included to show that it isn't an emulation bug/bad game dump. On the right are emulator screenshots of the same.

Chirijiraden as a less obvious example. Correct graphic on the left (No wrap on blade). Wrong graphic at right (Green wrap).


Complicating the matter, I found a screen of Elmdor drawing Muramasa as a rod, and another of him drawing Kiku as a rod (both from the Let's Play Archive), so it seems Elmdor's (or his two unique Sword Spirit skillsets') draw out graphics are even more messed up than the regular versions. Regardless, you've probably all noticed that his draw out animations go completely screwy sometimes anyway.

So, any ASM-ers want to tackle this? I'm willing to bet it's a simple fix, if you know where to look.
10
Nice work on these sprites :)

I tweaked your Rudvich sprite a bit, since I think I will use it in my mod. I'm not a spriting expert, so it won't be 100% perfect or anything, but I suppose it's "good enough" if no one else wants to work on it. I also reverted the eyes on the portrait to the original's, which you may not like, but you can change them back I suppose.
11
PSX FFT Hacking / Re: Choto's ASM Hacks and Effects
March 30, 2014, 11:22:58 pm
No worries about the Hamedo quirk. I actually had it (+Counter) on a monster class that had Two Swords innate as well, so they were able to get 4 attacks in on whoever hit 'em.:D But I've just removed Two Swords from them to compensate for the quirk (it didn't function with their normal attack anyway). So yes, it's easy to work around.
12
PSX FFT Hacking / Re: Buggy ASM hacks
March 30, 2014, 11:11:07 pm
Cool, it seems to work fine now. Thanks! Others will use this too, no doubt.

Yes, Blue Mage (or similar) is an obvious class to include in a patch--it should have been in the original.

When I make ASM changes (modest as they tend to be) to FF1 I usually make plenty of mistakes and typically need lots of trial-and-error to get things working properly. I also seem to learn new things slowly and have a terrible memory, so I doubt my coding skills could ever come close to yours or some of the others'.:)
13
PSX FFT Hacking / Re: Buggy ASM hacks
March 30, 2014, 08:36:02 pm
The same problem persists with this version, oddly enough :| Maybe it's just not a feasible hack for whatever strange reason. Don't keep trying if you don't want to; it's not that important.
(Are you sure Jot5 is using it? I checked and it doesn't look like it is.)
14
PSX FFT Hacking / Re: Buggy ASM hacks
March 29, 2014, 10:41:11 pm
Ah, good work, Choto. It's better now, but it still has an issue, unfortunately. If my unit gets hit with an enemy skill he has already learned, something... odd happens. He will get Blue Magic as his primary action command, overwriting whatever is supposed to be there. And after the battle's end, the character has been automatically job-changed to Blue Mage. I'm using Calculator/Math Skill as my Blue Mage base job/class, if that's relevant in any way. Hope this is a minor fix.

And yes Celdia, I'm the same Grond that makes FF1 hacks (and not much else). I've only got a tiny bit of programmer in me, I'm afraid--ASM hacking doesn't come as easily to me as I would like. But I think (hope) I can make a fun FFT mod without having to learn a bit of PSX coding... but others can judge that later on when I've got something to show.
15
Great job on keeping the patcher suite maintained, but there are a few things in FFTPatcher that I think need addressing:

The "Ability Animations" (middle option) in the BATTLE.BIN patching subsection in the Patch PSX ISO dialog erroneously reverts the data at 0x2d3e6-2d40f (at least) back to vanilla defaults. This is actually the first few lines of the in-battle weapon & shield graphics & palette data and should not be overwritten. Please fix this if possible.

Also, could the deep blue "changes highlighting" in the program be made a bit less dark/intense (or make the color user-selectable)? It's too heavily contrasting IMO.

One last thing: would it be too much trouble to add an extra confirmation step (that defaults to No/Cancel) when saving a .fftpatch in a different format (PSX vs PSP) than the format it currently is in?

Thanks in advance.
16
PSX FFT Hacking / Re: Buggy ASM hacks
March 27, 2014, 05:12:46 pm
There weren't any conflicts, trust me. Like I said, I tested the patches individually with a clean ISO (.bin, technically) that I personally ripped with ImgBurn--and it has the same hashes as one of those in this topic (the crc32 = 377F6510 one), so it's almost certainly a good rip.

Though actually, on a closer read of the Raven's Spreadsheet Shop topic it seems that it's known that the Multipliers Editor has lingering issues. If I'd noticed that before I wouldn't have mentioned it here. Well, it's of little concern to me. If it gets fixed I might use it, but I can do without it for now.

Concerning your evasion reduction hack, I assume no problems will arise if I alter 0x11e858 to make it subtract a lesser amount? I imagine it will work fine, but I figured I'd ask.
17
PSX FFT Hacking / Re: Buggy ASM hacks
March 25, 2014, 02:18:29 pm
Thanks for the accuracy and evasion hacks! They seem to work fine after a brief test.

If you can't fix the Disable Move hack easily, don't worry about it. I was only using it for two abilities anyway, so I can design around not having it easily enough.

Unfortunately the big learning hack you posted is the same as the one I tried, just without the editable parts indicated. :| Looks like I won't have a Learning ability, but I don't too much mind having to be in the Blue Mage job to learn the skills.

Concerning the Multiplier Editor, I suppose I don't need it either since there are seperate small hacks for pretty much all that stuff already.

Thanks again.
18
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

19
PSX FFT Hacking / Re: Choto's ASM Hacks and Effects
March 24, 2014, 01:55:29 pm
Hello, nice hacks you've made here:)

However, your "Blank Support under Equip Change adds XX% to final hit%" patch doesn't seem to function as described. I tried it and it seems to double the base hit rates, and then adds the XX/YY value on top of that, which can lead to very high success rates.

Also, I'm having a minor issue with the Hamedo Fix, though it isn't a bug as much as it is an unintended side-effect, I suppose, but using this patch I noticed that giving Hamedo and Counter to the same unit (all monsters in my mod will have Counter + a second reaction innate) allows the unit to perform Hamedo and/or Counter in response to a single attack (letting it potentially get two hits in retaliation) when normally only one of the two reactions should randomly trigger. I haven't tested if this happens paired with anything besides Counter. I'm not too bothered by this, but if you can fix it without much trouble it would be nice, I suppose.

20
Unfortunately after searching around a bit more here it looks like the compressed stuff is just some male squire pieces (see melonhead's last post in http://ffhacktics.com/smf/index.php?topic=115.0 ). Perhaps the real compression data is somewhere else, or maybe it doesn't exist at all...

Anyway, I might try to clean up the parts of the priest that are usable, and then if someone else wants to draw the rest, they can.

While I'm posting, I'll toss this simple meliadoul/unused portrait mashup here: