Back to the front page

png-to-dreamcast 0.01

Here's the README, which explains all. After that, you could download the source(6K tar.gz).

png-to-dreamcast 0.01
by Howard Jones (howie@thingy.com)
http://wotsit.thingy.com/haj/
September 23rd 2001

This a little tool I wrote back in March to help me produce the textures for a
Spacewar clone I am working on without too much fooling around. It takes in
PNG files and produces most DC texture formats. The current version doesn't
actually do the 'twiddled' modes or the YUV modes, even though the options are
there for it. Most importantly, it understands PNG alpha-channels, which means
you can use Photoshop or other tools* that deal with transparency to create your
graphics, then produce RGBA4444 sprites or textures from them.

* One interesting one is that 3DS Max can save renders with the alpha channel
intact.

To compile:
----------
Check that you have libpng (most modern systems, including cygwin and Linux do),
type 'make; make install'


Usage:
-----
png_to_dreamcast -f formatname -i inputfilename.png -o outputfilename

Write a Dreamcast-formatted version of the input PNG file to outputfilename
Version 0.01 by Howard Jones (howie@thingy.com) March 2001
Additional options:
   -a    -   append to outputfile
   -t    -   'twiddle' texture for Tile Accelerator [NOT YET!]
   -d idname - output a #define on stdout with the byte offset and this ID
   -h    -   this help text
Supported format names: * = Half/Not Implemented! ;-) 
   RGB555  
   RGB565  
   RGB888  
   ARGB1555  
   ARGB4444  
   YUV422  *

Notes 
----- 
A couple of the options might need a little explaining. The -a (append) and -d
(idname) options are intended to be used together to make it easier to produce
'big lump of graphics' files. This should save you some time when your game is
loading from CD (loading lots of small files is slow), and makes embedding in
a binary a little easier too. I use it in a shellscript like:

   # Note: only the first line is not Append, and all the same file
   png_to_dreamcast -i redship.png -o sprites.dat -f ARGB4444 -d TXT_REDSHIP
   png_to_dreamcast -i blueship.png -o sprites.dat -f ARGB4444 -a -d TXT_BLUESHIP
   png_to_dreamcast -i yellowship.png -o sprites.dat -f ARGB4444 -a -d TXT_YELLOWSHIP
   png_to_dreamcast -i greenship.png -o sprites.dat -f ARGB4444 -a -d TXT_GREENSHIP

Which gives me a single sprites.dat file, and some #defines ready to paste into 
my headers, like:
   #define TXT_REDSHIP (TEXTURE_BASE + 0)
   #define TXT_BLUESHIP (TEXTURE_BASE + 8192)
   #define TXT_YELLOWSHIP (TEXTURE_BASE + 16384)
   #define TXT_GREENSHIP (TEXTURE_BASE + 24576)
Just define TEXTURE_BASE, and they are ready to use with ta_load_texture().