• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 06:57:46 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.


Dokurider's Custom AoEs

Started by Dokurider, April 21, 2014, 04:41:48 pm

Xifanie

June 04, 2014, 06:53:14 pm #40 Last Edit: June 04, 2014, 07:46:44 pm by Xifanie
Doing a simple hex search flipping the bytes of the errors, I was able to easily deduct that you are branching to 0x80158748, which seems to be kanji space, but wasn't overwritten with your code.
Your code writes more to like... 0x8014F568

And really, I've made many many hacks if you didn't notice. If you want things to work, you have to make sure everything on your end first, which I doubt you did.

This whole thing is also stuff that I could never hope to understand.


  • Only a few mod makers will actually use your hack

  • Even fewer will actually want to test it

  • Even fewer will report bugs



Welcome to ASM hacking.

Also congrats, I ran your .xml through my MIPS analyzer, which detects most (but not all) console freezing bugs, and it returned 0 errors. \o/
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

Dokurider

Except it is working on my end, flawlessly. I'm looking at my game running it right now (posting from a phone; can't see images btw) with zero errors whatsoever. I just don't understand why Celdia is getting errors running the exact same code I uploaded this morning (which I tested before heading out to the computer lab) that is now running right in front of me with no issues. I Just don't know, bra, but I'm doing everything I can think of to troubleshoot.

Choto

June 04, 2014, 10:38:32 pm #42 Last Edit: June 04, 2014, 10:51:15 pm by Choto
savestate --> step through it with a debugger to see what command its crashing at. It's pretty much the quickest way to figure out why and where something's crashing.

Celdia, I'm assuming you tried the hack by itself to rule out a conflict right?

Celdia

The hack by itself has some interesting effects:

- Normal attacks are unaffected.
- Skills, for the most part seem unaffected.
- Queklain attempting to act crashes the game, sending it into a loop of errors that I didn't bother to screenshot.
- Dance and Sing do literally nothing. They show no active targets when selected and they play no animation I assume because they aren't going to hit anyone. Amusingly, the Dancing unit does stop dancing long enough to punch at empty air while the Singing unit just continues his normal singing animation throughout.

Again, this is applying the Cone AoE Final2 hack and nothing else. Without modifying anything with FFTP in some fashion though, I don't have any way to really test the conic AoE. I'm going to try modifying Ramza at ENTD 0183 as suggested and starting a new game to see what effect that has, if any. Will edit this post with results.

EDIT: Doku, this is the weirdest hack, ever. And I use ALMA, ffs.

So, modifying Ramza and starting a new game [I decided to actually modify his Ch2 Squire skillset instead of the ENTD itself,] this hack works seemingly as-expected. I used Wave Around since that was your test skill initially, set for 3/131/1 and it gave me no problems at all. Some of the potential AoEs possible from selecting different tiles was interesting, so I looked deeper and tried my original idea. I chose a different skill [Head Break] and gave it 5/133/3 which resulted in more interesting changes. The targeting worked fine for the first 3 tiles out from Ramza, forming a 5-tile cone originating from the selected tile. But selecting the 4th and 5th tiles out caused the AoE to start from Ramza and spread to end of the map. On Orbonne, this results in a total AoE of Cone-8. Which, by the way, also works. I tried some more modifications and then I went to apply a change to the skill name I'd been working with to use for a quick demo video...and when Gaffy tried to move I got this:


I don't even know. So I started over from scratch, applied just Cone Final2 and my Patcher changes and it went back to functioning fine. Even tested my old .fftp for its changes and had no problems. It's looking like my changes in Tactext may have been the culprit after all this which while making me look like the fool still possibly reveals a different problem with the hack.

Pre-Edit: Just applied the Tactext change again, which is literally ONE skill name being lengthened, and it crashes. So, I've located the source of the error in my case. But if this hack can't be used with any text changes, I don't see it going too far. I'll keep checking in here for updates though.
  • Modding version: PSX
  • Discord username: Celdia#0

Choto

The gaffy thing sounds like an AI issue. Try setting Rama to auto battle. They do some calculations to find max and min range attacks

Dokurider

QuoteFFTactext

Oh of course. FFTactext overwrites text space, and this hack is saved in, wait for it, text space, albeit space that isn't supposed to be used in the NTSC-U, Kanji Space. Did you apply FFTactext before you patched, or after and what skill did you change?

Quoteused Wave Around since that was your test skill initially, set for 3/131/1 and it gave me no problems at all. Some of the potential AoEs possible from selecting different tiles was interesting, so I looked deeper and tried my original idea. I chose a different skill [Head Break] and gave it 5/133/3 which resulted in more interesting changes. The targeting worked fine for the first 3 tiles out from Ramza, forming a 5-tile cone originating from the selected tile. But selecting the 4th and 5th tiles out caused the AoE to start from Ramza and spread to end of the map. On Orbonne, this results in a total AoE of Cone-8. Which, by the way, also works.


That is actually the result of an oversight. I've known about it for a while now and I'm going to fix it next version. I foolishly tied the border logic to the Caster, which causes it to resize to where the caster is, which was okay initially because I was only using it in conjunction with 1 Range. But by using massive Ranges, this flaw becomes pretty obvious, especially if you're halfway across the map.

QuoteDance and Sing do literally nothing. They show no active targets when selected and they play no animation I assume because they aren't going to hit anyone. Amusingly, the Dancing unit does stop dancing long enough to punch at empty air while the Singing unit just continues his normal singing animation throughout.

Also makes sense. Dance and Sing's abilities are at 255 AoE, which the hack interprets as "Cone AoE". Cone AoE doesn't work if you have 0 Range, or if you don't select a target, thus, no AoE. In order to have Dance/Sing (and Galaxy Stop) work normally, just set it to 0x0f or 15 AoE.

