From: bogglez <bo...@us...> - 2017-03-09 21:30:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 142eb5331239ff58d71700dd9ae768d18a9c0c8d (commit) via d883a8c45921db534134dfac7adf80afc7cd37e3 (commit) from d0be8ed7e09cc721d45d4ba38266d0a10e07598e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 142eb5331239ff58d71700dd9ae768d18a9c0c8d Author: bogglez <bo...@pr...> Date: Thu Mar 9 22:30:31 2017 +0100 kmgenc: use same readpng code as vqenc/dcbumpgen, io errors commit d883a8c45921db534134dfac7adf80afc7cd37e3 Author: bogglez <bo...@pr...> Date: Thu Mar 9 22:29:52 2017 +0100 kmgenc: add man page ----------------------------------------------------------------------- Summary of changes: utils/kmgenc/kmgenc.1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ utils/kmgenc/readpng.c | 12 +++++++----- utils/kmgenc/readpng.h | 2 +- 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 utils/kmgenc/kmgenc.1 diff --git a/utils/kmgenc/kmgenc.1 b/utils/kmgenc/kmgenc.1 new file mode 100644 index 0000000..28015eb --- /dev/null +++ b/utils/kmgenc/kmgenc.1 @@ -0,0 +1,45 @@ +.TH KMGENC 1 "Mar 2017" "Version 1.0" +.SH NAME +kmgenc \- Store images as SEGA Dreamcast PVR textures in a KMG container +.SH SYNOPSIS +\fBkmgenc\fR [\fIOPTION\fR]... [\fIFILE\fR]... + +.SH DESCRIPTION +.B kmgenc +is used to convert images to the SEGA Dreamcast's available +image formats. Typically this means RGB565, ARGB1555 or ARGB4444. + +.SH OPTIONS +.TP +.BR \-v ", " \-\-verbose\fR +Print more information during processing. + +.TP +.BR \-d ", " \-\-debug\fR +Print much more information. + +.TP +.BR \-a4 ", " \-\-argb4444\fR +Use 4 bit alpha channel (Dreamcast PVR texture format ARGB4444). + +.TP +.BR \-a1 ", " \-\-argb1555\fR +Use 1 bit alpha channel (Dreamcast PVR texture format ARGB1555). + +.SH EXAMPLES + +.EX +.B + kmgenc -a image.png +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Gil Megidish in 2002 and modified by +Dan Potter in 2003. + +.SH BUGS +kmgenc is very incomplete and you may want to use vqenc instead, since it is also +capable of outputting kmg container files with mipmaps and VQ compression. diff --git a/utils/kmgenc/readpng.c b/utils/kmgenc/readpng.c index 642fdeb..788f100 100644 --- a/utils/kmgenc/readpng.c +++ b/utils/kmgenc/readpng.c @@ -25,7 +25,7 @@ void readpng_version_info(void) { } -/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ +/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 3 for io, 4 for no mem */ uint32 readpng_init(FILE *infile) { uint8 sig[8]; @@ -33,7 +33,9 @@ uint32 readpng_init(FILE *infile) { /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ - fread(sig, 1, 8, infile); + if(fread(sig, 8, 1, infile) != 1) { + return 3; + } if(!png_check_sig(sig, 8)) return 1; /* bad signature */ @@ -62,7 +64,7 @@ uint32 readpng_init(FILE *infile) { return 0; } -uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, uint32 *pHeight) { +uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, int *pWidth, int *pHeight) { png_uint_32 width, height; int bit_depth, color_type; uint8 *image_data = NULL; @@ -77,8 +79,8 @@ uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, u png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL); - *pWidth = width; - *pHeight = height; + *pWidth = (int)width; + *pHeight = (int)height; /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, * transparency chunks to full alpha channel; strip 16-bit-per-sample diff --git a/utils/kmgenc/readpng.h b/utils/kmgenc/readpng.h index af0cc29..1c4a034 100644 --- a/utils/kmgenc/readpng.h +++ b/utils/kmgenc/readpng.h @@ -35,6 +35,6 @@ uint32 readpng_init(FILE *infile); * The caller is responsible for freeing the memory */ uint8 *readpng_get_image(uint32 *pNumChannels, - uint32 *pRowBytes, uint32 *pWidth, uint32 *pHeight); + uint32 *pRowBytes, int *pWidth, int *pHeight); void readpng_cleanup(void); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |