• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 11:11:40 am

News:

Please use .png instead of .bmp when uploading unfinished sprites to the forum!


More ASM Questions

Started by Emmy, July 08, 2016, 02:44:23 am

Emmy

July 08, 2016, 02:44:23 am Last Edit: July 08, 2016, 10:43:38 pm by Emmy
1.  So I was poking around in World.Bin to see if I can allow the player to rename Holy Dragons.  I used this hack:

<Patch name="Soldier Office can rename any units (including humans and special characters)">
    <Location file="WORLD_WORLD_BIN" offset="041205">15</Location>
  </Patch>

I'm not 100% sure how this hack works, but setting r2 = 0 on the line before the branch will function like this hack, and r2 = 1 will disable all renaming.  However I can't find where the hardcoding is that prevents Holy Dragon (job 48) from being renamed. :(  Possibly relevant:  http://ffhacktics.com/wiki/001210e8_-_001212b4

2.  I've had a couple failed attempts at coding Pain Split (like the Pokemon move).  Check in the beginning is the same immortal flag check that I used in several of my other formula hacks (will cause the move to fail if the unit is immortal), you can remove these lines if you want.  I'm not quite sure what I'm doing wrong here. :'(  This one does what I want it to, to the target; but not to the caster:


  <Patch name="3B = Pain Split">
    <Description>Doesn't work :'(</Description>
    <Location file="BATTLE_BIN" offset="11FD58">
E8FFBD27
1000BFAF
B448050C
00000000
0E004014
00000000
1980013C
982D218C
1980023C
942D428C
00000000
28004494
28002594
00000000
21188500
43180300
2330A300
900126A4
920146A4
1000BF8F
1800BD27
0800E003
00000000
    </Location>
  </Patch>

ASM:

addiu r29,r29,-0x0018
sw r31,0x0010(r29)
jal 0x001522d0               
nop
bne r2,r0,0x?
nop
lui r1,0x8019
lw r1,0x2d98(r1)
lui r2,0x8019
lw r2,0x2d94(r2)
nop
lhu r4,0x0028(r2)
lhu r5,0x0028(r1)
nop
addu r3,r4,r5
sra r3,r3,0x01
subu r6,r5,r3
sh r6,0x0190(r1)
sh r6,0x0192(r2)
lw r31,0x0010(r29)
addiu r29,r29,0x0018
jr r31
nop



3.  I'm also making an ability that adds +1 PA/MA to the guy with the ability if he kills something.  I've tried it in at least 7 different routines, no idea if the code is erroneous at this point or if I need to just keep trying routines until I get the right one.  How do I find the right routine for this one?  Possibly erroneous code:


lui r1,0x8019
lw r1,0x2d94(r1)
nop
lbu r2,0x0090(r1)
nop
andi r2,r2,0x0020
beq r2,r0,0x00000064
lui r2,0x8019
lw r2,0x2d98(r2)
nop
lbu r3,0x015c(r2)
nop
beq r3,r0,0x00000064
lui r3,0x8019
lw r3,0x2d8c(r3)
ori r2,r0,0x0081
sb r2,0x0014(r3)
lui r3,0x8019
lw r3,0x2d8c(r3)
ori r2,r0,0x0081
sb r2,0x0015(r3)
lui r3,0x8019
lw r3,0x2d8c(r3)
ori r2,r0,0x0001
sb r2,0x0025(r3)
j 0x?                         Jump to original routine/changes with what is tried
nop


4.  Another method of poking around reveals I might have some hard coding around 0x001a0c80 battle.bin that affects the reaction slots that are screwed up/currently disabled that I mentioned in another topic.  However there's no documentation in the wiki between 0019f2f4 - 001a0f6c.  Does anyone happen to have it?

5.  So I managed to figure out this: http://ffhacktics.com/wiki/00125540_-_001255e0  However I'm not quite sure what the addiu r2,r0,0xfffd or addiu r2,r0,0xfffa  lines do outside of what I'd written in the wiki.  By that I mean, is there a way to customize the options of what is locked outside of those options?  Such as if I wanted something to be able to equip items and not equip additional abilities.
  • Modding version: PSX

dw6561

For the pain split hack, is there any reason why you used a arithmetic shift instead of a logical one? Are any of the values you used signed? Just something I noticed. Not sure if that's the root of the problem, but I can't really see any other problem with it.
  • Modding version: PSX
This is FF Tactics. All the Tactics you can ever have, all in one byte.

Emmy

I don't know the difference between the shifts.  Copied it from a similar segment of code elsewhere that divides something by 2.
  • Modding version: PSX

Pride

Use a logical shift, srl or sll respectfully. But not the issue. I'm about 90% sure that the issue is that you did not set the hit flag (byte x25) for HP damage (activating bit x80) on either the target or user. Look at the self destruct formula if you want an example of the flags being loaded and altered.
  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Glain

For #2: This could get weird if the damage and/or recovery numbers are negative.  It might work but the display would probably be bizarre.  You might want to check if damage is negative and if so, add it to recovery, and vice versa.
If the problem is the display type (0x25) then the effects of the ability would still happen, it just wouldn't show you the damage and recovery numbers.  Check your units' HP values to see if they were modified...

#3: I would think that code would just be inserted into the formula you're changing.  Where else?

#5: I would look at the routine that calls that one to see what checks it makes on r2 immediately following the call.
  • Modding version: Other/Unknown

Choto

for #1, if you know the party ID or party data or Job ID anywhere in the routine, you could jump to a custom routine that checks the Job ID vs. what you want to rename, set the conditions for success (r2 = 0), and jump back to the branch.

Emmy

Update:

1.  On the Pain Split formula - The hit flag for HP damage appears to be tied to the display, and doesn't seem to be affecting anything else.  I tested a version that sets the hit flag, and it has the same (broken) effect it did before only this time it displays damage.  This is also the reason that the Endeavor formula only displays 100% (if target can be hit by it) or 0% (if immune).  Looking into it and getting a flag for HP damage attached to it produces a glitchy looking 999 value for display if the ability heals damage and displays as normal if it deals damage. 

2.  So I think I got somewhere with this ability, but it's still not working.  I tested it to just add +1 PA to the unit who is attacking if it kills a target.  Managed to find a routine that I know for sure it's reading this code but I have no idea how to get it to function.



  <Patch name="Secret Hunt = +1 PA if unit gets kill">
    <Description>TEST</Description>
    <Location file="BATTLE_BIN" offset="12497c">
281F060C
00000000
00000000
00000000
    </Location>
    <Location file="BATTLE_BIN" offset="120ca0">
E8FFBD27
1000BFAF
1980063C
902DC68C
00000000
1B00C290
00000000
00000000
00000000
00000000
1980013C
942D218C
00000000
91002290
00000000
40004230
09004010
00000000
1980033C
8C2D638C
81000234
140062A0
1980033C
8C2D638C
01000234
250062A0
1000BF8F
1800BD27
0800E003
00000000
    </Location>
  </Patch>


ASM of the main routine:


addiu r29,r29,0xffe8   
sw r31,0x0010(r29)
lui r6,0x8019
lw r6,0x2d90(r6)
nop
lbu r2,0x001b(r6)
nop
andi r2,r2,0x0020
beq r2,r0,0x?    <-- Branch to this line: lw r31,0x0010(r29)
nop
lui r1,0x8019
lw r1,0x2d94(r1)
nop
lbu r2,0x0091(r1)
nop
andi r2,r2,0x0040
beq r2,r0,0x?    <-- Branch to this line: lw r31,0x0010(r29)
nop
lui r3,0x8019
lw r3,0x2d8c(r3)   <-- *
ori r2,r0,0x0081
sb r2,0x0014(r3)
lui r3,0x8019
lw r3,0x2d8c(r3)   <-- *
ori r2,r0,0x0001
sb r2,0x0025(r3)
lw r31,0x0010(r29)
addiu r29,r29,0x0018
jr r31
nop


So, how do I know this routine is being read?  Changing the first branch line to nop and both lines marked with * above to "lw r3,0x2d90(r3)" will produce a support ability that changes every attack that a unit does to apply +1 PA to the target with the hit rate of the original moves.  This obviously isn't what I intend to do with this ability but at least it lets me know that the game is applying this routine on the end of every attack.
  • Modding version: PSX