This report is pretty grim. Worst case scenario is that Kanji Space is being used by the various events and yet unknown to me arcane functions and code (god help me if it's pointer data) in the game, meaning I may not be able to have it there. I might just have to find some other space to place this hack. As of now, this hack requires 0xEF lines of code, and the next update is only going to expand on that and I only know of two routines I can write over. The best I can do in the meantime is to press on and just finish the code and hope one day I can find enough space to fit it into the game. I'm still looking at and documenting code for other hacks I want to develop, so prospect of that happening isn't impossible and can even happen sooner rather than later.

In any case, I thank you for your time and patience, Celdia, Choto, Xifanie, Elric, and yes, even you, Jack of All Trades.

QuoteEDIT: Doku, this is the weirdest hack, ever. And I use ALMA, ffs.

lol.
It may end up not as weird anymore if the Unknown Flags of Ability Flags 1 can be verified as being truly and utterly useless/nonfunctioning. Then I can just use those and drop the whole AoE as a flag thing.

Celdia

Ha! Order of operations! Of course!

By patching Cone Final2 last, my text changes are still applied and the hack works fine. So at least this can be used without crashing things so long as that is accounted for. I don't know why I didn't think about this before, especially with me running into a very similar problem testing something else recently. -_-;;
  • Modding version: PSX
  • Discord username: Celdia#0

Glain

There's still something weird about this, isn't there?  If you have to patch one first, then the other, that would imply that something is being overwritten.  I don't recall Tactext normally patching over kanji space...

Does kanji space really start all the way back at 0x0014f334 RAM?  That's too far back to even be in the allocated space.
  • Modding version: Other/Unknown

Xifanie

Glain's got a point there.

http://ffhacktics.com/wiki/Font

Characters STARTS at 0x000E92AC BATTLE.BIN / 0x8014E614 Memory
"Kanji" (still hiragana) starts at 0x000E9284 BATTLE.BIN / 0x80150284 Memory

Very important things to know:
- Never EVER overwrite single byte characters, They're used by tactext to combine characters for better compression. Like "th" being a one byte character.
- Early Kanji space is used by my hacks. http://ffhacktics.com/wiki/Allocated_space

You're currently overwriting starting from character 0x60.
So yeah, tactext breaking your hack isn't surprising at all.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful


LastingDawn

Great work on figuring out a lot more about the range Dokurider! By chance were you looking into "Weapon Cast" AoE's at all? Or is that pretty much hardcoded to be a single target no matter what?
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Dokurider

Quote from: LastingDawn on June 07, 2014, 05:59:28 pm
Great work on figuring out a lot more about the range Dokurider! By chance were you looking into "Weapon Cast" AoE's at all? Or is that pretty much hardcoded to be a single target no matter what?

Weapon cast? You mean like procs? Or getting AoE out of Weapon Range? Because if it's the latter, then yeah, it is hardcoded as single target only. I will look into it, but right now my hands are full with this hack.
Speaking of:

I don't really understand why Kanji Space Nopper NOPs 0x14f334 or character 0x60 if it's going to cause tactext trouble. Or where they never meant to be compatible to begin with?

Xifanie

whoo~ Raven blaming time, my favourite time of the day \o/
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful


Dokurider

December 21, 2016, 05:33:38 pm #54 Last Edit: December 21, 2016, 05:50:51 pm by Dokurider
k, I'm back

I'll add pictures later on.



Cone AoE (v2)
Version 1.09
Creates Cone AoE. Enable this on any skill by flagging both Linear and Tri Direction AoE flags. Uses Kanji Space. Uses lines 0x1557fc - 0x155b04. 194 Lines. Does not work with Direct/Stop at Obstacle or Weapon Range, as neither does Linear/Tri AoE. Does not work with Auto Target, so give it a non-zero range. Don't even think about targeting yourselves, you derps. Designed to emulate Linear/Tri's behaviors including being dependent on the caster panel to be generated.
0017bb24: Targeting Routine (0x0017b874)

0017bb24: 06000234 ori r2,r0,0x0006
0017bb28: FF55050C jal 0x001557fc
0017bb2c: 00000000 nop
0017bb30: 02004014 bne r2,r0,0x0017bb3c
0017bb34: 1000A427 addiu r4,r29,0x0010 Needed for Ally/Enemy Targeting Routine
0017bb38: 0C56050C jal 0x00155830 Cone Generation Routine
0017bb3c: 00000000 nop
0017bb40: 0300A010 beq r5,r0,0x0017bb50 Branch if not flagged as Linear/Tri
0017bb44: C0003032 andi r16,r17,0x00c0
0017bb48: 9AEF050C jal 0x0017be68 Linear/Tri Generation Routine
0017bb4c: 00000000 nop

========================================================

Morbol Virus Depth Check (0x00179204)

00179214: 00004126 addiu r1,r18,0x0000 Saves Target Tile Vertical

========================================================

001557fc: Parse Linear AoE Flags Routine

001557fc: 06002632 andi r6,r17,0x0006 False if flagged as Cone (Linear + Tri)
00155800: 09004610 beq r2,r6,0x00155828 Branch if Cone AoE
00155804: 00000234 ori r2,r0,0x0000 r2 = Cone AoE
00155808: 02000234 ori r2,r0,0x0002
0015580c: 0600C210 beq r6,r2,0x00155828 Branch if Tri Linear AoE
00155810: 03000534 ori r5,r0,0x0003 r5 = 3 (Tri Linear Value)
00155814: 04000234 ori r2,r0,0x0004
00155818: 0300C210 beq r6,r2,0x00155828 Branch if Linear AoE
0015581c: 01000534 ori r5,r0,0x0001 r5 = 1 (Linear Value)
00155820: FF000234 ori r2,r0,0x00ff r2 = -1 (No Value)
00155824: 00000534 ori r5,r0,0x0000
00155828: 0800E003 jr r31
0015582c: 00002F24 addiu r15,r1,0x0000 r15 = Target Tile Vertical

========================================================================

00155830: AoE Flagging Routine

r5 = IsLinear/Tri? (1,3,0)
r15 = Target Tile Vertical
r16 = Unit Y
r17 = Unit X
r18 = Target X
r19 = Direction
r20 = Target Y
r21 = Vertical


00155830: C0FFBD27 addiu r29,r29,-0x0040 Pointer Memory - 40
00155834: 1000A527 addiu r5,r29,0x0010
00155838: 3C00BFAF sw r31,0x003c(r29)
0015583c: 3800B4AF sw r20,0x0038(r29)
00155840: 3400B3AF sw r19,0x0034(r29)
00155844: 3000B2AF sw r18,0x0030(r29)
00155848: 2C00B1AF sw r17,0x002c(r29)
0015584c: 8B78010C jal 0x0005e22c Transfer Attacker/Self ID Routine
00155850: 2800B0AF sw r16,0x0028(r29)
00155854: 1000A393 lbu r3,0x0010(r29) Load Attacker/Self ID
00155858: 1C00B287 lh r18,0x001c(r29) Load Target X
0015585c: 2000B487 lh r20,0x0020(r29) Load Target Y
00155860: 01000234 ori r2,r0,0x0001 r2 = 1
00155864: 1980013C lui r1,0x8019
00155868: F8F422AC sw r2,-0x0b08(r1) Linear Attack = True
0015586c: C0100300 sll r2,r3,0x03
00155870: 23104300 subu r2,r2,r3
00155874: 80110200 sll r2,r2,0x06
00155878: 1980033C lui r3,0x8019
0015587c: CC086324 addiu r3,r3,0x08cc Load Unit Data
00155880: 21104300 addu r2,r2,r3
00155884: 47005190 lbu r17,0x0047(r2) Load Unit's X
00155888: 48005090 lbu r16,0x0048(r2) Load Unit's Y

0015588c: 2A103202 slt r2,r17,r18
00155890: 04004010 beq r2,r0,0x001558a4 Branch if Unit X >= Target X is not true
00155894: 01001334 ori r19,r0,0x0001 Direction = +X
00155898: 5856050C jal 0x00155960 Cone Generation Routine
0015589c: 00000000 nop
001558a0: 3A560508 j 0x001558e8
001558a4: 2A105102 slt r2,r18,r17
001558a8: 04004010 beq r2,r0,0x001558bc Branch if Target X >= Unit X is not true
001558ac: FF001334 ori r19,r0,0x00ff Direction = -X
001558b0: 5856050C jal 0x00155960 Cone Generation Routine
001558b4: 00000000 nop
001558b8: 3A560508 j 0x001558e8
001558bc: 2A101402 slt r2,r16,r20
001558c0: 04004010 beq r2,r0,0x001558d4 Branch if Unit Y >= Target Y is not true
001558c4: 00011334 ori r19,r0,0x0100 Direction = +Y
001558c8: 5856050C jal 0x00155960 Cone Generation Routine
001558cc: 00000000 nop
001558d0: 3A560508 j 0x001558e8
001558d4: 2A109002 slt r2,r20,r16
001558d8: 18004010 beq r2,r0,0x0015593c End if Target Y >= Unit Y is not true
001558dc: 00FF1334 ori r19,r0,0xff00 Direction = -Y
001558e0: 5856050C jal 0x00155960 Cone Generation Routine
001558e4: 00000000 nop

001558e8: 21200000 addu r4,r0,r0 Tile Counter = 0
001558ec: 1980033C lui r3,0x8019
001558f0: D82D6324 addiu r3,r3,0x2dd8
001558f4: 01006290 lbu r2,0x0001(r3) Load Tile Targeted? Flag
001558f8: 00000000 nop
001558fc: 03004014 bne r2,r0,0x0015590c Branch if Tile is Targeted?
00155900: 00000000 nop
00155904: 44560508 j 0x00155910
00155908: 000060A0 sb r0,0x0000(r3) AoE = 0
0015590c: 010060A0 sb r0,0x0001(r3) Tile Targeted? = False
00155910: 01008424 addiu r4,r4,0x0001 Counter ++
00155914: 00028228 slti r2,r4,0x0200
00155918: F6FF4014 bne r2,r0,0x001558f4 Branch if Counter < 0x200
0015591c: 05006324 addiu r3,r3,0x0005 Pointer += 5

00155920: 00000000 nop [deleted line]
00155924: 2C00B18F lw r17,0x002c(r29)
00155928: FF00E431 andi r4,r15,0x00ff
0015592c: 2128A002 addu r5,r21,r0
00155930: 42311100 srl r6,r17,0x05
00155934: A9E4050C jal 0x001792a4 check vertical tolerance + if tiles can be chosen
00155938: 0100C630 andi r6,r6,0x0001 Top Down Targeting Flag

0015593c: 3C00BF8F lw r31,0x003c(r29)
00155940: 3800B48F lw r20,0x0038(r29)
00155944: 3400B38F lw r19,0x0034(r29)
00155948: 3000B28F lw r18,0x0030(r29)
0015594c: 2C00B18F lw r17,0x002c(r29)
00155950: 2800B08F lw r16,0x0028(r29)
00155954: 4000BD27 addiu r29,r29,0x0040 Pointer + 40
00155958: 0800E003 jr r31
0015595c: 25280000 or r5,r0,r0 Is Linear/Tri? = False

====================================================================



00155960: Cone Attack Tile Calculation

r4 = Tile Coordinate
r5 = Secondary Tile Coordinate
r6 = AoE
r7 = Row Counter
r8 = 0xffffffff (Also used as Temporary High Tile Coordinate)
r9 = Row Width Counter
r10 = 0x0001 (True)
r16 = Unit Y (Treated as Current Y)
r17 = Unit X (Treated as Current X)
r18 = Target X
r20 = Target Y
r19 = Direction


00155960: 21380000 addu r7,r0,r0 Initialize Row Counter
00155964: 19800B3C lui r11,0x8019
00155968: D82D6B25 addiu r11,r11,0x2dd8 r11 = Tile Data Pointer
0015596c: 01000A34 ori r10,r0,0x0001 r10 = True
00155970: 3400A68F lw r6,0x0034(r29) r6 = AoE
00155974: 62004006 bltz r18,0x00155af0 Branch if X is negative
00155978: 0E80033C lui r3,0x800e
0015597c: 9C4E6390 lbu r3,0x4e9c(r3) Load Map Max X
00155980: 00000000 nop
00155984: 2A104302 slt r2,r18,r3
00155988: 5D004010 beq r2,r0,0x00155af0 Branch if X >= Max X
0015598c: 00000000 nop
00155990: 5B008006 bltz r20,0x00155af0 Branch if Y is negative
00155994: 0E80023C lui r2,0x800e
00155998: A04E4290 lbu r2,0x4ea0(r2) Load Map Max Y
0015599c: 00000000 nop
001559a0: 2A108202 slt r2,r20,r2
001559a4: 56004010 beq r2,r0,0x00155af0 Branch if Y >= Max Y

001559a8: 18000302 mult r16,r3 Y * Max X
001559ac: 12100000 mflo r2
001559b0: 21205100 addu r4,r2,r17 Tile ID = Y * Max X + X

<-Row Length Main Loop Starts Here->
========================
X Direction Sub Routine
========================

001559b4: 0E80083C lui r3,0x800e
001559b8: FF000834 ori r8,r0,0x00ff r8 = -1
001559bc: 24106802 and r2,r19,r8 Get X Direction from Direction Variable
001559c0: 0F004010 beq r2,r0,0x001559f0 Branch to Y if no X Direction obtained
001559c4: 00000000 nop

-X Direction

001559c8: 05000215 bne r8,r2,0x001559d0 Branch if r2 =/= -X Direction
001559cc: FFFF2126 addiu r1,r17,0xffff Current X - 1
001559d0: 48002004 bltz r1,0x00155ae4 Proceed to Next Row if the current Target X = -1
001559d4: 00000000 nop
001559d8: 7D560508 j 0x001559f4 Go To Tile Coordinates Modify Function
001559dc: FFFF0224 addiu r2,r0,0xffff r2 = -1


+X Direction

001559e0: 9C4E6390 lbu r3,0x4e9c(r3) Load Map Max X
001559e4: 01002126 addiu r1,r17,0x0001 Current X + 1
001559e8: 42006110 beq r3,r1,0x00155ae4 End if current Target X is Max X
001559ec: 00000000 nop
001559f0: 01000220 addi r2,r0,0x0001 r2 = 1

001559f4: 20882202 add r17,r17,r2 Current Target X++
001559f8: 93560508 j 0x00155a4c Go to Row Generation Subroutine
001559fc: 20208200 add r4,r4,r2 Tile Coordinates is modified(+/-)

========================
Y Direction Sub Routine
========================

00155a00: 02121300 srl r2,r19,0x0008 Get Y Direction from Direction Variable
00155a04: 3E004010 beq r2,r0,0x00155af0 End if no Y Direction obtained
00155a08: FFFF0126 addiu r1,r16,0xffff Current Y - 1

-Y Direction

00155a0c: 06000215 bne r8,r2,0x00155a18 Branch if r2 =/= 0x00ff
00155a10: 00000000 nop

00155a14: 37002004 bltz r1,0x00155ae4 End Routine if the current Target Y = -1
00155a18: FFFF0224 addiu r2,r0,0xffff
00155a1c: 9C4E6390 lbu r3,0x4e9c(r3) Get Max X
00155a20: 91560508 j 0x00155a44 Jump to Modify Tile Coordinate Function
00155a24: 22180300 sub r3,r0,r3 r3 = -Max X (-Y)

+Y Direction

00155a28: A04E6390 lbu r3,0x4ea0(r3) Load Max Y
00155a2c: 01000126 addiu r1,r16,0x0001 Current Y + 1
00155a30: 30007010 beq r3,r16,0x00155ae4 Branch if current Target Y is greater than Max Y
00155a34: 00000000 nop
00155a38: 0E80033C lui r3,0x800e
00155a3c: 9C4E6390 lbu r3,0x4e9c(r3) Get Max X
00155a40: 01000234 ori r2,r0,0x0001

00155a44: 20800202 add r16,r16,r2 Current Target Y++
00155a48: 20208300 add r4,r4,r3 Tile Coordinates++

========================
Row Generation Subroutine
========================

What direction are we going?
If X direction, then make Y rows, and vice versa

r7 = Row Counter
r9 = Row Size Counter
r6 = AoE
r9 = r0 - r7
r9++ until r9 = r7
r7++ until r7 = r6

r20 = Target Y
r18 = Target X
r5 = Secondary Tile Coordinate

========================================================================================

00155a4c: 22480700 sub r9,r0,r7 Initialize Row Size Counter
00155a50: 25288000 or r5,r4,r0 Initialize Secondary Tile Coordinate
<-Row Size Subloop Begins Here->
00155a54: FF000334 ori r3,r0,0x00ff
00155a58: 24106302 and r2,r19,r3 Get X Direction from Direction Variable
00155a5c: 0E004010 beq r2,r0,0x00155a88 Branch if X Direction was not obtained
00155a60: 0E80033C lui r3,0x800e

Y Row

00155a64: 20100902 add r2,r16,r9
00155a68: 20004004 bltz r2,0x00155adc Branch if Y Size is negative
00155a6c: A04E6390 lbu r3,0x4ea0(r3) Load Max Y
00155a70: 00000000 nop
00155a74: 1F006210 beq r3,r2,0x00155ae4 Branch if Y Size = Max Y
00155a78: 00000000 nop
00155a7c: 0E80033C lui r3,0x800e
00155a80: 9C4E6390 lbu r3,0x4e9c(r3) Load Map Max X
00155a84: 00000000 nop
00155a88: 18006900 mult r3,r9 Max X * Row Size Counter
00155a8c: 12180000 mflo r3
00155a90: B0560508 j 0x00155ac0 Jump to Save Tile
00155a94: 20288300 add r5,r4,r3 Modify Secondary Tile Coordinate

X Row

00155a98: 02121300 srl r2,r19,0x0008 Get X Direction from Direction Variable
00155a9c: 18004010 beq r2,r0,0x00155af0 End if no X Direction obtained
00155aa0: 00000000 nop
00155aa4: 20102902 add r2,r17,r9
00155aa8: 10004004 bltz r2,0x00155adc Branch if X Size is negative
00155aac: 9C4E6390 lbu r3,0x4e9c(r3) Load Map Max X
00155ab0: 00000000 nop
00155ab4: 0F006210 beq r3,r2,0x00155ae4 Branch if X Size = Max X
00155ab8: 00000000 nop
00155abc: 20288900 add r5,r4,r9 Modify Secondary Tile Coordinate

Save Tile

00155ac0: 80100500 sll r2,r5,0x02 ID * 4
00155ac4: 21104500 addu r2,r2,r5 ID * 5
00155ac8: 21184B00 addu r3,r2,r11
00155acc: 00006AA0 sb r10,0x0000(r3) Store Low Tile's AoE = True
00155ad0: 01006AA0 sb r10,0x0001(r3) Store Low Tile Targeted? = True
00155ad4: 0001A824 addiu r8,r5,0x0100 Tile ID + 0x100
00155ad8: 80100800 sll r2,r8,0x02 ID * 4
00155adc: 21104800 addu r2,r2,r8 ID * 5
00155ae0: 21184B00 addu r3,r2,r11
00155ae4: 00006AA0 sb r10,0x0000(r3) Store High Tile's AoE = True
00155ae8: 01006AA0 sb r10,0x0001(r3) Store High Tile Targeted? = True
00155aec: D9FF2715 bne r9,r7,0x00155a44 Branch if Size Counter = Row Counter else loop
00155af0: 01002921 addi r9,r9,0x0001 Size Counter++
00155af4: 2210C700 sub r2,r6,r7
00155af8: AEFF401C bgtz r2,0x001559a4 Finish if Row Counter has exceeded AoE else loop
00155afc: 0100E724 addiu r7,r7,0x0001 Row Counter++
00155b00: 0800E003 jr r31
00155b04: 00000000 nop



"Arcing" AoE and Range
Version 1.1
Feeds AoE/Range generation through the Arc Range Routine (001798b0), creating an AoE/Range that gains size from height/2
Uses Ability Flags 1 Unknown Flags 0x80 and 0x40.
Removes and overwrites the coding otherwise attached to the Unknown Ability Flags (0017a6dc) known so far. Does not use Kanji Space.
0x80 - Arcing AoE
0x40 - Arcing Range
Old:

0017bac8: 00002821 addu r5,r0,r0
0017bacc: 26620001 addiu r2,r19,0x0001
0017bad0: a1020000 sb r2,0x0000(r8) store aoe + 1
0017bad4: 0c05e546 jal 0x00179518 Store surrounding panels AoE value
0017bad8: a0e20000 sb r2,0x0000(r7) store aoe + 1

New:
0017bac8: 0680053C lui r5,0x8006
0017bacc: 01006226 addiu r2,r19,0x0001
0017bad0: 000002A1 sb r2,0x0000(r8)
0017bad4: B7E9050C jal 0x0017a6dc Arc Range/AoE Routine


Old:

0017a43c: 0c05e546 jal 0x00179518 Calculate Tiles Hit by Ability
0017a440: 00002821 addu r5,r0,r0 r5 = 0

New:

0017a43c: B7E9050C jal 0x0017a6dc Arc Range/AoE Routine
0017a440: 0680053C lui r5,0x8006

Old:

0017a4a0: 324200c0 andi r2,r18,0x00c0 If Unknown Flags 0x80/0x40 (!!!)
0017a4a4: 0c05e497 jal 0x0017925c Clear Some stuff for Untargetable Terrain
0017a4a8: 00000000 nop
0017a4ac: 324200c0 andi r2,r18,0x00c0 If Unknown Flags 0x80/0x40 (!!!)
0017a4b0: 10400003 beq r2,r0,0x0017a4c0 Branch if False
0017a4b4: 02802021 addu r4,r20,r0 r4 = Caster Data
0017a4b8: 0c05e9b7 jal 0x0017a6dc Target Ally/Enemy with Range Routine
0017a4bc: 02402821 addu r5,r18,r0 r5 = Ability Flags 1
0017a4c0: 324200d0 andi r2,r18,0x00d0 If Unknown Flags 0x80/0x40 or Vertical Fixed
0017a4c4: 14400005 bne r2,r0,0x0017a4dc Branch if True

New:

0017a4a0: 00000000 nop
0017a4a4: 97E4050C jal 0x0017925c Clear Some stuff for Untargetable Terrain
0017a4a8: 00000000 nop [Deleted]
0017a4ac: 00000000 nop
0017a4b0: 00000000 nop
0017a4b4: 00000000 nop
0017a4b8: 00000000 nop
0017a4bc: 21208002 addu r4,r20,r0
0017a4c0: 10004232 andi r2,r18,0x0010
0017a4c4: 05004014 bne r2,r0,0x0017a4dc Branch if Vertical Fixed


Arc Range/AoE Routine

0017a6dc: F0FBA524 addiu r5,r5,0xfbf0
0017a6e0: 1200A287 lh r2,0x0012(r29)           r2 = Used Ability ID
0017a6e4: C0180200 sll r3,r2,0x03
0017a6e8: 23186200 subu r3,r3,r2
0017a6ec: 40180300 sll r3,r3,0x01
0017a6f0: 2128A300 addu r5,r5,r3
0017a6f4: 1880063C lui r6,0x8018
0017a6f8: A8A7DFAC sw r31,0xa7a8(r6) Save return address
0017a6fc: A8A7C280 lb r2,0xa7a8(r6) Load last two bytes of Return Address' instructions
0017a700: FF004230 andi r2,r2,0x00ff
0017a704: DC000334 ori r3,r0,0x00dc
0017a708: 0300A580 lb r5,0x0003(r5) Load Ability Flags 1
0017a70c: 14004314 bne r2,r3,0x0017a760 Branch if not from Targeting Routine (From AoE routine)
0017a710: 8000A230 andi r2,r5,0x0080
0017a714: 1D004010 beq r2,r0,0x0017a78c Branch if not Arc AoE
0017a718: 4CA7C324 addiu r3,r6,0xa74c
0017a71c: 2000AD93 lbu r13,0x0020(r29) r13 = Target Y
0017a720: 1C00AC93 lbu r12,0x001c(r29) r12 = Target X
0017a724: 0E80023C lui r2,0x800e
0017a728: D0FFBD27 addiu r29,r29,-0x0030
0017a72c: 2000B0AF sw r16,0x0020(r29)
0017a730: 2400B1AF sw r17,0x0024(r29)
0017a734: 2800A3AF sw r3,0x0028(r29) Save Return Address
0017a738: 3899C0AC sw r0,0x9938(r6) Remove Close Range Branch from Arc routine
0017a73c: 21184002 addu r3,r18,r0 r3 = Target Height
0017a740: 21886002 addu r17,r19,r0 r17 = AoE
0017a744: 39E6050C jal 0x001798e4 Calculate Arc AoE Routine (Jump to later on in the routine)
0017a748: A04E4290 lbu r2,0x4ea0(r2) r2 = Max Map Y
0017a74c: 1880023C lui r2,0x8018
0017a750: 4014033C lui r3,0x1440
0017a754: 27006324 addiu r3,r3,0x0027 Load instructions (14400027)
0017a758: 389943AC sw r3,0x9938(r2) Restore Close Range Branch from Arc Routine
0017a75c: E5E90508 j 0x0017a794 Exit Routine
0017a760: 4000A230 andi r2,r5,0x0040
0017a764: 09004010 beq r2,r0,0x0017a78c Branch if not Arc Range
0017a768: 25288000 or r5,r4,r0 r5 = Ability Range
0017a76c: 3899C0AC sw r0,0x9938(r6)
0017a770: 2CE6050C jal 0x001798b0 Calculate Arc Range Routine
0017a774: 25208002 or r4,r20,r0 r4 = Caster Unit Data
0017a778: 1880023C lui r2,0x8018
0017a77c: 4014033C lui r3,0x1440
0017a780: 27006324 addiu r3,r3,0x0027 Load instructions (14400027)
0017a784: E5E90508 j 0x0017a794
0017a788: 389943AC sw r3,0x9938(r2) Restore Close Range Branch from Arc Routine
0017a78c: 46E5050C jal 0x00179518 Store surrounding panels AoE value (Normal function)
0017a790: 21280000 addu r5,r0,r0
0017a794: 1880023C lui r2,0x8018
0017a798: A8A75F8C lw r31,0xa7a8(r2) Load old return address
0017a79c: 00000000 nop
0017a7a0: 0800E003 jr r31
0017a7a4: 00000000 nop
0017a7a8: 00000000 nop Return Address here



Reenables Unknown Flags 1 and 2
Speaking of the Unknown Ability Flags, this hack restores their functionality that was deliberately disabled by Square. Enables you to target any ally or any enemy on the map.
No notes because there really isn't much to it. It's literally a single line.


Weapon Range now accepts AoE
Version -1.0
I'm releasing this against my better judgement. Enables the use of Weapon Ranged AoE. It might also enable Direct/Stop at Obstacle AoE as well. Won't crash your game, but it's interactions with AoE might cause your brain to crash if I'm reading the Weapon Strike/Direct routines correctly. Still current doing research on the matter, but feel free to be a guinea pig.
0017af40: 0c05ed28 jal 0x0017b4a0 Invalidate AoE panels routine (In the Weapon Targeting Routine [0017ac90])
to
0017af40: 00000000 nop [deleted]

0017babc: 31220020 andi r2,r9,0x0020 Weapon Ranged check
0017bac0: 1440000e bne r2,r0,0x 0017bafc branch if so
to
0017bac0: 00000000 nop [deleted]



Clear Yellow Panels not occupied by a unit.
Version 2.0
Overwrites Morbol AoE Depth Routine. Takes the 255 AoE check and modifies it to target only tiles with units in them. Good for Random Fire Skills. Saves Ability ID to unused lines for future Ability ID hardcoding. Enable this on an ability by flagging it as a Math Skill.

Don't Target Empty Space Routine

====================================================================================================================================
Targeting/AoE Main Routine(0x0017b874)
====================================================================================================================================

Original Code:
0017b8d0: 90690003 lbu r9,0x0003(r3) Load ability flags 1
0017b8d4: 90710004 lbu r17,0x0004(r3) Load ability flags 2
0017b8d8: 90640006 lbu r4,0x0006(r3) Load ability flags 4

New Code
0017b8d4: lhu r17,0x0004(r3) Load Ability Flags 2 and 3

====================================================================================================================================

Original Code
0017bae4: 00113142 srl r6,r17,0x05 Parse down Ability Flag 2 to Top Down Targeting Flag

New Code
0017bae4: andi r6,r17,0x00e0 Parse Ability Flag 2 to Hit Ally/Enemy

====================================================================================================================================

Original Code
0017baec: 30c60001 andi r6,r6,0x0001 Keep Top Down Targeting Flag

New Code
0017baec: andi r6,r6,0x0020 Keep Top Down Targeting Flag

====================================================================================================================================

Original Code
0017baf4: 0c05e481 jal 0x00179204 moldball virus depth check
0017baf8: 00000000 nop

New Code
0017baf4: jal 0x00179204 moldball virus depth check
0017baf8: lui r2,0x8018

====================================================================================================================================

Original Code
0017b9fc: 326300ff andi r3,r19,0x00ff r3 = ability AoE
0017ba00: 340200ff ori r2,r0,0x00ff
0017ba04: 1462000c bne r3,r2,0x 0017ba38 Branch if ability AoE isn't 0xff
0017ba08: 00002021 addu r4,r0,r0
0017ba0c: 34050001 ori r5,r0,0x0001
0017ba10: 3c038019 lui r3,0x8019
0017ba14: 24632dd8 addiu r3,r3,0x2dd8
0017ba18: a0650000 sb r5,0x0000(r3) store highlight panel for targeting
0017ba1c: a0600001 sb r0,0x0001(r3) store panel not targeted
0017ba20: 24840001 addiu r4,r4,0x0001 Counter++
0017ba24: 28820200 slti r2,r4,0x0200 Do for all tiles
0017ba28: 1440fffb bne r2,r0,0x 0017ba18
0017ba2c: 24630005 addiu r3,r3,0x0005 tile counter++
0017ba30: 0805eebf j 0x 0017bafc skip following routine
0017ba34: 00000000 nop

New Code
0017b9fc: addu r4,r0,r0 Clear r4
0017ba00: andi r2,r17,0x4000 Get Math Skill Flag
0017ba04: lui r3,0x8018
0017ba08: addiu r3,r3,0xba28
0017ba0c: sh r0,0x0000(r3) Clear space
0017ba10: beq r2,r0,0x0017ba38 Branch if no Math Flag
0017ba14: nop
0017ba18: xori r17,r17,0x00c0 Add Ignore Ally/Enemy Flag if Math Skill (Reverses the effects of a later routine)
0017ba1c: sh r2,0x0000(r3) Jump to Tile Initialization
0017ba20: j 0x0017ba38 Save Math Skill Flag for later
0017ba24: nop
0017ba28: nop                           [save Math Flag here]
0017ba2c: nop [save Ability ID here]
0017ba30: nop
0017ba34: nop                             

====================================================================================================================================

Original Code
0017bb40: 323000c0 andi r16,r17,0x00c0 Keep Hit Ally/Enemy Flags

New Code
0017bb40: andi r16,r17,0x40c0 Keep Hit Ally/Enemy and Math Skill Flag

====================================================================================================================================

Original Code
0017bb60: 3a6700ff xori r7,r19,0x00ff
0017bb64: 0c05ef1e jal 0x0017bc78 Hit ally/enemy routine
0017bb68: 2ce70001 sltiu r7,r7,0x0001

New Code
0017bb60: lui r7,0x8018
0017bb64: jal 0x0017bc78 Hit ally/enemy routine
0017bb68: addiu r7,r7,0xba28 Load Math Skill Flag

====================================================================================================================================
Check if Ally/Enemy can be targeted Routine(0x0017bc78)
====================================================================================================================================

Original Code
0017bc90: 00e0b821 addu r23,r7,r0 r23 = 255 AoE check

New Code
0017bc90: lhu r23,0x0000(r7) r23 = Math Flag

====================================================================================================================================

Original Code
0017bd68: 32e200ff andi r2,r23,0x00ff
0017bd6c: 1440000c bne r2,r0,0x 0017bda0 Branch if AoE = 255
0017bd70: 00008021 addu r16,r0,r0 Tile Counter = 0
0017bd74: 34040001 ori r4,r0,0x0001 Tile Targeted? = True
0017bd78: 3c038019 lui r3,0x8019
0017bd7c: 24632dd8 addiu r3,r3,0x2dd8

New Code
0017bd68: addu r16,r0,r0 Tile Counter = 0
0017bd6c: ori r4,r0,0x0001 Tile Targeted? = True
0017bd70: jal 0x0017921c
0017bd74: nop
0017bd78: bne r23,r2,0x0017bda0
0017bd7c: nop

====================================================================================================================================
Morbol Virus Depth Check (0x00179204)
====================================================================================================================================

Original Code
00179204: 00042400 sll r4,r4,0x10
00179208: 00042403 sra r4,r4,0x10
0017920c: 34020149 ori r2,r0,0x0149 r2 = Moldball Virus
00179210: 14820010 bne r4,r2,0x 00179254 Branch if ID != Moldball Virus
00179214: 00000000 nop
00179218: 00002821 addu r5,r0,r0 Counter = 0
0017921c: 3c048019 lui r4,0x8019
00179220: 24842dd8 addiu r4,r4,0x2dd8 r4 = ? Tile Data Pointer
00179224: 3c038019 lui r3,0x8019
00179228: 2463f8cc addiu r3,r3,0xf8cc r3 = Tile Data Pointer
0017922c: 90620003 lbu r2,0x0003(r3) Load Tile's Halves + Depth
00179230: 00000000 nop
00179234: 304200e0 andi r2,r2,0x00e0
00179238: 10400002 beq r2,r0,0x 00179244 Branch if Depth > 1
0017923c: 24630008 addiu r3,r3,0x0008 Tile Data Pointer += 8
00179240: a0800000 sb r0,0x0000(r4) Store AoE = 0
00179244: 24a50001 addiu r5,r5,0x0001 Counter ++
00179248: 28a20200 slti r2,r5,0x0200
0017924c: 1440fff7 bne r2,r0,0x 0017922c Branch if Counter < 0x200
00179250: 24840005 addiu r4,r4,0x0005 ? Tile Data Pointer += 5
00179254: 03e00008 jr r31
00179258: 00000000 nop

New Code
r3 = Tile Data (0x80192dd8)
r4 = True
r23 = Math Skill

00179204: addiu r2,r2,0xba2c
00179208: sll r4,r4,0x10 Code still needs a parsed Ability ID
0017920c: sra r4,r4,0x10
00179210: sh r4,0x0000(r2) Save Ability ID to (0x0017ba28)(For some future code)
00179214: nop Must be empty for another routine I made
00179218: jr r31
0017921c: lui r3,0x8019
00179220: beq r23,r0,0x00179254 Exit if no Math Skill
00179224: addiu r3,r3,0x2dd8
00179228: lbu r2,0x0000(r3) Load AoE saved on Tile
0017922c: lbu r20,0x0002(r3) Load Unit ID
00179230: sltiu r2,r2,0x0001 True if No AoE
00179234: sltiu r20,r20,0x0001 True if No Unit ID
00179238: addu r2,r2,r20
0017923c: bne r2,r0,0x179248 Do not Target Panel if panel does not have a unit on it and isn't apart of AoE
00179240: addiu r16,r16,0x0001 Tile Counter++
00179244: sb r4,0x0001(r3) Target Tile Panel
00179248: slti r2,r16,0x0200
0017924c: bne r2,r0,0x00179228 Loop for all 0x200 panels
00179250: addiu r3,r3,0x0005 Tile ID++
00179254: jr r31
00179258: ori r2,r0,0x4000

====================================================================================================================================



Enable Attacks on Yourself (Strike/Lunge Weapon)
Version 0.0
Allows units to target themselves with Attack. Only works with Strike/Lunge flagged Weapons.
Attack Self with Weapon Description

Original Code:

0017a598: a0800000 sb r0,0x0000(r4) Remove Caster Panel from targeting


New Code:

0017a598: 00000000 nop Code is deleted




Original Code:

0017a5a0: a0600000 sb r0,0x0000(r3) Remove High Caster Panel from targeting


New Code:

0017a5a0: 00000000 nop Code is deleted


Current Issues:

*This hack only applies to Strike/Lunge Weapons. Ranged units currently cannot attack themselves.


Notes:

Healing weapons do indeed heal on self attack.

HP Drain weapons also absorbs on self dealt damage.



Caster is always apart of AoE
Version -1.0
Removes the code from Unknown Flag 1 and 2 (0x80 and 0x40) of Ability Flags 1. This hack makes it so an ability will always target (make a yellow square under) the caster in addition to the targeted panel or panels. Enable this property with Unknown Flag 1. Unknown Flag 2 is non-functional. I can also upload an alternate version that checks for Ability IDs instead if requested.
0017bb04: 00021880 sll r3,r2,0x02
0017bb08: 00621821 addu r3,r3,r2
0017bb0c: 3c128019 lui r18,0x8019
0017bb10: 26522dd8 addiu r18,r18,0x2dd8
0017bb14: 32220001 andi r2,r17,0x0001

to

0017bb0c: andi r4,r9,0x0080 Look for Flag 1
0017bb10: jal 0x0017a6dc Always Target Caster Routine
0017bb14: lui r18,0x8019


0017a6dc: beq r4,r0,0x0017 Branch if Target Caster
0017a6e0: addiu r18,r18,0x2dd8 Load Map Data
0017a6e4: ori r2,r0,0x0001 Target Caster = True
0017a6e8: addu r3,r3,r18 r3 = Caster Tile
0017a6ec: sb r2,0x0000(r3) Target Caster Tile
0017a6f0: j 0x0017a6fc Exit Subroutine
0017a6f4: andi r2,r17,0x0001 Check Ability Flag 1 for Ignore Caster
0017a6f8: ori r2,r0,0x0000 Ignore Caster Tile = False
0017a6fc: jr r31
0017a700: nop
0017a704:
0017a708:
0017a70c:
0017a710:
0017a6dc:
0017a6dc:



F_MA Damage formula accepts Weapon Elemental (for one ability)
Version -1.2
Faith Magical Damage Formula accepts Weapon Elemental when ability ID = 165(Currently Maelstrom in Arena).
00185ffc: 3c028019 lui r2,0x8019
00186000: 8c422d94 lw r2,0x2d94(r2) Load Attacker's Data
00186004: 3c038019 lui r3,0x8019
00186008: 906338f7 lbu r3,0x38f7(r3) Load Abilities Element
0018600c: 90420071 lbu r2,0x0071(r2) Load Attacker's Elemental Strenghtened
00186010: 00000000 nop
00186014: 00431024 and r2,r2,r3
00186018: 1040000c beq r2,r0,0x0018604c Branch if Abilities Element isn't being powered
0018601c: 00000000 nop
00186020: 3c038019 lui r3,0x8019
00186024: 846338ce lh r3,0x38ce(r3) Load XA
00186028: 00000000 nop
0018602c: 00031080 sll r2,r3,0x02 XA * 4
00186030: 00431021 addu r2,r2,r3 XA * 5
00186034: 04410002 bgez r2,0x00186040 Branch if XA > 0
00186038: 00000000 nop
0018603c: 24420003 addiu r2,r2,0x0003 XA + 3
00186040: 00021083 sra r2,r2,0x02 XA * 5 / 4 (increase XA by 25%)
00186044: 3c018019 lui r1,0x8019
00186048: a42238ce sh r2,0x38ce(r1) Store new XA
0018604c: 03e00008 jr r31
00186050: 00000000 nop

========================================================================================================

00185ffc: 3c028019 lui r2,0x8019
00186000: 8c422d94 lw r2,0x2d94(r2) Load Attacker's Data
00186004: 3c038019 lui r3,0x8019
00186008: 906338f7 lbu r3,0x38f7(r3) Load Abilities Element
0018600c: 90420071 lbu r2,0x0071(r2) Load Attacker's Elemental Strenghtened
00186010: 00000000 nop
00186014: 00431024 and r2,r2,r3

to

11EFFC(+67000):
1580013C lui r1,0x8015
FC573FAC sw r31,0x57fc(r1)
0056050C jal 0x00155800
00000000 nop
25802000 or r16,r1,r0
1580013C lui r1,0x8015
24108300 and r2,r4,r3
1040000c beq r2,r0,0x0018604c Branch if Abilities Element isn't being powered
FC573F8C lw r31,0x57fc(r1)

...

00187010: 3c108019 lui r16,0x8019
00187014: 921038f7 lbu r16,0x38f7(r16)

to

120010(+67000):
0056050C jal 0x00155800
00000000 nop

...

Weapon Ele for F_MA damage Routine (0x1557fc)
EE7FC(+67000)
00000000 nop
1980013C lui r1,0x8019
D6382394 lhu r3,0x38d6(r1) Load Ability ID
942D248C lw r4,0x2d94(r1) Load Attacker's Data
65010134 ori r1,r0,0x0165
03006114 bne r3,r1,0x00155820 Branch if not the correct Ability ID
1980013C lui r1,0x8019
09560508 j 0x155824
04392390 lbu r3,0x3904(r1) Load Weapon's Element
F7382390 lbu r3,0x38f7(r1) Load Abilities Element
71008490 lbu r4,0x0071(r4) Load Attacker's Elemental Strengthened
25080002 or r1,r16,r0
25806000 or r16,r3,r0
0800E003 jr r31
00000000 nop





As always, the XMLs are attached to this post and notes are provided in spoilers above. Make sure you are using the latest version of FFTPatcher, or at least 489 or later. Let me know if you find any bugs, contacting me through this site or finding me on Steam.

EDIT: Thanks Firefox for crashing and wiping out my message, I'm switching back to Opera after this.

Jumza

:o Awesome stuff! Glad you released it all, I was so excited after I saw your videos :)
  • Modding version: PSX
