Author Topic: [FF7 PSX] How to find enemy encounters in memory?  (Read 286 times)

Raziel80

  • *
  • Posts: 86
    • View Profile
How to find enemy encounters in current area in memory, during gameplay? I want to find Battle ID and Probability for this battle for each area from field files, but in memory. Each unique area can support up to: 6 Normal battles and 4 Special Formation battles. I found several, but I don’t see how they are connected to each other. I want to add this data to my trainer to see which enemies you can meet in the current area. This data is located in very different places in memory. Maybe FF7 uses some kind of pointers for this?
« Last Edit: 2020-06-26 23:16:43 by Raziel80 »

NFITC1

  • *
  • Posts: 2938
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [FF7 PSX] How to find enemy encounters in memory?
« Reply #1 on: 2020-06-28 18:13:30 »
I can tell you the addresses on the PC version (0xCFF45C). I don't think it translates directly to the PSX. That points to the data in memory that you're looking for. I think the memory structure it points to goes something like this:

0x0 - word; overall encounter rate
0x2:0xD - words; 6bit encounter chance/10bit formation value. There's a chance that these can be encountered "preemptively".
0xE:0x15 - words; special formations in same format as above. Checked first in order. I believe they are two preemptive followed by one back attack and one side attack. Those formations cannot be overriden by preemptive, but can go up/down in probability of encountering with preemptive materia.
0x16 - word; probably nothing. Likely an alignment buffer.

Raziel80

  • *
  • Posts: 86
    • View Profile
Re: [FF7 PSX] How to find enemy encounters in memory?
« Reply #2 on: 2020-06-30 02:08:44 »
I can tell you the addresses on the PC version (0xCFF45C). I don't think it translates directly to the PSX. That points to the data in memory that you're looking for.
Found these pointers for psx. Thanks for the help. PC version has 2 pointers: 0xCFF444, 0xCFF45C and PSX version also has 2 pointers.

I think the memory structure it points to goes something like this:

0x0 - word; overall encounter rate
0x2:0xD - words; 6bit encounter chance/10bit formation value. There's a chance that these can be encountered "preemptively".
0xE:0x15 - words; special formations in same format as above. Checked first in order. I believe they are two preemptive followed by one back attack and one side attack. Those formations cannot be overriden by preemptive, but can go up/down in probability of encountering with preemptive materia.
0x16 - word; probably nothing. Likely an alignment buffer.

It looks like this:
0x00 - byte; may be enabled/disabled, encounter group 1
0x01 - byte; overall encounter rate
0x02 - battle 1 (0x02 - 0x0D - 6 words)
0x04 - battle 2
0x06 - battle 3
0x08 - battle 4
0x0A - battle 5
0x0C - battle 6
0x0E - back attack 1 (0xE - 0x15 - 4 words)
0x10 - back attack 2 (according to the Makou Reactor)
0x12 - side attack
0x14 - attack from both sides
0x16 - word. alignment

0x18 - byte; may be enabled/disabled, encounter group 2
0x19 - byte; overall encounter rate
0x1A - battle 1-6 (0x1A - 0x24 - 6 words)
0x26 - 4 special formations (0x26 - 0x2C - 4 words)
0x2E - word. alignment