Author Topic: News 'bout the .p file format...  (Read 8436 times)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« on: 2001-07-30 02:13:00 »
I've been workin' on the .p file format tonight. And that's
what I've found out.

Here we go:
--------------------------------------------------------
Number of Vertexes:

Additional (w/o numverts !)

--------------------------------------------------------
Number of Colors:

Additional + Value3 (w/o numverts, too!)

--------------------------------------------------------
Number of Polygons:

Numpolys (sometimes you've got to subtract some polys, but I haven't found that value in the file header yet)

========================================================
Start of Vertex Pool:

$80 (128 in decimal)

--------------------------------------------------------
Start of the Color Pool:

$80 + (NumVerts + Additional) * 12

--------------------------------------------------------
Start of the Polygon Pool (I'm not sure 'bout this, but it worx):

$80 + (Additional + NumVerts) * 12 + (value3 + Additional) * 4 + (NumPolys + NumLines + value3) * 4 ========================================================


I don't understand what's in '(NumPolys + NumLines + value3) * 4', but I'll keep workin' on it. Perhaps it's got to do with texture alignment or something like that...


So I said that reading out the color pool in the 'numpolys + additional'-way was a waste of memory? Heh, ALMOST THE *WHOLE* WAY we decoded the .p files was just a HUGE waste of memory...     :wink:

I guess nobody else found out this, b'cause nobody has programmed a 2D View for the .p files. I was just looking at Yuffie's head and I found some useless Vertx around the Point at 0 / 0 / 0. I wondered what these Verts were and I started deleting some source out of ultima and voila: These verts were read out unnecessarily...

Something else I found out:

NumVerts does only appear in field files (char.lgp), NumVerts in battle files is always 0.
Value3 does only appear in models which have textures (mostly heads). That's why I think Value3 has got something to do with Textures.

I think that's it for now.

- Alhexx

- edit -
Corrected Syntax

- edit 2 -
Forgot to mention that I've uploaded some screenshot to this topic on my site...

[This message has been edited by Alhexx (edited July 29, 2001).]


halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
News 'bout the .p file format...
« Reply #1 on: 2001-07-30 05:25:00 »
It's not a waste of memory when you realize that the data was not ment for the PC. The PSX uses packets of data that get rendered in an ordering table from the highest Z coordinte to the smallest. Take a look at the PSX GPU packet fromat. You will see the data start to fall into place

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
News 'bout the .p file format...
« Reply #2 on: 2001-07-30 11:15:00 »
If you want some more info about p format, look into my document,  http://sklad.host.sk/pformat.txt" TARGET=_blank>http://sklad.host.sk/pformat.txt  it is really messy, but you can find there some info.

The SaiNt

  • *
  • Posts: 1300
    • View Profile
News 'bout the .p file format...
« Reply #3 on: 2001-07-30 14:11:00 »
I would read and comment but my exams happen to be this week. I'll catch up this Sunday and comment about it as soon as I get some free time. I just posted to tell you that I am reading this in the first place  :)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #4 on: 2001-07-30 16:45:00 »
mirex, I had a fast look at your description...that's VERY ineteresting, especially the point with the small and big models...never thought 'bout something like this. I'll try around a little bit, but I don't think I'll be able to do this today.
It's good to have one more guy actively workin on this format.
Keep on the good work!

- Alhexx

- edit -

BTW: What will I be when crossing the 100 Posts Border?

- edit 2 -

