• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
June 22, 2025, 08:58:09 am

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


A quick question about Mind/Power/Speed Break,Mind/Power/Speed Ruin.

Started by scbw1234, April 10, 2013, 04:44:59 am

scbw1234

In FFT patcher the formula of Stats Break and Stats Ruin Regardless of Whether its Mind/Power or Speed,the formula are all the same(2B for breaks,1A for Ruins),what are the properties that distinguish Mind from Power and Speed?

For example,if i created a new skill using a blank slot in the ability tab,if i use formula 2B,how do i define whether its Power break or Mind break?Same goes to Ruins.

And is it possible to create a new skill that includes all three properties?lets say if i land my hit with this new ability once,the target will have all 3 stats decreased simultaneously.

Celdia

Taking a little piece of decoded BATTLE.BIN from here: http://ffhacktics.com/smf/index.php?topic=6538.0


[2b]
00189a90: 27bdffe8 addiu r29,r29,0xffe8
00189a94: afbf0010 sw r31,0x0010(r29)
00189a98: 0c062144 jal 0x00188510      Physical Evade Calculation
00189a9c: 00000000 nop
00189aa0: 14400009 bne r2,r0,0x00189ac8
00189aa4: 00000000 nop
00189aa8: 0c061781 jal 0x00185e04      Loads PA and Y
00189aac: 00000000 nop
00189ab0: 0c0621b5 jal 0x001886d4      Load (PA + Y)%
00189ab4: 00000000 nop
00189ab8: 14400003 bne r2,r0,0x00189ac8
00189abc: 00000000 nop
00189ac0: 0c061e18 jal 0x00187860   Determine which stat (PA/MA/SP) is reduced, Spell Slot Hard-Code Routine
00189ac4: 00000000 nop
00189ac8: 8fbf0010 lw r31,0x0010(r29)
00189acc: 27bd0018 addiu r29,r29,0x0018
00189ad0: 03e00008 jr r31
00189ad4: 00000000 nop


That's what Formula 2B looks like. That line I highlighted tells the game where to go look for the information about which stat is going to be affected by the formula and it is assigned by what skillslot the ability is in. Formula 2B used in the skillslot for Speed Break will always affect speed. There's more to this that someone else could answer in more detail but the short answer is: ASM fuckery.
  • Modding version: PSX
  • Discord username: Celdia#0

scbw1234

So if i want speed break to work,i must assign it at slot 6?(battle skillset order)

What would happen lets say if i added speed break in another skillset which is on the last slot of the skillset?

So there is no way to combine all three property together?

scbw1234

By the way,does the same thing apply to Equipment breaking and Mighty sword?If it does,wouldn't it be weird that orlandu had mighty sword in a different slot then Meliadoul and still works normally?

PS:sorry about double posting.

Celdia

Quote from: scbw1234 on April 10, 2013, 07:33:28 am
So if i want speed break to work,i must assign it at slot 6?(battle skillset order)

No, if you wanted Speed Break to work properly you would have to make it in Ability slot 008F under the abilities tab in FFTP.

Quote
What would happen lets say if i added speed break in another skillset which is on the last slot of the skillset?


You can put it into any Normal skillset without a problem.

Quote
So there is no way to combine all three property together?

Without modifying an ability formula via ASM, no, there is no way to have a skill that damages all three stats simultaneously.

Quote
By the way,does the same thing apply to Equipment breaking and Mighty sword?If it does,wouldn't it be weird that orlandu had mighty sword in a different slot then Meliadoul and still works normally?


Yes, the ability slot under the Abilities tab in FFTP is what is looked at to determine what piece of equipment is broken, not the skillset.

Quote
PS:sorry about double posting.


There is an Edit button for a reason. Learn it, live it, love it. ^_^
  • Modding version: PSX
  • Discord username: Celdia#0

scbw1234


Choto

Everything Celdia said is spot on, she's awesome.

Just a thought, if you get involved with learning ASM.. you will be able to do many of the things you are asking about with relative ease. You'll also have a better knowledge of what can or can't be done based on the original code. It's a long-term goal, but you should read some of the tutorials or look at the routines on the wiki and see what you think!

scbw1234

Quote from: Choto on April 10, 2013, 08:17:21 am
Everything Celdia said is spot on, she's awesome.

Just a thought, if you get involved with learning ASM.. you will be able to do many of the things you are asking about with relative ease. You'll also have a better knowledge of what can or can't be done based on the original code. It's a long-term goal, but you should read some of the tutorials or look at the routines on the wiki and see what you think!


