I've been working on extracting various files from Lucas Arts Gladius game (for PS2,XBox and GameCube). With the help of game extractor I've managed to turn the large BEC archives into indidividual files, and then with various zlib decompressors I've managed to turn those files into 'meaningful' data.

I have been struggling to get the texture data out though. The various code files seem to refer to the textures as TGA files, but they don't have a standard TGA Header, instead the data (on the ps2 version at least) seems to be raw 16bit per pixel rgb data after a given offset. I've extracted that (sample enclosed), but the colour data is wrong. The aspect ratio of the image also seems a little odd, this one came out at 256x392 to get the 'full' image, but as you can see it definitely looks stretched vertically.

Has anyone come across this sort of colour 'corruption' before and could offer some advice on where to start looking to fix it? I've tried changing texture order from rgb to grb and other combinations. I've tried looking for palette data but couldn't see anything particuarly appropriate in my sample files. I've also tried inverting the colours and so on in Paint.Net but am a little stumped now.

I've also been trying to compare the data differences between the xbox and ps2 versions for a hint as to how it might be structured but they seem pretty different as well. Thats probably a post for another day though.

Thanks in advance.

GladiusPS2Image1.png

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

You should take a better look inside those files. The image data is a bitmap, per pixel, up to 256 colours. The palette is right in front of the image data. The PS usually has images like that. The palette is RGBA, I would say. So that's 4 bytes per colour, 256 times = 0x400h (1024) bytes. The rest of the bytes is header stuff. This image is 512x512 (check out the location of this in the file).

Actually, I just remembered I worked on SSH files textures in Def Jam and FIFA street back in 2009/2010:viewtopic.php?f=18&t=3894&hilit=eagt (you may want to read that whole thread to get the gist of it all).

Bottom line, the Electronic Arts Graphics Tool I wrote helps out here too.

1. The file you uploaded is a sort of texture file,with magic word "R2D2psx2". Harhar.
2. At location 0x10 (16) you see 'tmap' as an identifier for a "texture map" (?) Anyway, you will find some header info there. I won't bother to figure out all that.
3. At location 0x90 the palette starts. As said, this is a 256 colour palette , of the BGRA format, A being the alpha (translucency) value up to 0c7f (128) max. 0 is fully transparent (background shines completely through), 0x7F is full colour. The size of this palette is thus 0x400 (1024) bytes. However, this is a PS2 specific format. Read the thread above what is going on.
4. At 0x04b0 the actual bitmap (one byte per pixel) starts. Before that, right after the palette is a small subheader of 0x20 (32) bytes long. There you will also find the width and height integers (words) showing 512 x 512. The total image bitmap is therefore 512x512 long. After the image data there seems to be a tail of 0x40 (64) bytes.

Now, get to using EAGT.

5. Get the palette data and image data as separate files using any hex-editor.
6. Open the palette data in EAGT and select Convert PS2 EA Palette... from the correct menu. Choose the palette you created and give a filename for the new one. Go.
7. Open up the raw image data in a good paint program, like Photoshop (in this case: Open As..." .RAW) and select 512x512.
8. Change the image to Indexed Colour mode (8 bit, 256 colours) and save as 8 bit Windows bitmap.
9. Open the image (.BMP) with the Hex Editor and replace the 0x400 bytes from location 0x36 with the new palette data. Save it.
10. Open the .BMP image, now with correct palette.

Thanks again, have spent a useful couple of hours updating my converters to write out a bunch of the files, just working on the palette converter based on your EAGT tool, but in general all those class images are coming out well now, next step is to make things more general based off the image size info and see what else I can find in the archives.
Gladius seems to be full of fun file headers, though that R2D2 one only appears in the ps2 version, xbox and GCN seem to have their own different formats, which if I'm feeling particlarly masochistic i'll try and extract as well.....

What am I going to do with them? Hadn't really thought it through that far..... Original goal was to get some textures, models and so on for a unity version of Gladius I'm writing as a fun project. This had me digging around in the files and extracted a lot of text based shop,item,character data . Then I used the Dolphin emulator and a GCN version of the game to get some ripped models of arenas, but a lot of the textures didn't come out particularly well so I wanted to find a way of getting the raw images. I'd also like to try and get the model and animation data out at a later stage, but got plenty to be going on with.

Ok, I've mostly got this working now, extracts single and multiple images from the PS2 files. Handles 8bpp indexed and rgba files. Also makes use of image names in the files where available to provide 'sensible' output. Theres still a few odd files I need to look at , and there also seems to be some texture atlas data for some files as well which might be nice to extract. c# vs2010 solution attached.

Thanks again to MrMouse for the help with this.

Now onto the model files. yay....

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