Difference between revisions of "Compatibility"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Moved secondadvent patch in from Talk page)
Line 132: Line 132:
 
  0018a508:  [[51 Hit_(MA+X)%]]
 
  0018a508:  [[51 Hit_(MA+X)%]]
 
  0018a844:  [[58 Generic: Set_Morbol: Hit(MA+X)%]]
 
  0018a844:  [[58 Generic: Set_Morbol: Hit(MA+X)%]]
 +
 +
= secondadvent Compatibility patch =
 +
 +
A rewrite thanks to SecondAdvent.
 +
 +
This rewrite saves a large amount of space (from 0x80184a2C to 0x80184b23) and gives freedom to change the compatibility damage changes as well as an accessory to neutralize compatibility damage.
 +
 +
00184964: 340600XX ori r6,r0,0x00XX r6 = Accessory ID (for Neutralization)
 +
00184968: 3c078019 lui r7,0x8019
 +
0018496c: 8ce22d94 lw r2,0x2d94(r7) Load Attacker's Data Pointer
 +
00184970: 8ce32d98 lw r3,0x2d98(r7) Load Target's Data Pointer
 +
00184974: 9045001c lbu r5,0x001c(r2) Load Attacker's Accessory ID
 +
00184978: 9064001c lbu r4,0x001c(r3) Load Target's Accessory ID
 +
0018497c: 10a60029 beq r5,r6,0x00184a24 Branch if Attacker has Neutralization Accessory
 +
00184980: 3401000c ori r1,r0,0x000c r1 = 0c (Serpentarius)
 +
00184984: 90450009 lbu r5,0x0009(r2) Load Attacker's Zodiac
 +
00184988: 10860026 beq r4,r6,0x00184a24 Branch if Target has Neutralization Accessory
 +
0018498c: 00052902 srl r5,r5,0x04 r5 = Attacker's Zodiac
 +
00184990: 90640009 lbu r4,0x0009(r3) Load Target's Zodiac
 +
00184994: 10a10023 beq r5,r1,0x00184a24 Branch if Attacker is Serpentarius
 +
00184998: 00042102 srl r4,r4,0x04 r4 = Target's Zodiac
 +
0018499c: 10810021 beq r4,r1,0x00184a24 Branch if Target is Serpentarius
 +
001849a0: 0085302b sltu r6,r4,r5
 +
001849a4: 14060002 bne r0,r6,0x001849b0 Branch if Target's Zodiac < Attacker's Zodiac
 +
001849a8: 00a40823 subu r1,r5,r4 r1 = AZ - TZ
 +
001849ac: 00850823 subu r1,r4,r5 r1 = TZ - AZ
 +
001849b0: 84e538ce lh r5,0x38ce(r7) Load XA
 +
001849b4: 00e13021 addu r6,r7,r1
 +
001849b8: 90c6f600 lbu r6,-0x0a00(r6) Load Compat Modifier
 +
001849bc: 34010003 ori r1,r0,0x0003 r1 = 3 (Opposing)
 +
001849c0: 90420006 lbu r2,0x0006(r2) Load Attacker's Gender byte
 +
001849c4: 90630006 lbu r3,0x0006(r3) Load Target's Gender byte
 +
001849c8: 14c10009 bne r6,r1,0x001849f0 Branch if Compat Mod is not Opposing
 +
001849cc: 00622025 or r4,r3,r2
 +
001849d0: 30840020 andi r4,r4,0x0020
 +
001849d4: 1480000b bne r4,r0,0x00184a04 Branch if either is a Monster
 +
001849d8: 304200c0 andi r2,r2,0x00c0 r2 = Attacker's Gender
 +
001849dc: 306300c0 andi r3,r3,0x00c0 r3 = Target's Gender
 +
001849e0: 14620009 bne r3,r2,0x00184a08 Branch if Genders are Different
 +
001849e4: 34010XXX ori r1,r0,0x0XXX r1 = XXX (best modifier)
 +
001849e8: 08061282 j 0x00184a08
 +
001849ec: 34010XXX ori r1,r0,0x0XXX r1 = XXX (worst modifier)
 +
001849f0: 34010XXX ori r1,r0,0x0XXX r1 = XXX (good modifier)
 +
001849f4: 34020002 ori r2,r0,0x0002 r2 = 2 (Good)
 +
001849f8: 10460003 beq r2,r6,0x00184a08 Branch if they have Good compat
 +
001849fc: 34030001 ori r3,r0,0x0001 r3 = 1 (Bad)
 +
00184a00: 14660008 bne r3,r6,0x00184a24 Branch if they have Neutral compat
 +
00184a04: 34010XXX ori r1,r0,0x0XXX r1 = XXX (bad modifier)
 +
00184a08: 00250019 multu r1,r5 XA * XXX (X modifier)
 +