mirex: Hey, I've also written a prog named Renamer (well, I  named it RE-Name-ER), and it also renames (many) files...
I've compiled Version 2.10 of WinRE-Name-ER, but it isn't published yet. (B'cause my 'main homepage' is under construction (see  http://alhexx.tripod.com" TARGET=_blank>http://alhexx.tripod.com  ))

[This message has been edited by Alhexx (edited July 30, 2001).]


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #5 on: 2001-07-31 01:38:00 »
I wrote much shit in my first post of this topic...
--------------------------------------------------------
Number of Vertexes:

Additional - value3

--------------------------------------------------------
Number of Colors:

Additional - Value3

--------------------------------------------------------
Number of Polygons:

When Value3 = 0
  NumPolys - Value3 + 6

When Value3 > 0
  NumPolys
========================================================
Start of the Color Pool:

$80 + (NumVerts + Additional) * 12 + value3 * 8
(I though it was only (numverts+additional)*12 b'cause of
an internal function of ultima...)

--------------------------------------------------------
Start of The Polygon Pool:

$80 + (NumVerts + Additional) * 12 + value3 * 8 + (Additional + NumPolys + NumLines) * 4

(The same as above, just another mathematical formula.
========================================================
This times im surer (or more sure?) that the values are correct...or at least correcter tha the old ones   :D

- Alhexx

- edit -
Just forgot to mention, that I've released a new version of ultima supporting this shit above...

[This message has been edited by Alhexx (edited July 30, 2001).]


mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
News 'bout the .p file format...
« Reply #6 on: 2001-08-02 11:02:00 »
halkun: question - what do you think, is there any purpose for additional values for textures, values 1 2 3 4 16 255 ? I mean, could it be for some use on PSX, some optimizing ?

alhexx, saint, all: Could you guys write some comment to my pformat ?

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


The SaiNt

  • *
  • Posts: 1300
    • View Profile
News 'bout the .p file format...
« Reply #7 on: 2001-08-02 12:09:00 »
I will this coming Saturday  :)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #8 on: 2001-08-02 15:19:00 »
mirex: I've had a look at it, and after my hacking session it doesn't seem to be 100% correct. But I'll have to wait until I get those textures running under Ultima, and to do this, Fice has got to write a DLL 4 me (well, he doesn't HAS TO, but it'll be very nice if he did...)

- Alhexx

- edit -
I've just had a look at my Ultima topic (ehm, .p, battle...) and I've seen, that Fice has coded the DLL...

[This message has been edited by Alhexx (edited August 02, 2001).]


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #9 on: 2001-08-09 22:16:00 »
Okay, no real news, but a question to the hackers:

Does anybody know how to decode the texture coords?

I mean, I know that the coords are located directly after the vertexes, but I can't figure out which vertexes use textures? Understand my problem? I don't know how many polygons to skip...

- Alhexx

- edit -
wrote one ' - Alhexx' too much...

[This message has been edited by Alhexx (edited August 09, 2001).]


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #10 on: 2001-08-19 02:00:00 »
I've been trying around with the FF7 .p file header tonight; I've found out a lot of crap, but also 1 VERY inetersting thing...

Okay, I won't post the structure of the header here, I'm just postin the Offsets.
Here's how my List is build: 1. Offset (2. name in Fice's description) 3. Result when changing value

code:

Offset   Fice's Name   mirex' Name   Default      Result when changed
---------------------------------------------------------------------------
$00   -      -      1      -
$04   -      -      1      -
$08   -      -      1      OpenGL-Colors deactivated
$0C   Additional      A(long)      -      model invisible / FF7 crash
$10   Numverts      A1(long)      -      FF7 crash
$14   -      -      0      FF7 crash
$18   Value3      T(long)      -      FF7 crash
$1C   -      V(long)      -      FF7 crash
$20   Numlines      E(long)      -      FF7 crash
$24   Numpolys      P(long)      -      Win hangup
$28   -      -      0      FF7 hangup
$2C   -      -      0      FF7 hangup
$30   -      H(long)      -      FF7 hangup
$34   -      I(long)      -      FF7 crash
$38   -      G(long)      -      FF7 crash
$3C   -      -      1      -
[/quote]


