Patapon (GXT) texture file

Textures, recreate headers, conversions, algorithms and parsing of image files
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Patapon (GXT) texture file

Post by OwocekTV »

I used a BND extractor to open Patapon archive, and now I need help to decrypt/view a Patapon texture files, which will be very useful for me.
The header is XXG.01.0MIG (58 58 47 2E 30 31 2E 30 4D 49 47 2E)
Here is a sample file: https://dl.dropboxusercontent.com/u/105 ... 1_01_1.gxt
Any help would be awesome!

Thanks!
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

Looks like they're big endian 4bpp linear pixels. I can't seem to find a palette though. Is there any file that might look like it contains a palette?
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

Anybody?
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

Hmm OK, after looking through these I found the palettes. They're 0x40 bytes after the pixel data, and the pixel data is at 0x80. It's length is found as a long at 0x44 (and 0x48 too?).

However, for some images the pixel data is 4bpp with a palette that's 0x40 bytes long, and for others it's 8bpp for a palette that's 0x100 bytes long. I'll see if I can figure out how to differentiate them. Can you give me more samples to check? Maybe even the entire folder containing them, if it's not too large.
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

OK, pretty sure I got it. I'll try make something for this soon.
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

Thank you ^^
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

So... any progress?
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

Sorry, life has been very busy lately. I have a free day tomorrow so I'll see if I can make something for it then.
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

gxt2png

Code: Select all

Usage: gxt2png inFile outDir
    inFile: The .gxt file to convert. Can alternatively be a folder containing the files to convert
    outDir: The folder to save the converted files to

Enjoy :)
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

lime.ndll is missing :(
http://scr.hu/3p34/2i6nh
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

Ok I've installed OpenFL and found missing lime.ndll.
Amazing work! You are awesome!

But...
Patapon 1 & 2 graphics don't have right colors but looks ok
Patapon 3 graphics doesn't work at all :(

Patapon 1 textures work just like Patapon 2, so colors are just not ok
Patapon 3 textures are glitched/corrupted

http://scr.hu/3p34/awykr - This should be dark turquise (blue)
http://scr.hu/3p34/mp7cc - This should be red/dark pink

https://dl.dropboxusercontent.com/u/105901018/pata3.7z - some Patapon 3 samples
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

I've updated it. It converts Patapon 1 and 2 textures properly now. Apparently the palette data is in RGBA format, I wasn't sure how it was supposed to look so thanks for telling me. I had some bit shifting issues, but now I know that I should use unsigned right shifting unless I specifically want signed.

Anyway, this won't work with Patapon 3 textures yet. The format looks identical, but for some reason the graphic doesn't show up properly. It looks like it should work the same but apparently it doesn't. Maybe the pixel data needs to be organised differently, I'm not sure.
I'll try figure it out, although unfortunately I can't promise anything.

(Oh, I've added lime.ndll now by the way, sorry that I missed that out. You shouldn't need OpenFL anymore.)
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

It's working perfectly now, thanks!
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

I have a 2 questions:
Can you make a feature to convert it back to gxt?
Can you provide me source code of this? I may add some things or just to teach myself.
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

Puggsoy, I need your help to create Patapon 3 graphics converter.

That's the things I figured out:
Based on that file: https://dl.dropboxusercontent.com/u/105 ... ips003.gxt

So first is the header. Next is the image data (which i haven't figure out, but that file should be 480x272)

After that, starting from 0x80 is the pixel data. This is more complex than the Patapon 1 and 2, because image is divided by pixel chunks, 16x8 (figured it out by real-time memory editing on emulator) which gives 128 pixels.

Chunks are placed like
111222333444
111222333444
555666777888
555666777888

Every hex in pixel data is a reference to Color ID stored in Palette data. Pallette data can be 256bit or 16bit.
256bit is stored like
00 00 01 FF 00 25 60 FF 00 55 33 FF... FF is splitting colors by each other and the triple hex's are just colors. Color ID starts from 0, so 00 00 01 have ID 0, 00 25 60 have ID 1, etc.

Then in pixel data if you got 55, convert it from hex to dec and get your colour by ID in Pixel Data. Simple.

In 0x0001FE80 you can see some numbers, I haven't figured what they do, but if its 02 00 00 00 00 04 00 00 00 04, pallete is 256 bit.

I hope this will help in converting Patapon 3 graphics, peace! :)
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

Sorry, I'm a little busy at the moment but I will try and do something for this. Thank you for your help :)
OwocekTV
Posts: 33
Joined: Fri Feb 20, 2015 7:24 pm

Re: Patapon (GXT) texture file

Post by OwocekTV »

Uhh, can you upload this again? Switched to new system, and then, file is missing from your dropbox.
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Patapon (GXT) texture file

Post by puggsoy »

Ah sorry, I've been moving some stuff around. Here you go: https://dl.dropbox.com/s/2634ia3fx66jl2v/gxt2png.zip

By the way, I'm sorry that I haven't really shown any progress with the Patapon 3 textures. I am working on a program that should be able to handle multiple graphic formats (similar to QuickBMS, but for graphics instead of archives). It's taking a while now but will make things faster and easier in the long run.