00184a0c: 00002812 mflo r5 r5 = XA * XXX
 +
00184a10: 00052a02 srl r5,r5,0x08 XA * XXX / 256
 +
00184a14: 1ca00002 bgtz r5,0x00184a20 Branch if XA is positive
 +
00184a18: 00000000 nop
 +
00184a1c: 34050001 ori r5,r0,0x0001 XA = 1
 +
00184a20: a4e538ce sh r5,0x38ce(r7) Store XA
 +
00184a24: 03e00008 jr r31
 +
00184a28: 00000000 nop

Revision as of 04:05, 3 October 2020

00184964: 27bdfff8 addiu r29,r29,0xfff8
00184968: 3406000c ori r6,r0,0x000c		r6 = c
0018496c: 3c028019 lui r2,0x8019
00184970: 8c422d94 lw r2,0x2d94(r2)		Load Attacker's Data Pointer
00184974: 3c038019 lui r3,0x8019
00184978: 8c632d98 lw r3,0x2d98(r3)		Load Target's Data Pointer
0018497c: 94420008 lhu r2,0x0008(r2)		Load Attacker's Zodiac + 1 byte
00184980: 94630008 lhu r3,0x0008(r3)		Load Target's Zodiac + 1 byte
00184984: 00022302 srl r4,r2,0x0c		r4 = Attacker's Zodiac
00184988: 00031b02 srl r3,r3,0x0c		r3 = Target's Zodiac
0018498c: 00802821 addu r5,r4,r0		r5 = Attacker's Zodiac
00184990: 10a60061 beq r5,r6,0x00184b18		Branch if Attacker is Serpentarius
00184994: 00601021 addu r2,r3,r0		r2 = Target's Zodiac
00184998: 3042ffff andi r2,r2,0xffff
0018499c: 1046005e beq r2,r6,0x00184b18		Branch if Target is Serpentarius
001849a0: 0045102b sltu r2,r2,r5
001849a4: 14400002 bne r2,r0,0x001849b0		Branch if Target's Sign is lower  than Attacker's
001849a8: 00831023 subu r2,r4,r3		r2 = AZ - TZ
001849ac: 00641023 subu r2,r3,r4		r2 = TZ - AZ
001849b0: 3042ffff andi r2,r2,0xffff
001849b4: 3c018019 lui r1,0x8019
001849b8: 00220821 addu r1,r1,r2
001849bc: 9024f600 lbu r4,-0x0a00(r1)		Load Compat Modifier
001849c0: 34020003 ori r2,r0,0x0003		r2 = 3 (Opposing)
001849c4: 308300ff andi r3,r4,0x00ff		r3 = Compat Modifier
001849c8: 14620015 bne r3,r2,0x00184a20		Branch if Compat Mod is not  Opposing
001849cc: 00000000 nop
001849d0: 3c028019 lui r2,0x8019
001849d4: 8c422d94 lw r2,0x2d94(r2)		Load Attacker's Data Pointer
001849d8: 00000000 nop
001849dc: 90430006 lbu r3,0x0006(r2)		Load Attacker's Gender byte
001849e0: 00000000 nop
001849e4: 30620020 andi r2,r3,0x0020
001849e8: 1440000d bne r2,r0,0x00184a20		Branch if Attacker is a Monster
001849ec: 34040001 ori r4,r0,0x0001		r4 = 1 (Bad)
001849f0: 3c028019 lui r2,0x8019
001849f4: 8c422d98 lw r2,0x2d98(r2)		Load Target's Data Pointer
001849f8: 00000000 nop
001849fc: 90450006 lbu r5,0x0006(r2)		Load Target's Gender byte
00184a00: 00000000 nop
00184a04: 30a20020 andi r2,r5,0x0020
00184a08: 14400005 bne r2,r0,0x00184a20		Branch if Target is a Monster
00184a0c: 306300c0 andi r3,r3,0x00c0		r3 = Attacker's Gender
00184a10: 30a200c0 andi r2,r5,0x00c0		r2 = Target's Gender
00184a14: 14620002 bne r3,r2,0x00184a20		Branch if Genders are Different
00184a18: 34040005 ori r4,r0,0x0005		r4 = 5 (Best)
00184a1c: 34040004 ori r4,r0,0x0004		r4 = 4 (Worst)
00184a20: 3c078019 lui r7,0x8019
00184a24: 24e738ce addiu r7,r7,0x38ce
00184a28: 84e20000 lh r2,0x0000(r7)		Load XA
00184a2c: 00000000 nop
00184a30: 00021840 sll r3,r2,0x01		XA * 2
00184a34: 00621821 addu r3,r3,r2		XA * 3
00184a38: 000318c0 sll r3,r3,0x03		XA * 24
00184a3c: 00622821 addu r5,r3,r2		XA * 25
00184a40: 00403021 addu r6,r2,r0		r6 = XA
00184a44: 308300ff andi r3,r4,0x00ff		r3 = 4 OR 5
00184a48: 34020002 ori r2,r0,0x0002		r2 = 2
00184a4c: 1062000f beq r3,r2,0x00184a8c		Branch if they have Good compat
00184a50: 30a2ffff andi r2,r5,0xffff		r2 = XA * 25
00184a54: 28620003 slti r2,r3,0x000 3
00184a58: 10400005 beq r2,r0,0x00184a70		Branch if they have Best/Worst  compat
00184a5c: 34020001 ori r2,r0,0x0001		r2 = 1
00184a60: 10620018 beq r3,r2,0x00184ac4		Branch if they have Bad compat
00184a64: 3c0351eb lui r3,0x51eb
00184a68: 080612bf j 0x00184afc
00184a6c: 00000000 nop
00184a70: 34020004 ori r2,r0,0x0004		r2 = 4
00184a74: 10620019 beq r3,r2,0x00184adc		Branch if they have Worst compat
00184a78: 34020005 ori r2,r0,0x0005		r2 = 5
00184a7c: 1062000a beq r3,r2,0x00184aa8		Branch if they have Best compat
00184a80: 3c0351eb lui r3,0x51eb
00184a84: 080612bf j 0x00184afc
00184a88: 00000000 nop
00184a8c: 3c0351eb lui r3,0x51eb
00184a90: 3463851f ori r3,r3,0x851f
00184a94: 00430019 multu r2,r3			XA * 25 * 0.32
00184a98: 00001010 mfhi r2			r2 = XA * 25 * 0.32 (XA * 8)
00184a9c: 00021142 srl r2,r2,0x05		XA * 8 / 32 (XA * 25 / 100, or XA  / 4)
00184aa0: 080612be j 0x00184af8
00184aa4: 00c21021 addu r2,r6,r2		r2 = XA + XA / 4
00184aa8: 3463851f ori r3,r3,0x851f
00184aac: 30a2ffff andi r2,r5,0xffff
00184ab0: 00430019 multu r2,r3			XA * 25 * 0.32
00184ab4: 00001010 mfhi r2			r2 = XA * 25 * 0.32 (XA * 8)
00184ab8: 00021102 srl r2,r2,0x04		XA * 8 / 16 (XA * 25 / 50, or XA /  2)
00184abc: 080612be j 0x00184af8
00184ac0: 00c21021 addu r2,r6,r2		r2 = XA + XA / 2
00184ac4: 3463851f ori r3,r3,0x851f
00184ac8: 30a2ffff andi r2,r5,0xffff
00184acc: 00430019 multu r2,r3			XA * 25 * 0.32
00184ad0: 00001010 mfhi r2			r2 = XA * 25 * 0.32 (XA * 8)
00184ad4: 080612bd j 0x00184af4
00184ad8: 00021142 srl r2,r2,0x05		XA * 8 / 32 (XA * 25 / 100, or XA / 4)
00184adc: 3c0351eb lui r3,0x51eb
00184ae0: 3463851f ori r3,r3,0x851f
00184ae4: 30a2ffff andi r2,r5,0xffff
00184ae8: 00430019 multu r2,r3			XA * 25 * 0.32
00184aec: 00001010 mfhi r2			r2 = XA * 25 * 0.32 (XA * 8)
00184af0: 00021102 srl r2,r2,0x04		XA * 8 / 16 (XA * 25 / 50, or XA / 2)
00184af4: 00c21023 subu r2,r6,r2		XA - XA / 4 OR 2
00184af8: a4e20000 sh r2,0x0000(r7)		Store new XA
00184afc: 3c038019 lui r3,0x8019
00184b00: 246338ce addiu r3,r3,0x38ce
00184b04: 84620000 lh r2,0x0000(r3)		Load XA
00184b08: 00000000 nop
00184b0c: 1c400002 bgtz r2,0x00184b18		Branch if XA is positive
00184b10: 34020001 ori r2,r0,0x0001		r2 = 1
00184b14: a4620000 sh r2,0x0000(r3)		Store XA = 1
00184b18: 27bd0008 addiu r29,r29,0x0008
00184b1c: 03e00008 jr r31
00184b20: 00000000 nop