Nyzer: Alma teleports out of her own possessed body.
Raijinili: Remember that you're telling a modding community that the game they love could use some fixing.

Dokurider

I just confirmed that the AI will hit itself with it's own weapon, (if it's allowed to) if it heals them.

Dokurider

AI Two Swords Range Fix

If your patch uses Two Swordable weapons of differing ranges, then you want this hack. Current in Vanilla, the AI will overwrite the top weapon range with the bottom weapon range. Not a problem at all in Vanilla, but is a problem if your weapon on the top hand is longer than the one in the bottom hand.
What you'll end up seeing, if you are using a ranged weapon with a melee weapon, is that the AI will think their range is that of the bottom weapon range and attempt to get in range and move right next to the guy, realize they aren't in range anymore, and are forced to find a target they can attack instead or use an ability.

This hack swaps the top and bottom weapon processing order around so that the bottom range is overwritten by the top weapon range, thus knowing the correct attack range.

Original Code:
0019a3c4: 9245001d lbu r5,0x001d(r18) Load Unit's RH Weapon
0019a3c8: 0c06694b jal 0x 0019a52c Store Weapon? Attack Data
0019a3cc: 27a60010 addiu r6,r29,0x0010 r6 = Pointer to stack
0019a3d0: 02002021 addu r4,r16,r0 r4 = ? AI Pointer
0019a3d4: 9245001f lbu r5,0x001f(r18) Load Unit's LH Weapon
0019a3d8: 0c06694b jal 0x 0019a52c Store Weapon? Attack Data
0019a3dc: 27a60010 addiu r6,r29,0x0010 r6 = Pointer to stack


