gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Load PCX and palette

#94740 - Turambar - Wed Jul 26, 2006 12:21 am

I have this code to load a pcx image from the filesystem
Code:
   
   const char *pcx_file = gbfs_get_obj(&data_gbfs, "img.pcx", NULL);
   loadPCX((u8*)pcx_file, &pcx);

I'm working with 8bit colors, how can I get the palette this image uses?

#94753 - tepples - Wed Jul 26, 2006 1:12 am

Depends on what loadPCX() is specified to do.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#94757 - dovoto - Wed Jul 26, 2006 1:33 am

pcx.palette;
_________________
www.drunkencoders.com

#95142 - Payk - Fri Jul 28, 2006 12:37 am

Hey...gbfs? its a pain...
those commands are not very good...sure u can do all with that but i recommand u romdiscfs...it it uses same way gbfs does...but has stdio functions...if u manage that u could load a 256color bmp like this:
http://rafb.net/paste/results/bj8s2u58.html
and u have it still in rom...better acces...same possibilitys...why not?

#95190 - tepples - Fri Jul 28, 2006 4:37 am

With PCX, you need to get the file size (pass &size, not NULL, as the third argument), and then read the palette from the last 768 bytes of the file.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.