Return Locations

001865d0:  Set XA + YA for Status Formulas (Stupid section)
00188620:  Physical XA Modifying Statuses/Support 
00188764:  Magical Support/Status/Compat
00188810:  MA + X
00188868:  Magical XA * YA
00188afc:  Cluster of Physical Routines
00188d4c:  07 Heal_(Weapon)
00189018:  0E Dmg_(Y)% Hit_F(MA+X)% 100% Status Hide Status
001898b0:  28 StealExp_(Lowest of TarCurExp & SP+Y) Hit_(SP+X)%
00189920:  29 OppositeSex: Hit_(MA+X)%
00189a44:  2A Hit_(MA+X)% // AffectBraveOrFaith(Y)
00189e48:  33 Hit_(PA+X)% 
00189eac:  34 Heal_(PA*Y) HealMP_(PA*Y/2)
00189f20:  35 Heal_(Y)% Hit_(PA+X)%
0018a18c:  42 Dmg_(PA*Y) DmgCas_(PA*Y/X)
0018a508:  51 Hit_(MA+X)%
0018a844:  58 Generic: Set_Morbol: Hit(MA+X)%

secondadvent Compatibility patch

A rewrite thanks to SecondAdvent.

This rewrite saves a large amount of space (from 0x80184a2C to 0x80184b23) and gives freedom to change the compatibility damage changes as well as an accessory to neutralize compatibility damage.

