Author Topic: More FF7 Tech Info for everyone.  (Read 6673 times)

The SaiNt

  • *
  • Posts: 1300
    • View Profile
More FF7 Tech Info for everyone.
« on: 2001-06-01 18:51:00 »
This is what I've found out so far with some free time of course  :)

FF7 Loading process for the battle.
-----------------------------------

1. FF7 reads AWE.LGP(or whichever depending on your music config)
-This is to load the MIDI file to be played.
(FF7 doesn't seem to read this file when you encounter you 2nd battle upon starting)

****************************************************************************************************************

2. FF7 reads MENU_US.LGP
-This is to load the battle menu displays and text
(FF7 doesn't seem to read this file when you encounter you 2nd battle upon starting)

****************************************************************************************************************

3. FF7 reads SCENE.BIN
-I suspect this is the background information for the battle

****************************************************************************************************************

4. FF7 reads KAGE.DAT
-Since KAGE is shadow in Japanese, Qhimm also believes that this represents the shadow in the battle.

****************************************************************************************************************

5. FF7 reads MARK.DAT
-After discussing with Qhimm, he believes this is the yellow triangle marker that appears above the characters head.

****************************************************************************************************************

6. FF7 creates the file TF2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 12
-Offset 176 : Length 4
-Offset 180 : Length 24
-Offset 204 : Length 56
-Offset 260 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

7. FF7 creates the file TF3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 12
-Offset 176 : Length 4
-Offset 180 : Length 24
-Offset 204 : Length 56
-Offset 260 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

8. FF7 creates the file TG2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 12
-Offset 176 : Length 4
-Offset 180 : Length 24
-Offset 204 : Length 56
-Offset 260 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

9. FF7 creates the file TG3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 12
-Offset 176 : Length 4
-Offset 180 : Length 24
-Offset 204 : Length 56
-Offset 260 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!
****************************************************************************************************************

10. FF7 creates the file T2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 24
-Offset 188 : Length 12
-Offset 200 : Length 4
-Offset 204 : Length 24
-Offset 228 : Length 56
-Offset 284 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

11. FF7 creates the file T3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 24
-Offset 188 : Length 12
-Offset 200 : Length 4
-Offset 204 : Length 24
-Offset 228 : Length 56
-Offset 284 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

12. FF7 creates the file TGT2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 24
-Offset 188 : Length 12
-Offset 200 : Length 4
-Offset 204 : Length 24
-Offset 228 : Length 56
-Offset 284 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

13. FF7 creates the file TGT3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 36
-Offset 164 : Length 24
-Offset 188 : Length 12
-Offset 200 : Length 4
-Offset 204 : Length 24
-Offset 228 : Length 56
-Offset 284 : Length 12
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

****************************************************************************************************************

14. FF7 creates the file SF2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 16
-Offset 192 : Length 8
-Offset 200 : Length 48
-Offset 248 : Length 56
-Offset 304 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

15. FF7 creates the file SF3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 16
-Offset 192 : Length 8
-Offset 200 : Length 48
-Offset 248 : Length 56
-Offset 304 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

16. FF7 creates the file SG2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 16
-Offset 192 : Length 8
-Offset 200 : Length 48
-Offset 248 : Length 56
-Offset 304 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

17. FF7 creates the file SG3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 16
-Offset 192 : Length 8
-Offset 200 : Length 48
-Offset 248 : Length 56
-Offset 304 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

****************************************************************************************************************

18. FF7 creates the file S2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 32
-Offset 208 : Length 16
-Offset 224 : Length 8
-Offset 232 : Length 48
-Offset 280 : Length 56
-Offset 336 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

19. FF7 creates the file S3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 32
-Offset 208 : Length 16
-Offset 224 : Length 8
-Offset 232 : Length 48
-Offset 280 : Length 56
-Offset 336 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

20. FF7 creates the file SGT2D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 32
-Offset 208 : Length 16
-Offset 224 : Length 8
-Offset 232 : Length 48
-Offset 280 : Length 56
-Offset 336 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

21. FF7 creates the file SGT3D.P or overwrites it if it already exists.
-Offset 0   : Length 128
-Offset 128 : Length 48
-Offset 176 : Length 32
-Offset 208 : Length 16
-Offset 224 : Length 8
-Offset 232 : Length 48
-Offset 280 : Length 56
-Offset 336 : Length 16
-After writing to the above offsets in the file, FF7 closes the file
-Now FF7 reopens this file and reads the offsets above. Don't ask me why!

****************************************************************************************************************

21. FF7 reads SEFFECT1.TEX
-Offset 0   : Length 236
-Offset 236 : Length 1728
-Offset 1964: Length 65536

22. FF7 reads SEFFECT2.TEX
-Offset 0   : Length 236
-Offset 236 : Length 1728
-Offset 1964: Length 65536

23. FF7 reads SEFFECT3.TEX
-Offset 0   : Length 236
-Offset 236 : Length 1728
-Offset 1964: Length 65536

I am led to believe that this texture files are the ones that appear when your weapons make contact with the target.

****************************************************************************************************************

24. FF7 reads CAMDAT0.BIN (the whole file)
-I would think this would have something to do with the camera positioning or such.

****************************************************************************************************************

25. Now FF7 reads BATTLE.LGP
- I'm too lazy to note down every offset it reads but my guess is that it reads all the battle model information from here.

Up to here, we've only arrived at the end of FF7 Loading process for the battle.

Exiting Battle
--------------
1. FF7 reads AWE.LGP(or whichever depending on your music config)

During Battle
-------------

Hitting a target
----------------

1. FF7 reads AUDIO.DAT
(Strangely, FF7 seems to load the whole file into memory because no more hard disk access is required after AUDIO.DAT is loaded the first time. This would mean that during the start of battle, should Cloud move first and slice the enemy AUDIO.DAT is loaded to memory. Any subsequent access to any sounds even if it's the sound of Barret's gunshot, will not require an disc access. What a memory waster FF7 is  :) )

Casting a spell / summon / limit break / enemy special attack
-------------------------------------------------------------

1. FF7 reads MAGIC.LGP
(Same thing happens as to AUDIO.DAT. The file is not reread from the hard disk ever again upon the first loading of the file. Even during the next battle! Now we know why FF7 uses so much memory!)


ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
More FF7 Tech Info for everyone.
« Reply #1 on: 2001-06-02 02:18:00 »
The reason files are never re-loaded *could* be because FF7 has some form of internal caching system.

I'd be surprised - you can rely on Windows for that normally - but it's one explanation.

As for why it writes to, then reads from, the temp files:

That's possibly the sign that the field and battle engines were developed *totally* separately. That's how Mechwarrior 2: Mercenaries works, except there, the planning shell and battle engines are two separate EXE's. In that, when you enter a battle, the main game writes data for the battle to temp files. Then it exits and runs the battle EXE, which reads in the temp files to find out which battle to run!

FF7 possibly does the same; except it's not *quite* so hacky; the two engines are both in the same EXE file. It's a very crude way of exchanging data between two game engines that were coded separately; easy to program, of course.

Only a possibility, but that's my opinion anyway  :)


Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
More FF7 Tech Info for everyone.
« Reply #2 on: 2001-06-02 22:15:00 »
Very interesting theory, ficedula.

More FF7 Tech Info for everyone.
« Reply #3 on: 2001-06-02 23:23:00 »
The SaiNt: Thanks! I think this helps us out a lot.   :)

