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.

Beginners > GFX2GBA messes with my palette

#29000 - identitycrisisuk - Tue Nov 09, 2004 10:30 pm

I'm posssibly using this for a lot less complex task than it was designed for but I'm using markus@console-dev.de's gfx2gba program to convert a 16 colour bitmap for the GBA. Because I'm not using all of the colours defined in the 16 colour palette in the bitmap, the progam always seems to simplify it as much as it can, only writing the colours that are used in the sprite to the palette that is output and subsequently changing the indexes used in the raw sprite data output. I suppose this would not be a problem if you have a sprite with 16 colours in it but I just find it a bit unsettling when I'm starting small and want to understand completely what is going on. Is there any way to stop it from optimising the palette and make it write out all of the colours even if they are not used?

Also, the arrays it outputs for the raw data are unsigned chars. Will I get the picture correctly if I cast this array to a u16 when I read it in to VRAM? i.e. would two u8's in an array {0x01, 0x23} be read as 0x2301 when cast to a u16 (which would be correct) or would it be 0x0123.

Thanks for any help.

#29006 - tepples - Wed Nov 10, 2004 2:43 am

GBA is little endian. If your graphics converter wants to output a 0x0842 (say, as a palette entry or as a mode 3/5 pixel), it will output 0x42 0x08.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#29014 - ScottLininger - Wed Nov 10, 2004 6:01 am

I believe there is an option to tell gfx2gba NOT to mess with your colors. It has to do with "Do not combine palettes". Otherwise it assumes that you are passing it multiple files and it "optimizes" as it goes, which means it drops out or reorders your palette.

Although, you have to be careful because there are at least two totally different conversion tools out there called "gfx2gba"... I hope we're talking about the same one.

-Scott

#29034 - identitycrisisuk - Wed Nov 10, 2004 12:15 pm

ScottLininger wrote:
Although, you have to be careful because there are at least two totally different conversion tools out there called "gfx2gba"... I hope we're talking about the same one.


I know, bit of a pain isn't it? There is an option to not combine palettes though so it sounds like it might be the same one. I'll have to try and see what happens, same with the endian issues as well.