Hello Choto hows your JoT5 maintenance going  :D

I'm kinda of embarrassed to say this,but...  :oops: :oops: :oops:

I tried to read Zodiac's Beginners Tutorial for ASM hacking,and start from section OPCODE i had no idea what he is talking about  :oops: :oops: :oops:

http://ffhacktics.com/tutorials.php?id=11

By the way,the R3000 was it from PSX emulator 1.13? Does Epsxe has this feature? :oops:

About dynamic and static,if you are using a memory editor to check for dynamic code,would the same address in dynamic matchs the address in hex editor?(static)

:oops: :oops: :oops: :oops:

Choto

r3000 is the processor of the psx. Commonly it's referred to as the debugger.. which Epsxe doesn't have. Pokeytax's tutorial has a download for psxrel debugger and a little tutorial of how to use it. Things will be confusing at first but try to look at all the different resources and tutorials and you can kinda put the pieces together.

The dynamic and static addresses wouldn't really match, they refer to different places I think. FFTPatcher edits all static addresses. Dynamic data is usually loaded from static places.. like unit data during battle is loaded from party data. Check the ASM starter kit thread for some files that will help!

scbw1234

I'll check the pokeytax beginner tutorial  :)

By the way,i'm looking for a formula that with boost MA like the way Accumulate boosts PA,but either scream boost all three or bard song hardcoded like those battle skills,Is there a formula other then these 2?Or if anyone had done an ASM hack to make such formula possible?because i want the bard song to stay as it is and make a new ability   :shock: :shock: :shock:

Choto

This is an easy hack to make, i'll walk you through it.

Here is the formula that boosts PA (Accumulate), taken from the Wiki
[36]
001868f0: 3c028019 lui r2,0x8019      
001868f4: 904238fa lbu r2,0x38fa(r2)        Load Y
001868f8: 3c038019 lui r3,0x8019      
001868fc: 8c632d90 lw r3,0x2d90(r3)      Load Targets Current Action Data
00186900: 34420080 ori r2,r2,0x0080         Set Bonus Flag
00186904: a0620014 sb r2,0x0014(r3)         Store Y + bonus flag as PA boost
00186908: 3c038019 lui r3,0x8019      
0018690c: 8c632d90 lw r3,0x2d90(r3)      
00186910: 34020001 ori r2,r0,0x0001         Load as Psuedo-Status
00186914: 03e00008 jr r31         
00186918: a0620025 sb r2,0x0025(r3)            Store attack type


If you open the "Data Locations" file that can be obtained from the ASM starter kit thread, scroll down to where it says "Unit Data". This is at 801908cc. If you keep scrolling down to offset 0x18c, you'll see "Current Action Data". This is the address that these two commands load into register 3:

00186908: 3c038019 lui r3,0x8019      
0018690c: 8c632d90 lw r3,0x2d90(r3)   

Then if you scroll further, you'll see that at offset 0x0014 is where the PA change is stored. Right past that at 0x0015 is "MA Change". So by simply changing "sb r2,0x0014(r3)" to "sb r2,0x0015(r3)" you will store the Y value of the ability as an MA change. Now if you want to keep the original accumulate, you'll have to copy/paste this formula into another formula to overwrite it, or jump to free space and write the formula there. Does that all make sense?

scbw1234

Quote from: Choto on April 11, 2013, 10:43:02 am
This is an easy hack to make, i'll walk you through it.

Here is the formula that boosts PA (Accumulate), taken from the Wiki
[36]
001868f0: 3c028019 lui r2,0x8019      
001868f4: 904238fa lbu r2,0x38fa(r2)        Load Y
001868f8: 3c038019 lui r3,0x8019      
001868fc: 8c632d90 lw r3,0x2d90(r3)      Load Targets Current Action Data
00186900: 34420080 ori r2,r2,0x0080         Set Bonus Flag
00186904: a0620014 sb r2,0x0014(r3)         Store Y + bonus flag as PA boost
00186908: 3c038019 lui r3,0x8019      
0018690c: 8c632d90 lw r3,0x2d90(r3)      
00186910: 34020001 ori r2,r0,0x0001         Load as Psuedo-Status
00186914: 03e00008 jr r31         
00186918: a0620025 sb r2,0x0025(r3)            Store attack type


If you open the "Data Locations" file that can be obtained from the ASM starter kit thread, scroll down to where it says "Unit Data". This is at 801908cc. If you keep scrolling down to offset 0x18c, you'll see "Current Action Data". This is the address that these two commands load into register 3:

00186908: 3c038019 lui r3,0x8019      
0018690c: 8c632d90 lw r3,0x2d90(r3)   

Then if you scroll further, you'll see that at offset 0x0014 is where the PA change is stored. Right past that at 0x0015 is "MA Change". So by simply changing "sb r2,0x0014(r3)" to "sb r2,0x0015(r3)" you will store the Y value of the ability as an MA change. Now if you want to keep the original accumulate, you'll have to copy/paste this formula into another formula to overwrite it, or jump to free space and write the formula there. Does that all make sense?


Hi Choto,i'm a bit confused

There are two parts i don't understand

1:what does these two command actually mean?

00186908: 3c038019 lui r3,0x8019      
0018690c: 8c632d90 lw r3,0x2d90(r3)   

How can i tell if these two command loads "Current Action Data"?

2:where are the blank formula space located?i can't find the address in the Wiki formula page

PS:There are some effects in R/S/M that are very unique like Move-HP-UP heal a percentage of health instead of fixed number,or MA/PA/SP save reaction that adds stats,or critical restore that only heals if certain conditions are met.Could this effect alterable or could those formulas be given to active abilities?

Choto

1. In data locations, take a look at these addresses:
80192d8c - Attacker Current Action Data Pointer
80192d90 - Target Current Action Data Pointer
80192d94 - Attacker's Data Pointer
80192d98 - Target Data Pointer