Scene.bin. If this *does* have the battle backgrounds, then our theories are correct. Does anyone have any idea whether or not any other battle location data would be in there as well? I doubt it, it's probably in the camdats, but you never know.

Kage.dat. I guess we were right on the money here as well.

Camdat0.bin. Hmmm. I suppose this makes more sense. At least it does as long as the camera data isn't in the same place as the backgrounds. This goes against our original theories that the camdat.bins seemed to hold limit break data and such. I assume Magic.lgp also has all the info for animations involving spells/limits/enemy skills/summons/special commands?

Ficedula: Makes sense. This goes back to how Square probably developed separate aspects of the game with separate teams. I'd guess that there probably was one team that concentrated solely on the battle engine.

[This message has been edited by Srethron Askvelhtnod (edited June 02, 2001).]


The SaiNt

  • *
  • Posts: 1300
    • View Profile
More FF7 Tech Info for everyone.
« Reply #4 on: 2001-06-12 15:53:00 »
There wasn't much point starting a whole new thread so I've decided to post it here instead.  :)

Since I might not find any time soon to update this docs and since fice is gonna be free real soon, I might as well post this link up.
(Use save target as..) http://www.zhenjock.f2s.com/dumps.jpg" TARGET=_blank>http://www.zhenjock.f2s.com/dumps.jpg
Remember to rename this file to the .zip file extension.

Tell me what you think!
This should help finding the files that keep the weapon, accessories and armour information. I do have one more file that I've not uploaded yet. It's a dump of the item list originally done my Qhimm.  :)


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
More FF7 Tech Info for everyone.
« Reply #5 on: 2001-06-14 00:38:00 »
Hmm, interesting. I don't really know what these files are, but fice's theory of two engines seems *possible*. That would explain why FF7 takes some time to load the battle field. But I've read out the files in my 'Ultima 0.27 ßETA 2' and here'r my results:

File   Figure   Color   add.   value3   Polys   ColorP's
========================================================
S2d.p   Quad   Black   4   4   2   6
S3d.p   Quad   Black   4   4   2   6
Sf2d.p   Quad   White   4   0   2   6
Sf3d.p   Quad   White   4   0   2   6
Sg2d.p   Quad   White   4   0   2   6
Sg3d.p   Quad   White   4   0   2   6
Sgt2d.p   Quad   Black   4   4   2   6
Sgt3d.p   Quad   Black   4   4   2   6
T2d.p   Tria   Black   3   3   1   4
T3p.p   Tria   Black   3   3   1   4
Tf2d.p   Tria   White   3   0   1   4
Tf3d.p   Tria   White   3   0   1   4
Tg2d.p   Tria   White   3   0   1   4
Tg3d.p   Tria   White   3   0   1   4
Tgt2d.p   Tria   Black   3   3   1   4
Tgt3d.p   Tria   Black   3   3   1   4

