Author Topic: Extract CLUT and turn it into a Paint Shop Pro palette?  (Read 1160 times)

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
I am dealing with the ".TIM" file that contains the hand cursor graphics in "WINDOW.BIN". This ".TIM" has 16 CLUTs, each with 16 colors. I would like to extract some of these CLUTs and have them in ".PspPalette" or ".pal" format that can be used with Jasc Paint Shop Pro 9.

I realize I can always take an existing 16 color Paint Shop Pro palette and just change the index values to match what is in the CLUT, but that is time consuming. (Also, if this was a 256 color CLUT, that would be an arthritis inducing nightmare.)

Is there a way to extract CLUTs from a ".TIM" and have it in a palette format that can be loaded into Jasc Paint Shop Pro 9?

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 452
  • Karma: 77
  • Back on the scene!
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #1 on: 2017-07-15 11:09:09 »
I can code a tool for this, but that palette format for your software could be a problem. I doubt there's a file structure somewhere out there. What if I exported each color from palette to HEX codes? Could that help you a bit?

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #2 on: 2017-07-16 06:54:43 »
Hmmm. To be honest, I don't know how the formatting for a ".PspPalette" or ".pal" file works.

However, I did find some resources on the file structure of a ".TIM" file awhile back, which includes the CLUT.

https://web.archive.org/web/20120529162751/http://rveach.romhack.org/PSXInfo/tim.html

http://www.romhacking.net/documents/timgfx.txt

Thanks for the response.

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 452
  • Karma: 77
  • Back on the scene!
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #3 on: 2017-07-16 10:54:19 »
Hmmm. To be honest, I don't know how the formatting for a ".PspPalette" or ".pal" file works.

However, I did find some resources on the file structure of a ".TIM" file awhile back, which includes the CLUT.

https://web.archive.org/web/20120529162751/http://rveach.romhack.org/PSXInfo/tim.html

http://www.romhacking.net/documents/timgfx.txt

Thanks for the response.

Okay, if you could please send me two-three palettes containing:
-only white
-only blue
-only red

I'll try to reverse it

hotdog963al

  • Crazy poster
  • *
  • Posts: 224
  • Karma: 1
  • Horse
    • View Profile
    • Horse HQ
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #4 on: 2017-07-16 15:26:12 »
Jasc (Paint Shop Pro) Palette files start with the following 3 lines:

Code: [Select]
JASC-PAL
0100
256

Then that follows with 256 lines of RGB values (each colour value separated with a space, eg: 0 0 0)
Simple as that :)

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 452
  • Karma: 77
  • Back on the scene!
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #5 on: 2017-07-17 07:10:49 »
Jasc (Paint Shop Pro) Palette files start with the following 3 lines:

Code: [Select]
JASC-PAL
0100
256

Then that follows with 256 lines of RGB values (each colour value separated with a space, eg: 0 0 0)
Simple as that :)

So the 16 color palette would be like:
Code: [Select]
JASC-PAL
0100
16
...
?

Okay, I'll be back here soon

Kaldarasha

  • No life
  • *
  • Posts: 2155
  • Karma: 130
  • Prince of Model Editing
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #6 on: 2017-07-17 07:17:21 »
I don't think so. 16 would create one palette with only 16 different colors. My guess is that 0100 is the number of the palette and the number after it defines the number of colors (or the color variation) it contains. 0200 is probably the next logical palette.

hotdog963al

  • Crazy poster
  • *
  • Posts: 224
  • Karma: 1
  • Horse
    • View Profile
    • Horse HQ
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #7 on: 2017-07-17 18:17:51 »
Just tested. Can confirm, 16 colour:

JASC-PAL
0100
16

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #8 on: 2017-07-22 02:25:32 »
Okay, if you could please send me two-three palettes containing:
-only white
-only blue
-only red

I'll try to reverse it

Sorry for the belated response. I've been extremely busy IRL and have been AFK a lot.

Here are the palettes, each with only 16 indexes.

https://www.mediafire.com/?woecvakccvl5lys

https://www.mediafire.com/?mi2idxa6dmg04z5


EDIT: Sorry, those palettes don't contain only white, blue, and red. The proper ones are here:

https://www.mediafire.com/?di72ytjtusupoxe

https://www.mediafire.com/?076d71gnnit3gib
« Last Edit: 2017-07-22 02:38:27 by NERV Agent »

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 452
  • Karma: 77
  • Back on the scene!
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #9 on: 2017-07-26 07:47:17 »
There you are (I almost forgot about it):
https://github.com/MaKiPL/TIM_to_PspPalette/releases/tag/1.0a