New Code:

0019a3c4: 9245001f lbu r5,0x001f(r18) Load Unit's LH Weapon
0019a3c8: 0c06694b jal 0x 0019a52c Store Weapon? Attack Data
0019a3cc: 27a60010 addiu r6,r29,0x0010 r6 = Pointer to stack
0019a3d0: 02002021 addu r4,r16,r0 r4 = ? AI Pointer
0019a3d4: 9245001d lbu r5,0x001d(r18) Load Unit's RH Weapon
0019a3d8: 0c06694b jal 0x 0019a52c Store Weapon? Attack Data
0019a3dc: 27a60010 addiu r6,r29,0x0010 r6 = Pointer to stack


Not much to it, really. With this hack you can make whatever weapon Two Swordable to your heart's content and the AI will use it correctly provided you are putting the range most weapon in your top hand.

Dokurider

New Movement: Range + 2

Replaces Jump + 3. This movement skill will increase the range (red squares) of any ability provided:


  • The Ability ID is less than 0x0170. This excludes Jump, Throw and Item.


  • The Ability is not using Weapon Range, so it does not increase the range of Attack, Charge or anything of the sort.


  • The Ability's range is 2 or greater.



This ability will not overflow. At 254 Range, it will add +1 Range instead and at 255 Range, it will do nothing.

