PDA

View Full Version : More Psychonauts Stuff


bgbennyboy
09-14-2005, 02:30 PM
I've been trying to work out the file format for the PS2 version (1 huge 3.2GB file RESOURCE.PAK). I doubt I'm going to be able to make an extractor for it but I did find some interesting stuff inside the archive:

An uncompiled lua script (http://quick.mixnmojo.com/temp/psychonauts/CS_THFP.lua)
PsychoMunger1 (http://quick.mixnmojo.com/temp/psychonauts/PsychoMunger.txt)
PsychoMunger2 (http://quick.mixnmojo.com/temp/psychonauts/PsychoMunger2.txt)

As you'll see from the txt files, PsychoMunger seems to be DoubleFine's internal tool for compiling level files. It also shows that .plb files are levels (or at least some of them are).

As for the ps2 archive itself, I cant find a way to extract files from it yet. There doesnt appear to be a name directory but there are 2 sections (near the beginning and end of the file) that look like file records, I cant get these to match up to anything though. The level pack files (PPAK) are included inside the archive, but the main PsychonautsData.pkg file doesnt seem to be there. The sheer size of the archive makes it a real pain to work with and half the time crashes my already-fragile pc. So support for the PS2 version in Psychonauts Explorer is quite unlikely right now.

john_doe
09-16-2005, 06:45 AM
Not bad. At least we know that there are at least two types of plb-files, one for the levels and one for models. I haven't made any progress with them, though, due to a lack of time and the complexity of the files :)
I still can't even parse the plb-files to get at least the vertex and index data to display some wireframes. Some files are quite simple but other files have some additional data which varies in size and I didn't find a way yet to find out this size.

bgbennyboy
09-16-2005, 09:04 AM
If you ever manage to view the models then perhaps we could also view the levels, assuming that they share a similar format :)

bgbennyboy
10-04-2005, 02:00 PM
I made some progress with the PS2 version, I found the location of the MPAK level files and by hardcoding their offsets I can display a great many of the files.

The image files in the PS2 version are set out in a similar way to the headerless DDS files in the other versions. They all seem to use 'texture id 14', which appears a few times in the XBox version. Its 1 byte per pixel with a 1024 byte palette coming after it (512 bytes of data then 512 of 00 usually). Unfortunately I havent been able to display these images yet, if I cant manage it then I'll post some examples and see if anyone else can :)

bgbennyboy
10-05-2005, 11:10 AM
I've uploaded some ps2 files (and the equivalent decoded image from the pc version) here (http://quick.mixnmojo.com/temp/ps2/) perhaps someone else can make sense of them :)

As I said, they are laid out in a very similar way to the headerless dds' :

2 bytes ID1
2 bytes ID2
2 bytes Texture ID (always 14)
6 bytes ?
4 bytes Width
4 bytes Height
4 bytes No of mipmaps (always 1?)
4 bytes ?
2 bytes Secondary Texture ID
12 bytes ?
56 bytes ?
Width*Height bytes Image Data
1024 bytes Palette

The format changes slightly for 'animated' images but none of the examples that i've uploaded are animated.

I'm not totally sure about the 56 bytes, I *think* that the pixel data begins after this, but its more of a guess than fact.

john_doe
10-06-2005, 10:41 PM
Today I had some time to work on the models again. The extra data at the end of the ppf files really is the level "model". I've tried it in my "viewer" (nothing exciting, I have to hardcode the data offsets).
The only thing that really annoys me is that I could not find where the texture coordinates are stored. I'm afraid they're compressed or something. Each model is divided into several "sub-meshes" (I guess one for each texture to save on switching textures). Each one of these has at least some vertex data (x,y,z floats and a vertex color) and index data (list of 16bit words). Both are needed to draw the part (most of them are triangle strips but some seem to be just triangle lists). Also, I guess there could be normal data. This could probably be calculated at runtime but could be slow for a lot of data. Then there have to be some texture coordinates. It's probably quite easy and I'm looking for texture coordinates in all the wrong places :)

I've also run Psychonauts with PIX which works great, you can easily display textures etc. and it even shows you the texture format and stuff like that. But it won't let me save the vertex data or other model-related stuff :(

PS: I hope it's ok to hijack this thread for model-related stuff?

bgbennyboy
10-07-2005, 06:29 AM
Hijack away! I uninstalled PIX because I couldnt get it to work, perhaps running it with the demo version or even a *cough* cracked .exe would give different results? When I was trying to decompile the exe I couldnt get the original to decompile, but a cracked exe did. Just a suggestion anyway :)

bgbennyboy
10-07-2005, 06:52 AM
The ps2 models seem slightly different to the pc and xbox ones, i've uploaded some here (http://quick.mixnmojo.com/temp/ps2model/) in case they can help.

[Edit] Another thought - we know (http://www.lua.org/uses.html#68) that the levels were created in Maya and then converted, maybe the models were too? Perhaps theres something in the Maya file formats (http://caad.arch.ethz.ch/info/maya/manual/FileFormats/) that will give some pointers.

bgbennyboy
10-13-2005, 06:57 PM
Regarding the ps2 images - I created an image that was compressed with ATI 3DC compression. I then chopped out the image data and replaced it with the image data from a ps2 file. This (http://quick.mixnmojo.com/temp/ClipImage2.jpg) was the result (the bottom image), it suggests that the image is compressed in a similar way to 3DC compression. Its a bit weird that the image shows twice, but its definately the correct image.

bgbennyboy
10-19-2005, 10:16 AM
I was adding stuff to this (http://wiki.xentax.com/index.php/Psychonauts) wiki and noticed that someone had already added the .pkg specs for Psychonauts. Looking at it I realised that they were correct and that my specs were slightly wrong.
Instead of this:

File Records:
-------------
Each file record is 16 bytes long:
4 bytes: Identifier
4 bytes: Offset of name in Name Directory (relative to start of name dir)
4 bytes: Offset of file data
4 bytes: File data size

The identifier identifies the file type:
256: .asd
1280: .atx
etc..

It should be this:

File Records:
-------------
Each file record is 16 bytes long:
1 byte: Null
2 bytes: File Extension Offset (relative to start of file ext dir)
1 byte: Null
4 bytes: Offset of name in Name Directory (relative to start of name dir)
4 bytes: Offset of file data
4 bytes: File data size


I've changed the code in Psychonauts Explorer, but it doesnt appear to have made much difference. I think the 'identifiers' that I used match up to the correct file extension anyway. :)