This soft outputs all palettes to one file, so I don't know if that would work
If not, just cut out every section starting with JASC-PAL inside that text file and save it to independent files.
« Last Edit: 2017-07-26 08:51:54 by Maki »

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #10 on: 2017-07-27 02:42:39 »
Hello Maki.

The following URL:

https://github.com/MaKiPL/TIM_to_PspPalette/releases/download/1.0a/TIMpal_PSP.exe

Leads to this XML file:

b55b22da-71e7-11e7-83fb-de396c7e6bd6.xml

Maybe put it in a ".zip" file?

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #11 on: 2017-07-27 03:05:45 »
Okay, I could download it with IE, but the program has some issues.

Here are my results:

Code: [Select]
>TIMpal_PSP.exe window.tim -4bpp out.psp
TIM to Paint Shop Pro
Usage:
TIMpal_PSP.exe file.tim out.psp
Input: file.tim - specify 8 BPP or 4 BPP TIM file       Output file: out.txt spe
cify output file

Code: [Select]
>TIMpal_PSP.exe window.tim -4bpp out.txt
TIM to Paint Shop Pro
Usage:
TIMpal_PSP.exe file.tim out.psp
Input: file.tim - specify 8 BPP or 4 BPP TIM file       Output file: out.txt spe
cify output file

What is the correct syntax?

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #12 on: 2017-07-27 03:41:43 »
In the meantime, I've come up with an alternative solution (if anyone else has to do this in the future).

There is a program called PSX Video RAM Viewer (PVV) v1.0 by creaothceann.

What I did was put my modified ".TIM" file back in the game, ran it in ePSXe and made a save state, then I loaded that save state into PVV.

I used PVV to extract the specific CLUT into a ".pal" file.

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 452
  • Karma: 77
  • Back on the scene!
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #13 on: 2017-07-27 05:16:39 »
Okay, I could download it with IE, but the program has some issues.

Here are my results:

Code: [Select]
>TIMpal_PSP.exe window.tim -4bpp out.psp
TIM to Paint Shop Pro
Usage:
TIMpal_PSP.exe file.tim out.psp
Input: file.tim - specify 8 BPP or 4 BPP TIM file       Output file: out.txt spe
cify output file

Code: [Select]
>TIMpal_PSP.exe window.tim -4bpp out.txt
TIM to Paint Shop Pro
Usage:
TIMpal_PSP.exe file.tim out.psp
Input: file.tim - specify 8 BPP or 4 BPP TIM file       Output file: out.txt spe
cify output file

What is the correct syntax?

TIMpal_PSP.exe window.tim palette.pspPalette

No -4bpp or anything like this

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #14 on: 2017-07-28 06:47:35 »
Unfortunately, this was my result:

Code: [Select]
Unhandled Exception: System.IO.FileNotFoundException: Could not find file '[Insert NERV Agent's personal directory path here]\TIM_to_PspPalette-1.0a\palette.pspPalette'.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at TIMpal_to_JASC.TIM..ctor(String path, Byte arg0)
   at TIMpal_to_JASC.Program.Main(String[] args)

So I made a blank ".txt" file and named it "palette.pspPalette" (I also changed the extension).

But this was my result:

Code: [Select]
Unhandled Exception: System.IndexOutOfRangeException: Index was outside the boun
ds of the array.
   at TIMpal_to_JASC.TIM.RecognizeBPP()
   at TIMpal_to_JASC.TIM..ctor(String path, Byte arg0)
   at TIMpal_to_JASC.Program.Main(String[] args)

creaothceann included his source code with his PVV program. Could that help?

Maki

  • Software hacker
  • Insane poster
  • *
  • Posts: 452
  • Karma: 77
  • Back on the scene!
    • View Profile

NERV Agent

  • Cool newbie
  • *
  • Posts: 91
  • Karma: 4
  • Pen Pen is waifu of the year.
    • View Profile
Re: Extract CLUT and turn it into a Paint Shop Pro palette?
« Reply #16 on: 2017-07-29 03:51:45 »
Okay, so I ran the program and open the output file in Notepad.

Then I make a new ".txt" file, select the CLUT I want and copy it over. The start of the specific CLUT should be

Code: [Select]
JASC-PAL
0100
16

I save the new ".txt" file but change the extension to ".PspPalette", but Paint Shop Pro won't recognize it.

Does anyone else have any luck? The ".TIM" file can be found here:

https://www.mediafire.com/?bj9mcyd1c5dua1d
« Last Edit: 2017-07-29 04:02:33 by NERV Agent »