XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Thu Mar 30, 2017 4:02 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Scarface's .P3D format Research Thread
PostPosted: Tue Nov 01, 2016 3:29 pm 
Offline
beginner
User avatar

Joined: Thu Apr 02, 2015 7:06 am
Posts: 26
Has thanked: 14 times
Have thanks: 1 time














You can make the ads go away by registering

While I know that .P3D files are containers for Texture/Model/ETC and have been used in games such as Scarface, Hulk Ultimate Destruction, and Prototype.

I was hoping that this thread could serve as a means to co-ordinate and properly research into the format.

here are an assortment of random P3D's straight from the PS2 version for reference.

Albatross.P3D
MCP_Assassin.P3D
Shark.P3D
Shark_collision.P3D
Skybox_miami_01.P3D
Zone_miami.P3D

_________________
Just a Modder of GTA SA and Resident Evil 4


Top
 Profile  
 
 Post subject: Re: Scarface's .P3D format Research Thread
PostPosted: Sat Nov 05, 2016 4:47 am 
Offline
advanced
User avatar

Joined: Thu Mar 08, 2012 6:17 pm
Posts: 45
Location: California, USA
Has thanked: 6 times
Have thanks: 12 times
Format looks to be a fairly simple container format, however there's some unknown data that controls how the data is stored.

Here's a pseudo-C struct (meaning it's just for research) that describes a P3D file. This only barely scratches the surface, and much more research will be required if any tools are to be made.

Code:
struct P3DFile {
    /*
        NOTE:
       
        All offsets/sizes are relative to the beginning of
        their respective structure unless otherwise specified.
   */
   
    const int magic = 0xFF443350; // 'P3Dÿ'
    int version; // version 12?
    int fileSize; // size of file + header (0xC)
   
    /*
        read entries until EOF
        if fileSize == 0xC, file is "empty"
    */
   
    struct P3DEntry {
        byte unk_00; // type?
        byte unk_01; // flags? part of type?
       
        /* these bytes appear to control the size of strLen? */
       
        byte unk_02; // GUESS: is strLen a byte?
        byte unk_03; // GUESS: is strLen a int?
       
        /*
            following are relative to beginning of P3DEntry
           
            if childOffset == chunkSize, it contains no children.
        */
       
        int childOffset; // offset to next child
        int chunkSize; // size of chunk/container, next entry will start immediately afterwards
       
        /*
            unfortunately this is where things get confusing,
            the unknown bytes at the beginning control what
            data will be put here.
           
            sometimes there's extra fields with unknown purposes.
            do not assume the filename will follow directly after!
        */
       
        if (unk_02 == 1) {
            byte strLen;
        }
        else if (unk_03 == 1) {
            int strLen;
        }
        else {
            /* error? */
        }
       
        char name[strLen + 1]; // strLen does not include null-terminator
       
        /*
            data starts here? unknown if there's anything else besides the name
            do not assume the child will follow directly after, usually there's
            data that needs to be stored in a buffer.
        */
       
        /* @ childOffset */
        P3DEntry child; // assuming childOffset != chunkSize
    } entries[]; // til EOF
}


Update:
My original research was close, but I was wrong on "unk_02" and "unk_03".

I've attached some logs of the P3D files you've provided. I've only read the headers in hopes someone with a hex editor and some street smarts can figure out what's going on.

Update 2:
As I originally suspected (but didn't note in the spec), the data is stored as a simple linked-list.

Once again, I've attached some dumps to help decode what the beginning bytes may mean.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Scarface's .P3D format Research Thread
PostPosted: Wed Jan 11, 2017 2:26 am 
Offline
beginner
User avatar

Joined: Thu Apr 02, 2015 7:06 am
Posts: 26
Has thanked: 14 times
Have thanks: 1 time
good progress :)

_________________
Just a Modder of GTA SA and Resident Evil 4


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot], jbeckman, ravenov and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group