[Wii] Trauma Center: Second Opinion - *.tpx files
Posted: Tue Apr 09, 2013 10:23 pm
Hello,
I am currently trying to rip the graphics from Atlus' wonderful game "Trauma Center: Second Opinion".
The graphic files have the extension *.tpx, which i personally never heard of, and I couldn't find anything useful on Google.
Please note that I have no experience in game file researching, so all the assumptions I'm going to make are mere guesses.
After looking at some of the files in a hex editor, I noticed that a lot of these files have values like 256 or 512 (unsigned 16-bit) at offsets 0x06 and 0x0E, so I think that these are width and height. (however, I am not sure...) I also noticed that these files contain a null-terminated string at offset 0x2C that looks very similar or is equal to the filename.
I did some experiments on the file "sprite\bustup\chr01_02.tpx" and attempted reading the image-file using the following piece of C# code:
However, this code obviously can't be correct with the little information I have.
The following image is output:

One of the game characters is clearly recognizable, but the colors are definetly wrong, and the image has a weird scanline effect.
I got rid of the scanlines by multiplying the image witdh with 2 (That line is commented in the code), but then he looks kind of squeezed:

The colors, i couldn't figure out. I tried ARGB4444, RGBA5551, ARGB1555 and RGB565, but none of them led to a good result.
I think I can't provide sample files, because I don't want to violate the rules.
I would be happy if someone could help me, a newbie with this.
TL;DR: I need help with the *.tpx files of Trauma Center: Second Opinion.
I am currently trying to rip the graphics from Atlus' wonderful game "Trauma Center: Second Opinion".
The graphic files have the extension *.tpx, which i personally never heard of, and I couldn't find anything useful on Google.
Please note that I have no experience in game file researching, so all the assumptions I'm going to make are mere guesses.
After looking at some of the files in a hex editor, I noticed that a lot of these files have values like 256 or 512 (unsigned 16-bit) at offsets 0x06 and 0x0E, so I think that these are width and height. (however, I am not sure...) I also noticed that these files contain a null-terminated string at offset 0x2C that looks very similar or is equal to the filename.
I did some experiments on the file "sprite\bustup\chr01_02.tpx" and attempted reading the image-file using the following piece of C# code:
Code: Select all
private static void Main(string[] args)
{
FileStream str = File.OpenRead(args[0]);
BitStream bs = new BitStream(str);
bs.BaseStream.Position = 6; //this is just a guess for the width offset
ushort width = bs.ReadUInt16();
bs.BaseStream.Position = 14; //this is just a guess for the height offset
ushort height = bs.ReadUInt16();
int bitGuess = width * height * 2; //I'm assuming 16bit coloring, so the size of a pixel should be 2 bytes
int offGuess = (int)(str.Length - bitGuess); //(Length Of File - Assumed size of the picture)
//width *= 2;
Bitmap bmp = new Bitmap(width, height);
bs.Seek((uint)offGuess);
uint r, g, b, a;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
r = bs.bitstream_read(5) * 8; //This should convert RGBA5551 to 32-bit
g = bs.bitstream_read(5) * 8; //bitstream_read(x) reads x bits
b = bs.bitstream_read(5) * 8;
a = bs.bitstream_read(1);
bmp.SetPixel(x, y, Color.FromArgb((byte)r, (byte)g, (byte)b));
if (bs.BaseStream.Position == bs.BaseStream.Length) break;
}
if (bs.BaseStream.Position == bs.BaseStream.Length) break;
}
bmp.Save("test.png");
}
The following image is output:

One of the game characters is clearly recognizable, but the colors are definetly wrong, and the image has a weird scanline effect.
I got rid of the scanlines by multiplying the image witdh with 2 (That line is commented in the code), but then he looks kind of squeezed:

The colors, i couldn't figure out. I tried ARGB4444, RGBA5551, ARGB1555 and RGB565, but none of them led to a good result.
I think I can't provide sample files, because I don't want to violate the rules.
I would be happy if someone could help me, a newbie with this.
TL;DR: I need help with the *.tpx files of Trauma Center: Second Opinion.