Found a bug with the Equip Change Fix hack: because Defend runs the same set of code that is altered, Defend tries to load data that would be set by EQUIP.OUT during Equip Change but turns out to just be junk data when using Defend. As a result, sometimes Defend would consume Act, and sometimes it would not.
Here's an update that would allow the modder to choose whether Defend consumes Act or not:
Here's an update that would allow the modder to choose whether Defend consumes Act or not:
Code Select
<Patch name="Equip Change Fix">
<Author>Xifanie, with a fix from Nyzer</Author>
<Description>Allows changing your Right Hand/Left Hand equipments without consuming your Act.
Additionally, can optionally prevent Defend from consuming Act as well.</Description>
<Location file="BATTLE_BIN" offset="E929E" mode="DATA">
00
</Location>
<Location file="BATTLE_BIN" offset="E9AA0" mode="ASM">
@EquipChangeKanji1: lbu r1,0x0005(r16) # Load unit's used skillset
ori r2,r0,0x0003 # r2 = 3 - Equip Change
bne r1,r2,@eqch_br_1 # Branch if not using Equip Change
ori r3,r0,%DefendConsumesAct
sw r6,0x0000(r29)
sw r7,0x0004(r29)
addiu r6,r0,0x0002
lui r7,0x801f
lw r7,-0x6d1c(r7)
lui r5,0x801e
addiu r5,r5,-0x781c
addiu r7,r7,0x0004
@eqch_br_2: lhu r3,0x0054(r7)
lh r2,0x0000(r5)
addiu r7,r7,0x0002
addiu r5,r5,0x0002
bne r2,r3,@eqch_br_1
ori r3,r0,0x0001
sltiu r2,r6,0x0005
bne r2,r0,@eqch_br_2
addiu r6,r6,0x0001
ori r3,r0,0x0000
@eqch_br_1: lui r2,0x8015
lw r2,-0x2cfc(r2)
ori r5,r0,0x01c0
mult r5,r2
mflo r5
lui r1,0x8019
addiu r1,r1,0x08cc
addu r1,r1,r5
sb r3,0x0188(r1)
lui r1,0x8015
ori r5,r0,0x0001
subu r3,r5,r3
sb r3,0x029e(r1)
lw r6,0x0000(r29)
lw r7,0x0004(r29)
@used_defend: j 0x000751c8
addiu r29,r29,0x0008
@EquipChangeKanji2: sb r0,0x029e(r4)
beq r5,r0,@eqch_br_3
ori r5,r0,0x0001
j 0x00138f18
sw r5,0x0110(r29)
@eqch_br_3: bne r2,r3,@eqch_end
sw r3,0x0110(r29)
sw r0,0x0110(r29)
@eqch_end: j 0x00138f18
nop
</Location>
<Location file="BATTLE_BIN" offset="751C0" offsetMode="RAM" mode="ASM">
j @EquipChangeKanji1
addiu r29,r29,-0x0008
</Location>
<Location file="BATTLE_BIN" offset="138F0C" offsetMode="RAM" mode="ASM">
lui r4,0x8015
j @EquipChangeKanji2
lbu r5,0x029e(r4)
</Location>
<Variable name="Defend Consumes Act" default="1" bytes="1" symbol="true"/>
</Patch>