Raw To C-array Application


pea

developer
Joined
Oct 3, 2004
Messages
1,089
Age
46
Location
New Zealand
Website
www.projectitis.com
Hi all,

I decided to clean up and release my windows application to convert any file to a c-array. This is very handy for dev's who want to include graphics, music, raw data etc directly into their fxe's.

It only supports char arrays at the moment (short and long will be added soon) but can output as decimal or hex, pad numbers with 0's or spaces, format data into lines, and also pad the file to align to 4-byte boundaries.

The zipped exe can be found here:
http://www.pea.co.nz/gp32/downloads.php#rawtoc

Screenie here:
rawtoc.jpg
 
Can you give me an example of what this might be used for? Is this the only way to implement music?
 
As far as I know there are three ways to implement music/any other file. Two of these methods involve converting the original file to a stream of raw byte data so that it can simply be included in the .fxe as raw data. There is no need for an external file this way.

The last way is to simply load the music/any other file from the smc. This requires (obviously) the music file to also be copied to the smc. This is sometimes not as prefered as it is much easier to deal with a single file rather than multiple.

The methods are:
1) Load seperate file from smc using open/read commands etc.
2) Create c-array and #include it into your application
3) Create a small ASM file that effectively does the same thing, but does it at compile time.

Number (3) is actually my preferred method, but I have alignment issues with it.

I'll find a link for you.
EDIT: This one is how to make the ASM file
http://www.gp32x.de/board/index.php?showt...ndpost&p=199857
This one is about the alignment problems
http://www.gp32x.de/board/index.php?showtopic=16663&st=15

Cheers
 
Last edited by a moderator:
Just a small note that one can use gcc's objcopy to create an object file from a binary file. No intermediate conversions and compiles faster (if that happens to be an issue).
:blink:
 
Back
Top