Qhimm.com Forums

Miscellaneous Forums => Troubleshooting => Topic started by: NERV Agent on 2016-06-18 03:35:55

Title: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?
Post by: NERV Agent on 2016-06-18 03:35:55
How do I replace a 256 color CLUT in a PSX ".TIM" file with a 256 color palette from a ".BMP" or ".PNG" file?

I know Tim2View can edit the CLUT, but it seems that requires changing each and every one of the 256 entries one by one (and possible arthritis). Is there a faster way?
Title: Re: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?
Post by: Maki on 2016-06-18 11:30:07
In TIMViewer:

1. Convert TIM to BMP using Convert>toBMP
2. Edit BMP palette as you wish in your favourite graphic tool
3. Save BMP preserving the 256 color format
4. Go back to TIM Viewer
5. Open BMP with your texture
6. Convert>BMP to TIM
7. Now you have working TIM file
-You say it's 256 palette, therefore the only TIM containing 256 colors is 8BPP

So look at uint16 at 0x12- It's number of CLUT palettes. If your texture is only one CLUT, then just after the count a 512 bytes of CLUT data is. Therefore:
8. Copy paste from the same location the converted TIM from your BMP over the TIM you want to edit palette.
(copy 512 bytes starting from 0x20+(CLUT*512) to the same location in your final TIM texture OR if the initial texture has only one palette, then always copy from 0x20 from custom image to 0x20+(CLUT*512) in your final texture)
Title: Re: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?
Post by: NERV Agent on 2016-06-26 23:22:14
Thanks, but what exactly do I input here?

(https://s19.postimg.org/gfp9gfgsz/timviewer_bmp_extra_fields.png)
Title: Re: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?
Post by: NERV Agent on 2016-06-27 00:06:10
Also, I'm trying the steps right now and keep getting the same discolored results.
Title: Re: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?
Post by: NERV Agent on 2016-06-27 00:12:43
So look at uint16 at 0x12- It's number of CLUT palettes. If your texture is only one CLUT, then just after the count a 512 bytes of CLUT data is. Therefore:
8. Copy paste from the same location the converted TIM from your BMP over the TIM you want to edit palette.
(copy 512 bytes starting from 0x20+(CLUT*512) to the same location in your final TIM texture OR if the initial texture has only one palette, then always copy from 0x20 from custom image to 0x20+(CLUT*512) in your final texture)

When I get to this step, I compare both ".TIM" files in Tim2View and see that the CLUTs do not match. :(
Title: Re: Replace 256 ".TIM" CLUT with a 256 color palette from a ".bmp" or ".PNG" file?
Post by: NERV Agent on 2016-06-27 00:23:23
Here's what I mean.

This is the custom generated ".TIM" that TimViewer converted from a ".BMP":

(https://s19.postimg.org/t3x1mrkyb/for_public_custom_generated_image.png)

And here is the "final texture" that was ripped from the game and changed via hex editor per the "step 8" instructions:

(https://s19.postimg.org/ssfla04ib/for_public_final_tim_after_hex_edit.png)

What is going on?