The AI is aware of this change and should expand their target acquisitioning accordingly.

Oh and this hack does not come with any text changes. You have to do that yourselves.

Known Bugs: The game will still display Jump + 3 adding Jump while being selected to be added to a unit in the Formation Screen. The Unit Data Screen however wiil still correctly display that Jump + 3 did not add any Jump at all once added to the unit. It has no mechanical impact on the game.
lol idk where display code is.



Range + 2 (Normal Version)

Old:
0005c950: 10400002 beq r2,r0,0x0005c95c Branch if Unit doesn't have Jump + 3
0005c954: 30a2ffff andi r2,r5,0xffff
0005c958: 24630003 addiu r3,r3,0x0003 Jump += 3

0017a304: 90470001 lbu r7,0x0001(r2)        load AoE
0017a308: 90530000 lbu r19,0x0000(r2)       load Range
0017a30c: a3a70028 sb r7,0x0028(r29)        save AoE to stack

00195ce0: 90620000 lbu r2,0x0000(r3) Load Ability's Range
00195ce4: 00000000 nop
00195ce8: a2020004 sb r2,0x0004(r16) Store Range = Ability's Range


New:
0005c958: 00000000 nop [deleted Jump + 3]

0017a304: C04C050C jal 0x00153300 Range + 2
0017a308: 00000000 nop
0017a30c: 00000000 nop

