I'm having TIM troubles. I'm trying to deal with character textures, but the format doesn't match the usual one that all of the TIM exporting/inserting/editing programs I've found expect.
Here's the header:
10 00 00 00 08 00 00 00 0C 08 00 00 00 02 F0 01 40 00 10 00Type: 4 bpp
CLUT size: 2048
Palette Org X: 512
Palette Org Y: 496
# colors in CLUT: 64
# CLUTs: 16
But according to everything I've found, 4bpp images should only have 16 colors per CLUT. TimViewer seems to assume this, and treats it as 64 16-color CLUTs instead of the other way round. Tim2View at least recognizes the correct specs. The way they're organized, the first color is black (transparency), then the colors are in the next 15 indices, and the rest are black transparencies.
This causes the problem that any program I use to edit the image exports 16-color palettes (and keeps reordering them). I've tried the GIMP plugin, low-color bmps with paint.net, and usenti, but I'm not having any luck preserving the palette. The one time I managed to replace the texture without the game breaking (using GIMP), the palette was still corrupted, leaving transparencies in weird places because certain pixels got changed to black.
The other issue is that the first 5 CLUTs have non-zero values in the first 16 indices, which means there are 5 UV maps (am I thinking of this correctly?). The last 11 64-color CLUTs are all 00s. But every time I edit the TIM, it chops off the last UV map. So when I save a new TIM, I end up with a CLUT that's 512 bytes long instead of 2048, and contains only 4 color-filled CLUTs, instead of 5. I got the one palette-corrupted texture to work by adding in 1536 bytes of 00s, but that still meant I was missing one of my UV maps (or rather it was fully transparent).
Is there any way I can work with these files to preserve them correctly? Also, how do you work with colors in a multi-palette TIM, when you can't see the true colors as they appear in the game?