• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 02:17:39 pm

News:

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


Kapilapis's ASMs, fixes and notes

Started by Kapilapis, April 29, 2021, 06:30:26 pm

Kapilapis

April 29, 2021, 06:30:26 pm Last Edit: April 01, 2022, 07:06:52 pm by Kapilapis
This thread has a collection of ASM Hacks that I either made or altered/fixed to use in Lapis Tactics as well as some notes on other hacks I tried out and had issues with.

Hacks I wrote:

Elixir heals undead:
So AI doesn't just bully undead with their infinite 100% accuracy instant one shot move.
<Patch name="Elixir heals undead">
      <Location file="BATTLE_BIN" offset="1232D4">
        E41C060C
      </Location>
  </Patch>

1 HP Golem:
Golem works exactly the same as vanilla except its health is capped to 1. What that means is that it will only block a single instance of physical damage.
<Patch name="Low HP Golem">
<Description>Formula 14 sets Golem's HP to 1</Description>
<Location file="BATTLE_BIN" offset="124FB4">
01000224
</Location>
</Patch>

Formula 19 is Seal Evil formula for Dark/Evil Looking:
This makes Formula 19 into a (Sp+x)% ailment infliction that only works if the target has Dark/Evil Looking. In my patch I used it to flag Animal type monsters so Ranger abilities could hit them specifically (for example, a Red Panther can be Charmed by a Ranger but not a Skeleton).
You will need to use ASM hacks to make Dark/Evil Looking march normally and recolor the sprite to look normal if you use this (provided below).
<Patch name="Formula 19 is Seal Evil formula for Dark/Evil Looking">
<Description>Inflicts ailment at (Sp+X)% against targets with Dark/Evil Looking</Description>
<Location file="BATTLE_BIN" offset="128674">B89F1580<!--Formula 19--></Location>
<Location file="BATTLE_BIN" offset="F2FB8">
E8FFBD27
1000BFAF
8C17060C <!-- Loads SP and X -->
00000000
7E21060C <!-- Zodiac Calculation -->
00000000
6719060C <!-- Loads SP + X as X -->
00000000
441D060C <!-- Total Accuracy Check -->
00000000
1980023C
902D428C
00000000
00004290
00000000
0F004010
00000000
1980023C
982D428C
00000000
59004290 <!-- Load status group 59 -->
00000000
02004230 <!-- Cursed -->
05004014 <!-- Cursed check -->
00000000
C310060C <!-- ELSE FAIL routine -->
00000000
0D680508
00000000
C91F060C <!-- Status Proc -->
00000000
1000BF8F
1800BD27
0800E003
00000000
</Location>
</Patch>
These status recoloration edits were made with Raven's tools https://ffhacktics.com/smf/index.php?topic=7271.0
The ASM to make Dark/Evil Looking march normally is also included in the spreadsheet.
<Patch name="Status Coloration Edits">
    <Location file="BATTLE_BIN" offset="1b3f0">
    FF101000
    FF101000
    0FFCFCFC060102
    0A03FF08060000
    13080000040000
    1F000800050000
    1E000008040000
    17FCFCFC050000
    09000000040000
    04040005058B02
    FF000000060000
    FF000000060000
    FF000000060000
    FF000000060000
    FF000000060000
    FF000000060000
    FF000000060000
    FF000000060000
    </Location>
    <Location file="BATTLE_BIN" offset="1b2bc">
    D0FFBD27
    3E018290
    2800BFAF
    3D004014
    2140C000
    04008790
    21280000
    3401898C
    0800023C
    F0234634
    10000224
    250382A0
    270382A0
    0000C390
    0100A524
    FF000234
    27006210
    2000622C
    04004014
    00000000
    5C002291
    C7080208
    E0FF6324
    5800228D
    01000124
    04186100
    24104300
    1D004010
    0300A32C
    06006010
    00000000
    0100C180
    0200C280
    250381A0
    E7080208
    270382A0
    06008180
    0500C280
    0600C380
    23102200
    2B084300
    0F002014
    0300A32C
    0100C180
    0200C280
    0300C380
    0400C580
    1400A1AF
    1800A2AF
    1C00A3AF
    1000A0AF
    03000634
    4408020C
    2000A8AF
    F0080208
    00000000
    0300A32C
    02006014
    0400C624
    0300C624
    1200A22C
    CFFF4014
    00000000
    5507020C
    21300001
    2800BF8F
    3000BD27
    0800E003
    00000000
    </Location>
    </Patch>
<Patch name="Character with Dark/Evil Looking Marches Normally">
<Location file="BATTLE_BIN" offset="1c0a4">
0c004010
</Location>
</Patch>