00195ce0: D74C050C jal 0x0015335c AI Range + 2
00195ce4: 00000000 nop
00195ce8: 00000000 nop

00153300: 01004790 lbu r7,0x0001(r2)        load AoE
00153304: 00005390 lbu r19,0x0000(r2)       load Range
00153308: 2800A7A3 sb r7,0x0028(r29)        save AoE to stack
0015330c: 03004790 lbu r7,0x0003(r2)        load Ability Flags 1
00153310: 1200A387 lh r3,0x0012(r29)        Load Ability ID
00153314: 93009692 lbu r22,0x0093(r20) Load Movement 1
00153318: 7001632C sltiu r3,r3,0x0170
0015331c: 0D006010 beq r3,r0,0x00153354 Exit if Ability is 0x170 or greater (Throw, Jump and Item)
00153320: 2000E730 andi r7,r7,0x0020
00153324: 0B00E014 bne r7,r0,0x00153354 Exit if Weapon Range
00153328: 0400D632 andi r22,r22,0x0004
0015332c: 0900C012 beq r22,r0,0x00153354 Exit if no Range + 2 (Jump + 3)
00153330: 0200632E sltiu r3,r19,0x0002
00153334: 07006014 bne r3,r0,0x00153354 Exit if Range is less than 2
00153338: FF000334 ori r3,r0,0x00ff
0015333c: 05006312 beq r19,r3,0x00153354 Exit if Range is 255
00153340: FE000334 ori r3,r0,0x00fe
00153344: 02006312 beq r19,r3,0x00153350 Increase Range by 1 if 254 Range
00153348: 01000334 ori r3,r0,0x0001
0015334c: 02000334 ori r3,r0,0x0002
00153350: 21986302 addu r19,r19,r3 Range + 2
00153354: 0800E003 jr r31
00153358: 00000000 nop