00184964: 340600XX ori r6,r0,0x00XX		r6 = Accessory ID (for Neutralization)
00184968: 3c078019 lui r7,0x8019
0018496c: 8ce22d94 lw r2,0x2d94(r7)		Load Attacker's Data Pointer
00184970: 8ce32d98 lw r3,0x2d98(r7)		Load Target's Data Pointer
00184974: 9045001c lbu r5,0x001c(r2)		Load Attacker's Accessory ID
00184978: 9064001c lbu r4,0x001c(r3)		Load Target's Accessory ID
0018497c: 10a60029 beq r5,r6,0x00184a24		Branch if Attacker has Neutralization Accessory
00184980: 3401000c ori r1,r0,0x000c		r1 = 0c (Serpentarius)
00184984: 90450009 lbu r5,0x0009(r2)		Load Attacker's Zodiac
00184988: 10860026 beq r4,r6,0x00184a24		Branch if Target has Neutralization Accessory
0018498c: 00052902 srl r5,r5,0x04		r5 = Attacker's Zodiac
00184990: 90640009 lbu r4,0x0009(r3)		Load Target's Zodiac
00184994: 10a10023 beq r5,r1,0x00184a24		Branch if Attacker is Serpentarius
00184998: 00042102 srl r4,r4,0x04		r4 = Target's Zodiac
0018499c: 10810021 beq r4,r1,0x00184a24		Branch if Target is Serpentarius
001849a0: 0085302b sltu r6,r4,r5
001849a4: 14060002 bne r0,r6,0x001849b0		Branch if Target's Zodiac < Attacker's Zodiac
001849a8: 00a40823 subu r1,r5,r4		r1 = AZ - TZ
001849ac: 00850823 subu r1,r4,r5		r1 = TZ - AZ
001849b0: 84e538ce lh r5,0x38ce(r7)		Load XA
001849b4: 00e13021 addu r6,r7,r1
001849b8: 90c6f600 lbu r6,-0x0a00(r6)		Load Compat Modifier
001849bc: 34010003 ori r1,r0,0x0003		r1 = 3 (Opposing)
001849c0: 90420006 lbu r2,0x0006(r2)		Load Attacker's Gender byte
001849c4: 90630006 lbu r3,0x0006(r3)		Load Target's Gender byte
001849c8: 14c10009 bne r6,r1,0x001849f0		Branch if Compat Mod is not Opposing
001849cc: 00622025 or r4,r3,r2
001849d0: 30840020 andi r4,r4,0x0020
001849d4: 1480000b bne r4,r0,0x00184a04		Branch if either is a Monster
001849d8: 304200c0 andi r2,r2,0x00c0		r2 = Attacker's Gender
001849dc: 306300c0 andi r3,r3,0x00c0		r3 = Target's Gender
001849e0: 14620009 bne r3,r2,0x00184a08		Branch if Genders are Different
001849e4: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (best modifier)
001849e8: 08061282 j 0x00184a08
001849ec: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (worst modifier)
001849f0: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (good modifier)
001849f4: 34020002 ori r2,r0,0x0002		r2 = 2 (Good)
001849f8: 10460003 beq r2,r6,0x00184a08		Branch if they have Good compat
001849fc: 34030001 ori r3,r0,0x0001		r3 = 1 (Bad)
00184a00: 14660008 bne r3,r6,0x00184a24		Branch if they have Neutral compat
00184a04: 34010XXX ori r1,r0,0x0XXX		r1 = XXX (bad modifier)
00184a08: 00250019 multu r1,r5			XA * XXX (X modifier)
00184a0c: 00002812 mflo r5			r5 = XA * XXX
00184a10: 00052a02 srl r5,r5,0x08		XA * XXX / 256
00184a14: 1ca00002 bgtz r5,0x00184a20		Branch if XA is positive
00184a18: 00000000 nop
00184a1c: 34050001 ori r5,r0,0x0001		XA = 1
00184a20: a4e538ce sh r5,0x38ce(r7)		Store XA
00184a24: 03e00008 jr r31
00184a28: 00000000 nop