+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Extracting palettes from a PSX game.
Pages: 1 [2] 3
Author Topic: Extracting palettes from a PSX game.  (Read 2 times)
sb iq
Guest
« Reply #15 on: November 04, 2006, 09:28:23 pm »

I asked a friend of mine to use Photoshop (I don't have Photoshop) to copy and paste the stuff on the right into a raw file (raw, with no extension at all) using Photoshop. He sent it to me, and I added .pal at the end. But Paint Shop Pro does not recognize the file.

The file is 54 KB. I thought that was strange, so I decided to use Paint Shop Pro, loaded the VRAM dump, zoomed in at 5000% so it would be pixel perfect, and copied and pasted that stuff on the right into a new .raw file. The resolution was 64 x 286, so I was expecting it to be 18304 bytes, but it was 54 KB again. Any help?
tomaitheous
Guest
« Reply #16 on: November 05, 2006, 12:08:04 am »

Quote
He sent it to me, and I added .pal at the end.

RAW palette dumps/files are different than PAL files. ACT or RAW palette files do not have a header like the PAL file does.

sb iq
Guest
« Reply #17 on: November 05, 2006, 04:36:12 am »

Thanks for clearing that up for me. Me and my friend were pretty confused as to why PSP wouldn't recognize it.

How do I add the proper header to my raw data so that it can be a proper .pal file?

Also, why is my "rip" so huge? I'm sure I did something wrong, but I don't know what.

At this point I am all out of ideas. My brain hurts. I tried contacting the creator of the plugin (I think his name is Pete) but his public email doesn't work, and his message board is dead.
« Last Edit: November 05, 2006, 05:31:41 am by sb iq »
creaothceann
Guest
« Reply #18 on: November 05, 2006, 06:15:25 am »

What kind of .pal file format are we talking about here? The one I know is text-based and goes like this:

Code:
JASC-PAL
0100
256
0 0 0
0 0 0
24 4 0
48 12 4
72 28 4
...

The 18 KB -> 54 KB is probably because your raw file uses 24-bit color depth, i.e. 3 bytes per pixel.
sb iq
Guest
« Reply #19 on: November 05, 2006, 06:46:07 pm »

The kind of .pal file that Paint Shop Pro loads as a palette. I think the .pal you just mentioned is that kind of .pal file.

So how exactly do I add this header?

And what format should I convert my VRAM dump into to make it 8-bit so my rip ends up as 18 KB? Although now that I think about it, 18 KB seems pretty big compared to most .pal files I've seen. Should I go as far as making it 1-bit or 4-bit?
« Last Edit: November 06, 2006, 03:27:56 am by sb iq »
creaothceann
Guest
« Reply #20 on: November 06, 2006, 05:35:39 am »

The JASC .pal format is text-based. Your .raw files are binary. Unless you convert them somehow (via a little program or manually), PSP won't understand it.

Actually you can use vSNES to load a palette file of 768 bytes, then save it as a JASC .pal file. (See the options window for selecting the format.)

1-bit or 4-bit palettes won't help you much with 8-bit graphics.

About the size: Think about what you're working with. You'll have to convert 64 x 286 pixels of 24-bit each into palettes (arrays of 768 bytes) aka 256 pixels of 24-bit.

The data should amount to 71.5 256-color palettes, so there's a bit more than needed, I guess...
Gemini
Guest
« Reply #21 on: November 06, 2006, 06:20:48 am »

Why don't you just use Tile Molester and forget about PSP?
tomaitheous
Guest
« Reply #22 on: November 06, 2006, 08:36:09 pm »

Quote from: sb  iq
The kind of .pal file that Paint Shop Pro loads as a palette. I think the .pal you just mentioned is that kind of .pal file.

So how exactly do I add this header?


 I didn't know PSP used JASC palettes. I was refering to RIFF pal files that have the values stored in binary - not ascii form.
creaothceann
Guest
« Reply #23 on: November 07, 2006, 01:57:53 am »

Quote from: tomaitheous on November 06, 2006, 08:36:09 pm
Quote from: sb  iq
The kind of .pal file that Paint Shop Pro loads as a palette. I think the .pal you just mentioned is that kind of .pal file.

So how exactly do I add this header?


 I didn't know PSP used JASC palettes. I was refering to RIFF pal files that have the values stored in binary - not ascii form.

Offtopic, but... do you have a link to a format description?
MegaManJuno
Guest
« Reply #24 on: November 07, 2006, 03:33:51 am »

Quote from: tomaitheous on November 06, 2006, 08:36:09 pm
I didn't know PSP used JASC palettes.

Isn't JASC the original developer of Paint Shop Pro...?  Tongue
creaothceann
Guest
« Reply #25 on: November 07, 2006, 03:41:48 am »

Yep.
Kitsune Sniper
Guest
« Reply #26 on: November 07, 2006, 01:38:50 pm »

I think he meant Photoshop. Tongue
tomaitheous
Guest
« Reply #27 on: November 07, 2006, 05:56:49 pm »

Actually, I phrased that incorrectly. I meant to say, I wasn't aware of JASC format of .pal files. I thought all .pal palette files were RIFF. Grin

 Anyway, I don't have a link to the RIFF format. I just exported 4-5 different palettes and looked at them with a hex editor. All the RIFF pals I've created with my PCE <->PAL/ACT utility seem to work fine in Photoshop.



Here's the RIFF format:

Header is 16bytes long-

unsigned char PAL_header[16]={ 0x52,0x49,0x46,0x46,0x58,0x00,0x00,0x00,0x50,0x41,0x4c,0x20,0x64,0x61,0x74,0x61};

followed by the palette data length-

PAL_len=(PAL_colors*4)+4;  /* word length - little endian */

and the number of bytes for palette entry (3 bytes = red,green, blue). The fourth byte is alpha channel, but I haven't seen it in use.

unsigned char PAL_shim[4]={ 0x00,0x00,0x00,0x03};

and the number of colors/slots

PAL_colors=n;  /* word length - little endian */

and then the data which is 4 bytes long-

PAL_output[x*4]=red;
PAL_output[x*4+1]=green;
PAL_output[x*4+2]=blue;
PAL_output[x*4+3]=0;



-R
creaothceann
Guest
« Reply #28 on: November 07, 2006, 07:45:41 pm »

Thanks. Wink
sb iq
Guest
« Reply #29 on: November 08, 2006, 12:28:41 am »

Thanks for the program creaothceann. I'm just wondering, it seems my "rip" is going to be much greater than 768 bytes. Will vSNES still be able to convert it to JASC .pal?

Quote from: Gemini on November 06, 2006, 06:20:48 am
Why don't you just use Tile Molester and forget about PSP?

Yeah, I tried loading my VRAM dump into Tile Molester and I got tons of gibberish.

My reasons for using Paint Shop Pro has to do with this topic since I have to make raw data I ripped from the PC game refer to the palette in the PSX game.

Also, the huge size is bugging me. I mean, the textures are only 8-bit, yet the palette seems freaking huge. Something tells me that just can't be right.

I tried getting in contact with the epsxe authors and asking them the hex address that epsxe saves the CLUT when it makes a save state. I still have not received a reply.  Sad
« Last Edit: November 08, 2006, 01:24:29 am by sb iq »
Pages: 1 [2] 3  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC