Author Topic: Increasing poison damage in FF7  (Read 5729 times)

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Increasing poison damage in FF7
« on: 2010-08-01 20:21:51 »
Title says it all really. I'd like to ask about upping the damage in the PC or PSOne versions of FF7.

I did make a first time try and disassembly (the R3000 version), but I can't say I got too far. I managed to find where damage dealt is stored (0xF99EC) and put a breakpoint on it, but without much experience with true assembler I couldn't find much out. Here's what I could make out:

When damage is dealt, data from R2 is put into address 0xF99EC. Where does this data for R2 come from? Well, the mention of R2 that comes before it is

lhu R2 0x0000 R1

So, it pulls whatever data R1 points to into R2. What's that?

I try setting a breakpoint with the PSX R3000 debugger, setting 'execute' and the address of the instruction (I *assume* that's how it's done - I'm honestly unsure). Doing this seems to break at that instruction, although the next instruction becomes illegal (maybe the break happens *before* the specified instruction is performed, not during?).

The value in R1 is 800fa08d. There's my poison damage at that location. What writes there? Setting a breakpoint yields

sll R4 R4 0x02

That's just a shift left? There's no mention of any prominent addresses anywhere in the registries, either. Evidently, I must be misunderstanding how this works...

The question is: how would I find the point at which poison damage is calculated? Or, if anyone already knows, I'd be glad for the help.

« Last Edit: 2010-08-01 20:23:27 by Bosola »

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Increasing poison damage in FF7
« Reply #1 on: 2010-08-03 01:56:55 »
I'd very much like to know this as well, although it looks like this information is undiscovered :|

Is there a chance that discovering this will help us to find out the other battle damage formulas? Because that would help greatly in modding the game...

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Increasing poison damage in FF7
« Reply #2 on: 2010-08-03 20:00:33 »
When I get more time, I'll also look for specific operations and particular values in registers.

I assume the operation goes like this:

* Read from Max HP post-materia in battle memory map  (we know where this value is)
* Read value for poison fraction
* Multiply the two
* Divide by 32
* ? ? ? ?
* PROFIT!

Now, what actually happens on the assembler level? This is my first proper soujourn into true assembler, and into the R3000. It's not obvious from looking at this how many registers the game will juggle, and how often it'll offload some value to a 'workbench' somewhere in RAM. The little I've seen so far makes me suspect there'll be two active registers, but I could be totally wrong.

At any rate, there'll be a divide at some point. I can watch the HI and LO registers for interesting values (if I expect a particular modulo, for instance, I can watch for it in LO, which stores the remainders of division). I might be able to trace the logic back - I hope. Even then, it's one thing to identify the ASM in the memory, and quite another to recognize the data on the ISO which yields it - unless someone here has a clue.

I wonder if NFITC1 has any tips - pretty sure he's disassembled the PC version at least. Someone must have done this at some point, or else we wouldn't have info on the damage algorithms.
« Last Edit: 2010-08-03 20:05:02 by Bosola »

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Increasing poison damage in FF7
« Reply #3 on: 2010-08-03 21:28:56 »
Someone must have done this at some point, or else we wouldn't have info on the damage algorithms.

Then perhaps you can hope that Terence Fergusson turns up ITT. He's the source of all our knowledge about damage algorithms. Assuming he didn't spend hours playing around to figure things out by trial and error, he must know something about the parts of the game's code dealing with damage.

Personally, I'd like a way to fiddle with physical and magical damage algorithms; I'd like physical damage to be less dependent on the attacker's level and magic damage to be more dependent on it (because at high levels, the strength of physical attacks makes magic attacks useless).

nfitc1

  • *
  • Posts: 3013
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Increasing poison damage in FF7
« Reply #4 on: 2010-08-03 21:58:11 »
I wonder if NFITC1 has any tips - pretty sure he's disassembled the PC version at least. Someone must have done this at some point, or else we wouldn't have info on the damage algorithms.

I've tried to stay away from battle functions since they seem to be all over the place and one "function" usually turns out to be about 15 nested functions that have generic purposes. I've found lots of other stuff, but not damage formulas. Finding them tends to be a pain too.

However, you did inspire me to go back and look at the Battle Arena's Slot handling and I realized that what I thought was "Break ALL Materia" is more selective and the "Break Command Materia" is really "Inflict Mini". Except it's not really. It's more like "queue attack that will attempt to inflict Mini with perfect hit-and-inflict-rate.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Increasing poison damage in FF7
« Reply #5 on: 2010-08-03 22:54:37 »
I suppose what I want to know is whether or not I'm even approaching this the right way. I've never used a debugger before, nor really worked in assembler. I can get my head around the concepts of pointers and the like, I'm just totally unsure about the tools. As in the first post, I just can't see the chain of events. Why would a logical shift left write to an address? I'm going to take another look and play with the debugger some more...

Anyway, I'll see if I can find the division. Maybe then I'll be able to trace the logic. I'm also going to read through Gemini's posts like a hawk. He can do more in a few posts for this forum than many members do through their entire tenures.

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Increasing poison damage in FF7
« Reply #6 on: 2010-08-05 19:57:10 »
Anyway, I'll see if I can find the division. Maybe then I'll be able to trace the logic. I'm also going to read through Gemini's posts like a hawk. He can do more in a few posts for this forum than many members do through their entire tenures.

Yes, and this isn't because of any magical ability that he has. When people have assumed that jobs are too difficult to do, no progress gets made. When people have made an effort of solves those problems, they often turn out to be easily fixable. See the field backgrounds: nothing got done for years because everyone thought it was too hard, and then everyone steamrollered ahead once they realised it wasn't.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: Increasing poison damage in FF7
« Reply #7 on: 2010-08-06 01:43:31 »
In the meanwhile, I guess there's always AI haxorring! Perhaps poisoned physical attackers should take a damage penalty. I've never actually written AI that directly subtracts, adds or alters HP, though there's no real reason it shouldn't work. The only thing to remember is that there'd be no damage displayed. That'd give the status some teeth.

I will try and trace the logic though.