Ok, so trying to figure out the specifics of the Prime 3 compression setup in paks. This is proving to be pretty messy. :/
So in MP3 compressed data can be stored in multiple blocks. There can be 1-3 blocks used, and generally everything is one block except textures. With textures, they generally compress each part of the texture separately: the header, the palettes (for C4/C8), and the actual image data. I'm not sure why, but that's what they do. Problem is, some textures actually only use one block, and I'm having trouble figuring out the reason why. It's not based on the texture format, and it doesn't seem to be based on the size of the file. I'll try a little longer to figure it out, but if that fails, the game probably won't care if all textures are in one block. (It should at least work though it might be less efficient - hard to say without knowing why Retro did it this way)
There's also a one-byte value taking up the top byte of some of the compressed sizes. I'm not really sure what the point of this byte is but it seems to be consistent, with only four possible values:
- 1 block: block 1 has 0xA0
- 2-3 blocks: blocks 2/3 have 0xC0 if compressed, 0x40 if uncompressed
- byte is 0 in all other circumstances
By the way thanks Grenola for getting me to implement the ability to automatically unpack every pak from a given game. It's making it really easy to run tests across every pak in the game :P
With PakTool the state I'm currently at is - every pak format has full extraction/decompression support, MP1/2/3 proto are fully supported, 3/DKCR have a repacker that needs some debugging. DKCTF isn't going to have a repacker right now because there's no way to actually make use of it. I'm hoping to get this done soon. I want to try figuring out MP3 materials once the repacker is working fully.
Also this is the 1000th post in the thread, yay. (Though if you go by the permalink URLs, RetroLover's post up there was actually the 1000th one :P)
So in MP3 compressed data can be stored in multiple blocks. There can be 1-3 blocks used, and generally everything is one block except textures. With textures, they generally compress each part of the texture separately: the header, the palettes (for C4/C8), and the actual image data. I'm not sure why, but that's what they do. Problem is, some textures actually only use one block, and I'm having trouble figuring out the reason why. It's not based on the texture format, and it doesn't seem to be based on the size of the file. I'll try a little longer to figure it out, but if that fails, the game probably won't care if all textures are in one block. (It should at least work though it might be less efficient - hard to say without knowing why Retro did it this way)
There's also a one-byte value taking up the top byte of some of the compressed sizes. I'm not really sure what the point of this byte is but it seems to be consistent, with only four possible values:
- 1 block: block 1 has 0xA0
- 2-3 blocks: blocks 2/3 have 0xC0 if compressed, 0x40 if uncompressed
- byte is 0 in all other circumstances
By the way thanks Grenola for getting me to implement the ability to automatically unpack every pak from a given game. It's making it really easy to run tests across every pak in the game :P
With PakTool the state I'm currently at is - every pak format has full extraction/decompression support, MP1/2/3 proto are fully supported, 3/DKCR have a repacker that needs some debugging. DKCTF isn't going to have a repacker right now because there's no way to actually make use of it. I'm hoping to get this done soon. I want to try figuring out MP3 materials once the repacker is working fully.
Also this is the 1000th post in the thread, yay. (Though if you go by the permalink URLs, RetroLover's post up there was actually the 1000th one :P)