Formula 19 is Seal Evil formula for Wall:
Same as above but uses Wall isntead of Dark/Evil Looking. This is what I was originally going to use in the mod, but turns out that the ASM to make Wall lose all hard-coding does not lose the bit of hard-coding that makes Walled targets immune to Invite. Needless to say, you will need an ASM to make Wall lose all hard-coding if you want to use this one. It does not require recolors, but beware of the Invitation caveat if you wish to use this version.
<Patch name="Formula 19 is Seal Evil formula for Wall">
<Description>Formula 19 Inflicts ailment at (Sp+X)% against targets with Wall</Description>
<Location file="BATTLE_BIN" offset="128674">B89F1580<!--Formula 19--></Location>
<Location file="BATTLE_BIN" offset="F2FB8">
E8FFBD27
1000BFAF
8C17060C <!-- Loads SP and X -->
00000000
7E21060C <!-- Zodiac Calculation -->
00000000
6719060C <!-- Loads SP + X as X -->
00000000
441D060C <!-- Total Accuracy Check -->
00000000
1980023C
902D428C
00000000
00004290
00000000
0F004010
00000000
1980023C
982D428C
00000000
5B004290 <!-- Load status group 5B -->
00000000
01004230 <!-- Wall -->
05004014 <!-- Wall Check -->
00000000
C310060C <!-- ELSE FAIL routine -->
00000000
0D680508
00000000
C91F060C <!-- Status Proc -->
00000000
1000BF8F
1800BD27
0800E003
00000000
</Location>
</Patch>