Numverts and Numlines are '0' in every file.

I've also compared the files with a Hex-Editor. Some files are almost the same, exept one byte, some others are different.

Like I said, I think Fice's theory of two engines could be possible, but I don't really think, that these files store the info for this action. Reason: The files are 'legal' .p files; they don't cause any errors when u load 'em in ultima...

Probably, these files are just trash (but I don't really think so). I just wonder why FF7 doesn't delete these files...
Hm, I think, we've got to work on it...and I think it could take a lot of time to find out, what these files are...

HEY, I've got an idea: has anyone tried to go into a battle, quit it, backup the created .p files and go into a battle agian. Then FF7 creates new .p files. Copy this files again and compare 'em with the backuped ones..?..If I have enough time,  I'll try it out...if someone has already tried this, please tell the result to me, ehm, us...

- Alhexx


The SaiNt

  • *
  • Posts: 1300
    • View Profile
More FF7 Tech Info for everyone.
« Reply #6 on: 2001-06-14 10:44:00 »
Hehe, I forgot something.
To view the dump files, make sure you switch off word wrap  :)

The Skillster

  • *
  • Posts: 2284
  • Loving every Final Fantasy
    • View Profile
More FF7 Tech Info for everyone.
« Reply #7 on: 2001-06-14 11:59:00 »
ah THOSE dump files  :)
i argued before that they where temp files.
qhimm said they was dubbuging dumps  :P
so they are 3d engine cache or something?

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
More FF7 Tech Info for everyone.
« Reply #8 on: 2001-06-14 15:32:00 »
Ok, I've compared some of of these files from different battles...and that's what I've found  out:
I've started 3 battles, and there's something interesting: the files from the first and the third battle were completely the same...but that's probably just a coincidence...

The Polygon Data and the figure are still the same...things like value3, additional and so on, too...but some bytes have changed in the second files:

Files: S*.p (all square files)
Offsets:
40, 41, 42, 4c, 4d, 4e,
50, 51, 52, 5c, 5d, 5e,
6c, 6d, 6e,
74, 75, 76, 7c, 7d, 7e,
e0, e1     <--- that's interesting


Files: T*.p (all triangle files)
Offsets:
40, 41, 42, 4c, 4d, 4e,
50, 51, 52, 5c, 5d, 5e,
6c, 6d, 6e,
74, 75, 76, 7c, 7d, 7e,
c8, c9

IOW, the bytes, which change every battle, are the bytes between 40 an 7e. Fice wrote in his description that the Vertex Pool starts at Offset 80...so the changes are in the file header (is it really the header, or does FF7 store any important information there ??) the last two changed bytes are at the end of the color pool...

In the square files (S*.p) there are 128 Bytes of data directly behind the polygon pool; in the triangle files (T*.p) therre are 96 Bytes.
That could mean: there are 32 Bytes for every Vertex...

I think we've got to hack the .p file format more...BTW, could does anybody know what is stored in the 'Value3'-Pool??? I'm askin b'cause in 50% of these S*.p and T*.p files, value3 ahs got a value...oh man, this is goin' to be complicated...

There's one more idea I have: Probably the 3D model in these .p files are just something like dummies; the real information could be stored in the file header...

- Alhexx


The SaiNt

  • *
  • Posts: 1300
    • View Profile
More FF7 Tech Info for everyone.
« Reply #9 on: 2001-06-14 17:30:00 »
Alhexx, I for one can tell you that the files will most likely be in the same format.   :)
However, you should not assume that they are standard. P files. Before, when I had some time, I was going to make an assumption, that the temp .P files are indeed INTER files for 2 engines. These .P files should represent all 3 characters that appear in battle (should there be 3) and the other enemies you are fighting. What you could try is this. Try running around in the same area several times. Now, keep comparing the .P files and look to see which contents of the files change whenever you meet different enemies. It would however be advisable to compare the files with similar battles to see if you get similar files. Do you get what I'm trying to say? I'm known for confusing people with long replies   :)

*EDIT*
Skillster, which dump files are you refering to?
In my last post, i meant the memory dump files I made not the FF7 temp files.
BTW, has anyone taken a look at them yet?

[This message has been edited by The SaiNt (edited June 14, 2001).]


The Skillster

  • *
  • Posts: 2284
  • Loving every Final Fantasy
    • View Profile
More FF7 Tech Info for everyone.
« Reply #10 on: 2001-06-15 01:30:00 »
im talkin the P file dumps in the ff7 root directory
the do exist in ff8, but they get deleted  on exit

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
More FF7 Tech Info for everyone.
« Reply #11 on: 2001-06-15 01:59:00 »
SaiNt: I've got much work with my Ultima-Project now...so I don't htink I'll have much time to work on this, too. I'd be nice if someone else would try around with these .p files...

- Alhexx


mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
More FF7 Tech Info for everyone.
« Reply #12 on: 2001-07-02 11:05:00 »
I just got an idea, maybe those temp *.p files are only grounds in battle scenes, because there are only plains. hmm hmm

[This message has been edited by mirex (edited July 02, 2001).]