Author Topic: .p file editing question, and a general LGP question too  (Read 5078 times)

chocomog

  • *
  • Posts: 23
    • View Profile
I have two questions:
On alhexx's site, on the .p file description, there's all this stuff like number of normals, textures, vertices, etc...this is gonna sound noobish, but how do you get to all that stuff? I tried notepad, and it didn't work...

and I've been trying to make Aeris's battle model in to a Jemnezmy's, just because I wanna learn how to do it. Using lgptools, biturn, and Borde's Kimera tool, it's been going ok until I come to this: Jemnezmy's head model seems to have eyebrow textures; why I have no idea. But anyway, I tried adding rzae.p (hiae is the real eyebrow texture; i renamed it, and when I did this in biturn it worked) to the lgp, and the game enters battle fine, but when I win or run away, it crashes. the lgp has the correct number of overall files though, since i deleted a different file to make room. moreover, there's still a white space where the texture should've been.

so basically does the lgp crash if each model doesn't have the right number of files, or the whole thing?

EmperorSteele

  • *
  • Posts: 933
    • View Profile
.p file editing question, and a general LGP question too
« Reply #1 on: 2005-06-21 18:27:21 »
It sounds like an animation problem.  I don't know much about these things myself, but that's what it sounds like to me.

As for the textures, i think it may have to do with The game thinking that the jezenemy is still aeris and it won't load the textures for Jez.. i dunno.

Hey, someone who knows what they're talking about, help me out here!

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
.p file editing question, and a general LGP question too
« Reply #2 on: 2005-06-21 19:05:40 »
If I do understand you right, then the answer is that the model has to have exactly all files it needs, not the LGP file at all.
The LGP file is an archive, so it does not matter for FF7, how many files there are inside, as long as every single model has all files it needs.

I hope this is what you wanted to know.

 - Alhexx

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
.p file editing question, and a general LGP question too
« Reply #3 on: 2005-06-21 21:45:07 »
Quote
On alhexx's site, on the .p file description, there's all this stuff like number of normals, textures, vertices, etc...this is gonna sound noobish, but how do you get to all that stuff? I tried notepad, and it didn't work...

What do you want to do with that stuff ? If you want just to see the information, you can do so in Biturn. When you load the model press button Data info and choose respective data type in the combobox.
If you want to alter the data then I dont know about any tool .. but guys in 'Hires field models' thread were doing something about this, try asking them.

Reunion

  • *
  • Posts: 104
    • View Profile
.p file editing question, and a general LGP question too
« Reply #4 on: 2005-06-21 21:50:38 »
Using notepad will only give you ascii charaters. The values are held in hexadecimals. So you will need a Hex editor to see these values.

Jemnezmy's head has three textures:
hiac
hiad
hiae

Aeris only has two textures:
rvac
rvad

Here is what I would do...
Rename:
hiac to rvac
hiad to rvad
hiae to rvae (this one will be added to the lgp but thats ok)

(just to note: a battle file will never have an extension)

Now Aeris's skeleton file (rvaa) will only load two textures because offset 0x18 has a value of 2.
It will load:
rvac
rvad

To make it load the three textures change offset 0x18 to have a value of 3.
Now it will load:
rvac
rvad
rvae

chocomog

  • *
  • Posts: 23
    • View Profile
.p file editing question, and a general LGP question too
« Reply #5 on: 2005-06-21 23:13:29 »
It worked!...kinda. Thanks to Reunion's instructions, the game loads all three textures now, but it still crashes after battle. Based on what Alhexx said, I think its because the game detects that Aeris doesn't have the right number of files anymore and crashes...

How do I change the number of models each file has? Aeris has 42 (I think, not including aa, ae (which I added) or da) files, but I couldn't find 42 or 2A  anywhere in the rvaa file.

BTW reunion how'd you know it was in the 0x18 offset? that was genius o_O

thank you all for your help so far.

L. Spiro

  • *
  • Posts: 797
    • View Profile
    • http://www.memoryhacking.com/index.php
.p file editing question, and a general LGP question too
« Reply #6 on: 2005-06-22 07:59:47 »
Quote
Based on what Alhexx said, I think its because the game detects that Aeris doesn't have the right number of files anymore and crashes...

The game doesn’t count the files and decide to crash.
It crashes because it needs something that isn’t there.

You deleted a file.
Stop that.  Put it back where it belongs.

What Reunion said about the battle models having no extension isn’t entirely correct.
The last two letters of the file ARE the extension; it’s just not an extension as you expect it to be in windows.

The last two letters tell you what type of file it is.

Keep this in mind as I explain offset 0x18.
In the skeleton file, which we decoded long ago, offset 0x18 is described as determining the number of texture files the model uses (in total, which is a different way from doing it compared to field models, which actually list the texture files they use by name).
It means, in total, the model will use 2, or 3, or whatever number is on 0x18.
Thus, when the game loads the skeleton file, it reads that number and stores it in memory.
It creates an array of textures equal to that number and then loads them (in order).
After that, the various .p models will have groups of vertices.
There is a type of vertex/polygon group that has a texture, and in this group, it will have an index to the texture it is using.

In other words, the game loads 3 textures:

tex[0]
tex[1]
tex[2]

Then one of the .p files uses, for example, tex[0] (the first one).
That .p file will have many polygons that are just colored, like Cloud’s hair or skin, but there will be one or two groups that are tagged as “a group that uses a texture”.
Once we get to these groups, there will be a number “0” which will indicate to us that the texture for the polygons in that group will be tex[0].
What happens if a group needs tex[3]?  It’s not there!  The game crashes.
Actually it will just show the white blobs over their eyes that you have been seeing.
But if there is an offset error and it ends up requesting texture -15469348772, it may just crash.




As I said before, field models reference textures by name, while battle models have nothing more than a number.
How does this work?

The ID of the model being loaded is the first two letters of the file name(s).
After that, to get a specific type of file, you add the extension.
aa = skeleton file.
da = animations.
ac - al = textures.
am - cj = body parts.
ck - cz = weapons (for humans mostly).

Thus the engine knows, if it is loading Aeris (rv), and she has 3 textures, then the textures are in files “rvac”, “rvad”, and “rvae”.

This is not the only place where this is true.
The engine is told, by the skeleton file, how many model files there are.
Therefore you need to ensure all the “rvam” through “rvcj” files are there (and by this I mean only the files NEEDED).
And you get the number of files it needs by offset 0x20 in the skeleton file.


L. Spiro

chocomog

  • *
  • Posts: 23
    • View Profile
.p file editing question, and a general LGP question too
« Reply #7 on: 2005-06-23 04:58:47 »
wow, thank you for the long help post ^_^. i just got back home; i'll try it out tonight (though its past midnight...hmm) and see if it works.

EDIT: w00t, it works now! the problem was that I intentionally corrupted a few of the files in order to make them invisible, which worked before, but when making an lgp, the game didn't like that. this time I used borde's editor to make something really small, so it was as good as invisible.