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.

Coding > BIN/RAW File format

#9997 - Lupin - Sun Aug 24, 2003 1:39 pm

I want to know how bin or raw file format is constructed, because I want to write an app wich converts some data to bin/raw format.

Is bin and raw the same or is there an difference?

#10001 - tepples - Sun Aug 24, 2003 2:37 pm

It depends on the "some data" that you want to convert. For example, to me, ".bin" is a Sega Genesis ROM (GBA ROMs are .gba), and ".raw" is a raw PCM audio file, but it may be different in your application.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#10006 - Lupin - Sun Aug 24, 2003 5:10 pm

Hm, I ment the raw/bin files included by ADS' INCBIN directive

#10008 - Lupin - Sun Aug 24, 2003 5:51 pm

are raw files really pure data only? I once used an tool to convert raw->h and the tool did name the const array name differently from the raw file name, so I thought there's some extra info stored within the raw file

#10059 - sajiimori - Mon Aug 25, 2003 11:37 pm

.bin and .raw are filename extensions, and no more. Often, they are somebody's way of saying that the data has no particular format. Then again, as a previous poster noted, some people use the extension .raw to denote audio samples. It's all in interpretation.

INCBIN will gladly attach any file, regardless of format. The point of the directive is to include a binary file, and not interpret or modify it at all.

I don't know what the tool you used did, or how it names its structures. Ask the author.

Anyway, perhaps you could be more specific about what you are trying to do, then you might get a more useful answer. For instance, you might want to know how to convert a .bmp file to a strip of 15-bit BGR 8x8 characters, so that you can use a DMA copy directly from ROM to video RAM.

#10082 - GBA Coda - Tue Aug 26, 2003 5:43 pm

Hi,

.bin & .raw are both binary file extentions!

if you saved an image ( 256 color palette ) of say 32x32 pixels as .raw your file size would be 1024 bytes, containing only the bitmap its self with no header & no palette.

the only thing you have to do is track the image dimentions & palette manually!

i hope that sorta answers somthing....

GBA Coda
_________________
Expression has no effect in function Main()!

#10086 - sajiimori - Tue Aug 26, 2003 6:24 pm

Quote:

if you saved an image ( 256 color palette ) of say 32x32 pixels as .raw your file size would be 1024 bytes, containing only the bitmap its self with no header & no palette.

Or you could strip just the header off a .bmp file and call it .raw if you want, leaving the palette intact. Or you could apply the palette to the image and convert it to 24 bit color, then call it .raw. Or you could just rename the .bmp file to .raw, just because BMP images have trivial encoding compared to JPEG images, so they are practically "raw" in comparison. Or...

Like I said, it's all interpretation. A stream of 1024 indexes into a 256-color palette (stored elsewhere) is still a format; it is merely a simple one. Lay out your data however you like, and name the files whatever you want. :-)

#10119 - Lupin - Wed Aug 27, 2003 3:18 pm

Thank you for your answers, that's all I need to know at the moment. This way I would be able to directly import any type of file without having it converted.