File type details

Discussion in 'Sega Dreamcast Development and Research' started by Dreamcast, Mar 18, 2008.

  1. Dreamcast

    Dreamcast Intrepid Member

    Joined:
    Jul 17, 2007
    Messages:
    619
    Likes Received:
    35
    There are a lot of great converters / (de)compiliers out there, but there really isn't a lot of documentation on how the files are constructed, so I'm trying to do that.

    PVM:

    Right now I'm doing a write up on the PVM package format. Below is what I have so far:

    (0x00) file type identifier (PVMH) (4 bytes)
    (0x04) offset to the first object's data (4 bytes)
    (0x08) unknown (2 bytes)
    (0x0A) total number of objects in the package (2 bytes)

    After that, it starts describing the objects inside of the package by associating a stepped (starting at 0) identifer (first two bytes of each entry) and then the name of the object. What's confusing is in one PVM file I looked at, each entry is 34 bytes long, with a four byte padding after all of the entries. In another, there's the 34 bytes for the name, but there's also a full path to the file included as well.

    Note on the filename: it looks like the object's name is set at a fixed maximum length of 28 bytes.


    Also, the padding that separates the index from the actual data seems to vary as if padding to a fixed length (such as divisible by 16, etc).

    Any ideas?

    UPDATES:

    (1) After reviewing several other PVM files, it seems that the zero padding between the header and the PVR files is used to pad the entire header to a length divisible by 32.


    (feel free to post your own questions here if they pertain to the construction of a file)
     
    Last edited: Mar 18, 2008
  2. Dreamcast

    Dreamcast Intrepid Member

    Joined:
    Jul 17, 2007
    Messages:
    619
    Likes Received:
    35
    TPF:

    This appears to stand for "texture package format" or "texture package file" (whichever you like better. :D). I recently came across it when viewing files from the unreleased Chakan. It's a very basic packaging implementation that stores PVR data (but its construction suggests that it can store anything, really). I was able to completely document its structure and how it's put together. The only part I'm 50 / 50 on is the file type (0x31,0x00) at the beginning, but everything else is accurate. I cross-checked against two files to ensure everything was adding up correctly.

    TPF (TEXTURE PACKAGE FORMAT / FILE) (LITTLE ENDIAN)

    HEADER (20 bytes total):

    [0001 -> 0002] ??? possibly file identifier (0x31, 0x00) ???
    [0003 -> 0004] how many PVR images are in the package (65,535 possible texture files in a package)
    [0005 -> 0008] total length of the file entry data
    [0009 -> 0012] length of the header (for now, constant 20 bytes)
    [0013 -> 0016] total length of the actual PVR data (not including header / file entries)
    [0017 -> 0020] total length of the header and file entries

    FILE ENTRY ENTRIES (24 bytes per entry):

    [0001 -> 0016] file name (it's either 16 bytes or 15 bytes if one byte is null for string stop)
    [0017 -> 0020] file length
    [0021 -> 0024] offset from last file (starting at first file offset)

    (the file entry system repeats for each of the PVR files)

    The actual PVR files come after the header and file entries.
     
    Last edited: Jan 2, 2009
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page