As you can see, the only thing interesting is Offset $08. It is usually set to
1, b'cause every model in FF7 uses OpenGL Colors. But you can set it to 0. Then,
the model will be full white (RGB: 255/ 255/255). BUT: If it is a model which
uses textures, too, the textures are displayed. I think, with this option it'd
be possible use a model with no OpenGL Colors, but full textured.
Oh, if anyone's interested: I've been testing with file 'rxao' (Yuffie's Head).

That's all 4 now. I'll keep on testing.

- Alhexx

- edit -
Had to insert that crap as 'code'

[This message has been edited by Alhexx (edited August 18, 2001).]


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #11 on: 2001-08-21 00:01:00 »
I've had a serious look at the format, and I've released an own .p format description.
Take a look at it:
 http://www.8ung.at/alhexx/ff7" TARGET=_blank>http://www.8ung.at/alhexx/ff7

under descriptions

- Alhexx


mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
News 'bout the .p file format...
« Reply #12 on: 2001-08-21 11:48:00 »
Alhexx:
 looks good, im going to take a look at it, when i'll have some time, probably on weekend. I found some interesting things in there.
Great, now there are values with my name on  :D

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #13 on: 2001-08-21 15:43:00 »
I'm going to have a look at those files today. *Probably* there aren't only vertex-colors, but also poly-colors...I'm going to check that.
I've had a lot of ideas tonight...

As for the names: I didn't want to invent new names, so I used yours...

- Alhexx


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #14 on: 2001-08-21 18:01:00 »
Here we go! I found sth. new out:

The Color Pool consists of vertex-colors and poly-gon colors. If you want to view the model using poly-colors, read the following:

Start: $80 + (Additional + NumVerts) * 12 + Value3 * 8 + additional * 4

Length: Numpolys

Polygon 1 uses Color 1 and so on...I guess that could be useful for your .p-to-3df converter...

- Alhexx


mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
News 'bout the .p file format...
« Reply #15 on: 2001-08-22 11:16:00 »
I already knew about that, it is also written in my doc, that there are vert-colors and then poly-colors. But there is a problem that poly-colors are sometimes screwed up, unusable.
So to make it work allways, i had to take colors of vertexs, coz they are fine.

But thanks anyhow Alhexx
 :)

[This message has been edited by mirex (edited August 22, 2001).]


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #16 on: 2001-08-22 19:20:00 »
Oh,  :D, looks like I haven't seen that...

- Alhexx


Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #17 on: 2001-08-23 18:51:00 »
Hm, looks like over 50% of all posts here came from me   :D ...Does anyone else than me and mirex read that crap?

Okay, I've found out sth 'bout the hundrets pool: It's for the textures. It says which texture is used where. I haven't been able to hack the important functions out of it, but it seems like only 3 bytes are really needed...

- Alhexx

- edit -

Wanna post what I've found out 'bout the hundrets pool:
Most of the values aren't needed. Here's what's needed:

$08 - no idea what it is
$0C - no idea...
$10 - specifies which of the loaded textures are used. Ascensing order (0, 1, ...)

These values are for every of the hundret bytes. You can set every other byte to 0, it won't do harm.

- Alhexx

[This message has been edited by Alhexx (edited August 23, 2001).]


halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
News 'bout the .p file format...
« Reply #18 on: 2001-08-24 03:39:00 »
Things to remeber about the textures. When I took apart that PSX version of FF7 I found that the textures for the eyes hung out in video memory in a particular spot. Also remember that the field chacters *blink* so thoes exra coords might just be pointing to the textures. The blinking of the eyes is done by a background process that, for a single frame, will randomly change the eye texture from open to close. Also remeber that the eyes are all the same textre, just reversed.

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
News 'bout the .p file format...
« Reply #19 on: 2001-08-27 11:42:00 »
alhexx: never mind, at least we two cooperate here, and we will hack tha P format completly. I hope  :)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
News 'bout the .p file format...
« Reply #20 on: 2001-08-27 19:01:00 »
I hope you're right.
Oh, and I forgot to mention here that I'm doing a break at the moment. I'm going to work on on the weekend.

- Alhexx