Faith magic with 100% proc:
Same as the regular Faith magic formula but with 100% ailment proc rate. Weeks after writing this one I realized there was already a similar hack included in the orgASM download. This one does not overwrite base formula 8, however, allowing you more freedom to choose the proc rate for your faith spells. (base formula 8 for 19%, formula 13 with separate flag for 25%s, formula 13 with all or nothing for 100%, etc)
<Patch name="Faith magic with 100% proc">
<Description>Formula 13 becomes Dmg_F(MA*Y) ME with 100% ailment proc rate</Description>
<Location file="BATTLE_BIN" offset="12865C">E4101580<!--Formula 13--></Location>
<Location file="BATTLE_BIN" offset="EA0E4">
E8FFBD27
1000BFAF
6E21060C <!-- Magical Evade Calculation -->
00000000
13004014 <!-- Branch if attack is evaded  -->
00000000
2517060C <!-- Store MA and Y -->
00000000
FF17060C <!-- Elemental Strengthen -->
00000000
D121060C <!-- Magical Support/Status/Compat -->
00000000
DF21060C <!-- Element XA * YA -->
00000000
09004014
00000000
541C060C <!-- Faith calculation -->
00000000
C721060C <!-- Elemental absorb and status roll -->
00000000
01004014 <!-- (doesn't) Branch if status effect roll fails -->
00000000
AD1F060C <!-- Apply status (to action) - (Preserve hit status, evade type, hit %) -->
00000000
1000BF8F
1800BD27
0800E003
00000000
</Location>
</Patch>

Weapon Guard innate all:
This one needs a bit of a longer explanation:
First I tried the (Choto's untested fix) included in orgASM's download. Apparently it works for other people, from what I could gather from forum comments, but in the emulator I was using, it would crash the game every time I tried to attack someone. I have no idea why this happened and I will elaborate on why in a bit.
Then I tried Xifanie's original version. It seemed to work perfectly at first but, considering there was a fix to it, I knew there should be something wrong with that version. Upon further testing, I found out that weapon evasion only worked on the right hand and shield evasion only worked on the left hand in that version.
After that I just decided to take matters into my own hands and check the wiki for how Weapon Guard is checked and see if I could make my own version of the ASM. Essentially just turn the lines that ask "do you have Weapon Guard" off and voila, hack done.
After writing that version of the hack, I went back and checked how the other two versions were done. Xifanie's original version was skipping a few too many steps of the check, and that's why it disabled Shield evasion in one hand and Weapon evasion in the other.
Choto's untested fix seems to have been made to dirty patch on top of Xifanie's, because it has a redundant line of code that overwrites a default line with itself. Other than that single line, it is the same as the version I had written myself. And that is why I am very confused about how that could have caused crashes for me.
Anyway, all that story is the reason I classify this under limbo. I wrote it from scratch, checking only the wiki for reference, but it is also a (tested) fix for a hack that already existed before.
<Patch name="Weapon Guard check removed (WG 'innate' all)">
      <Location file="BATTLE_BIN" offset="11e0d0">
        00000000
      </Location>
      <Location file="BATTLE_BIN" offset="11e178">
        00000000
      </Location>
  </Patch>

Edited/fixed hacks:

Blade Grasp dodge percentage is (Brave * Multiplier) / 1024 and only affects certain weapons:
This is a Glain hack that didn't even load in orgASM when I tried loading it. The problem was in how the customizable variables were set. I don't know how to make them customizable, but removing them and just adding the values manually worked to fix it.
The values I have set up for it make Blade Grasp work on Daggers, Ninjato, Swords, Knightswords, Katanas and Axes.
The bolded portions are what you need to edit if you want to change which weapons it works with and the brave multiplier for its success rate.
<Patch name="Blade Grasp dodge percentage is (Brave * Multiplier) / 1024 and only affects certain weapons">
        <Description>
            Blade grasp only affects weapons with ID from 0x01 up to Max Weapon ID. 
            Example multiplier values:
                0x400 (vanilla) -> 1024 / 1024 (full)
                0x200 (half)    -> 512 / 1024 (1/2)
                0x180 (default) -> 384 / 1024 (3/8)
                0x100 (quarter) -> 256 / 1024 (1/4)
        </Description>
        <Location file="BATTLE_BIN" offset="18D050" mode="ASM" offsetMode="RAM">
                lui    t0, 0x8019
                lbu    t1, 0x38f6(t0)
                lbu    t2, 0x38d8(t0)
                addiu  sp, sp, -24
                andi    t1, t1, 0x10
                addiu  t2, t2, -1
                sltiu  t2, t2, 0x32
                sltu    t1, zero, t1
                sltu    t2, zero, t2
                and    t1, t1, t2
                beq    t1, zero, end
                sw      ra, 16(sp)
                lw      a0, 0x2d98(t0)
                li      t3, 100
                lbu    t1, 0x24(a0)
                lw      t2, 0x2d90(t0)
                li      a1, 0x400
                multu  t1, a1
                mflo    t1
                addiu  t1, t1, 512
                srl    t1, t1, 10
                subu    t1, t3, t1
                jal    0x8018d388
                sh      t1, 0x2a(t2)
                bne    v0, zero, end
                lui    t0, 0x8019
                lw      t1, -0x0a04(t0)
                lw      t2, 0x2d90(t0)
                bne    t1, zero, end
                li      t3, 11
                sb      zero, 0(t2)
                sb      t3, 2(t2)
                li      t3, 0x01c3
                sh      t3, 14(t2)
       
            end:
                lw      ra, 16(sp)
                addiu  sp, sp, 24
                jr      ra
                nop
        </Location>
        <Location file="BATTLE_BIN" offset="18D384" mode="ASM" offsetMode="RAM">
                li      a1, 1024
                lui    v0, 0x8019
                lw      v0, -0x0a04(v0)
                lbu    t0, 0x24(a0)
                bne    v0, zero, end
                multu  t0, a1
                mflo    t0
                addiu  t0, t0, 512
                srl    a1, t0, 10
                j      0x8005e0cc
                li      a0, 100

            end:
                jr      ra
                nop
        </Location>
    </Patch>


Miscellaneous notes on other hacks:

Pokeytax's "Learning Support Hack"

While the learning support does work, it glitches your HP/MP bars making them fly off screen every time a learning check is performed and sometimes causes your main skillset to be replaced by the skillset of the job you are learning things from. Resulting in silly situations such as <this one>

FFMaster's "Slow is 25% speed loss"
The hack actually makes slow reduce your speed -to- 25% rather than -by- 25%.
e.g. instead of turning an 8 into a 6 as advertised, it turns an 8 into a 2.
Only use it if you want Slow to be ridiculously powerful.

Razele's "Blade Grasp trigger: weapon attack"

For this hack, instead of setting what you want to Blade Grasp as instructed, you have to set what you want Blade Grasp to ignore.
But, even then, there are weird side effects: grasping fists will make all Monk skills Blade Graspable, including Chakra. A character with Blade Grasp will dodge his own Chakra(!!). Similarly, grasping Katakas will block Draw Out (and yes, a character with Blade Grasp <will dodge his own Kiyomori> and such)
  • Modding version: PSX

nitwit

April 29, 2021, 11:49:20 pm #1 Last Edit: April 30, 2021, 08:12:40 pm by nitwit
I may be mistaken, but I believe there are features in FFTOrgASM which allow a degree of customization for asm hacks. You could use that to make your formula 19 hacks check for any debuff, by altering the byte loaded and bit checked for.

Should be pretty obvious how it works (and how to customize it without such niceties) for anyone with freshman level coding experience who wants to change the status effect used, but it's something to consider if you're so inclined and want to make it easier on other people.

Kapilapis

That's a really good idea that didn't even cross my mind. I will look into it as soon as I can.
  • Modding version: PSX

JadeKnightblazer

May 24, 2021, 07:28:46 am #3 Last Edit: May 24, 2021, 11:11:12 am by JadeKnightblazer
please delete
  • Modding version: PSX
  • Discord username: JadeKnightblazer

Nyzer

There is a topic for ASM requests. Please don't jump into someone's personal topic to request hacks.
  • Modding version: Other/Unknown