0015335c: 03006290 lbu r2,0x0003(r3) Load Ability Flags
00153360: 00000000 nop
00153364: 20004230 andi r2,r2,0x0020
00153368: 04004014 bne r2,r0,0x0015337c Reload Ability Range if Weapon Range
0015336c: 00000234 ori r2,r0,0x0000 Makes branch always jump
00153370: 93004292 lbu r2,0x0093(r18) Load Unit's Movement 1
00153374: 00000000 nop
00153378: 04004230 andi r2,r2,0x0004
0015337c: 0B004010 beq r2,r0,0x001533ac Exit if no Range + 2 (Jump + 3)
00153380: 00006490 lbu r4,0x0000(r3) Load Ability's Range
00153384: 00000000 nop
00153388: 0200822C sltiu r2,r4,0x0002
0015338c: 07004014 bne r2,r0,0x001533ac Exit if Range is less than 2
00153390: 00000000 nop
00153394: FF000234 ori r2,r0,0x00ff
00153398: 04004410 beq r2,r4,0x001533ac Exit if Range is 255
0015339c: FE000234 ori r2,r0,0x00fe
001533a0: 02004410 beq r2,r4,0x001533ac
001533a4: 01008424 addiu r4,r4,0x0001 Range + 1 (Increases 254 to 255)
001533a8: 01008424 addiu r4,r4,0x0001 Range + 2 (1 + 1)
001533ac: 0800E003 jr r31
001533b0: 040004A2 sb r4,0x0004(r16) Store Range = Ability's Range



As always, let me know if you find anything glitches or bugs.

Dokurider

So I just finished uploading every AI routine I've documented so far. Some are okay, but many of them are from my early research and thus are spotty and lacking in understanding like some of the later works. However, know this: I am no where near done working not just on AI research, but on formatting and notes. They will all look something like this when I'm finished.

Anyways, I hope you all take some time to look through what has been uploaded and I hope they help you all in your endeavors. As always, feel free to drop me any questions or concerns. Thank you.