the 20 units that can appear in battle have data ranging from 1908cc to ~192F4C. each units data is 0x1c0 long (the 0x means it's the hexadecimal number system, whose numbers range from 0 1 2 3 4 5 6 7 8 9 A B C D E F, so A would be 10, F would be 15) Somewhere along the routines, the targets and attackers data addresses are stored at these locations that I posted above, so the address POINT to the address where the units data is stored. That's why they're referred to as a pointer. If we were to step through the debugger it would look like this:

lui r3,0x8019     -->    r3 = 0x80190000
lw r3, 0x2d90(r3) -->  r3 = 0x801924cc (units data address)

the second command is saying "load the word of data at 0x2d90 + whatever is in r3, so effectively 80192d90

2. If you click on the formulas link on the main page it will take you to a list of all the formulas. If you then click on the blank ones, you'll see where they are located. The blank ones simply don't do anything though, they just return to where you jumped to them from. You would need to put a jump command that jumps to Free Space, then write the routine you want in that free space, and then jumps back to the same location like nothing ever happened. "Free space" is referring to the Kanji Table. This is a section of the Battle.bin file at which a bunch of kanji was stored that isn't actually used for code or data in the game... and can thus be written over with all of our hacks. However, you have to be careful not to write over the same locations where another hack is stored or the game will crash. So as long as you know what is stored where in this free space, you'll be fine.

The other effects that you are describing are scattered in a bunch of different routines on Battle.bin. The best way for you to see what is where would be to go to the Routine Locations of Battle.bin, and browse through the different routines that are up there to see what it's doing. For example: http://ffhacktics.com/wiki/Poison_and_Regen

You can see that this routine handles the hp Loss or gain from poison and regen. It's probably jumped to from a routine that runs only when the end of the units turn occurs. The easiest way for you to find the one you're looking for is to set a breakpoint in the debugger. So say you want to change PA save to CT save or something. Give a unit PA save, and right before you hit him, set a write breakpoint at that units current action data in the 0x14 byte that we described earlier "PA Change". The game will then freeze at the command that sets the PA bonus, and you can change it to a CT bonus instead much like we changed accumulate to use MA instead.

Glain

That's a pretty impressively condensed ASM hacking primer.  There's a lot to cram in, but it's a lot easier to understand this stuff when you work through some of the hacks, I think.

Just a slight nitpick.  The R3000 is the model of the PSX processor and is what's being emulated by the emulators.  The debugger in pSX is an "R3000 debugger", i.e. it's a debugging program for the R3000 processor.  That is, the R3000 is a CPU which is the target processor of the debugging, not the debugger itself.

Isn't 2d90 the attacker's action (i.e. the main action), not the target's?  I'm pretty sure 2d8c is the action used to apply HP healing to the attacker from the target in the drain abilities.

Edit: Removed a statement that didn't make sense.
  • Modding version: Other/Unknown

scbw1234

Quote from: Choto on April 12, 2013, 08:14:56 am
1. In data locations, take a look at these addresses:
80192d8c - Attacker Current Action Data Pointer
80192d90 - Target Current Action Data Pointer
80192d94 - Attacker's Data Pointer
80192d98 - Target Data Pointer


the 20 units that can appear in battle have data ranging from 1908cc to ~192F4C. each units data is 0x1c0 long (the 0x means it's the hexadecimal number system, whose numbers range from 0 1 2 3 4 5 6 7 8 9 A B C D E F, so A would be 10, F would be 15)


So if its 1c0 for each unit,would it makes it end at 192BCC? how come it ends at 192F4C?


QuoteSomewhere along the routines, the targets and attackers data addresses are stored at these locations that I posted above, so the address POINT to the address where the units data is stored. That's why they're referred to as a pointer. If we were to step through the debugger it would look like this:

lui r3,0x8019     -->    r3 = 0x80190000


what does r3 itself stands for? i understood the second command lw stands for load word,how about the first line lui?

Quotelw r3, 0x2d90(r3) -->  r3 = 0x801924cc (units data address)

the second command is saying "load the word of data at 0x2d90 + whatever is in r3, so effectively 80192d90


where did 0x801924cc calculated from? how come r3 = 0x801924cc?

Quote2. If you click on the formulas link on the main page it will take you to a list of all the formulas. If you then click on the blank ones, you'll see where they are located. The blank ones simply don't do anything though, they just return to where you jumped to them from. You would need to put a jump command that jumps to Free Space, then write the routine you want in that free space, and then jumps back to the same location like nothing ever happened. "Free space" is referring to the Kanji Table. This is a section of the Battle.bin file at which a bunch of kanji was stored that isn't actually used for code or data in the game... and can thus be written over with all of our hacks. However, you have to be careful not to write over the same locations where another hack is stored or the game will crash. So as long as you know what is stored where in this free space, you'll be fine.


When i opened FFTpathcer,on the formula flag in every ability,i could all the way scroll to FF,but the formula page in wiki ends at 64,so if i were to use blank slot,i would have to do it within 64,the range from 65-FF are not doable?

QuoteThe other effects that you are describing are scattered in a bunch of different routines on Battle.bin. The best way for you to see what is where would be to go to the Routine Locations of Battle.bin, and browse through the different routines that are up there to see what it's doing. For example: http://ffhacktics.com/wiki/Poison_and_Regen

You can see that this routine handles the hp Loss or gain from poison and regen. It's probably jumped to from a routine that runs only when the end of the units turn occurs. The easiest way for you to find the one you're looking for is to set a breakpoint in the debugger. So say you want to change PA save to CT save or something. Give a unit PA save, and right before you hit him, set a write breakpoint at that units current action data in the 0x14 byte that we described earlier "PA Change". The game will then freeze at the command that sets the PA bonus, and you can change it to a CT bonus instead much like we changed accumulate to use MA instead.


Is it possbile to make the effect from R/S/M to those formulas used by abilities? let say if i want to create a ability that heals an ally based on a percentage of target's max HP.

Thanks so much Choto,you are like an abecedarian teacher to me  :D

Choto

Quote from: scbw1234 on April 12, 2013, 10:48:23 am
So if its 1c0 for each unit,would it makes it end at 192BCC? how come it ends at 192F4C?


guests are considered 6th and 7th units. there is a total of 0x16 (20) available slots for units in battle. so 0x1908cc + 0x1c0*0x16 = 0x192f4c

Quote from: scbw1234 on April 12, 2013, 10:48:23 am
what does r3 itself stands for? i understood the second command lw stands for load word,how about the first line lui?


r3 stands for register 3. There are 31 registers in the r3000 processor. If you open the debugger or look at pokeytax's tutorial you will see them on the upper-right. Data is loaded/manipulated in these registered and then stored back into memory if needed. Lui means load unsigned immediate. you can find a good description of most commands in FDC's tutorial.

Quote from: scbw1234 on April 12, 2013, 10:48:23 am
where did 0x801924cc calculated from? how come r3 = 0x801924cc?


say Ramza is the 1st player character in battle. His data is stored at 0x801924cc. Now lets say he attacks an enemy whos data is at 0x801908cc. Ramza's data will be stored as "attackers data", and the enemies will be stored as Targets data. Their respective current action data will be 0x18c past their unit data. So i was wrong actually.. In the case i'm describing now, those two commands would load the Targets current action data, 0x80190a58. Memory would look like this:

80192d8c: 80192658                Attacker Current Action Data Pointer
80192d90: 80190a58                Target Current Action Data Pointer
80192d94: 801924cc                Attacker's Data Pointer
80192d98: 801908cc                Target Data Pointer

So if you load the word at 80192d90, then you would be loading 80190a58 into r3.

Quote from: scbw1234 on April 12, 2013, 10:48:23 am
When i opened FFTpathcer,on the formula flag in every ability,i could all the way scroll to FF,but the formula page in wiki ends at 64,so if i were to use blank slot,i would have to do it within 64,the range from 65-FF are not doable?


Any formula past 64 will default to formula 1. It's "hardcoded" to do so. Hardcoding refers to specific code that square put in that will always occur. You can change the hardcoding if you want, but you have to make sure everything works :P

Quote
Is it possbile to make the effect from R/S/M to those formulas used by abilities? let say if i want to create a ability that heals an ally based on a percentage of target's max HP.


Mathematically, it's simple to do this. I believe there is a formula already that heals based on a percentage of HP. I know for a fact that the Demi formulas damage based on HP.. so you could even call that formula.. and then code it to convert the damage to healing. Any mathematics like that are simply a matter of coding the routine to perform those operations that you want.

Quote
Thanks so much Choto,you are like an abecedarian teacher to me  :D


Anytime, try to scour the forums for more information. There's alot to learn and a good amount of common questions have already been asked. Keep at it and you'll get it.

scbw1234

I see!So the current unit action means accumulation targets self.

So if i want to replace blank slot 46 to accumulation MA,but act as cheer/yell,which targets other unit,how should it be done?

[46]
0018a218: 03e00008 jr r31         
0018a21c: 00000000 nop

What should i do in hex editor?I remember in pokeytax's tutorial,he mentioned in hex editor the addresses are subtract 0x67000.but whats the range for each formula?since i have to add all the code my self to the blank slot.


Choto

Either you can try to fit the formula into the original formula space, or jump to free space and use all the available space for whatever you need to do. Since formula 46 is only 2 lines long, you're gonna need more room. So:

0018a218: j 0x151ff0        -This jumps to free space at 0x151ff0
0018a21C: nop


[0x00151FF0] addiu r29,r29,-0x0010        \These two lines save the return address, dont worry about them at this point
[0x00151FF4] sw r31,0x0004(r29)           /
[0x00151FF8] jal 0x001868f0              #run through formula 36
[0x00151FFC] nop
[0x00152000] lui r1,0x8019
[0x00152004] lw r2,0x2d90(r1)      #load targets action data
[0x00152008] nop
[0x0015200C] lbu r3,0x0014(r2)      #load PA change
[0x00152010] sb r0,0x0014(r2)      #clear PA change
[0x00152014] sb r3,0x0015(r2)      #store old PA change as MA change
[0x00152018] lw r31,0x0004(r29)            \
[0x0015201C] addiu r29,r29,0x0010         /these two lines load the original return address
[0x00152020] jr r31
[0x00152024] nop


So there's our code, but in order to write a patch for it, we need to do some things. The conversion that pokeytax talks about is from RAM to the actual battle.bin file. Battle.bin is loaded at 0x67000 in RAM, meaning address 0 in Battle.bin is actually address 0x67000 in RAM. We want to write to battle.bin. So we put our code into MassHexASM and convert it to hex, and offset the location that we want to write to:

0018a218 - 0067000 = 123218

00151ff0 - 0067000 = EAFF0

So here is what your patch will look like:
<Patch name="formula 46 becomes +MA (Y)">
    <Location file="BATTLE_BIN" offset="123218">
FC470508
00000000
</Location>
   <Location file="BATTLE_BIN" offset="EAFF0">
F0FFBD27
0400BFAF
3C1A060C
00000000
1980013C
902D228C
00000000
14004390
140040A0
150043A0
0400BF8F
1000BD27
0800E003
00000000
</Location>
  </Patch>


now paste this into one of the .xml files with other patches that look like it in the FFTorgASM folder. If you don't see it when you load fftorgASM, it means you pasted it in wrong and messed up the format of the .xml file. Patch your iso and hopefully i didn't make any errors.

This is the lazy way to do it since we just called formula 36 and then changed stuff afterward.. so if you change formula 36, you will change formula 46 too, but if you're only doing some small scale hacking you should be fine.

scbw1234

I'm saving this thread to my computer as starter tutorial :)

Although there are still things that i don't quite understand,but i think i get the basic principle about RAM,Hex and hacking now,thank you so much Choto

By the way,is there a dictionary for all the command such as sw,jal,nop used in RAM?and what does save and load return address do?