X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=tools%2Fpngdump%2Fmain.c;h=d7aba3e23f8a65bb8ec999efbd80615574128304;hb=HEAD;hp=a2b37fd2daaa5cfde6a5267ced6083561c1b56b7;hpb=ca3123df6cd875b1361533020c1f4eebfe9da295;p=gba_blender diff --git a/tools/pngdump/main.c b/tools/pngdump/main.c index a2b37fd..d7aba3e 100644 --- a/tools/pngdump/main.c +++ b/tools/pngdump/main.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "image.h" void print_usage(const char *argv0); @@ -10,8 +11,11 @@ int main(int argc, char **argv) { int i, mode = 0; int text = 0; - char *fname = 0, *outfname = 0; - struct image img; + int renibble = 0; + char *outfname = 0; + char *infiles[256]; + int num_infiles = 0; + struct image img, tmpimg; FILE *out = stdout; for(i=1; i> 4); + } + } + if(outfname) { if(!(out = fopen(outfname, "wb"))) { fprintf(stderr, "failed to open output file: %s: %s\n", outfname, strerror(errno)); @@ -93,7 +123,8 @@ int main(int argc, char **argv) printf("%d %d %d\n", img.cmap[i].r, img.cmap[i].g, img.cmap[i].b); } } else { - fwrite(img.cmap, sizeof img.cmap[0], img.cmap_ncolors, out); + /*fwrite(img.cmap, sizeof img.cmap[0], img.cmap_ncolors, out);*/ + fwrite(img.cmap, sizeof img.cmap[0], 1 << img.bpp, out); } break; @@ -117,9 +148,11 @@ void print_usage(const char *argv0) { printf("Usage: %s [options] \n", argv0); printf("Options:\n"); + printf(" -o : specify output file (default: stdout)\n"); printf(" -p: dump pixels (default)\n"); printf(" -c: dump colormap (palette) entries\n"); printf(" -i: print image information\n"); printf(" -t: dump as text\n"); + printf(" -n: swap the order of nibbles (for 4bpp)\n"); printf(" -h: print usage and exit\n"); }