• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 19, 2024, 08:40:23 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.


Hamedo Fix Request

Started by Devreckas, November 07, 2013, 08:21:41 pm

Devreckas

I was wondering if it was possible to hack 'hamedo' so the defending unit still strikes the attacking unit first, but doesn't negate their attack?

Timbo

  • Modding version: PSX
  • Discord username: Timbo

Devreckas

Yeah, I may be wrong, but from the in-game description it seems like this was their original intent.  I mean even this version is a huge improvement on counter, and having hamedo negate the attack just makes it ridiculously OP.

Choto

Hamedo is a little strange in that it doesn't act like most other reactions. I remember seeing it get checked in a weird place. I'm not really sure how an attack gets cancelled because of the reaction either. FDC might know more about it than me...

formerdeathcorps

It's not quite so easy.  If the defender was to get first strike rather than preemption, we have to then store the data of the attacker somewhere while reminding FFT that the reaction already occurred.

Courtesy of secondadvent (Annotated by me):

0017e064: 9202008e lbu r2,0x008e(r16)      Load 4th set of Reactions
0017e068: 00000000 nop            
0017e06c: 30420001 andi r2,r2,0x0001      
0017e070: 10400036 beq r2,r0,0x0017e14c      Branch if Hamedo is not equiped
0017e074: 2402ffff addiu r2,r0,0xffff      
0017e078: 0c0634e1 jal 0x0018d384      Chance to react
0017e07c: 02002021 addu r4,r16,r0      
0017e080: 14400032 bne r2,r0,0x0017e14c      Branch if RNG roll failed
0017e084: 2402ffff addiu r2,r0,0xffff      
0017e088: 02002021 addu r4,r16,r0                     
0017e08c: 0c06325a jal 0x0018c968              Deep Water check
0017e090: 2614016e addiu r20,r16,0x016e               r20 = Defender's ID's address
0017e094: 1440002d bne r2,r0,0x0017e14c              If so, branch to end
0017e098: 2402ffff addiu r2,r0,0xffff
0017e09c: 3c058019 lui r5,0x8019
0017e0a0: 24a53848 addiu r5,r5,0x3848                  r5 = an address of values that is currently blank
0017e0a4: 3c018019 lui r1,0x8019
0017e0a8: ac33f5f0 sw r19,-0x0a10(r1)                  A value that isn't 1 is stored (When this word = 1, the game knows it is the player's decision phase)
0017e0ac: 0c01788b jal 0x0005e22c                       Transfer Defender's ID byte to Mount Data byte's values to 0x193848 - 5C
0017e0b0: 02802021 addu r4,r20,r0
0017e0b4: 02002021 addu r4,r16,r0                         r4 = Defender's Main Data Table Address
0017e0b8: 34050001 ori r5,r0,0x0001                       r5 = 1
0017e0bc: 340201c5 ori r2,r0,0x01c5                       r2 = Hamedo's ability ID
0017e0c0: 00003021 addu r6,r0,r0                           r6 = 0
0017e0c4: 34070001 ori r7,r0,0x0001                        r7 = 1
0017e0c8: 3c018019 lui r1,0x8019
0017e0cc: a4222d9c sh r2,0x2d9c(r1)                       Counter Used = Hamedo
0017e0d0: 3c018019 lui r1,0x8019
0017e0d4: ac35f8c8 sw r21,-0x0738(r1)                    Acting Unit ID = Attacker ID
0017e0d8: 0c05f994 jal 0x0017e650                           Big Routine...
0017e0dc: a212016e sb r18,0x016e(r16)                    Defender's ID's address = Defender ID
0017e0e0: 14400015 bne r2,r0,0x0017e138                 If target is out of range, switch data back to normal and goto END.
0017e0e4: 00000000 nop
0017e0e8: 0c05f688 jal 0x0017da20                          MP Cost Section (Square...)
0017e0ec: 02002021 addu r4,r16,r0
0017e0f0: 14400011 bne r2,r0,0x0017e138                 Branch if Attack cannot be cast
0017e0f4: 00000000 nop
0017e0f8: 0c05f528 jal 0x0017d4a0                           Multi-Hit Formula (if you have 2S), Disables Procs
0017e0fc: 02002021 addu r4,r16,r0
0017e100: 3c028019 lui r2,0x8019
0017e104: 94422d9c lhu r2,0x2d9c(r2)
0017e108: 00000000 nop
0017e10c: a6c20000 sh r2,0x0000(r22)                     Stores Hamedo Ability ID to  ???
0017e110: 3c018019 lui r1,0x8019
0017e114: ac3338bc sw r19,0x38bc(r1)                  A value that isn't 1 is stored (When this word = 1, the game knows it is the player's decision phase...Square is being redundant; this already exists at 18f5f0)
0017e118: 92230003 lbu r3,0x0003(r17)
0017e11c: 3402005d ori r2,r0,0x005d
0017e120: 14620003 bne r3,r2,0x0017e130              If defender isn't a mime, GOTO 17e130     
0017e124: 340200ff ori r2,r0,0x00ff
0017e128: a222001d sb r2,0x001d(r17)                   ELSE, defender's RH and LH weapons are force-unequipped (Square....)
0017e12c: a222001f sb r2,0x001f(r17)
0017e130: 0805f853 j 0x0017e14c                          GOTO END, return defender ID (meaning that all the damage has been set up, now the routine that reads this sets the turn to defender; attacker data has already been wiped between the Multi-Hit routine, MP Cost routine, and Rangefinder routine)
0017e134: 02401021 addu r2,r18,r0
0017e138: 3c048019 lui r4,0x8019
0017e13c: 24843848 addiu r4,r4,0x3848
0017e140: 0c01788b jal 0x0005e22c                          Set data back to normal
0017e144: 02802821 addu r5,r20,r0
0017e148: 2402ffff addiu r2,r0,0xffff
0017e14c: 8fbf0044 lw r31,0x0044(r29)                      ASM commands that lead to a return value


I'll write a proper hack for this later, but I suspect it will be ugly.
The destruction of the will is the rape of the mind.
The dogmas of every era are nothing but the fantasies of those in power; their dreams are our waking nightmares.

Timbo

It might be ugly but for me, it puts Hamedo back on the table. Without this hack, I surely won't be using it as a Reaction.
  • Modding version: PSX
  • Discord username: Timbo

Devreckas

Thanks for all the work FDC, I think this will really help with some balancing issues in my patch.

HalfGodBro

Reviving this post because i am also looking for an Hamedo fix like this, but i dont know how can i patch my iso with that thing you posted  formerdeathcorps?

Choto

February 04, 2014, 10:52:08 pm #8 Last Edit: February 05, 2014, 10:04:17 am by Choto
What he posted is the code behind Hamedo, it's not a hack. I've since made a somewhat thorough pass through that routine and the ones around it yet come up without a hack. I'm planning on seeing it through but it may be awhile. I did find out how to make the hamedo ability something other than attack though! lol... stand by for awhile.

Edit: Very unexpectedly, I figured this out. Here is a hamedo fix hack:


<Patch name="Original attacker hits after hamedo">
<Location file="BATTLE_BIN" offset="1095c">
00000000
</Location>
<Location file="BATTLE_BIN" offset="117114">
00000000
</Location>
</Patch>

Vanya

  • Modding version: Other/Unknown
¯\(°_0)/¯