From 6b785b0b68345d181329797b4797232dc67ae2ba Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 12 Aug 2008 03:25:16 +0000 Subject: [PATCH] housekeeping --- Makefile.gc | 8 +- Makefile.wii | 8 +- README.txt | 3 +- source/libpng/png.h | 3569 +++++++++++++++++ source/libpng/pngconf.h | 1481 +++++++ source/libpng/pngu/pngu.c | 1132 ++++++ source/libpng/pngu/pngu.h | 171 + source/ngc/button_mapping.c | 244 +- source/ngc/button_mapping.h | 11 + source/ngc/cheatmgr.cpp | 60 +- source/ngc/dkpro.h | 877 ---- source/ngc/dvd.cpp | 76 +- source/ngc/dvd.h | 11 +- source/ngc/fileop.cpp | 74 +- source/ngc/fileop.h | 6 +- source/ngc/filesel.cpp | 344 +- source/ngc/filesel.h | 3 + source/ngc/{memfile.cpp => freeze.cpp} | 284 +- source/ngc/{memfile.h => freeze.h} | 0 source/ngc/{ => images}/gfx_bg.h | 7 +- .../ngc/{gcglobals.cpp => images/saveicon.h} | 420 +- source/ngc/{mcsave.cpp => memcardop.cpp} | 30 +- source/ngc/{mcsave.h => memcardop.h} | 8 +- source/ngc/menu.cpp | 51 +- source/ngc/menudraw.cpp | 80 +- source/ngc/preferences.cpp | 44 +- source/ngc/s9xconfig.cpp | 8 +- source/ngc/s9xconfig.h | 4 +- source/ngc/smbop.cpp | 226 +- source/ngc/smbop.h | 6 +- source/ngc/snes9xGX.cpp | 13 +- source/ngc/snes9xGX.h | 4 +- source/ngc/sram.cpp | 27 +- source/ngc/tempgfx.h | 556 --- source/ngc/unzip.cpp | 212 +- source/ngc/unzip.h | 3 +- source/ngc/video.cpp | 19 +- source/snes9x/snapshot.cpp | 2 +- 38 files changed, 7284 insertions(+), 2798 deletions(-) create mode 100644 source/libpng/png.h create mode 100644 source/libpng/pngconf.h create mode 100644 source/libpng/pngu/pngu.c create mode 100644 source/libpng/pngu/pngu.h delete mode 100644 source/ngc/dkpro.h rename source/ngc/{memfile.cpp => freeze.cpp} (55%) rename source/ngc/{memfile.h => freeze.h} (100%) rename source/ngc/{ => images}/gfx_bg.h (99%) rename source/ngc/{gcglobals.cpp => images/saveicon.h} (60%) rename source/ngc/{mcsave.cpp => memcardop.cpp} (95%) rename source/ngc/{mcsave.h => memcardop.h} (83%) delete mode 100644 source/ngc/tempgfx.h diff --git a/Makefile.gc b/Makefile.gc index c9a0107..72f9583 100644 --- a/Makefile.gc +++ b/Makefile.gc @@ -19,9 +19,9 @@ include $(DEVKITPPC)/gamecube_rules #--------------------------------------------------------------------------------- TARGET := executables/snes9xgx-$(VERSION)-gc BUILD := build_gc -SOURCES := source/snes9x source/ngc +SOURCES := source/snes9x source/ngc source/libpng source/libpng/pngu DATA := data -INCLUDES := source/snes9x source/ngc +INCLUDES := source source/snes9x source/ngc #--------------------------------------------------------------------------------- # options for code generation @@ -41,13 +41,13 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lbba -ltinysmb -lfat -lz -logc -lm -lfreetype +LIBS := -lpng -lbba -ltinysmb -lfat -lz -logc -lm -lfreetype #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := +LIBDIRS := $(CURDIR) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional diff --git a/Makefile.wii b/Makefile.wii index 3b99417..140bb1f 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -19,9 +19,9 @@ include $(DEVKITPPC)/wii_rules #--------------------------------------------------------------------------------- TARGET := executables/snes9xgx-$(VERSION)-wii BUILD := build_wii -SOURCES := source/snes9x source/ngc +SOURCES := source/snes9x source/ngc source/libpng source/libpng/pngu DATA := data -INCLUDES := source/snes9x source/ngc +INCLUDES := source source/snes9x source/ngc #--------------------------------------------------------------------------------- # options for code generation @@ -41,13 +41,13 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype -ltinysmb +LIBS := -lpng -lfat -lwiiuse -lz -lbte -logc -lm -lfreetype -ltinysmb #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := +LIBDIRS := $(CURDIR) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional diff --git a/README.txt b/README.txt index 4e674ad..da5750a 100644 --- a/README.txt +++ b/README.txt @@ -25,7 +25,8 @@ Tantric .CHT file name must match file name of ROM - added: load/save preference selector. ROM, SRAM, Freeze, and preferences are saved/loaded according to these -- added: preliminary Wii SMB support +- added: preliminary Wii SMB support - completely working, but you must change + settings in s9xconfig.cpp - added: 'Auto' settings for save/load - attempts to automatically determine your load/save device(s) - SD, USB, Memory Card, DVD, SMB - added: ROM Information page diff --git a/source/libpng/png.h b/source/libpng/png.h new file mode 100644 index 0000000..e0cec0c --- /dev/null +++ b/source/libpng/png.h @@ -0,0 +1,3569 @@ +/* png.h - header file for PNG reference library + * + * libpng version 1.2.29 - May 8, 2008 + * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * Authors and maintainers: + * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat + * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger + * libpng versions 0.97, January 1998, through 1.2.29 - May 8, 2008: Glenn + * See also "Contributing Authors", below. + * + * Note about libpng version numbers: + * + * Due to various miscommunications, unforeseen code incompatibilities + * and occasional factors outside the authors' control, version numbering + * on the library has not always been consistent and straightforward. + * The following table summarizes matters since version 0.89c, which was + * the first widely used release: + * + * source png.h png.h shared-lib + * version string int version + * ------- ------ ----- ---------- + * 0.89c "1.0 beta 3" 0.89 89 1.0.89 + * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] + * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] + * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] + * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] + * 0.97c 0.97 97 2.0.97 + * 0.98 0.98 98 2.0.98 + * 0.99 0.99 98 2.0.99 + * 0.99a-m 0.99 99 2.0.99 + * 1.00 1.00 100 2.1.0 [100 should be 10000] + * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] + * 1.0.1 png.h string is 10001 2.1.0 + * 1.0.1a-e identical to the 10002 from here on, the shared library + * 1.0.2 source version) 10002 is 2.V where V is the source code + * 1.0.2a-b 10003 version, except as noted. + * 1.0.3 10003 + * 1.0.3a-d 10004 + * 1.0.4 10004 + * 1.0.4a-f 10005 + * 1.0.5 (+ 2 patches) 10005 + * 1.0.5a-d 10006 + * 1.0.5e-r 10100 (not source compatible) + * 1.0.5s-v 10006 (not binary compatible) + * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) + * 1.0.6d-f 10007 (still binary incompatible) + * 1.0.6g 10007 + * 1.0.6h 10007 10.6h (testing xy.z so-numbering) + * 1.0.6i 10007 10.6i + * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) + * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) + * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) + * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) + * 1.0.7 1 10007 (still compatible) + * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 + * 1.0.8rc1 1 10008 2.1.0.8rc1 + * 1.0.8 1 10008 2.1.0.8 + * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 + * 1.0.9rc1 1 10009 2.1.0.9rc1 + * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 + * 1.0.9rc2 1 10009 2.1.0.9rc2 + * 1.0.9 1 10009 2.1.0.9 + * 1.0.10beta1 1 10010 2.1.0.10beta1 + * 1.0.10rc1 1 10010 2.1.0.10rc1 + * 1.0.10 1 10010 2.1.0.10 + * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 + * 1.0.11rc1 1 10011 2.1.0.11rc1 + * 1.0.11 1 10011 2.1.0.11 + * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 + * 1.0.12rc1 2 10012 2.1.0.12rc1 + * 1.0.12 2 10012 2.1.0.12 + * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) + * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 + * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 + * 1.2.0rc1 3 10200 3.1.2.0rc1 + * 1.2.0 3 10200 3.1.2.0 + * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 + * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 + * 1.2.1 3 10201 3.1.2.1 + * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 + * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 + * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 + * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 + * 1.0.13 10 10013 10.so.0.1.0.13 + * 1.2.2 12 10202 12.so.0.1.2.2 + * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 + * 1.2.3 12 10203 12.so.0.1.2.3 + * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 + * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 + * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 + * 1.0.14 10 10014 10.so.0.1.0.14 + * 1.2.4 13 10204 12.so.0.1.2.4 + * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 + * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 + * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 + * 1.0.15 10 10015 10.so.0.1.0.15 + * 1.2.5 13 10205 12.so.0.1.2.5 + * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 + * 1.0.16 10 10016 10.so.0.1.0.16 + * 1.2.6 13 10206 12.so.0.1.2.6 + * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 + * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1 + * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 + * 1.0.17 10 10017 10.so.0.1.0.17 + * 1.2.7 13 10207 12.so.0.1.2.7 + * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 + * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5 + * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 + * 1.0.18 10 10018 10.so.0.1.0.18 + * 1.2.8 13 10208 12.so.0.1.2.8 + * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 + * 1.2.9beta4-11 13 10209 12.so.0.9[.0] + * 1.2.9rc1 13 10209 12.so.0.9[.0] + * 1.2.9 13 10209 12.so.0.9[.0] + * 1.2.10beta1-8 13 10210 12.so.0.10[.0] + * 1.2.10rc1-3 13 10210 12.so.0.10[.0] + * 1.2.10 13 10210 12.so.0.10[.0] + * 1.2.11beta1-4 13 10211 12.so.0.11[.0] + * 1.0.19rc1-5 10 10019 10.so.0.19[.0] + * 1.2.11rc1-5 13 10211 12.so.0.11[.0] + * 1.0.19 10 10019 10.so.0.19[.0] + * 1.2.11 13 10211 12.so.0.11[.0] + * 1.0.20 10 10020 10.so.0.20[.0] + * 1.2.12 13 10212 12.so.0.12[.0] + * 1.2.13beta1 13 10213 12.so.0.13[.0] + * 1.0.21 10 10021 10.so.0.21[.0] + * 1.2.13 13 10213 12.so.0.13[.0] + * 1.2.14beta1-2 13 10214 12.so.0.14[.0] + * 1.0.22rc1 10 10022 10.so.0.22[.0] + * 1.2.14rc1 13 10214 12.so.0.14[.0] + * 1.0.22 10 10022 10.so.0.22[.0] + * 1.2.14 13 10214 12.so.0.14[.0] + * 1.2.15beta1-6 13 10215 12.so.0.15[.0] + * 1.0.23rc1-5 10 10023 10.so.0.23[.0] + * 1.2.15rc1-5 13 10215 12.so.0.15[.0] + * 1.0.23 10 10023 10.so.0.23[.0] + * 1.2.15 13 10215 12.so.0.15[.0] + * 1.2.16beta1-2 13 10216 12.so.0.16[.0] + * 1.2.16rc1 13 10216 12.so.0.16[.0] + * 1.0.24 10 10024 10.so.0.24[.0] + * 1.2.16 13 10216 12.so.0.16[.0] + * 1.2.17beta1-2 13 10217 12.so.0.17[.0] + * 1.0.25rc1 10 10025 10.so.0.25[.0] + * 1.2.17rc1-3 13 10217 12.so.0.17[.0] + * 1.0.25 10 10025 10.so.0.25[.0] + * 1.2.17 13 10217 12.so.0.17[.0] + * 1.0.26 10 10026 10.so.0.26[.0] + * 1.2.18 13 10218 12.so.0.18[.0] + * 1.2.19beta1-31 13 10219 12.so.0.19[.0] + * 1.0.27rc1-6 10 10027 10.so.0.27[.0] + * 1.2.19rc1-6 13 10219 12.so.0.19[.0] + * 1.0.27 10 10027 10.so.0.27[.0] + * 1.2.19 13 10219 12.so.0.19[.0] + * 1.2.20beta01-04 13 10220 12.so.0.20[.0] + * 1.0.28rc1-6 10 10028 10.so.0.28[.0] + * 1.2.20rc1-6 13 10220 12.so.0.20[.0] + * 1.0.28 10 10028 10.so.0.28[.0] + * 1.2.20 13 10220 12.so.0.20[.0] + * 1.2.21beta1-2 13 10221 12.so.0.21[.0] + * 1.2.21rc1-3 13 10221 12.so.0.21[.0] + * 1.0.29 10 10029 10.so.0.29[.0] + * 1.2.21 13 10221 12.so.0.21[.0] + * 1.2.22beta1-4 13 10222 12.so.0.22[.0] + * 1.0.30rc1 10 10030 10.so.0.30[.0] + * 1.2.22rc1 13 10222 12.so.0.22[.0] + * 1.0.30 10 10030 10.so.0.30[.0] + * 1.2.22 13 10222 12.so.0.22[.0] + * 1.2.23beta01-05 13 10223 12.so.0.23[.0] + * 1.2.23rc01 13 10223 12.so.0.23[.0] + * 1.2.23 13 10223 12.so.0.23[.0] + * 1.2.24beta01-02 13 10224 12.so.0.24[.0] + * 1.2.24rc01 13 10224 12.so.0.24[.0] + * 1.2.24 13 10224 12.so.0.24[.0] + * 1.2.25beta01-06 13 10225 12.so.0.25[.0] + * 1.2.25rc01-02 13 10225 12.so.0.25[.0] + * 1.0.31 10 10031 10.so.0.31[.0] + * 1.2.25 13 10225 12.so.0.25[.0] + * 1.2.26beta01-06 13 10226 12.so.0.26[.0] + * 1.2.26rc01 13 10226 12.so.0.26[.0] + * 1.2.26 13 10226 12.so.0.26[.0] + * 1.0.32 10 10032 10.so.0.32[.0] + * 1.2.27beta01-06 13 10227 12.so.0.27[.0] + * 1.2.27rc01 13 10227 12.so.0.27[.0] + * 1.0.33 10 10033 10.so.0.33[.0] + * 1.2.27 13 10227 12.so.0.27[.0] + * 1.0.34 10 10034 10.so.0.34[.0] + * 1.2.28 13 10228 12.so.0.28[.0] + * 1.2.29beta01-03 13 10229 12.so.0.29[.0] + * 1.2.29rc01 13 10229 12.so.0.29[.0] + * 1.0.35 10 10035 10.so.0.35[.0] + * 1.2.29 13 10229 12.so.0.29[.0] + * + * Henceforth the source version will match the shared-library major + * and minor numbers; the shared-library major version number will be + * used for changes in backward compatibility, as it is intended. The + * PNG_LIBPNG_VER macro, which is not used within libpng but is available + * for applications, is an unsigned integer of the form xyyzz corresponding + * to the source version x.y.z (leading zeros in y and z). Beta versions + * were given the previous public release number plus a letter, until + * version 1.0.6j; from then on they were given the upcoming public + * release number plus "betaNN" or "rcNN". + * + * Binary incompatibility exists only when applications make direct access + * to the info_ptr or png_ptr members through png.h, and the compiled + * application is loaded with a different version of the library. + * + * DLLNUM will change each time there are forward or backward changes + * in binary compatibility (e.g., when a new feature is added). + * + * See libpng.txt or libpng.3 for more information. The PNG specification + * is available as a W3C Recommendation and as an ISO Specification, + * defines should NOT be changed. + */ +#define PNG_INFO_gAMA 0x0001 +#define PNG_INFO_sBIT 0x0002 +#define PNG_INFO_cHRM 0x0004 +#define PNG_INFO_PLTE 0x0008 +#define PNG_INFO_tRNS 0x0010 +#define PNG_INFO_bKGD 0x0020 +#define PNG_INFO_hIST 0x0040 +#define PNG_INFO_pHYs 0x0080 +#define PNG_INFO_oFFs 0x0100 +#define PNG_INFO_tIME 0x0200 +#define PNG_INFO_pCAL 0x0400 +#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ +#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ +#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ +#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ +#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ + +/* This is used for the transformation routines, as some of them + * change these values for the row. It also should enable using + * the routines for other purposes. + */ +typedef struct png_row_info_struct +{ + png_uint_32 width; /* width of row */ + png_uint_32 rowbytes; /* number of bytes in row */ + png_byte color_type; /* color type of row */ + png_byte bit_depth; /* bit depth of row */ + png_byte channels; /* number of channels (1, 2, 3, or 4) */ + png_byte pixel_depth; /* bits per pixel (depth * channels) */ +} png_row_info; + +typedef png_row_info FAR * png_row_infop; +typedef png_row_info FAR * FAR * png_row_infopp; + +/* These are the function types for the I/O functions and for the functions + * that allow the user to override the default I/O functions with his or her + * own. The png_error_ptr type should match that of user-supplied warning + * and error functions, while the png_rw_ptr type should match that of the + * user read/write data functions. + */ +typedef struct png_struct_def png_struct; +typedef png_struct FAR * png_structp; + +typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); +typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); +typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); +typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, + int)); +typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, + int)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, + png_uint_32, int)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, + png_row_infop, png_bytep)); +#endif + +#if defined(PNG_USER_CHUNKS_SUPPORTED) +typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); +#endif +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); +#endif + +/* Transform masks for the high-level interface */ +#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ +#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ +#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ +#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ +#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ +#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ +#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ +#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ +#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ +#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ +#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ +#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ +#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ + +/* Flags for MNG supported features */ +#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 +#define PNG_FLAG_MNG_FILTER_64 0x04 +#define PNG_ALL_MNG_FEATURES 0x05 + +typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); +typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); + +/* The structure that holds the information to read and write PNG files. + * The only people who need to care about what is inside of this are the + * people who will be modifying the library for their own special needs. + * It should NOT be accessed directly by an application, except to store + * the jmp_buf. + */ + +struct png_struct_def +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf jmpbuf; /* used in png_error */ +#endif + png_error_ptr error_fn; /* function for printing errors and aborting */ + png_error_ptr warning_fn; /* function for printing warnings */ + png_voidp error_ptr; /* user supplied struct for error functions */ + png_rw_ptr write_data_fn; /* function for writing output data */ + png_rw_ptr read_data_fn; /* function for reading input data */ + png_voidp io_ptr; /* ptr to application struct for I/O functions */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) + png_user_transform_ptr read_user_transform_fn; /* user read transform */ +#endif + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_user_transform_ptr write_user_transform_fn; /* user write transform */ +#endif + +/* These were added in libpng-1.0.2 */ +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_voidp user_transform_ptr; /* user supplied struct for user transform */ + png_byte user_transform_depth; /* bit depth of user transformed pixels */ + png_byte user_transform_channels; /* channels in user transformed pixels */ +#endif +#endif + + png_uint_32 mode; /* tells us where we are in the PNG file */ + png_uint_32 flags; /* flags indicating various things to libpng */ + png_uint_32 transformations; /* which transformations to perform */ + + z_stream zstream; /* pointer to decompression structure (below) */ + png_bytep zbuf; /* buffer for zlib */ + png_size_t zbuf_size; /* size of zbuf */ + int zlib_level; /* holds zlib compression level */ + int zlib_method; /* holds zlib compression method */ + int zlib_window_bits; /* holds zlib compression window bits */ + int zlib_mem_level; /* holds zlib compression memory level */ + int zlib_strategy; /* holds zlib compression strategy */ + + png_uint_32 width; /* width of image in pixels */ + png_uint_32 height; /* height of image in pixels */ + png_uint_32 num_rows; /* number of rows in current pass */ + png_uint_32 usr_width; /* width of row at start of write */ + png_uint_32 rowbytes; /* size of row in bytes */ + png_uint_32 irowbytes; /* size of current interlaced row in bytes */ + png_uint_32 iwidth; /* width of current interlaced row in pixels */ + png_uint_32 row_number; /* current row in interlace pass */ + png_bytep prev_row; /* buffer to save previous (unfiltered) row */ + png_bytep row_buf; /* buffer to save current (unfiltered) row */ +#ifndef PNG_NO_WRITE_FILTERING + png_bytep sub_row; /* buffer to save "sub" row when filtering */ + png_bytep up_row; /* buffer to save "up" row when filtering */ + png_bytep avg_row; /* buffer to save "avg" row when filtering */ + png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ +#endif + png_row_info row_info; /* used for transformation routines */ + + png_uint_32 idat_size; /* current IDAT size for read */ + png_uint_32 crc; /* current chunk CRC value */ + png_colorp palette; /* palette from the input file */ + png_uint_16 num_palette; /* number of color entries in palette */ + png_uint_16 num_trans; /* number of transparency values */ + png_byte chunk_name[5]; /* null-terminated name of current chunk */ + png_byte compression; /* file compression type (always 0) */ + png_byte filter; /* file filter type (always 0) */ + png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ + png_byte pass; /* current interlace pass (0 - 6) */ + png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ + png_byte color_type; /* color type of file */ + png_byte bit_depth; /* bit depth of file */ + png_byte usr_bit_depth; /* bit depth of users row */ + png_byte pixel_depth; /* number of bits per pixel */ + png_byte channels; /* number of channels in file */ + png_byte usr_channels; /* channels at start of write */ + png_byte sig_bytes; /* magic bytes read/written from start of file */ + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +#ifdef PNG_LEGACY_SUPPORTED + png_byte filler; /* filler byte for pixel expansion */ +#else + png_uint_16 filler; /* filler bytes for pixel expansion */ +#endif +#endif + +#if defined(PNG_bKGD_SUPPORTED) + png_byte background_gamma_type; +# ifdef PNG_FLOATING_POINT_SUPPORTED + float background_gamma; +# endif + png_color_16 background; /* background color in screen gamma space */ +#if defined(PNG_READ_GAMMA_SUPPORTED) + png_color_16 background_1; /* background normalized to gamma 1.0 */ +#endif +#endif /* PNG_bKGD_SUPPORTED */ + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) + png_flush_ptr output_flush_fn;/* Function for flushing output */ + png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ + png_uint_32 flush_rows; /* number of rows written since last flush */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ +#ifdef PNG_FLOATING_POINT_SUPPORTED + float gamma; /* file gamma value */ + float screen_gamma; /* screen gamma value (display_exponent) */ +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep gamma_table; /* gamma table for 8-bit depth files */ + png_bytep gamma_from_1; /* converts from 1.0 to screen */ + png_bytep gamma_to_1; /* converts from file to 1.0 */ + png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ + png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ + png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) + png_color_8 sig_bit; /* significant bits in each available channel */ +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) + png_color_8 shift; /* shift for significant bit tranformation */ +#endif + +#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ + || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep trans; /* transparency values for paletted files */ + png_color_16 trans_values; /* transparency values for non-paletted files */ +#endif + + png_read_status_ptr read_row_fn; /* called after each row is decoded */ + png_write_status_ptr write_row_fn; /* called after each row is encoded */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED + png_progressive_info_ptr info_fn; /* called after header data fully read */ + png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ + png_progressive_end_ptr end_fn; /* called after image is complete */ + png_bytep save_buffer_ptr; /* current location in save_buffer */ + png_bytep save_buffer; /* buffer for previously read data */ + png_bytep current_buffer_ptr; /* current location in current_buffer */ + png_bytep current_buffer; /* buffer for recently used data */ + png_uint_32 push_length; /* size of current input chunk */ + png_uint_32 skip_length; /* bytes to skip in input data */ + png_size_t save_buffer_size; /* amount of data now in save_buffer */ + png_size_t save_buffer_max; /* total size of save_buffer */ + png_size_t buffer_size; /* total amount of available input data */ + png_size_t current_buffer_size; /* amount of data now in current_buffer */ + int process_mode; /* what push library is currently doing */ + int cur_palette; /* current push library palette index */ + +# if defined(PNG_TEXT_SUPPORTED) + png_size_t current_text_size; /* current size of text input data */ + png_size_t current_text_left; /* how much text left to read in input */ + png_charp current_text; /* current text chunk buffer */ + png_charp current_text_ptr; /* current location in current_text */ +# endif /* PNG_TEXT_SUPPORTED */ +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) +/* for the Borland special 64K segment handler */ + png_bytepp offset_table_ptr; + png_bytep offset_table; + png_uint_16 offset_table_number; + png_uint_16 offset_table_count; + png_uint_16 offset_table_count_free; +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) + png_bytep palette_lookup; /* lookup table for dithering */ + png_bytep dither_index; /* index translation for palette files */ +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) + png_uint_16p hist; /* histogram */ +#endif + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + png_byte heuristic_method; /* heuristic for row filter selection */ + png_byte num_prev_filters; /* number of weights for previous rows */ + png_bytep prev_filters; /* filter type(s) of previous row(s) */ + png_uint_16p filter_weights; /* weight(s) for previous line(s) */ + png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ + png_uint_16p filter_costs; /* relative filter calculation cost */ + png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ +#endif + +#if defined(PNG_TIME_RFC1123_SUPPORTED) + png_charp time_buffer; /* String to hold RFC 1123 time text */ +#endif + +/* New members added in libpng-1.0.6 */ + +#ifdef PNG_FREE_ME_SUPPORTED + png_uint_32 free_me; /* flags items libpng is responsible for freeing */ +#endif + +#if defined(PNG_USER_CHUNKS_SUPPORTED) + png_voidp user_chunk_ptr; + png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ +#endif + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + int num_chunk_list; + png_bytep chunk_list; +#endif + +/* New members added in libpng-1.0.3 */ +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + png_byte rgb_to_gray_status; + /* These were changed from png_byte in libpng-1.0.6 */ + png_uint_16 rgb_to_gray_red_coeff; + png_uint_16 rgb_to_gray_green_coeff; + png_uint_16 rgb_to_gray_blue_coeff; +#endif + +/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) || \ + defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* changed from png_byte to png_uint_32 at version 1.2.0 */ +#ifdef PNG_1_0_X + png_byte mng_features_permitted; +#else + png_uint_32 mng_features_permitted; +#endif /* PNG_1_0_X */ +#endif + +/* New member added in libpng-1.0.7 */ +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_fixed_point int_gamma; +#endif + +/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) + png_byte filter_type; +#endif + +#if defined(PNG_1_0_X) +/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ + png_uint_32 row_buf_size; +#endif + +/* New members added in libpng-1.2.0 */ +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +# if !defined(PNG_1_0_X) +# if defined(PNG_MMX_CODE_SUPPORTED) + png_byte mmx_bitdepth_threshold; + png_uint_32 mmx_rowbytes_threshold; +# endif + png_uint_32 asm_flags; +# endif +#endif + +/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ +#ifdef PNG_USER_MEM_SUPPORTED + png_voidp mem_ptr; /* user supplied struct for mem functions */ + png_malloc_ptr malloc_fn; /* function for allocating memory */ + png_free_ptr free_fn; /* function for freeing memory */ +#endif + +/* New member added in libpng-1.0.13 and 1.2.0 */ + png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* The following three members were added at version 1.0.14 and 1.2.4 */ + png_bytep dither_sort; /* working sort array */ + png_bytep index_to_palette; /* where the original index currently is */ + /* in the palette */ + png_bytep palette_to_index; /* which original index points to this */ + /* palette color */ +#endif + +/* New members added in libpng-1.0.16 and 1.2.6 */ + png_byte compression_type; + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_uint_32 user_width_max; + png_uint_32 user_height_max; +#endif + +/* New member added in libpng-1.0.25 and 1.2.17 */ +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + /* storage for unknown chunk that the library doesn't recognize. */ + png_unknown_chunk unknown_chunk; +#endif + +/* New members added in libpng-1.2.26 */ + png_uint_32 old_big_row_buf_size, old_prev_row_size; +}; + + +/* This triggers a compiler error in png.c, if png.c and png.h + * do not agree upon the version number. + */ +typedef png_structp version_1_2_29; + +typedef png_struct FAR * FAR * png_structpp; + +/* Here are the function definitions most commonly used. This is not + * the place to find out how to use libpng. See libpng.txt for the + * full explanation, see example.c for the summary. This just provides + * a simple one line description of the use of each function. + */ + +/* Returns the version number of the library */ +extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); + +/* Tell lib we have already handled the first magic bytes. + * Handling more than 8 bytes from the beginning of the file is an error. + */ +extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, + int num_bytes)); + +/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a + * PNG file. Returns zero if the supplied bytes match the 8-byte PNG + * signature, and non-zero otherwise. Having num_to_check == 0 or + * start > 7 will always fail (ie return non-zero). + */ +extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, + png_size_t num_to_check)); + +/* Simple signature checking function. This is the same as calling + * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). + */ +extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); + +/* Allocate and initialize png_ptr struct for reading, and any other memory. */ +extern PNG_EXPORT(png_structp,png_create_read_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)); + +/* Allocate and initialize png_ptr struct for writing, and any other memory */ +extern PNG_EXPORT(png_structp,png_create_write_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)); + +#ifdef PNG_WRITE_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_WRITE_SUPPORTED +extern PNG_EXPORT(void,png_set_compression_buffer_size) + PNGARG((png_structp png_ptr, png_uint_32 size)); +#endif + +/* Reset the compression stream */ +extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); + +/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_structp,png_create_read_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +extern PNG_EXPORT(png_structp,png_create_write_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +#endif + +/* Write a PNG chunk - size, type, (optional) data, CRC. */ +extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_bytep data, png_size_t length)); + +/* Write the start of a PNG chunk - length and chunk name. */ +extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_uint_32 length)); + +/* Write the data of a PNG chunk started with png_write_chunk_start(). */ +extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ +extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); + +/* Allocate and initialize the info structure */ +extern PNG_EXPORT(png_infop,png_create_info_struct) + PNGARG((png_structp png_ptr)); + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +/* Initialize the info structure (old interface - DEPRECATED) */ +extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); +#undef png_info_init +#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\ + png_sizeof(png_info)); +#endif + +extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, + png_size_t png_info_struct_size)); + +/* Writes all the PNG information before the image. */ +extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the information before the actual image data. */ +extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#if defined(PNG_TIME_RFC1123_SUPPORTED) +extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) + PNGARG((png_structp png_ptr, png_timep ptime)); +#endif + +#if !defined(_WIN32_WCE) +/* "time.h" functions are not supported on WindowsCE */ +#if defined(PNG_WRITE_tIME_SUPPORTED) +/* convert from a struct tm to png_time */ +extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, + struct tm FAR * ttime)); + +/* convert from time_t to png_time. Uses gmtime() */ +extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, + time_t ttime)); +#endif /* PNG_WRITE_tIME_SUPPORTED */ +#endif /* _WIN32_WCE */ + +#if defined(PNG_READ_EXPAND_SUPPORTED) +/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ +extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); +#if !defined(PNG_1_0_X) +extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp + png_ptr)); +#endif +extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +/* Deprecated */ +extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); +#endif +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +/* Use blue, green, red order for pixels. */ +extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +/* Expand the grayscale to 24-bit RGB if necessary. */ +extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +/* Reduce RGB to grayscale. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, + int error_action, double red, double green )); +#endif +extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, + int error_action, png_fixed_point red, png_fixed_point green )); +extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp + png_ptr)); +#endif + +extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, + png_colorp palette)); + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ +extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +/* The values of the PNG_FILLER_ defines should NOT be changed */ +#define PNG_FILLER_BEFORE 0 +#define PNG_FILLER_AFTER 1 +/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ +#if !defined(PNG_1_0_X) +extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +#endif +#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +/* Swap bytes in 16-bit depth files. */ +extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) +/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ +extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) +/* Swap packing order of pixels in bytes. */ +extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) +/* Converts files to legal bit depths. */ +extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, + png_color_8p true_bits)); +#endif + +#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ + defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* Have the code handle the interlacing. Returns the number of passes. */ +extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +/* Invert monochrome files */ +extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +/* Handle alpha and tRNS by replacing with a background color. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, + png_color_16p background_color, int background_gamma_code, + int need_expand, double background_gamma)); +#endif +#define PNG_BACKGROUND_GAMMA_UNKNOWN 0 +#define PNG_BACKGROUND_GAMMA_SCREEN 1 +#define PNG_BACKGROUND_GAMMA_FILE 2 +#define PNG_BACKGROUND_GAMMA_UNIQUE 3 +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +/* strip the second byte of information from a 16-bit depth file. */ +extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* Turn on dithering, and reduce the palette to the number of colors available. */ +extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette, int maximum_colors, + png_uint_16p histogram, int full_dither)); +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +/* Handle gamma correction. Screen_gamma=(display_exponent) */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, + double screen_gamma, double default_file_gamma)); +#endif +#endif + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ +/* Deprecated and will be removed. Use png_permit_mng_features() instead. */ +extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, + int empty_plte_permitted)); +#endif +#endif + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +/* Set how many lines between output flushes - 0 for no flushing */ +extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); +/* Flush the current PNG output buffer */ +extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); +#endif + +/* optional update palette with requested transformations */ +extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); + +/* optional call to update the users info structure */ +extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read one or more rows of image data. */ +extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); +#endif + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read a row of data. */ +extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, + png_bytep row, + png_bytep display_row)); +#endif + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the whole image into memory at once. */ +extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, + png_bytepp image)); +#endif + +/* write a row of image data */ +extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, + png_bytep row)); + +/* write a few rows of image data */ +extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_uint_32 num_rows)); + +/* write the image data */ +extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, + png_bytepp image)); + +/* writes the end of the PNG file. */ +extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the end of the PNG file. */ +extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +/* free any memory associated with the png_info_struct */ +extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, + png_infopp info_ptr_ptr)); + +/* free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp + png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); + +/* free all memory used by the read (old method - NOT DLL EXPORTED) */ +extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, + png_infop end_info_ptr)); + +/* free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_write_struct) + PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); + +/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ +extern void png_write_destroy PNGARG((png_structp png_ptr)); + +/* set the libpng method of handling chunk CRC errors */ +extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, + int crit_action, int ancil_action)); + +/* Values for png_set_crc_action() to say how to handle CRC errors in + * ancillary and critical chunks, and whether to use the data contained + * therein. Note that it is impossible to "discard" data in a critical + * chunk. For versions prior to 0.90, the action was always error/quit, + * whereas in version 0.90 and later, the action for CRC errors in ancillary + * chunks is warn/discard. These values should NOT be changed. + * + * value action:critical action:ancillary + */ +#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ +#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ +#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ +#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ +#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ +#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ + +/* These functions give the user control over the scan-line filtering in + * libpng and the compression methods used by zlib. These functions are + * mainly useful for testing, as the defaults should work with most users. + * Those users who are tight on memory or want faster performance at the + * expense of compression can modify them. See the compression library + * header file (zlib.h) for an explination of the compression functions. + */ + +/* set the filtering method(s) used by libpng. Currently, the only valid + * value for "method" is 0. + */ +extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, + int filters)); + +/* Flags for png_set_filter() to say which filters to use. The flags + * are chosen so that they don't conflict with real filter types + * below, in case they are supplied instead of the #defined constants. + * These values should NOT be changed. + */ +#define PNG_NO_FILTERS 0x00 +#define PNG_FILTER_NONE 0x08 +#define PNG_FILTER_SUB 0x10 +#define PNG_FILTER_UP 0x20 +#define PNG_FILTER_AVG 0x40 +#define PNG_FILTER_PAETH 0x80 +#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ + PNG_FILTER_AVG | PNG_FILTER_PAETH) + +/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. + * These defines should NOT be changed. + */ +#define PNG_FILTER_VALUE_NONE 0 +#define PNG_FILTER_VALUE_SUB 1 +#define PNG_FILTER_VALUE_UP 2 +#define PNG_FILTER_VALUE_AVG 3 +#define PNG_FILTER_VALUE_PAETH 4 +#define PNG_FILTER_VALUE_LAST 5 + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ +/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ + * defines, either the default (minimum-sum-of-absolute-differences), or + * the experimental method (weighted-minimum-sum-of-absolute-differences). + * + * Weights are factors >= 1.0, indicating how important it is to keep the + * filter type consistent between rows. Larger numbers mean the current + * filter is that many times as likely to be the same as the "num_weights" + * previous filters. This is cumulative for each previous row with a weight. + * There needs to be "num_weights" values in "filter_weights", or it can be + * NULL if the weights aren't being specified. Weights have no influence on + * the selection of the first row filter. Well chosen weights can (in theory) + * improve the compression for a given image. + * + * Costs are factors >= 1.0 indicating the relative decoding costs of a + * filter type. Higher costs indicate more decoding expense, and are + * therefore less likely to be selected over a filter with lower computational + * costs. There needs to be a value in "filter_costs" for each valid filter + * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't + * setting the costs. Costs try to improve the speed of decompression without + * unduly increasing the compressed image size. + * + * A negative weight or cost indicates the default value is to be used, and + * values in the range [0.0, 1.0) indicate the value is to remain unchanged. + * The default values for both weights and costs are currently 1.0, but may + * change if good general weighting/cost heuristics can be found. If both + * the weights and costs are set to 1.0, this degenerates the WEIGHTED method + * to the UNWEIGHTED method, but with added encoding time/computation. + */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, + int heuristic_method, int num_weights, png_doublep filter_weights, + png_doublep filter_costs)); +#endif +#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ + +/* Heuristic used for row filter selection. These defines should NOT be + * changed. + */ +#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ +#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ +#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ +#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ + +/* Set the library compression level. Currently, valid values range from + * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 + * (0 - no compression, 9 - "maximal" compression). Note that tests have + * shown that zlib compression levels 3-6 usually perform as well as level 9 + * for PNG images, and do considerably fewer caclulations. In the future, + * these values may not correspond directly to the zlib compression levels. + */ +extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, + int level)); + +extern PNG_EXPORT(void,png_set_compression_mem_level) + PNGARG((png_structp png_ptr, int mem_level)); + +extern PNG_EXPORT(void,png_set_compression_strategy) + PNGARG((png_structp png_ptr, int strategy)); + +extern PNG_EXPORT(void,png_set_compression_window_bits) + PNGARG((png_structp png_ptr, int window_bits)); + +extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, + int method)); + +/* These next functions are called for input/output, memory, and error + * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, + * and call standard C I/O routines such as fread(), fwrite(), and + * fprintf(). These functions can be made to use other I/O routines + * at run time for those applications that need to handle I/O in a + * different manner by calling png_set_???_fn(). See libpng.txt for + * more information. + */ + +#if !defined(PNG_NO_STDIO) +/* Initialize the input/output for the PNG file to the default functions. */ +extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); +#endif + +/* Replace the (error and abort), and warning functions with user + * supplied functions. If no messages are to be printed you must still + * write and use replacement functions. The replacement error_fn should + * still do a longjmp to the last setjmp location if you are using this + * method of error handling. If error_fn or warning_fn is NULL, the + * default function will be used. + */ + +extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); + +/* Return the user pointer associated with the error functions */ +extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); + +/* Replace the default data output functions with a user supplied one(s). + * If buffered output is not used, then output_flush_fn can be set to NULL. + * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time + * output_flush_fn will be ignored (and thus can be NULL). + */ +extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); + +/* Replace the default data input function with a user supplied one. */ +extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr read_data_fn)); + +/* Return the user pointer associated with the I/O functions */ +extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); + +extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, + png_read_status_ptr read_row_fn)); + +extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, + png_write_status_ptr write_row_fn)); + +#ifdef PNG_USER_MEM_SUPPORTED +/* Replace the default memory allocation functions with user supplied one(s). */ +extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, + png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +/* Return the user pointer associated with the memory functions */ +extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr read_user_transform_fn)); +#endif + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr write_user_transform_fn)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp + png_ptr, png_voidp user_transform_ptr, int user_transform_depth, + int user_transform_channels)); +/* Return the user pointer associated with the user transform functions */ +extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_USER_CHUNKS_SUPPORTED +extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, + png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); +extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp + png_ptr)); +#endif + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +/* Sets the function callbacks for the push reader, and a pointer to a + * user-defined structure available to the callback functions. + */ +extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, + png_voidp progressive_ptr, + png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, + png_progressive_end_ptr end_fn)); + +/* returns the user pointer associated with the push read functions */ +extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) + PNGARG((png_structp png_ptr)); + +/* function to be called when data becomes available */ +extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); + +/* function that combines rows. Not very much different than the + * png_combine_row() call. Is this even used????? + */ +extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, + png_bytep old_row, png_bytep new_row)); +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, + png_uint_32 size)); + +#if defined(PNG_1_0_X) +# define png_malloc_warn png_malloc +#else +/* Added at libpng version 1.2.4 */ +extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, + png_uint_32 size)); +#endif + +/* frees a pointer allocated by png_malloc() */ +extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); + +#if defined(PNG_1_0_X) +/* Function to allocate memory for zlib. */ +extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, + uInt size)); + +/* Function to free memory for zlib */ +extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); +#endif + +/* Free data that was allocated internally */ +extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 free_me, int num)); +#ifdef PNG_FREE_ME_SUPPORTED +/* Reassign responsibility for freeing existing data, whether allocated + * by libpng or by the application */ +extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, + png_infop info_ptr, int freer, png_uint_32 mask)); +#endif +/* assignments for png_data_freer */ +#define PNG_DESTROY_WILL_FREE_DATA 1 +#define PNG_SET_WILL_FREE_DATA 1 +#define PNG_USER_WILL_FREE_DATA 2 +/* Flags for png_ptr->free_me and info_ptr->free_me */ +#define PNG_FREE_HIST 0x0008 +#define PNG_FREE_ICCP 0x0010 +#define PNG_FREE_SPLT 0x0020 +#define PNG_FREE_ROWS 0x0040 +#define PNG_FREE_PCAL 0x0080 +#define PNG_FREE_SCAL 0x0100 +#define PNG_FREE_UNKN 0x0200 +#define PNG_FREE_LIST 0x0400 +#define PNG_FREE_PLTE 0x1000 +#define PNG_FREE_TRNS 0x2000 +#define PNG_FREE_TEXT 0x4000 +#define PNG_FREE_ALL 0x7fff +#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ + +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, + png_uint_32 size)); +extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, + png_voidp ptr)); +#endif + +extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, + png_voidp s1, png_voidp s2, png_uint_32 size)); + +extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, + png_voidp s1, int value, png_uint_32 size)); + +#if defined(USE_FAR_KEYWORD) /* memory model conversion function */ +extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, + int check)); +#endif /* USE_FAR_KEYWORD */ + +#ifndef PNG_NO_ERROR_TEXT +/* Fatal error in PNG image of libpng - can't continue */ +extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)); + +/* The same, but the chunk name is prepended to the error string. */ +extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)); +#else +/* Fatal error in PNG image of libpng - can't continue */ +extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)); +#endif + +#ifndef PNG_NO_WARNINGS +/* Non-fatal error in libpng. Can continue, but may have a problem. */ +extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +#ifdef PNG_READ_SUPPORTED +/* Non-fatal error in libpng, chunk name is prepended to message. */ +extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); +#endif /* PNG_READ_SUPPORTED */ +#endif /* PNG_NO_WARNINGS */ + +/* The png_set_ functions are for storing values in the png_info_struct. + * Similarly, the png_get_ calls are used to read values from the + * png_info_struct, either storing the parameters in the passed variables, or + * setting pointers into the png_info_struct where the data is stored. The + * png_get_ functions return a non-zero value if the data was available + * in info_ptr, or return zero and do not change any of the parameters if the + * data was not available. + * + * These functions should be used instead of directly accessing png_info + * to avoid problems with future changes in the size and internal layout of + * png_info_struct. + */ +/* Returns "flag" if chunk data is valid in info_ptr. */ +extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, +png_infop info_ptr, png_uint_32 flag)); + +/* Returns number of bytes needed to hold a transformed row. */ +extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +/* Returns row_pointers, which is an array of pointers to scanlines that was +returned from png_read_png(). */ +extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, +png_infop info_ptr)); +/* Set row_pointers, which is an array of pointers to scanlines for use +by png_write_png(). */ +extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytepp row_pointers)); +#endif + +/* Returns number of color channels in image. */ +extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_EASY_ACCESS_SUPPORTED +/* Returns image width in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image height in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image bit_depth. */ +extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image color_type. */ +extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image filter_type. */ +extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image interlace_type. */ +extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image compression_type. */ +extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image resolution in pixels per meter, from pHYs chunk data. */ +extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns pixel aspect ratio, computed from pHYs chunk data. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +#endif + +/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ +extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +#endif /* PNG_EASY_ACCESS_SUPPORTED */ + +/* Returns pointer to signature string read from PNG header */ +extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_bKGD_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p *background)); +#endif + +#if defined(PNG_bKGD_SUPPORTED) +extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p background)); +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *white_x, double *white_y, double *red_x, + double *red_y, double *green_x, double *green_y, double *blue_x, + double *blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point + *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, + png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point + *int_blue_x, png_fixed_point *int_blue_y)); +#endif +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, double white_x, double white_y, double red_x, + double red_y, double green_x, double green_y, double blue_x, double blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *file_gamma)); +#endif +extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_file_gamma)); +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double file_gamma)); +#endif +extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_file_gamma)); +#endif + +#if defined(PNG_hIST_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p *hist)); +#endif + +#if defined(PNG_hIST_SUPPORTED) +extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p hist)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, + int *bit_depth, int *color_type, int *interlace_method, + int *compression_method, int *filter_method)); + +extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_method, int compression_method, + int filter_method)); + +#if defined(PNG_oFFs_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, + int *unit_type)); +#endif + +#if defined(PNG_oFFs_SUPPORTED) +extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, + int unit_type)); +#endif + +#if defined(PNG_pCAL_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, + int *type, int *nparams, png_charp *units, png_charpp *params)); +#endif + +#if defined(PNG_pCAL_SUPPORTED) +extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, + int type, int nparams, png_charp units, png_charpp params)); +#endif + +#if defined(PNG_pHYs_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); +#endif + +#if defined(PNG_pHYs_SUPPORTED) +extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp *palette, int *num_palette)); + +extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp palette, int num_palette)); + +#if defined(PNG_sBIT_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p *sig_bit)); +#endif + +#if defined(PNG_sBIT_SUPPORTED) +extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p sig_bit)); +#endif + +#if defined(PNG_sRGB_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *intent)); +#endif + +#if defined(PNG_sRGB_SUPPORTED) +extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +#endif + +#if defined(PNG_iCCP_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charpp name, int *compression_type, + png_charpp profile, png_uint_32 *proflen)); + /* Note to maintainer: profile should be png_bytepp */ +#endif + +#if defined(PNG_iCCP_SUPPORTED) +extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp name, int compression_type, + png_charp profile, png_uint_32 proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#if defined(PNG_sPLT_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tpp entries)); +#endif + +#if defined(PNG_sPLT_SUPPORTED) +extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tp entries, int nentries)); +#endif + +#if defined(PNG_TEXT_SUPPORTED) +/* png_get_text also returns the number of text chunks in *num_text */ +extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp *text_ptr, int *num_text)); +#endif + +/* + * Note while png_set_text() will accept a structure whose text, + * language, and translated keywords are NULL pointers, the structure + * returned by png_get_text will always contain regular + * zero-terminated C strings. They might be empty strings but + * they will never be NULL pointers. + */ + +#if defined(PNG_TEXT_SUPPORTED) +extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#if defined(PNG_tIME_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep *mod_time)); +#endif + +#if defined(PNG_tIME_SUPPORTED) +extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep mod_time)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep *trans, int *num_trans, + png_color_16p *trans_values)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep trans, int num_trans, + png_color_16p trans_values)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +#endif + +#if defined(PNG_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, double *width, double *height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); +#endif +#endif +#endif /* PNG_sCAL_SUPPORTED */ + +#if defined(PNG_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, double width, double height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); +#endif +#endif +#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +/* provide a list of chunks and how they are to be handled, if the built-in + handling or default unknown chunk handling is not desired. Any chunks not + listed will be handled in the default manner. The IHDR and IEND chunks + must not be listed. + keep = 0: follow default behaviour + = 1: do not keep + = 2: keep only if safe-to-copy + = 3: keep even if unsafe-to-copy +*/ +extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp + png_ptr, int keep, png_bytep chunk_list, int num_chunks)); +extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); +extern PNG_EXPORT(void, png_set_unknown_chunk_location) + PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); +extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp + png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); +#endif +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep + chunk_name)); +#endif + +/* Png_free_data() will turn off the "valid" flag for anything it frees. + If you need to turn it off for a chunk that your application has freed, + you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ +extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, + png_infop info_ptr, int mask)); + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +/* The "params" pointer is currently not used and is for future expansion. */ +extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +#endif + +/* Define PNG_DEBUG at compile time for debugging information. Higher + * numbers for PNG_DEBUG mean more debugging information. This has + * only been added since version 0.95 so it is not implemented throughout + * libpng yet, but more support will be added as needed. + */ +#ifdef PNG_DEBUG +#if (PNG_DEBUG > 0) +#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) +#include +#if (PNG_DEBUG > 1) +#define png_debug(l,m) _RPT0(_CRT_WARN,m) +#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) +#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) +#endif +#else /* PNG_DEBUG_FILE || !_MSC_VER */ +#ifndef PNG_DEBUG_FILE +#define PNG_DEBUG_FILE stderr +#endif /* PNG_DEBUG_FILE */ +#if (PNG_DEBUG > 1) +#define png_debug(l,m) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ +} +#define png_debug1(l,m,p1) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ +} +#define png_debug2(l,m,p1,p2) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ +} +#endif /* (PNG_DEBUG > 1) */ +#endif /* _MSC_VER */ +#endif /* (PNG_DEBUG > 0) */ +#endif /* PNG_DEBUG */ +#ifndef png_debug +#define png_debug(l, m) +#endif +#ifndef png_debug1 +#define png_debug1(l, m, p1) +#endif +#ifndef png_debug2 +#define png_debug2(l, m, p1, p2) +#endif + +extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); + +#ifdef PNG_MNG_FEATURES_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp + png_ptr, png_uint_32 mng_features_permitted)); +#endif + +/* For use in png_set_keep_unknown, added to version 1.2.6 */ +#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 +#define PNG_HANDLE_CHUNK_NEVER 1 +#define PNG_HANDLE_CHUNK_IF_SAFE 2 +#define PNG_HANDLE_CHUNK_ALWAYS 3 + +/* Added to version 1.2.0 */ +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) +#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ +#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ +#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 +#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 +#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 +#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 +#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 +#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 +#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ + +#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ + | PNG_ASM_FLAG_MMX_READ_INTERLACE \ + | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ + | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ + | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ + | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ) +#define PNG_MMX_WRITE_FLAGS ( 0 ) + +#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ + | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ + | PNG_MMX_READ_FLAGS \ + | PNG_MMX_WRITE_FLAGS ) + +#define PNG_SELECT_READ 1 +#define PNG_SELECT_WRITE 2 +#endif /* PNG_MMX_CODE_SUPPORTED */ + +#if !defined(PNG_1_0_X) +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) + PNGARG((int flag_select, int *compilerID)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) + PNGARG((int flag_select)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_asm_flags) + PNGARG((png_structp png_ptr)); + +/* pngget.c */ +extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) + PNGARG((png_structp png_ptr)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) + PNGARG((png_structp png_ptr)); + +/* pngset.c */ +extern PNG_EXPORT(void,png_set_asm_flags) + PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); + +/* pngset.c */ +extern PNG_EXPORT(void,png_set_mmx_thresholds) + PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, + png_uint_32 mmx_rowbytes_threshold)); + +#endif /* PNG_1_0_X */ + +#if !defined(PNG_1_0_X) +/* png.c, pnggccrd.c, or pngvcrd.c */ +extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + +/* Strip the prepended error numbers ("#nnn ") from error and warning + * messages before passing them to the error or warning handler. */ +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp + png_ptr, png_uint_32 strip_mode)); +#endif + +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp + png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); +extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp + png_ptr)); +extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp + png_ptr)); +#endif + +/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ + +#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED +/* With these routines we avoid an integer divide, which will be slower on + * most machines. However, it does take more operations than the corresponding + * divide method, so it may be slower on a few RISC systems. There are two + * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. + * + * Note that the rounding factors are NOT supposed to be the same! 128 and + * 32768 are correct for the NODIV code; 127 and 32767 are correct for the + * standard method. + * + * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] + */ + + /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ + +# define png_composite(composite, fg, alpha, bg) \ + { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ + + (png_uint_16)(bg)*(png_uint_16)(255 - \ + (png_uint_16)(alpha)) + (png_uint_16)128); \ + (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } + +# define png_composite_16(composite, fg, alpha, bg) \ + { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ + + (png_uint_32)(bg)*(png_uint_32)(65535L - \ + (png_uint_32)(alpha)) + (png_uint_32)32768L); \ + (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } + +#else /* standard method using integer division */ + +# define png_composite(composite, fg, alpha, bg) \ + (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ + (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ + (png_uint_16)127) / 255) + +# define png_composite_16(composite, fg, alpha, bg) \ + (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ + (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ + (png_uint_32)32767) / (png_uint_32)65535L) + +#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ + +/* Inline macros to do direct reads of bytes from the input buffer. These + * require that you are using an architecture that uses PNG byte ordering + * (MSB first) and supports unaligned data storage. I think that PowerPC + * in big-endian mode and 680x0 are the only ones that will support this. + * The x86 line of processors definitely do not. The png_get_int_32() + * routine also assumes we are using two's complement format for negative + * values, which is almost certainly true. + */ +#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) +# define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) +# define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) +# define png_get_int_32(buf) ( *((png_int_32p) (buf))) +#else +extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); +extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); +extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf)); +#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ +extern PNG_EXPORT(png_uint_32,png_get_uint_31) + PNGARG((png_structp png_ptr, png_bytep buf)); +/* No png_get_int_16 -- may be added if there's a real need for it. */ + +/* Place a 32-bit number into a buffer in PNG byte order (big-endian). + */ +extern PNG_EXPORT(void,png_save_uint_32) + PNGARG((png_bytep buf, png_uint_32 i)); +extern PNG_EXPORT(void,png_save_int_32) + PNGARG((png_bytep buf, png_int_32 i)); + +/* Place a 16-bit number into a buffer in PNG byte order. + * The parameter is declared unsigned int, not png_uint_16, + * just to avoid potential problems on pre-ANSI C compilers. + */ +extern PNG_EXPORT(void,png_save_uint_16) + PNGARG((png_bytep buf, unsigned int i)); +/* No png_save_int_16 -- may be added if there's a real need for it. */ + +/* ************************************************************************* */ + +/* These next functions are used internally in the code. They generally + * shouldn't be used unless you are writing code to add or replace some + * functionality in libpng. More information about most functions can + * be found in the files where the functions are located. + */ + + +/* Various modes of operation, that are visible to applications because + * they are used for unknown chunk location. + */ +#define PNG_HAVE_IHDR 0x01 +#define PNG_HAVE_PLTE 0x02 +#define PNG_HAVE_IDAT 0x04 +#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ +#define PNG_HAVE_IEND 0x10 + +#if defined(PNG_INTERNAL) + +/* More modes of operation. Note that after an init, mode is set to + * zero automatically when the structure is created. + */ +#define PNG_HAVE_gAMA 0x20 +#define PNG_HAVE_cHRM 0x40 +#define PNG_HAVE_sRGB 0x80 +#define PNG_HAVE_CHUNK_HEADER 0x100 +#define PNG_WROTE_tIME 0x200 +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 +#define PNG_BACKGROUND_IS_GRAY 0x800 +#define PNG_HAVE_PNG_SIGNATURE 0x1000 +#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ + +/* flags for the transformations the PNG library does on the image data */ +#define PNG_BGR 0x0001 +#define PNG_INTERLACE 0x0002 +#define PNG_PACK 0x0004 +#define PNG_SHIFT 0x0008 +#define PNG_SWAP_BYTES 0x0010 +#define PNG_INVERT_MONO 0x0020 +#define PNG_DITHER 0x0040 +#define PNG_BACKGROUND 0x0080 +#define PNG_BACKGROUND_EXPAND 0x0100 + /* 0x0200 unused */ +#define PNG_16_TO_8 0x0400 +#define PNG_RGBA 0x0800 +#define PNG_EXPAND 0x1000 +#define PNG_GAMMA 0x2000 +#define PNG_GRAY_TO_RGB 0x4000 +#define PNG_FILLER 0x8000L +#define PNG_PACKSWAP 0x10000L +#define PNG_SWAP_ALPHA 0x20000L +#define PNG_STRIP_ALPHA 0x40000L +#define PNG_INVERT_ALPHA 0x80000L +#define PNG_USER_TRANSFORM 0x100000L +#define PNG_RGB_TO_GRAY_ERR 0x200000L +#define PNG_RGB_TO_GRAY_WARN 0x400000L +#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ + /* 0x800000L Unused */ +#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ +#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */ + /* 0x4000000L unused */ + /* 0x8000000L unused */ + /* 0x10000000L unused */ + /* 0x20000000L unused */ + /* 0x40000000L unused */ + +/* flags for png_create_struct */ +#define PNG_STRUCT_PNG 0x0001 +#define PNG_STRUCT_INFO 0x0002 + +/* Scaling factor for filter heuristic weighting calculations */ +#define PNG_WEIGHT_SHIFT 8 +#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) +#define PNG_COST_SHIFT 3 +#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) + +/* flags for the png_ptr->flags rather than declaring a byte for each one */ +#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 +#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 +#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 +#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 +#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 +#define PNG_FLAG_ZLIB_FINISHED 0x0020 +#define PNG_FLAG_ROW_INIT 0x0040 +#define PNG_FLAG_FILLER_AFTER 0x0080 +#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 +#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 +#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 +#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 +#define PNG_FLAG_FREE_PLTE 0x1000 +#define PNG_FLAG_FREE_TRNS 0x2000 +#define PNG_FLAG_FREE_HIST 0x4000 +#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L +#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L +#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L +#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L +#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ +#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ + /* 0x800000L unused */ + /* 0x1000000L unused */ + /* 0x2000000L unused */ + /* 0x4000000L unused */ + /* 0x8000000L unused */ + /* 0x10000000L unused */ + /* 0x20000000L unused */ + /* 0x40000000L unused */ + +#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ + PNG_FLAG_CRC_ANCILLARY_NOWARN) + +#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ + PNG_FLAG_CRC_CRITICAL_IGNORE) + +#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ + PNG_FLAG_CRC_CRITICAL_MASK) + +/* save typing and make code easier to understand */ + +#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ + abs((int)((c1).green) - (int)((c2).green)) + \ + abs((int)((c1).blue) - (int)((c2).blue))) + +/* Added to libpng-1.2.6 JB */ +#define PNG_ROWBYTES(pixel_bits, width) \ + ((pixel_bits) >= 8 ? \ + ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \ + (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) ) + +/* PNG_OUT_OF_RANGE returns true if value is outside the range + ideal-delta..ideal+delta. Each argument is evaluated twice. + "ideal" and "delta" should be constants, normally simple + integers, "value" a variable. Added to libpng-1.2.6 JB */ +#define PNG_OUT_OF_RANGE(value, ideal, delta) \ + ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) + +/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ +#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) +/* place to hold the signature string for a PNG file. */ +#ifdef PNG_USE_GLOBAL_ARRAYS + PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8]; +#else +#endif +#endif /* PNG_NO_EXTERN */ + +/* Constant strings for known chunk types. If you need to add a chunk, + * define the name here, and add an invocation of the macro in png.c and + * wherever it's needed. + */ +#define PNG_IHDR png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} +#define PNG_IDAT png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} +#define PNG_IEND png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} +#define PNG_PLTE png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} +#define PNG_bKGD png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} +#define PNG_cHRM png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} +#define PNG_gAMA png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} +#define PNG_hIST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} +#define PNG_iCCP png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} +#define PNG_iTXt png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} +#define PNG_oFFs png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} +#define PNG_pCAL png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} +#define PNG_sCAL png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} +#define PNG_pHYs png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} +#define PNG_sBIT png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} +#define PNG_sPLT png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} +#define PNG_sRGB png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} +#define PNG_tEXt png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} +#define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} +#define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} +#define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} + +#ifdef PNG_USE_GLOBAL_ARRAYS +PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5]; +PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5]; +#endif /* PNG_USE_GLOBAL_ARRAYS */ + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +/* Initialize png_ptr struct for reading, and allocate any other memory. + * (old interface - DEPRECATED - use png_create_read_struct instead). + */ +extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); +#undef png_read_init +#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); +#endif + +extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t + png_info_size)); +#endif + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +/* Initialize png_ptr struct for writing, and allocate any other memory. + * (old interface - DEPRECATED - use png_create_write_struct instead). + */ +extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); +#undef png_write_init +#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); +#endif + +extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); +extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t + png_info_size)); + +/* Allocate memory for an internal libpng struct */ +PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); + +/* Free memory from internal libpng struct */ +PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); + +PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr + malloc_fn, png_voidp mem_ptr)); +PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, + png_free_ptr free_fn, png_voidp mem_ptr)); + +/* Free any memory that info_ptr points to and reset struct. */ +PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_1_0_X +/* Function to allocate memory for zlib. */ +PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); + +/* Function to free memory for zlib */ +PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); + +#ifdef PNG_SIZE_T +/* Function to convert a sizeof an item to png_sizeof item */ + PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); +#endif + +/* Next four functions are used internally as callbacks. PNGAPI is required + * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ + +PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif + +PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +#if !defined(PNG_NO_STDIO) +PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); +#endif +#endif +#else /* PNG_1_0_X */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif +#endif /* PNG_1_0_X */ + +/* Reset the CRC variable */ +PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); + +/* Write the "data" buffer to whatever output you are using. */ +PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read data from whatever input you are using into the "data" buffer */ +PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read bytes into buf, and update png_ptr->crc */ +PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, + png_size_t length)); + +/* Decompress data in a chunk that uses compression */ +#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ + defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) +PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, + int comp_type, png_charp chunkdata, png_size_t chunklength, + png_size_t prefix_length, png_size_t *data_length)); +#endif + +/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ +PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); + +/* Read the CRC from the file and compare it to the libpng calculated CRC */ +PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); + +/* Calculate the CRC over a section of data. Note that we are only + * passing a maximum of 64K on systems that have this as a memory limit, + * since this is the maximum buffer size we can specify. + */ +PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, + png_size_t length)); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); +#endif + +/* simple function to write the signature */ +PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); + +/* write various chunks */ + +/* Write the IHDR chunk, and update the png_struct with the necessary + * information. + */ +PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, + png_uint_32 height, + int bit_depth, int color_type, int compression_method, int filter_method, + int interlace_method)); + +PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, + png_uint_32 num_pal)); + +PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); + +#if defined(PNG_WRITE_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point + file_gamma)); +#endif +#endif + +#if defined(PNG_WRITE_sBIT_SUPPORTED) +PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, + int color_type)); +#endif + +#if defined(PNG_WRITE_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, + double white_x, double white_y, + double red_x, double red_y, double green_x, double green_y, + double blue_x, double blue_y)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, + png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#if defined(PNG_WRITE_sRGB_SUPPORTED) +PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, + int intent)); +#endif + +#if defined(PNG_WRITE_iCCP_SUPPORTED) +PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, + png_charp name, int compression_type, + png_charp profile, int proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#if defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, + png_sPLT_tp palette)); +#endif + +#if defined(PNG_WRITE_tRNS_SUPPORTED) +PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, + png_color_16p values, int number, int color_type)); +#endif + +#if defined(PNG_WRITE_bKGD_SUPPORTED) +PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, + png_color_16p values, int color_type)); +#endif + +#if defined(PNG_WRITE_hIST_SUPPORTED) +PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, + int num_hist)); +#endif + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ + defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, + png_charp key, png_charpp new_key)); +#endif + +#if defined(PNG_WRITE_tEXt_SUPPORTED) +PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len)); +#endif + +#if defined(PNG_WRITE_zTXt_SUPPORTED) +PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len, int compression)); +#endif + +#if defined(PNG_WRITE_iTXt_SUPPORTED) +PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, + int compression, png_charp key, png_charp lang, png_charp lang_key, + png_charp text)); +#endif + +#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ +PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#if defined(PNG_WRITE_oFFs_SUPPORTED) +PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, + png_int_32 x_offset, png_int_32 y_offset, int unit_type)); +#endif + +#if defined(PNG_WRITE_pCAL_SUPPORTED) +PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, + png_int_32 X0, png_int_32 X1, int type, int nparams, + png_charp units, png_charpp params)); +#endif + +#if defined(PNG_WRITE_pHYs_SUPPORTED) +PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, + png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, + int unit_type)); +#endif + +#if defined(PNG_WRITE_tIME_SUPPORTED) +PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, + png_timep mod_time)); +#endif + +#if defined(PNG_WRITE_sCAL_SUPPORTED) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, + int unit, double width, double height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, + int unit, png_charp width, png_charp height)); +#endif +#endif +#endif + +/* Called when finished processing a row of data */ +PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); + +/* Internal use only. Called before first row of data */ +PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); + +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); +#endif + +/* combine a row of data, dealing with alpha, etc. if requested */ +PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, + int mask)); + +#if defined(PNG_READ_INTERLACING_SUPPORTED) +/* expand an interlaced row */ +/* OLD pre-1.0.9 interface: +PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass, png_uint_32 transformations)); + */ +PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); +#endif + +/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ + +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* grab pixels out of a row for an interlaced pass */ +PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass)); +#endif + +/* unfilter a row */ +PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, + png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); + +/* Choose the best filter to use and filter the row data */ +PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, + png_row_infop row_info)); + +/* Write out the filtered row. */ +PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, + png_bytep filtered_row)); +/* finish a row while reading, dealing with interlacing passes, etc. */ +PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); + +/* initialize the row buffers, etc. */ +PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); +/* optional call to update the users info structure */ +PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +/* these are the functions that do the transformations */ +#if defined(PNG_READ_FILLER_SUPPORTED) +PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 filler, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ + defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) +PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop + row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) +PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) +PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p sig_bits)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, + png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); + +# if defined(PNG_CORRECT_PALETTE_SUPPORTED) +PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette)); +# endif +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_WRITE_PACK_SUPPORTED) +PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 bit_depth)); +#endif + +#if defined(PNG_WRITE_SHIFT_SUPPORTED) +PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p bit_depth)); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background, + png_color_16p background_1, + png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, + png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, + png_uint_16pp gamma_16_to_1, int gamma_shift)); +#else +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background)); +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, + png_bytep gamma_table, png_uint_16pp gamma_16_table, + int gamma_shift)); +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) +PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, + png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); +PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, + png_bytep row, png_color_16p trans_value)); +#endif + +/* The following decodes the appropriate chunks, and does error correction, + * then calls the appropriate callback for the chunk if it is valid. + */ + +/* decode the IHDR chunk */ +PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); + +#if defined(PNG_READ_bKGD_SUPPORTED) +PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_cHRM_SUPPORTED) +PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_gAMA_SUPPORTED) +PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_hIST_SUPPORTED) +PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_iCCP_SUPPORTED) +extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_iCCP_SUPPORTED */ + +#if defined(PNG_READ_iTXt_SUPPORTED) +PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_oFFs_SUPPORTED) +PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_pCAL_SUPPORTED) +PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_pHYs_SUPPORTED) +PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sBIT_SUPPORTED) +PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sCAL_SUPPORTED) +PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sPLT_SUPPORTED) +extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_sPLT_SUPPORTED */ + +#if defined(PNG_READ_sRGB_SUPPORTED) +PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tEXt_SUPPORTED) +PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tIME_SUPPORTED) +PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tRNS_SUPPORTED) +PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_zTXt_SUPPORTED) +PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); + +PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, + png_bytep chunk_name)); + +/* handle the transformations for reading and writing */ +PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); + +PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, + png_uint_32 length)); +PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); +PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); +#if defined(PNG_READ_tEXt_SUPPORTED) +PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) +PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) +PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#ifdef PNG_MNG_FEATURES_SUPPORTED +PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) +/* png.c */ /* PRIVATE */ +PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); +#endif +#endif + +#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) +PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_pHYs_SUPPORTED) +PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr, +png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); +#endif /* PNG_pHYs_SUPPORTED */ +#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ + +/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + +#endif /* PNG_INTERNAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* PNG_VERSION_INFO_ONLY */ +/* do not put anything past this line */ +#endif /* PNG_H */ diff --git a/source/libpng/pngconf.h b/source/libpng/pngconf.h new file mode 100644 index 0000000..06a182f --- /dev/null +++ b/source/libpng/pngconf.h @@ -0,0 +1,1481 @@ + +/* pngconf.h - machine configurable file for libpng + * + * libpng version 1.2.29 - May 8, 2008 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + */ + +/* Any machine specific code is near the front of this file, so if you + * are configuring libpng for a machine, you may want to read the section + * starting here down to where it starts to typedef png_color, png_text, + * and png_info. + */ + +#ifndef PNGCONF_H +#define PNGCONF_H + +#define PNG_1_2_X + +/* + * PNG_USER_CONFIG has to be defined on the compiler command line. This + * includes the resource compiler for Windows DLL configurations. + */ +#ifdef PNG_USER_CONFIG +# ifndef PNG_USER_PRIVATEBUILD +# define PNG_USER_PRIVATEBUILD +# endif +#include "pngusr.h" +#endif + +/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */ +#ifdef PNG_CONFIGURE_LIBPNG +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#endif + +/* + * Added at libpng-1.2.8 + * + * If you create a private DLL you need to define in "pngusr.h" the followings: + * #define PNG_USER_PRIVATEBUILD + * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." + * #define PNG_USER_DLLFNAME_POSTFIX + * e.g. // private DLL "libpng13gx.dll" + * #define PNG_USER_DLLFNAME_POSTFIX "gx" + * + * The following macros are also at your disposal if you want to complete the + * DLL VERSIONINFO structure. + * - PNG_USER_VERSIONINFO_COMMENTS + * - PNG_USER_VERSIONINFO_COMPANYNAME + * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS + */ + +#ifdef __STDC__ +#ifdef SPECIALBUILD +# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ + are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") +#endif + +#ifdef PRIVATEBUILD +# pragma message("PRIVATEBUILD is deprecated.\ + Use PNG_USER_PRIVATEBUILD instead.") +# define PNG_USER_PRIVATEBUILD PRIVATEBUILD +#endif +#endif /* __STDC__ */ + +#ifndef PNG_VERSION_INFO_ONLY + +/* End of material added to libpng-1.2.8 */ + +/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble + Restored at libpng-1.2.21 */ +#if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \ + !defined(PNG_WARN_UNINITIALIZED_ROW) +# define PNG_WARN_UNINITIALIZED_ROW 1 +#endif +/* End of material added at libpng-1.2.19/1.2.21 */ + +/* This is the size of the compression buffer, and thus the size of + * an IDAT chunk. Make this whatever size you feel is best for your + * machine. One of these will be allocated per png_struct. When this + * is full, it writes the data to the disk, and does some other + * calculations. Making this an extremely small size will slow + * the library down, but you may want to experiment to determine + * where it becomes significant, if you are concerned with memory + * usage. Note that zlib allocates at least 32Kb also. For readers, + * this describes the size of the buffer available to read the data in. + * Unless this gets smaller than the size of a row (compressed), + * it should not make much difference how big this is. + */ + +#ifndef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 8192 +#endif + +/* Enable if you want a write-only libpng */ + +#ifndef PNG_NO_READ_SUPPORTED +# define PNG_READ_SUPPORTED +#endif + +/* Enable if you want a read-only libpng */ + +#ifndef PNG_NO_WRITE_SUPPORTED +# define PNG_WRITE_SUPPORTED +#endif + +/* Enabled by default in 1.2.0. You can disable this if you don't need to + support PNGs that are embedded in MNG datastreams */ +#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) +# ifndef PNG_MNG_FEATURES_SUPPORTED +# define PNG_MNG_FEATURES_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_FLOATING_POINT_SUPPORTED +# ifndef PNG_FLOATING_POINT_SUPPORTED +# define PNG_FLOATING_POINT_SUPPORTED +# endif +#endif + +/* If you are running on a machine where you cannot allocate more + * than 64K of memory at once, uncomment this. While libpng will not + * normally need that much memory in a chunk (unless you load up a very + * large file), zlib needs to know how big of a chunk it can use, and + * libpng thus makes sure to check any memory allocation to verify it + * will fit into memory. +#define PNG_MAX_MALLOC_64K + */ +#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) +# define PNG_MAX_MALLOC_64K +#endif + +/* Special munging to support doing things the 'cygwin' way: + * 'Normal' png-on-win32 defines/defaults: + * PNG_BUILD_DLL -- building dll + * PNG_USE_DLL -- building an application, linking to dll + * (no define) -- building static library, or building an + * application and linking to the static lib + * 'Cygwin' defines/defaults: + * PNG_BUILD_DLL -- (ignored) building the dll + * (no define) -- (ignored) building an application, linking to the dll + * PNG_STATIC -- (ignored) building the static lib, or building an + * application that links to the static lib. + * ALL_STATIC -- (ignored) building various static libs, or building an + * application that links to the static libs. + * Thus, + * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and + * this bit of #ifdefs will define the 'correct' config variables based on + * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but + * unnecessary. + * + * Also, the precedence order is: + * ALL_STATIC (since we can't #undef something outside our namespace) + * PNG_BUILD_DLL + * PNG_STATIC + * (nothing) == PNG_USE_DLL + * + * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent + * of auto-import in binutils, we no longer need to worry about + * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, + * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes + * to __declspec() stuff. However, we DO need to worry about + * PNG_BUILD_DLL and PNG_STATIC because those change some defaults + * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. + */ +#if defined(__CYGWIN__) +# if defined(ALL_STATIC) +# if defined(PNG_BUILD_DLL) +# undef PNG_BUILD_DLL +# endif +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# if !defined(PNG_STATIC) +# define PNG_STATIC +# endif +# else +# if defined (PNG_BUILD_DLL) +# if defined(PNG_STATIC) +# undef PNG_STATIC +# endif +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if !defined(PNG_DLL) +# define PNG_DLL +# endif +# else +# if defined(PNG_STATIC) +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# else +# if !defined(PNG_USE_DLL) +# define PNG_USE_DLL +# endif +# if !defined(PNG_DLL) +# define PNG_DLL +# endif +# endif +# endif +# endif +#endif + +/* This protects us against compilers that run on a windowing system + * and thus don't have or would rather us not use the stdio types: + * stdin, stdout, and stderr. The only one currently used is stderr + * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will + * prevent these from being compiled and used. #defining PNG_NO_STDIO + * will also prevent these, plus will prevent the entire set of stdio + * macros and functions (FILE *, printf, etc.) from being compiled and used, + * unless (PNG_DEBUG > 0) has been #defined. + * + * #define PNG_NO_CONSOLE_IO + * #define PNG_NO_STDIO + */ + +#if defined(_WIN32_WCE) +# include + /* Console I/O functions are not supported on WindowsCE */ +# define PNG_NO_CONSOLE_IO +# ifdef PNG_DEBUG +# undef PNG_DEBUG +# endif +#endif + +#ifdef PNG_BUILD_DLL +# ifndef PNG_CONSOLE_IO_SUPPORTED +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# endif +#endif + +# ifdef PNG_NO_STDIO +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# ifdef PNG_DEBUG +# if (PNG_DEBUG > 0) +# include +# endif +# endif +# else +# if !defined(_WIN32_WCE) +/* "stdio.h" functions are not supported on WindowsCE */ +# include +# endif +# endif + +/* This macro protects us against machines that don't have function + * prototypes (ie K&R style headers). If your compiler does not handle + * function prototypes, define this macro and use the included ansi2knr. + * I've always been able to use _NO_PROTO as the indicator, but you may + * need to drag the empty declaration out in front of here, or change the + * ifdef to suit your own needs. + */ +#ifndef PNGARG + +#ifdef OF /* zlib prototype munger */ +# define PNGARG(arglist) OF(arglist) +#else + +#ifdef _NO_PROTO +# define PNGARG(arglist) () +# ifndef PNG_TYPECAST_NULL +# define PNG_TYPECAST_NULL +# endif +#else +# define PNGARG(arglist) arglist +#endif /* _NO_PROTO */ + + +#endif /* OF */ + +#endif /* PNGARG */ + +/* Try to determine if we are compiling on a Mac. Note that testing for + * just __MWERKS__ is not good enough, because the Codewarrior is now used + * on non-Mac platforms. + */ +#ifndef MACOS +# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ + defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) +# define MACOS +# endif +#endif + +/* enough people need this for various reasons to include it here */ +#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) +# include +#endif + +#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) +# define PNG_SETJMP_SUPPORTED +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* This is an attempt to force a single setjmp behaviour on Linux. If + * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. + */ + +# ifdef __linux__ +# ifdef _BSD_SOURCE +# define PNG_SAVE_BSD_SOURCE +# undef _BSD_SOURCE +# endif +# ifdef _SETJMP_H + /* If you encounter a compiler error here, see the explanation + * near the end of INSTALL. + */ + __pngconf.h__ already includes setjmp.h; + __dont__ include it again.; +# endif +# endif /* __linux__ */ + + /* include setjmp.h for error handling */ +# include + +# ifdef __linux__ +# ifdef PNG_SAVE_BSD_SOURCE +# ifndef _BSD_SOURCE +# define _BSD_SOURCE +# endif +# undef PNG_SAVE_BSD_SOURCE +# endif +# endif /* __linux__ */ +#endif /* PNG_SETJMP_SUPPORTED */ + +#ifdef BSD +# include +#else +# include +#endif + +/* Other defines for things like memory and the like can go here. */ +#ifdef PNG_INTERNAL + +#include + +/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which + * aren't usually used outside the library (as far as I know), so it is + * debatable if they should be exported at all. In the future, when it is + * possible to have run-time registry of chunk-handling functions, some of + * these will be made available again. +#define PNG_EXTERN extern + */ +#define PNG_EXTERN + +/* Other defines specific to compilers can go here. Try to keep + * them inside an appropriate ifdef/endif pair for portability. + */ + +#if defined(PNG_FLOATING_POINT_SUPPORTED) +# if defined(MACOS) + /* We need to check that hasn't already been included earlier + * as it seems it doesn't agree with , yet we should really use + * if possible. + */ +# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) +# include +# endif +# else +# include +# endif +# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) + /* Amiga SAS/C: We must include builtin FPU functions when compiling using + * MATH=68881 + */ +# include +# endif +#endif + +/* Codewarrior on NT has linking problems without this. */ +#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) +# define PNG_ALWAYS_EXTERN +#endif + +/* This provides the non-ANSI (far) memory allocation routines. */ +#if defined(__TURBOC__) && defined(__MSDOS__) +# include +# include +#endif + +/* I have no idea why is this necessary... */ +#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ + defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) +# include +#endif + +/* This controls how fine the dithering gets. As this allocates + * a largish chunk of memory (32K), those who are not as concerned + * with dithering quality can decrease some or all of these. + */ +#ifndef PNG_DITHER_RED_BITS +# define PNG_DITHER_RED_BITS 5 +#endif +#ifndef PNG_DITHER_GREEN_BITS +# define PNG_DITHER_GREEN_BITS 5 +#endif +#ifndef PNG_DITHER_BLUE_BITS +# define PNG_DITHER_BLUE_BITS 5 +#endif + +/* This controls how fine the gamma correction becomes when you + * are only interested in 8 bits anyway. Increasing this value + * results in more memory being used, and more pow() functions + * being called to fill in the gamma tables. Don't set this value + * less then 8, and even that may not work (I haven't tested it). + */ + +#ifndef PNG_MAX_GAMMA_8 +# define PNG_MAX_GAMMA_8 11 +#endif + +/* This controls how much a difference in gamma we can tolerate before + * we actually start doing gamma conversion. + */ +#ifndef PNG_GAMMA_THRESHOLD +# define PNG_GAMMA_THRESHOLD 0.05 +#endif + +#endif /* PNG_INTERNAL */ + +/* The following uses const char * instead of char * for error + * and warning message functions, so some compilers won't complain. + * If you do not want to use const, define PNG_NO_CONST here. + */ + +#ifndef PNG_NO_CONST +# define PNG_CONST const +#else +# define PNG_CONST +#endif + +/* The following defines give you the ability to remove code from the + * library that you will not be using. I wish I could figure out how to + * automate this, but I can't do that without making it seriously hard + * on the users. So if you are not using an ability, change the #define + * to and #undef, and that part of the library will not be compiled. If + * your linker can't find a function, you may want to make sure the + * ability is defined here. Some of these depend upon some others being + * defined. I haven't figured out all the interactions here, so you may + * have to experiment awhile to get everything to compile. If you are + * creating or using a shared library, you probably shouldn't touch this, + * as it will affect the size of the structures, and this will cause bad + * things to happen if the library and/or application ever change. + */ + +/* Any features you will not be using can be undef'ed here */ + +/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user + * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS + * on the compile line, then pick and choose which ones to define without + * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED + * if you only want to have a png-compliant reader/writer but don't need + * any of the extra transformations. This saves about 80 kbytes in a + * typical installation of the library. (PNG_NO_* form added in version + * 1.0.1c, for consistency) + */ + +/* The size of the png_text structure changed in libpng-1.0.6 when + * iTXt support was added. iTXt support was turned off by default through + * libpng-1.2.x, to support old apps that malloc the png_text structure + * instead of calling png_set_text() and letting libpng malloc it. It + * was turned on by default in libpng-1.3.0. + */ + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +# ifndef PNG_NO_iTXt_SUPPORTED +# define PNG_NO_iTXt_SUPPORTED +# endif +# ifndef PNG_NO_READ_iTXt +# define PNG_NO_READ_iTXt +# endif +# ifndef PNG_NO_WRITE_iTXt +# define PNG_NO_WRITE_iTXt +# endif +#endif + +#if !defined(PNG_NO_iTXt_SUPPORTED) +# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) +# define PNG_READ_iTXt +# endif +# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) +# define PNG_WRITE_iTXt +# endif +#endif + +/* The following support, added after version 1.0.0, can be turned off here en + * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility + * with old applications that require the length of png_struct and png_info + * to remain unchanged. + */ + +#ifdef PNG_LEGACY_SUPPORTED +# define PNG_NO_FREE_ME +# define PNG_NO_READ_UNKNOWN_CHUNKS +# define PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_NO_READ_USER_CHUNKS +# define PNG_NO_READ_iCCP +# define PNG_NO_WRITE_iCCP +# define PNG_NO_READ_iTXt +# define PNG_NO_WRITE_iTXt +# define PNG_NO_READ_sCAL +# define PNG_NO_WRITE_sCAL +# define PNG_NO_READ_sPLT +# define PNG_NO_WRITE_sPLT +# define PNG_NO_INFO_IMAGE +# define PNG_NO_READ_RGB_TO_GRAY +# define PNG_NO_READ_USER_TRANSFORM +# define PNG_NO_WRITE_USER_TRANSFORM +# define PNG_NO_USER_MEM +# define PNG_NO_READ_EMPTY_PLTE +# define PNG_NO_MNG_FEATURES +# define PNG_NO_FIXED_POINT_SUPPORTED +#endif + +/* Ignore attempt to turn off both floating and fixed point support */ +#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ + !defined(PNG_NO_FIXED_POINT_SUPPORTED) +# define PNG_FIXED_POINT_SUPPORTED +#endif + +#ifndef PNG_NO_FREE_ME +# define PNG_FREE_ME_SUPPORTED +#endif + +#if defined(PNG_READ_SUPPORTED) + +#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_TRANSFORMS) +# define PNG_READ_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_READ_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_READ_EXPAND +# define PNG_READ_EXPAND_SUPPORTED +# endif +# ifndef PNG_NO_READ_SHIFT +# define PNG_READ_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACK +# define PNG_READ_PACK_SUPPORTED +# endif +# ifndef PNG_NO_READ_BGR +# define PNG_READ_BGR_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP +# define PNG_READ_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACKSWAP +# define PNG_READ_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT +# define PNG_READ_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_READ_DITHER +# define PNG_READ_DITHER_SUPPORTED +# endif +# ifndef PNG_NO_READ_BACKGROUND +# define PNG_READ_BACKGROUND_SUPPORTED +# endif +# ifndef PNG_NO_READ_16_TO_8 +# define PNG_READ_16_TO_8_SUPPORTED +# endif +# ifndef PNG_NO_READ_FILLER +# define PNG_READ_FILLER_SUPPORTED +# endif +# ifndef PNG_NO_READ_GAMMA +# define PNG_READ_GAMMA_SUPPORTED +# endif +# ifndef PNG_NO_READ_GRAY_TO_RGB +# define PNG_READ_GRAY_TO_RGB_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP_ALPHA +# define PNG_READ_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT_ALPHA +# define PNG_READ_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_STRIP_ALPHA +# define PNG_READ_STRIP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_USER_TRANSFORM +# define PNG_READ_USER_TRANSFORM_SUPPORTED +# endif +# ifndef PNG_NO_READ_RGB_TO_GRAY +# define PNG_READ_RGB_TO_GRAY_SUPPORTED +# endif +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ + +#if !defined(PNG_NO_PROGRESSIVE_READ) && \ + !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */ +# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ +#endif /* about interlacing capability! You'll */ + /* still have interlacing unless you change the following line: */ + +#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */ + +#ifndef PNG_NO_READ_COMPOSITE_NODIV +# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ +# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ +# endif +#endif + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +/* Deprecated, will be removed from version 2.0.0. + Use PNG_MNG_FEATURES_SUPPORTED instead. */ +#ifndef PNG_NO_READ_EMPTY_PLTE +# define PNG_READ_EMPTY_PLTE_SUPPORTED +#endif +#endif + +#endif /* PNG_READ_SUPPORTED */ + +#if defined(PNG_WRITE_SUPPORTED) + +# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_TRANSFORMS) +# define PNG_WRITE_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_WRITE_SHIFT +# define PNG_WRITE_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACK +# define PNG_WRITE_PACK_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_BGR +# define PNG_WRITE_BGR_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_SWAP +# define PNG_WRITE_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACKSWAP +# define PNG_WRITE_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT +# define PNG_WRITE_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_FILLER +# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ +# endif +# ifndef PNG_NO_WRITE_SWAP_ALPHA +# define PNG_WRITE_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT_ALPHA +# define PNG_WRITE_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_USER_TRANSFORM +# define PNG_WRITE_USER_TRANSFORM_SUPPORTED +# endif +#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ + +#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ + !defined(PNG_WRITE_INTERLACING_SUPPORTED) +#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant + encoders, but can cause trouble + if left undefined */ +#endif + +#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ + !defined(PNG_WRITE_WEIGHTED_FILTER) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED +#endif + +#ifndef PNG_NO_WRITE_FLUSH +# define PNG_WRITE_FLUSH_SUPPORTED +#endif + +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */ +#ifndef PNG_NO_WRITE_EMPTY_PLTE +# define PNG_WRITE_EMPTY_PLTE_SUPPORTED +#endif +#endif + +#endif /* PNG_WRITE_SUPPORTED */ + +#ifndef PNG_1_0_X +# ifndef PNG_NO_ERROR_NUMBERS +# define PNG_ERROR_NUMBERS_SUPPORTED +# endif +#endif /* PNG_1_0_X */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +# ifndef PNG_NO_USER_TRANSFORM_PTR +# define PNG_USER_TRANSFORM_PTR_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_STDIO +# define PNG_TIME_RFC1123_SUPPORTED +#endif + +/* This adds extra functions in pngget.c for accessing data from the + * info pointer (added in version 0.99) + * png_get_image_width() + * png_get_image_height() + * png_get_bit_depth() + * png_get_color_type() + * png_get_compression_type() + * png_get_filter_type() + * png_get_interlace_type() + * png_get_pixel_aspect_ratio() + * png_get_pixels_per_meter() + * png_get_x_offset_pixels() + * png_get_y_offset_pixels() + * png_get_x_offset_microns() + * png_get_y_offset_microns() + */ +#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) +# define PNG_EASY_ACCESS_SUPPORTED +#endif + +/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 + * and removed from version 1.2.20. The following will be removed + * from libpng-1.4.0 +*/ + +#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE) +# ifndef PNG_OPTIMIZED_CODE_SUPPORTED +# define PNG_OPTIMIZED_CODE_SUPPORTED +# endif +#endif + +#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) +# ifndef PNG_ASSEMBLER_CODE_SUPPORTED +# define PNG_ASSEMBLER_CODE_SUPPORTED +# endif + +# if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4) + /* work around 64-bit gcc compiler bugs in gcc-3.x */ +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_NO_MMX_CODE +# endif +# endif + +# if defined(__APPLE__) +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_NO_MMX_CODE +# endif +# endif + +# if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh)) +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_NO_MMX_CODE +# endif +# endif + +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_MMX_CODE_SUPPORTED +# endif + +#endif +/* end of obsolete code to be removed from libpng-1.4.0 */ + +#if !defined(PNG_1_0_X) +#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) +# define PNG_USER_MEM_SUPPORTED +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#if !defined(PNG_1_0_X) +#ifndef PNG_SET_USER_LIMITS_SUPPORTED +#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) +# define PNG_SET_USER_LIMITS_SUPPORTED +#endif +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter + * how large, set these limits to 0x7fffffffL + */ +#ifndef PNG_USER_WIDTH_MAX +# define PNG_USER_WIDTH_MAX 1000000L +#endif +#ifndef PNG_USER_HEIGHT_MAX +# define PNG_USER_HEIGHT_MAX 1000000L +#endif + +/* These are currently experimental features, define them if you want */ + +/* very little testing */ +/* +#ifdef PNG_READ_SUPPORTED +# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# endif +#endif +*/ + +/* This is only for PowerPC big-endian and 680x0 systems */ +/* some testing */ +/* +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +# define PNG_READ_BIG_ENDIAN_SUPPORTED +#endif +*/ + +/* Buggy compilers (e.g., gcc 2.7.2.2) need this */ +/* +#define PNG_NO_POINTER_INDEXING +*/ + +/* These functions are turned off by default, as they will be phased out. */ +/* +#define PNG_USELESS_TESTS_SUPPORTED +#define PNG_CORRECT_PALETTE_SUPPORTED +*/ + +/* Any chunks you are not interested in, you can undef here. The + * ones that allocate memory may be expecially important (hIST, + * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info + * a bit smaller. + */ + +#if defined(PNG_READ_SUPPORTED) && \ + !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_ANCILLARY_CHUNKS) +# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#if defined(PNG_WRITE_SUPPORTED) && \ + !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) +# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_READ_TEXT +# define PNG_NO_READ_iTXt +# define PNG_NO_READ_tEXt +# define PNG_NO_READ_zTXt +#endif +#ifndef PNG_NO_READ_bKGD +# define PNG_READ_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +#endif +#ifndef PNG_NO_READ_cHRM +# define PNG_READ_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +#endif +#ifndef PNG_NO_READ_gAMA +# define PNG_READ_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +#endif +#ifndef PNG_NO_READ_hIST +# define PNG_READ_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +#endif +#ifndef PNG_NO_READ_iCCP +# define PNG_READ_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +#endif +#ifndef PNG_NO_READ_iTXt +# ifndef PNG_READ_iTXt_SUPPORTED +# define PNG_READ_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_oFFs +# define PNG_READ_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +#endif +#ifndef PNG_NO_READ_pCAL +# define PNG_READ_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_sCAL +# define PNG_READ_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_pHYs +# define PNG_READ_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +#endif +#ifndef PNG_NO_READ_sBIT +# define PNG_READ_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sPLT +# define PNG_READ_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sRGB +# define PNG_READ_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +#endif +#ifndef PNG_NO_READ_tEXt +# define PNG_READ_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_tIME +# define PNG_READ_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +#endif +#ifndef PNG_NO_READ_tRNS +# define PNG_READ_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +#endif +#ifndef PNG_NO_READ_zTXt +# define PNG_READ_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_UNKNOWN_CHUNKS +# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_NO_HANDLE_AS_UNKNOWN +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif +#if !defined(PNG_NO_READ_USER_CHUNKS) && \ + defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) +# define PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_USER_CHUNKS_SUPPORTED +# ifdef PNG_NO_READ_UNKNOWN_CHUNKS +# undef PNG_NO_READ_UNKNOWN_CHUNKS +# endif +# ifdef PNG_NO_HANDLE_AS_UNKNOWN +# undef PNG_NO_HANDLE_AS_UNKNOWN +# endif +#endif +#ifndef PNG_NO_READ_OPT_PLTE +# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ +#endif /* optional PLTE chunk in RGB and RGBA images */ +#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ + defined(PNG_READ_zTXt_SUPPORTED) +# define PNG_READ_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +#endif + +#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_WRITE_TEXT +# define PNG_NO_WRITE_iTXt +# define PNG_NO_WRITE_tEXt +# define PNG_NO_WRITE_zTXt +#endif +#ifndef PNG_NO_WRITE_bKGD +# define PNG_WRITE_bKGD_SUPPORTED +# ifndef PNG_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_cHRM +# define PNG_WRITE_cHRM_SUPPORTED +# ifndef PNG_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_gAMA +# define PNG_WRITE_gAMA_SUPPORTED +# ifndef PNG_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_hIST +# define PNG_WRITE_hIST_SUPPORTED +# ifndef PNG_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iCCP +# define PNG_WRITE_iCCP_SUPPORTED +# ifndef PNG_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iTXt +# ifndef PNG_WRITE_iTXt_SUPPORTED +# define PNG_WRITE_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_oFFs +# define PNG_WRITE_oFFs_SUPPORTED +# ifndef PNG_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pCAL +# define PNG_WRITE_pCAL_SUPPORTED +# ifndef PNG_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sCAL +# define PNG_WRITE_sCAL_SUPPORTED +# ifndef PNG_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pHYs +# define PNG_WRITE_pHYs_SUPPORTED +# ifndef PNG_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sBIT +# define PNG_WRITE_sBIT_SUPPORTED +# ifndef PNG_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sPLT +# define PNG_WRITE_sPLT_SUPPORTED +# ifndef PNG_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sRGB +# define PNG_WRITE_sRGB_SUPPORTED +# ifndef PNG_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tEXt +# define PNG_WRITE_tEXt_SUPPORTED +# ifndef PNG_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tIME +# define PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tRNS +# define PNG_WRITE_tRNS_SUPPORTED +# ifndef PNG_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_zTXt +# define PNG_WRITE_zTXt_SUPPORTED +# ifndef PNG_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +# endif +#endif +#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ + defined(PNG_WRITE_zTXt_SUPPORTED) +# define PNG_WRITE_TEXT_SUPPORTED +# ifndef PNG_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +# endif +#endif + +#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ + +/* Turn this off to disable png_read_png() and + * png_write_png() and leave the row_pointers member + * out of the info structure. + */ +#ifndef PNG_NO_INFO_IMAGE +# define PNG_INFO_IMAGE_SUPPORTED +#endif + +/* need the time information for reading tIME chunks */ +#if defined(PNG_tIME_SUPPORTED) +# if !defined(_WIN32_WCE) + /* "time.h" functions are not supported on WindowsCE */ +# include +# endif +#endif + +/* Some typedefs to get us started. These should be safe on most of the + * common platforms. The typedefs should be at least as large as the + * numbers suggest (a png_uint_32 must be at least 32 bits long), but they + * don't have to be exactly that size. Some compilers dislike passing + * unsigned shorts as function parameters, so you may be better off using + * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may + * want to have unsigned int for png_uint_32 instead of unsigned long. + */ + +typedef unsigned long png_uint_32; +typedef long png_int_32; +typedef unsigned short png_uint_16; +typedef short png_int_16; +typedef unsigned char png_byte; + +/* This is usually size_t. It is typedef'ed just in case you need it to + change (I'm not sure if you will or not, so I thought I'd be safe) */ +#ifdef PNG_SIZE_T + typedef PNG_SIZE_T png_size_t; +# define png_sizeof(x) png_convert_size(sizeof (x)) +#else + typedef size_t png_size_t; +# define png_sizeof(x) sizeof (x) +#endif + +/* The following is needed for medium model support. It cannot be in the + * PNG_INTERNAL section. Needs modification for other compilers besides + * MSC. Model independent support declares all arrays and pointers to be + * large using the far keyword. The zlib version used must also support + * model independent data. As of version zlib 1.0.4, the necessary changes + * have been made in zlib. The USE_FAR_KEYWORD define triggers other + * changes that are needed. (Tim Wegner) + */ + +/* Separate compiler dependencies (problem here is that zlib.h always + defines FAR. (SJT) */ +#ifdef __BORLANDC__ +# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) +# define LDATA 1 +# else +# define LDATA 0 +# endif + /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ +# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) +# define PNG_MAX_MALLOC_64K +# if (LDATA != 1) +# ifndef FAR +# define FAR __far +# endif +# define USE_FAR_KEYWORD +# endif /* LDATA != 1 */ + /* Possibly useful for moving data out of default segment. + * Uncomment it if you want. Could also define FARDATA as + * const if your compiler supports it. (SJT) +# define FARDATA FAR + */ +# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ +#endif /* __BORLANDC__ */ + + +/* Suggest testing for specific compiler first before testing for + * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, + * making reliance oncertain keywords suspect. (SJT) + */ + +/* MSC Medium model */ +#if defined(FAR) +# if defined(M_I86MM) +# define USE_FAR_KEYWORD +# define FARDATA FAR +# include +# endif +#endif + +/* SJT: default case */ +#ifndef FAR +# define FAR +#endif + +/* At this point FAR is always defined */ +#ifndef FARDATA +# define FARDATA +#endif + +/* Typedef for floating-point numbers that are converted + to fixed-point with a multiple of 100,000, e.g., int_gamma */ +typedef png_int_32 png_fixed_point; + +/* Add typedefs for pointers */ +typedef void FAR * png_voidp; +typedef png_byte FAR * png_bytep; +typedef png_uint_32 FAR * png_uint_32p; +typedef png_int_32 FAR * png_int_32p; +typedef png_uint_16 FAR * png_uint_16p; +typedef png_int_16 FAR * png_int_16p; +typedef PNG_CONST char FAR * png_const_charp; +typedef char FAR * png_charp; +typedef png_fixed_point FAR * png_fixed_point_p; + +#ifndef PNG_NO_STDIO +#if defined(_WIN32_WCE) +typedef HANDLE png_FILE_p; +#else +typedef FILE * png_FILE_p; +#endif +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * png_doublep; +#endif + +/* Pointers to pointers; i.e. arrays */ +typedef png_byte FAR * FAR * png_bytepp; +typedef png_uint_32 FAR * FAR * png_uint_32pp; +typedef png_int_32 FAR * FAR * png_int_32pp; +typedef png_uint_16 FAR * FAR * png_uint_16pp; +typedef png_int_16 FAR * FAR * png_int_16pp; +typedef PNG_CONST char FAR * FAR * png_const_charpp; +typedef char FAR * FAR * png_charpp; +typedef png_fixed_point FAR * FAR * png_fixed_point_pp; +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * FAR * png_doublepp; +#endif + +/* Pointers to pointers to pointers; i.e., pointer to array */ +typedef char FAR * FAR * FAR * png_charppp; + +#if defined(PNG_1_0_X) || defined(PNG_1_2_X) +/* SPC - Is this stuff deprecated? */ +/* It'll be removed as of libpng-1.3.0 - GR-P */ +/* libpng typedefs for types in zlib. If zlib changes + * or another compression library is used, then change these. + * Eliminates need to change all the source files. + */ +typedef charf * png_zcharp; +typedef charf * FAR * png_zcharpp; +typedef z_stream FAR * png_zstreamp; +#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */ + +/* + * Define PNG_BUILD_DLL if the module being built is a Windows + * LIBPNG DLL. + * + * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. + * It is equivalent to Microsoft predefined macro _DLL that is + * automatically defined when you compile using the share + * version of the CRT (C Run-Time library) + * + * The cygwin mods make this behavior a little different: + * Define PNG_BUILD_DLL if you are building a dll for use with cygwin + * Define PNG_STATIC if you are building a static library for use with cygwin, + * -or- if you are building an application that you want to link to the + * static library. + * PNG_USE_DLL is defined by default (no user action needed) unless one of + * the other flags is defined. + */ + +#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) +# define PNG_DLL +#endif +/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. + * When building a static lib, default to no GLOBAL ARRAYS, but allow + * command-line override + */ +#if defined(__CYGWIN__) +# if !defined(PNG_STATIC) +# if defined(PNG_USE_GLOBAL_ARRAYS) +# undef PNG_USE_GLOBAL_ARRAYS +# endif +# if !defined(PNG_USE_LOCAL_ARRAYS) +# define PNG_USE_LOCAL_ARRAYS +# endif +# else +# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) +# if defined(PNG_USE_GLOBAL_ARRAYS) +# undef PNG_USE_GLOBAL_ARRAYS +# endif +# endif +# endif +# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) +# define PNG_USE_LOCAL_ARRAYS +# endif +#endif + +/* Do not use global arrays (helps with building DLL's) + * They are no longer used in libpng itself, since version 1.0.5c, + * but might be required for some pre-1.0.5c applications. + */ +#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) +# if defined(PNG_NO_GLOBAL_ARRAYS) || \ + (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER) +# define PNG_USE_LOCAL_ARRAYS +# else +# define PNG_USE_GLOBAL_ARRAYS +# endif +#endif + +#if defined(__CYGWIN__) +# undef PNGAPI +# define PNGAPI __cdecl +# undef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", + * you may get warnings regarding the linkage of png_zalloc and png_zfree. + * Don't ignore those warnings; you must also reset the default calling + * convention in your compiler to match your PNGAPI, and you must build + * zlib and your applications the same way you build libpng. + */ + +#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) +# ifndef PNG_NO_MODULEDEF +# define PNG_NO_MODULEDEF +# endif +#endif + +#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) +# define PNG_IMPEXP +#endif + +#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ + (( defined(_Windows) || defined(_WINDOWS) || \ + defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) + +# ifndef PNGAPI +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# define PNGAPI __cdecl +# else +# define PNGAPI _cdecl +# endif +# endif + +# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ + 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) +# define PNG_IMPEXP +# endif + +# if !defined(PNG_IMPEXP) + +# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol +# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol + + /* Borland/Microsoft */ +# if defined(_MSC_VER) || defined(__BORLANDC__) +# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) +# define PNG_EXPORT PNG_EXPORT_TYPE1 +# else +# define PNG_EXPORT PNG_EXPORT_TYPE2 +# if defined(PNG_BUILD_DLL) +# define PNG_IMPEXP __export +# else +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in + VC++ */ +# endif /* Exists in Borland C++ for + C++ classes (== huge) */ +# endif +# endif + +# if !defined(PNG_IMPEXP) +# if defined(PNG_BUILD_DLL) +# define PNG_IMPEXP __declspec(dllexport) +# else +# define PNG_IMPEXP __declspec(dllimport) +# endif +# endif +# endif /* PNG_IMPEXP */ +#else /* !(DLL || non-cygwin WINDOWS) */ +# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) +# ifndef PNGAPI +# define PNGAPI _System +# endif +# else +# if 0 /* ... other platforms, with other meanings */ +# endif +# endif +#endif + +#ifndef PNGAPI +# define PNGAPI +#endif +#ifndef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#ifdef PNG_BUILDSYMS +# ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END +# endif +# ifdef PNG_USE_GLOBAL_ARRAYS +# ifndef PNG_EXPORT_VAR +# define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT +# endif +# endif +#endif + +#ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol +#endif + +#ifdef PNG_USE_GLOBAL_ARRAYS +# ifndef PNG_EXPORT_VAR +# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type +# endif +#endif + +/* User may want to use these so they are not in PNG_INTERNAL. Any library + * functions that are passed far data must be model independent. + */ + +#ifndef PNG_ABORT +# define PNG_ABORT() abort() +#endif + +#ifdef PNG_SETJMP_SUPPORTED +# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) +#else +# define png_jmpbuf(png_ptr) \ + (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) +#endif + +#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ +/* use this to make far-to-near assignments */ +# define CHECK 1 +# define NOCHECK 0 +# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) +# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) +# define png_snprintf _fsnprintf /* Added to v 1.2.19 */ +# define png_strlen _fstrlen +# define png_memcmp _fmemcmp /* SJT: added */ +# define png_memcpy _fmemcpy +# define png_memset _fmemset +#else /* use the usual functions */ +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# ifndef PNG_NO_SNPRINTF +# ifdef _MSC_VER +# define png_snprintf _snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 _snprintf +# define png_snprintf6 _snprintf +# else +# define png_snprintf snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 snprintf +# define png_snprintf6 snprintf +# endif +# else + /* You don't have or don't want to use snprintf(). Caution: Using + * sprintf instead of snprintf exposes your application to accidental + * or malevolent buffer overflows. If you don't have snprintf() + * as a general rule you should provide one (you can get one from + * Portable OpenSSH). */ +# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1) +# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) +# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ + sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) +# endif +# define png_strlen strlen +# define png_memcmp memcmp /* SJT: added */ +# define png_memcpy memcpy +# define png_memset memset +#endif +/* End of memory model independent support */ + +/* Just a little check that someone hasn't tried to define something + * contradictory. + */ +#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) +# undef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 65536L +#endif + +/* Added at libpng-1.2.8 */ +#endif /* PNG_VERSION_INFO_ONLY */ + +#endif /* PNGCONF_H */ diff --git a/source/libpng/pngu/pngu.c b/source/libpng/pngu/pngu.c new file mode 100644 index 0000000..e2cfb7f --- /dev/null +++ b/source/libpng/pngu/pngu.c @@ -0,0 +1,1132 @@ +/******************************************************************************************** + +PNGU Version : 0.2a + +Coder : frontier + +More info : http://frontier-dev.net + +********************************************************************************************/ +#include +#include +#include "pngu.h" +#include "../png.h" + + +// Constants +#define PNGU_SOURCE_BUFFER 1 +#define PNGU_SOURCE_DEVICE 2 + + +// Prototypes of helper functions +int pngu_info (IMGCTX ctx); +int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlpha); +void pngu_free_info (IMGCTX ctx); +void pngu_read_data_from_buffer (png_structp png_ptr, png_bytep data, png_size_t length); +void pngu_write_data_to_buffer (png_structp png_ptr, png_bytep data, png_size_t length); +void pngu_flush_data_to_buffer (png_structp png_ptr); +int pngu_clamp (int value, int min, int max); + + +// PNGU Image context struct +struct _IMGCTX +{ + int source; + void *buffer; + char *filename; + PNGU_u32 cursor; + + PNGU_u32 propRead; + PNGUPROP prop; + + PNGU_u32 infoRead; + png_structp png_ptr; + png_infop info_ptr; + FILE *fd; + + png_bytep *row_pointers; + png_bytep img_data; +}; + + +// PNGU Implementation // + +IMGCTX PNGU_SelectImageFromBuffer (const void *buffer) +{ + IMGCTX ctx = NULL; + + if (!buffer) + return NULL; + + ctx = malloc (sizeof (struct _IMGCTX)); + if (!ctx) + return NULL; + + ctx->buffer = (void *) buffer; + ctx->source = PNGU_SOURCE_BUFFER; + ctx->cursor = 0; + ctx->filename = NULL; + ctx->propRead = 0; + ctx->infoRead = 0; + + return ctx; +} + + +IMGCTX PNGU_SelectImageFromDevice (const char *filename) +{ + IMGCTX ctx = NULL; + + if (!filename) + return NULL; + + ctx = malloc (sizeof (struct _IMGCTX)); + if (!ctx) + return NULL; + + ctx->buffer = NULL; + ctx->source = PNGU_SOURCE_DEVICE; + ctx->cursor = 0; + + ctx->filename = malloc (strlen (filename) + 1); + if (!ctx->filename) + { + free (ctx); + return NULL; + } + strcpy(ctx->filename, filename); + + ctx->propRead = 0; + ctx->infoRead = 0; + + return ctx; +} + + +void PNGU_ReleaseImageContext (IMGCTX ctx) +{ + if (!ctx) + return; + + if (ctx->filename) + free (ctx->filename); + + if ((ctx->propRead) && (ctx->prop.trans)) + free (ctx->prop.trans); + + pngu_free_info (ctx); + + free (ctx); +} + + +int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *imgprop) +{ + int res; + + if (!ctx->propRead) + { + res = pngu_info (ctx); + if (res != PNGU_OK) + return res; + } + + *imgprop = ctx->prop; + + return PNGU_OK; +} + + +int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride) +{ + int result; + PNGU_u32 x, y, buffWidth; + + // width needs to be divisible by two + if (width % 2) + return PNGU_ODD_WIDTH; + + // stride needs to be divisible by two + if (stride % 2) + return PNGU_ODD_STRIDE; + + result = pngu_decode (ctx, width, height, 1); + if (result != PNGU_OK) + return result; + + // Copy image to the output buffer + buffWidth = (width + stride) / 2; + for (y = 0; y < height; y++) + for (x = 0; x < (width / 2); x++) + ((PNGU_u32 *)buffer)[y*buffWidth+x] = PNGU_RGB8_TO_YCbYCr (*(ctx->row_pointers[y]+x*6), *(ctx->row_pointers[y]+x*6+1), *(ctx->row_pointers[y]+x*6+2), + *(ctx->row_pointers[y]+x*6+3), *(ctx->row_pointers[y]+x*6+4), *(ctx->row_pointers[y]+x*6+5)); + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + + // Success + return PNGU_OK; +} + + +int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride) +{ + int result; + PNGU_u32 x, y, buffWidth; + + result = pngu_decode (ctx, width, height, 1); + if (result != PNGU_OK) + return result; + + buffWidth = width + stride; + + // Copy image to the output buffer + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + ((PNGU_u16 *)buffer)[y*buffWidth+x] = + (((PNGU_u16) (ctx->row_pointers[y][x*3] & 0xF8)) << 8) | + (((PNGU_u16) (ctx->row_pointers[y][x*3+1] & 0xFC)) << 3) | + (((PNGU_u16) (ctx->row_pointers[y][x*3+2] & 0xF8)) >> 3); + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + + // Success + return PNGU_OK; +} + + +int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha) +{ + int result; + PNGU_u32 x, y, buffWidth; + + result = pngu_decode (ctx, width, height, 0); + if (result != PNGU_OK) + return result; + + buffWidth = width + stride; + + // Check is source image has an alpha channel + if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA) ) + { + // Alpha channel present, copy image to the output buffer + for (y = 0; y < height; y++) + memcpy (buffer + (y * buffWidth * 4), ctx->row_pointers[y], width * 4); + } + else + { + // No alpha channel present, copy image to the output buffer + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + ((PNGU_u32 *)buffer)[y*buffWidth+x] = + (((PNGU_u32) ctx->row_pointers[y][x*3]) << 24) | + (((PNGU_u32) ctx->row_pointers[y][x*3+1]) << 16) | + (((PNGU_u32) ctx->row_pointers[y][x*3+2]) << 8) | + ((PNGU_u32) default_alpha); + } + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + + // Success + return PNGU_OK; +} + + +int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer) +{ + int result; + PNGU_u32 x, y, qwidth, qheight; + + // width and height need to be divisible by four + if ((width % 4) || (height % 4)) + return PNGU_INVALID_WIDTH_OR_HEIGHT; + + result = pngu_decode (ctx, width, height, 1); + if (result != PNGU_OK) + return result; + + // Copy image to the output buffer + qwidth = width / 4; + qheight = height / 4; + + for (y = 0; y < qheight; y++) + for (x = 0; x < qwidth; x++) + { + int blockbase = (y * qwidth + x) * 4; + + PNGU_u64 field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*12)); + PNGU_u64 field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase] = + (((field64 & 0xF800000000000000ULL) | ((field64 & 0xFC000000000000ULL) << 3) | ((field64 & 0xF80000000000ULL) << 5)) | + (((field64 & 0xF800000000ULL) << 8) | ((field64 & 0xFC000000ULL) << 11) | ((field64 & 0xF80000ULL) << 13)) | + (((field64 & 0xF800ULL) << 16) | ((field64 & 0xFCULL) << 19) | ((field32 & 0xF8000000ULL) >> 11)) | + (((field32 & 0xF80000ULL) >> 8) | ((field32 & 0xFC00ULL) >> 5) | ((field32 & 0xF8ULL) >> 3))); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+1]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+1] = + (((field64 & 0xF800000000000000ULL) | ((field64 & 0xFC000000000000ULL) << 3) | ((field64 & 0xF80000000000ULL) << 5)) | + (((field64 & 0xF800000000ULL) << 8) | ((field64 & 0xFC000000ULL) << 11) | ((field64 & 0xF80000ULL) << 13)) | + (((field64 & 0xF800ULL) << 16) | ((field64 & 0xFCULL) << 19) | ((field32 & 0xF8000000ULL) >> 11)) | + (((field32 & 0xF80000ULL) >> 8) | ((field32 & 0xFC00ULL) >> 5) | ((field32 & 0xF8ULL) >> 3))); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+2]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+2] = + (((field64 & 0xF800000000000000ULL) | ((field64 & 0xFC000000000000ULL) << 3) | ((field64 & 0xF80000000000ULL) << 5)) | + (((field64 & 0xF800000000ULL) << 8) | ((field64 & 0xFC000000ULL) << 11) | ((field64 & 0xF80000ULL) << 13)) | + (((field64 & 0xF800ULL) << 16) | ((field64 & 0xFCULL) << 19) | ((field32 & 0xF8000000ULL) >> 11)) | + (((field32 & 0xF80000ULL) >> 8) | ((field32 & 0xFC00ULL) >> 5) | ((field32 & 0xF8ULL) >> 3))); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+3]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+3] = + (((field64 & 0xF800000000000000ULL) | ((field64 & 0xFC000000000000ULL) << 3) | ((field64 & 0xF80000000000ULL) << 5)) | + (((field64 & 0xF800000000ULL) << 8) | ((field64 & 0xFC000000ULL) << 11) | ((field64 & 0xF80000ULL) << 13)) | + (((field64 & 0xF800ULL) << 16) | ((field64 & 0xFCULL) << 19) | ((field32 & 0xF8000000ULL) >> 11)) | + (((field32 & 0xF80000ULL) >> 8) | ((field32 & 0xFC00ULL) >> 5) | ((field32 & 0xF8ULL) >> 3))); + } + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + + // Success + return PNGU_OK; +} + + +int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha) +{ + int result; + PNGU_u32 x, y, qwidth, qheight; + PNGU_u64 alphaMask; + + // width and height need to be divisible by four + if ((width % 4) || (height % 4)) + return PNGU_INVALID_WIDTH_OR_HEIGHT; + + result = pngu_decode (ctx, width, height, 0); + if (result != PNGU_OK) + return result; + + // Init some vars + qwidth = width / 4; + qheight = height / 4; + + // Check is source image has an alpha channel + if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA) ) + { + // Alpha channel present, copy image to the output buffer + for (y = 0; y < qheight; y++) + for (x = 0; x < qwidth; x++) + { + int blockbase = (y * qwidth + x) * 4; + PNGU_u64 tmp; + + PNGU_u64 fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*16)); + PNGU_u64 fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*16+8)); + // If first pixel is opaque set MSB to 1 and encode colors in RGB555, else set MSB to 0 and encode colors in ARGB3444 + if ((fieldA & 0xE000000000ULL) == 0xE000000000ULL) + tmp = 0x8000000000000000ULL | ((fieldA & 0xF800000000000000ULL) >> 1) | ((fieldA & 0xF8000000000000ULL) << 2) | ((fieldA & 0xF80000000000ULL) << 5); + else + tmp = ((fieldA & 0xE000000000ULL) << 23) | ((fieldA & 0xF000000000000000ULL) >> 4) | (fieldA & 0xF0000000000000ULL) | ((fieldA & 0xF00000000000ULL) << 4); + + // If second pixel is opaque set MSB to 1 and encode colors in RGB555, else set MSB to 0 and encode colors in ARGB3444 + if ((fieldA & 0xE0ULL) == 0xE0ULL) + tmp = tmp | 0x800000000000ULL | ((fieldA & 0xF8000000ULL) << 15) | ((fieldA & 0xF80000ULL) << 18) | ((fieldA & 0xF800ULL) << 21); + else + tmp = tmp | ((fieldA & 0xE0ULL) << 39) | ((fieldA & 0xF0000000ULL) << 12) | ((fieldA & 0xF00000ULL) << 16) | ((fieldA & 0xF000ULL) << 20); + + // If third pixel is opaque set MSB to 1 and encode colors in RGB555, else set MSB to 0 and encode colors in ARGB3444 + if ((fieldB & 0xE000000000ULL) == 0xE000000000ULL) + tmp = tmp | 0x80000000ULL | ((fieldB & 0xF800000000000000ULL) >> 33) | ((fieldB & 0xF8000000000000ULL) >> 30) | ((fieldB & 0xF80000000000ULL) >> 27); + else + tmp = tmp | ((fieldB & 0xE000000000ULL) >> 9) | ((fieldB & 0xF000000000000000ULL) >> 36) | ((fieldB & 0xF0000000000000ULL) >> 32) | ((fieldB & 0xF00000000000ULL) >> 28); + + // If fourth pixel is opaque set MSB to 1 and encode colors in RGB555, else set MSB to 0 and encode colors in ARGB3444 + if ((fieldB & 0xE0ULL) == 0xE0ULL) + tmp = tmp | 0x8000ULL | ((fieldB & 0xF8000000ULL) >> 17) | ((fieldB & 0xF80000ULL) >> 14) | ((fieldB & 0xF800ULL) >> 11); + else + tmp = tmp | ((fieldB & 0xE0ULL) << 7) | ((fieldB & 0xF0000000ULL) >> 20) | ((fieldB & 0xF00000ULL) >> 16) | ((fieldB & 0xF000ULL) >> 12); + ((PNGU_u64 *) buffer)[blockbase] = tmp; + + fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*16)); + fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*16+8)); + if ((fieldA & 0xE000000000ULL) == 0xE000000000ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = 0x8000000000000000ULL | ((fieldA & 0xF800000000000000ULL) >> 1) | ((fieldA & 0xF8000000000000ULL) << 2) | ((fieldA & 0xF80000000000ULL) << 5); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = ((fieldA & 0xE000000000ULL) << 23) | ((fieldA & 0xF000000000000000ULL) >> 4) | (fieldA & 0xF0000000000000ULL) | ((fieldA & 0xF00000000000ULL) << 4); + + if ((fieldA & 0xE0ULL) == 0xE0ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x800000000000ULL | ((fieldA & 0xF8000000ULL) << 15) | ((fieldA & 0xF80000ULL) << 18) | ((fieldA & 0xF800ULL) << 21); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldA & 0xE0ULL) << 39) | ((fieldA & 0xF0000000ULL) << 12) | ((fieldA & 0xF00000ULL) << 16) | ((fieldA & 0xF000ULL) << 20); + + if ((fieldB & 0xE000000000ULL) == 0xE000000000ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x80000000ULL | ((fieldB & 0xF800000000000000ULL) >> 33) | ((fieldB & 0xF8000000000000ULL) >> 30) | ((fieldB & 0xF80000000000ULL) >> 27); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldB & 0xE000000000ULL) >> 9) | ((fieldB & 0xF000000000000000ULL) >> 36) | ((fieldB & 0xF0000000000000ULL) >> 32) | ((fieldB & 0xF00000000000ULL) >> 28); + + if ((fieldB & 0xE0ULL) == 0xE0ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x8000ULL | ((fieldB & 0xF8000000ULL) >> 17) | ((fieldB & 0xF80000ULL) >> 14) | ((fieldB & 0xF800ULL) >> 11); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldB & 0xE0ULL) << 7) | ((fieldB & 0xF0000000ULL) >> 20) | ((fieldB & 0xF00000ULL) >> 16) | ((fieldB & 0xF000ULL) >> 12); + ((PNGU_u64 *) buffer)[blockbase+1] = tmp; + + fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*16)); + fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*16+8)); + if ((fieldA & 0xE000000000ULL) == 0xE000000000ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = 0x8000000000000000ULL | ((fieldA & 0xF800000000000000ULL) >> 1) | ((fieldA & 0xF8000000000000ULL) << 2) | ((fieldA & 0xF80000000000ULL) << 5); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = ((fieldA & 0xE000000000ULL) << 23) | ((fieldA & 0xF000000000000000ULL) >> 4) | (fieldA & 0xF0000000000000ULL) | ((fieldA & 0xF00000000000ULL) << 4); + + if ((fieldA & 0xE0ULL) == 0xE0ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x800000000000ULL | ((fieldA & 0xF8000000ULL) << 15) | ((fieldA & 0xF80000ULL) << 18) | ((fieldA & 0xF800ULL) << 21); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldA & 0xE0ULL) << 39) | ((fieldA & 0xF0000000ULL) << 12) | ((fieldA & 0xF00000ULL) << 16) | ((fieldA & 0xF000ULL) << 20); + + if ((fieldB & 0xE000000000ULL) == 0xE000000000ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x80000000ULL | ((fieldB & 0xF800000000000000ULL) >> 33) | ((fieldB & 0xF8000000000000ULL) >> 30) | ((fieldB & 0xF80000000000ULL) >> 27); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldB & 0xE000000000ULL) >> 9) | ((fieldB & 0xF000000000000000ULL) >> 36) | ((fieldB & 0xF0000000000000ULL) >> 32) | ((fieldB & 0xF00000000000ULL) >> 28); + + if ((fieldB & 0xE0ULL) == 0xE0ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x8000ULL | ((fieldB & 0xF8000000ULL) >> 17) | ((fieldB & 0xF80000ULL) >> 14) | ((fieldB & 0xF800ULL) >> 11); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldB & 0xE0ULL) << 7) | ((fieldB & 0xF0000000ULL) >> 20) | ((fieldB & 0xF00000ULL) >> 16) | ((fieldB & 0xF000ULL) >> 12); + ((PNGU_u64 *) buffer)[blockbase+2] = tmp; + + fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*16)); + fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*16+8)); + if ((fieldA & 0xE000000000ULL) == 0xE000000000ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = 0x8000000000000000ULL | ((fieldA & 0xF800000000000000ULL) >> 1) | ((fieldA & 0xF8000000000000ULL) << 2) | ((fieldA & 0xF80000000000ULL) << 5); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = ((fieldA & 0xE000000000ULL) << 23) | ((fieldA & 0xF000000000000000ULL) >> 4) | (fieldA & 0xF0000000000000ULL) | ((fieldA & 0xF00000000000ULL) << 4); + + if ((fieldA & 0xE0ULL) == 0xE0ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x800000000000ULL | ((fieldA & 0xF8000000ULL) << 15) | ((fieldA & 0xF80000ULL) << 18) | ((fieldA & 0xF800ULL) << 21); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldA & 0xE0ULL) << 39) | ((fieldA & 0xF0000000ULL) << 12) | ((fieldA & 0xF00000ULL) << 16) | ((fieldA & 0xF000ULL) << 20); + + if ((fieldB & 0xE000000000ULL) == 0xE000000000ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x80000000ULL | ((fieldB & 0xF800000000000000ULL) >> 33) | ((fieldB & 0xF8000000000000ULL) >> 30) | ((fieldB & 0xF80000000000ULL) >> 27); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldB & 0xE000000000ULL) >> 9) | ((fieldB & 0xF000000000000000ULL) >> 36) | ((fieldB & 0xF0000000000000ULL) >> 32) | ((fieldB & 0xF00000000000ULL) >> 28); + + if ((fieldB & 0xE0ULL) == 0xE0ULL) + // Opaque pixel, so set MSB to 1 and encode colors in RGB555 + tmp = tmp | 0x8000ULL | ((fieldB & 0xF8000000ULL) >> 17) | ((fieldB & 0xF80000ULL) >> 14) | ((fieldB & 0xF800ULL) >> 11); + else + // Tranlucid pixel, so set MSB to 0 and encode colors in ARGB3444 + tmp = tmp | ((fieldB & 0xE0ULL) << 7) | ((fieldB & 0xF0000000ULL) >> 20) | ((fieldB & 0xF00000ULL) >> 16) | ((fieldB & 0xF000ULL) >> 12); + ((PNGU_u64 *) buffer)[blockbase+3] = tmp; + } + } + else + { + // No alpha channel present, copy image to the output buffer + default_alpha = (default_alpha >> 5); + if (default_alpha == 7) + { + // The user wants an opaque texture, so set MSB to 1 and encode colors in RGB555 + alphaMask = 0x8000800080008000ULL; + + for (y = 0; y < qheight; y++) + for (x = 0; x < qwidth; x++) + { + int blockbase = (y * qwidth + x) * 4; + + PNGU_u64 field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*12)); + PNGU_u64 field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase] = + alphaMask | ((field64 & 0xF800000000000000ULL) >> 1) | ((field64 & 0xF8000000000000ULL) << 2) | + ((field64 & 0xF80000000000ULL) << 5) | ((field64 & 0xF800000000ULL) << 7) | ((field64 & 0xF8000000ULL) << 10) | + ((field64 & 0xF80000ULL) << 13) | ((field64 & 0xF800ULL) << 15) | ((field64 & 0xF8ULL) << 18) | + ((field32 & 0xF8000000ULL) >> 11) | ((field32 & 0xF80000ULL) >> 9) | ((field32 & 0xF800ULL) >> 6) | ((field32 & 0xF8ULL) >> 3); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+1]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+1] = + alphaMask | ((field64 & 0xF800000000000000ULL) >> 1) | ((field64 & 0xF8000000000000ULL) << 2) | + ((field64 & 0xF80000000000ULL) << 5) | ((field64 & 0xF800000000ULL) << 7) | ((field64 & 0xF8000000ULL) << 10) | + ((field64 & 0xF80000ULL) << 13) | ((field64 & 0xF800ULL) << 15) | ((field64 & 0xF8ULL) << 18) | + ((field32 & 0xF8000000ULL) >> 11) | ((field32 & 0xF80000ULL) >> 9) | ((field32 & 0xF800ULL) >> 6) | ((field32 & 0xF8ULL) >> 3); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+2]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+2] = + alphaMask | ((field64 & 0xF800000000000000ULL) >> 1) | ((field64 & 0xF8000000000000ULL) << 2) | + ((field64 & 0xF80000000000ULL) << 5) | ((field64 & 0xF800000000ULL) << 7) | ((field64 & 0xF8000000ULL) << 10) | + ((field64 & 0xF80000ULL) << 13) | ((field64 & 0xF800ULL) << 15) | ((field64 & 0xF8ULL) << 18) | + ((field32 & 0xF8000000ULL) >> 11) | ((field32 & 0xF80000ULL) >> 9) | ((field32 & 0xF800ULL) >> 6) | ((field32 & 0xF8ULL) >> 3); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+3]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+3] = + alphaMask | ((field64 & 0xF800000000000000ULL) >> 1) | ((field64 & 0xF8000000000000ULL) << 2) | + ((field64 & 0xF80000000000ULL) << 5) | ((field64 & 0xF800000000ULL) << 7) | ((field64 & 0xF8000000ULL) << 10) | + ((field64 & 0xF80000ULL) << 13) | ((field64 & 0xF800ULL) << 15) | ((field64 & 0xF8ULL) << 18) | + ((field32 & 0xF8000000ULL) >> 11) | ((field32 & 0xF80000ULL) >> 9) | ((field32 & 0xF800ULL) >> 6) | ((field32 & 0xF8ULL) >> 3); + } + } + else + { + // The user wants a translucid texture, so set MSB to 0 and encode colors in ARGB3444 + default_alpha = (default_alpha << 4); + alphaMask = (((PNGU_u64) default_alpha) << 56) | (((PNGU_u64) default_alpha) << 40) | + (((PNGU_u64) default_alpha) << 24) | (((PNGU_u64) default_alpha) << 8); + + for (y = 0; y < qheight; y++) + for (x = 0; x < qwidth; x++) + { + int blockbase = (y * qwidth + x) * 4; + + PNGU_u64 field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*12)); + PNGU_u64 field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase] = + alphaMask | ((field64 & 0xF000000000000000ULL) >> 4) | (field64 & 0xF0000000000000ULL) | ((field64 & 0xF00000000000ULL) << 4) | + ((field64 & 0xF000000000ULL) << 4) | ((field64 & 0xF0000000ULL) << 8) | ((field64 & 0xF00000ULL) << 12) | + ((field64 & 0xF000ULL) << 12) | ((field64 & 0xF0ULL) << 16) | ((field32 & 0xF0000000ULL) >> 12) | + ((field32 & 0xF00000ULL) >> 12) | ((field32 & 0xF000ULL) >> 8) | ((field32 & 0xF0ULL) >> 4); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+1]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+1] = + alphaMask | ((field64 & 0xF000000000000000ULL) >> 4) | (field64 & 0xF0000000000000ULL) | ((field64 & 0xF00000000000ULL) << 4) | + ((field64 & 0xF000000000ULL) << 4) | ((field64 & 0xF0000000ULL) << 8) | ((field64 & 0xF00000ULL) << 12) | + ((field64 & 0xF000ULL) << 12) | ((field64 & 0xF0ULL) << 16) | ((field32 & 0xF0000000ULL) >> 12) | + ((field32 & 0xF00000ULL) >> 12) | ((field32 & 0xF000ULL) >> 8) | ((field32 & 0xF0ULL) >> 4); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+2]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+2] = + alphaMask | ((field64 & 0xF000000000000000ULL) >> 4) | (field64 & 0xF0000000000000ULL) | ((field64 & 0xF00000000000ULL) << 4) | + ((field64 & 0xF000000000ULL) << 4) | ((field64 & 0xF0000000ULL) << 8) | ((field64 & 0xF00000ULL) << 12) | + ((field64 & 0xF000ULL) << 12) | ((field64 & 0xF0ULL) << 16) | ((field32 & 0xF0000000ULL) >> 12) | + ((field32 & 0xF00000ULL) >> 12) | ((field32 & 0xF000ULL) >> 8) | ((field32 & 0xF0ULL) >> 4); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+3]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+3] = + alphaMask | ((field64 & 0xF000000000000000ULL) >> 4) | (field64 & 0xF0000000000000ULL) | ((field64 & 0xF00000000000ULL) << 4) | + ((field64 & 0xF000000000ULL) << 4) | ((field64 & 0xF0000000ULL) << 8) | ((field64 & 0xF00000ULL) << 12) | + ((field64 & 0xF000ULL) << 12) | ((field64 & 0xF0ULL) << 16) | ((field32 & 0xF0000000ULL) >> 12) | + ((field32 & 0xF00000ULL) >> 12) | ((field32 & 0xF000ULL) >> 8) | ((field32 & 0xF0ULL) >> 4); + } + } + } + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + + // Success + return PNGU_OK; +} + + +int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha) +{ + int result; + PNGU_u32 x, y, qwidth, qheight; + PNGU_u64 alphaMask; + + // width and height need to be divisible by four + if ((width % 4) || (height % 4)) + return PNGU_INVALID_WIDTH_OR_HEIGHT; + + result = pngu_decode (ctx, width, height, 0); + if (result != PNGU_OK) + return result; + + // Init some variables + qwidth = width / 4; + qheight = height / 4; + + // Check is source image has an alpha channel + if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA) ) + { + // Alpha channel present, copy image to the output buffer + for (y = 0; y < qheight; y++) + for (x = 0; x < qwidth; x++) + { + int blockbase = (y * qwidth + x) * 8; + + PNGU_u64 fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*16)); + PNGU_u64 fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*16+8)); + ((PNGU_u64 *) buffer)[blockbase] = + ((fieldA & 0xFF00000000ULL) << 24) | ((fieldA & 0xFF00000000000000ULL) >> 8) | + ((fieldA & 0xFFULL) << 40) | ((fieldA & 0xFF000000ULL) << 8) | + ((fieldB & 0xFF00000000ULL) >> 8) | ((fieldB & 0xFF00000000000000ULL) >> 40) | + ((fieldB & 0xFFULL) << 8) | ((fieldB & 0xFF000000ULL) >> 24); + ((PNGU_u64 *) buffer)[blockbase+4] = + ((fieldA & 0xFFFF0000000000ULL) << 8) | ((fieldA & 0xFFFF00ULL) << 24) | + ((fieldB & 0xFFFF0000000000ULL) >> 24) | ((fieldB & 0xFFFF00ULL) >> 8); + + fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*16)); + fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*16+8)); + ((PNGU_u64 *) buffer)[blockbase+1] = + ((fieldA & 0xFF00000000ULL) << 24) | ((fieldA & 0xFF00000000000000ULL) >> 8) | + ((fieldA & 0xFFULL) << 40) | ((fieldA & 0xFF000000ULL) << 8) | + ((fieldB & 0xFF00000000ULL) >> 8) | ((fieldB & 0xFF00000000000000ULL) >> 40) | + ((fieldB & 0xFFULL) << 8) | ((fieldB & 0xFF000000ULL) >> 24); + ((PNGU_u64 *) buffer)[blockbase+5] = + ((fieldA & 0xFFFF0000000000ULL) << 8) | ((fieldA & 0xFFFF00ULL) << 24) | + ((fieldB & 0xFFFF0000000000ULL) >> 24) | ((fieldB & 0xFFFF00ULL) >> 8); + + fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*16)); + fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*16+8)); + ((PNGU_u64 *) buffer)[blockbase+2] = + ((fieldA & 0xFF00000000ULL) << 24) | ((fieldA & 0xFF00000000000000ULL) >> 8) | + ((fieldA & 0xFFULL) << 40) | ((fieldA & 0xFF000000ULL) << 8) | + ((fieldB & 0xFF00000000ULL) >> 8) | ((fieldB & 0xFF00000000000000ULL) >> 40) | + ((fieldB & 0xFFULL) << 8) | ((fieldB & 0xFF000000ULL) >> 24); + ((PNGU_u64 *) buffer)[blockbase+6] = + ((fieldA & 0xFFFF0000000000ULL) << 8) | ((fieldA & 0xFFFF00ULL) << 24) | + ((fieldB & 0xFFFF0000000000ULL) >> 24) | ((fieldB & 0xFFFF00ULL) >> 8); + + fieldA = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*16)); + fieldB = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*16+8)); + ((PNGU_u64 *) buffer)[blockbase+3] = + ((fieldA & 0xFF00000000ULL) << 24) | ((fieldA & 0xFF00000000000000ULL) >> 8) | + ((fieldA & 0xFFULL) << 40) | ((fieldA & 0xFF000000ULL) << 8) | + ((fieldB & 0xFF00000000ULL) >> 8) | ((fieldB & 0xFF00000000000000ULL) >> 40) | + ((fieldB & 0xFFULL) << 8) | ((fieldB & 0xFF000000ULL) >> 24); + ((PNGU_u64 *) buffer)[blockbase+7] = + ((fieldA & 0xFFFF0000000000ULL) << 8) | ((fieldA & 0xFFFF00ULL) << 24) | + ((fieldB & 0xFFFF0000000000ULL) >> 24) | ((fieldB & 0xFFFF00ULL) >> 8); + } + } + else + { + // No alpha channel present, copy image to the output buffer + alphaMask = (((PNGU_u64)default_alpha) << 56) | (((PNGU_u64)default_alpha) << 40) | + (((PNGU_u64)default_alpha) << 24) | (((PNGU_u64)default_alpha) << 8); + + for (y = 0; y < qheight; y++) + for (x = 0; x < qwidth; x++) + { + int blockbase = (y * qwidth + x) * 8; + + PNGU_u64 field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4]+x*12)); + PNGU_u64 field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase] = + (((field64 & 0xFF00000000000000ULL) >> 8) | (field64 & 0xFF00000000ULL) | + ((field64 & 0xFF00ULL) << 8) | ((field32 & 0xFF0000ULL) >> 16) | alphaMask); + ((PNGU_u64 *) buffer)[blockbase+4] = + (((field64 & 0xFFFF0000000000ULL) << 8) | ((field64 & 0xFFFF0000ULL) << 16) | + ((field64 & 0xFFULL) << 24) | ((field32 & 0xFF000000ULL) >> 8) | (field32 & 0xFFFFULL)); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+1]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+1]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+1] = + (((field64 & 0xFF00000000000000ULL) >> 8) | (field64 & 0xFF00000000ULL) | + ((field64 & 0xFF00ULL) << 8) | ((field32 & 0xFF0000ULL) >> 16) | alphaMask); + ((PNGU_u64 *) buffer)[blockbase+5] = + (((field64 & 0xFFFF0000000000ULL) << 8) | ((field64 & 0xFFFF0000ULL) << 16) | + ((field64 & 0xFFULL) << 24) | ((field32 & 0xFF000000ULL) >> 8) | (field32 & 0xFFFFULL)); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+2]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+2]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+2] = + (((field64 & 0xFF00000000000000ULL) >> 8) | (field64 & 0xFF00000000ULL) | + ((field64 & 0xFF00ULL) << 8) | ((field32 & 0xFF0000ULL) >> 16) | alphaMask); + ((PNGU_u64 *) buffer)[blockbase+6] = + (((field64 & 0xFFFF0000000000ULL) << 8) | ((field64 & 0xFFFF0000ULL) << 16) | + ((field64 & 0xFFULL) << 24) | ((field32 & 0xFF000000ULL) >> 8) | (field32 & 0xFFFFULL)); + + field64 = *((PNGU_u64 *)(ctx->row_pointers[y*4+3]+x*12)); + field32 = (PNGU_u64) *((PNGU_u32 *)(ctx->row_pointers[y*4+3]+x*12+8)); + ((PNGU_u64 *) buffer)[blockbase+3] = + (((field64 & 0xFF00000000000000ULL) >> 8) | (field64 & 0xFF00000000ULL) | + ((field64 & 0xFF00ULL) << 8) | ((field32 & 0xFF0000ULL) >> 16) | alphaMask); + ((PNGU_u64 *) buffer)[blockbase+7] = + (((field64 & 0xFFFF0000000000ULL) << 8) | ((field64 & 0xFFFF0000ULL) << 16) | + ((field64 & 0xFFULL) << 24) | ((field32 & 0xFF000000ULL) >> 8) | (field32 & 0xFFFFULL)); + } + } + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + + // Success + return PNGU_OK; +} + + +int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride) +{ + png_uint_32 rowbytes; + PNGU_u32 x, y, buffWidth; + + // Erase from the context any readed info + pngu_free_info (ctx); + ctx->propRead = 0; + + // Check if the user has selected a file to write the image + if (ctx->source == PNGU_SOURCE_BUFFER); + + else if (ctx->source == PNGU_SOURCE_DEVICE) + { + // Open file + if (!(ctx->fd = fopen (ctx->filename, "wb"))) + return PNGU_CANT_OPEN_FILE; + } + + else + return PNGU_NO_FILE_SELECTED; + + // Allocation of libpng structs + ctx->png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!(ctx->png_ptr)) + { + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + return PNGU_LIB_ERROR; + } + + ctx->info_ptr = png_create_info_struct (ctx->png_ptr); + if (!(ctx->info_ptr)) + { + png_destroy_write_struct (&(ctx->png_ptr), (png_infopp)NULL); + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + return PNGU_LIB_ERROR; + } + + if (ctx->source == PNGU_SOURCE_BUFFER) + { + // Installation of our custom data writer function + ctx->cursor = 0; + png_set_write_fn (ctx->png_ptr, ctx, pngu_write_data_to_buffer, pngu_flush_data_to_buffer); + } + else if (ctx->source == PNGU_SOURCE_DEVICE) + { + // Default data writer uses function fwrite, so it needs to use our FILE* + png_init_io (ctx->png_ptr, ctx->fd); + } + + // Setup output file properties + png_set_IHDR (ctx->png_ptr, ctx->info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); + + // Allocate memory to store the image in RGB format + rowbytes = width * 3; + if (rowbytes % 4) + rowbytes = ((rowbytes / 4) + 1) * 4; // Add extra padding so each row starts in a 4 byte boundary + + ctx->img_data = malloc (rowbytes * height); + if (!ctx->img_data) + { + png_destroy_write_struct (&(ctx->png_ptr), (png_infopp)NULL); + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + return PNGU_LIB_ERROR; + } + + ctx->row_pointers = malloc (sizeof (png_bytep) * height); + if (!ctx->row_pointers) + { + png_destroy_write_struct (&(ctx->png_ptr), (png_infopp)NULL); + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + return PNGU_LIB_ERROR; + } + + // Encode YCbYCr image into RGB8 format + buffWidth = (width + stride) / 2; + for (y = 0; y < height; y++) + { + ctx->row_pointers[y] = ctx->img_data + (y * rowbytes); + + for (x = 0; x < (width / 2); x++) + PNGU_YCbYCr_TO_RGB8 ( ((PNGU_u32 *)buffer)[y*buffWidth+x], + ((PNGU_u8 *) ctx->row_pointers[y]+x*6), ((PNGU_u8 *) ctx->row_pointers[y]+x*6+1), + ((PNGU_u8 *) ctx->row_pointers[y]+x*6+2), ((PNGU_u8 *) ctx->row_pointers[y]+x*6+3), + ((PNGU_u8 *) ctx->row_pointers[y]+x*6+4), ((PNGU_u8 *) ctx->row_pointers[y]+x*6+5) ); + } + + // Tell libpng where is our image data + png_set_rows (ctx->png_ptr, ctx->info_ptr, ctx->row_pointers); + + // Write file header and image data + png_write_png (ctx->png_ptr, ctx->info_ptr, PNG_TRANSFORM_IDENTITY, NULL); + + // Tell libpng we have no more data to write + png_write_end (ctx->png_ptr, (png_infop) NULL); + + // Free resources + free (ctx->img_data); + free (ctx->row_pointers); + png_destroy_write_struct (&(ctx->png_ptr), &(ctx->info_ptr)); + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + + // Success + return PNGU_OK; +} + + +// This function is taken from a libogc example +PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2) +{ + int y1, cb1, cr1, y2, cb2, cr2, cb, cr; + + y1 = (299 * r1 + 587 * g1 + 114 * b1) / 1000; + cb1 = (-16874 * r1 - 33126 * g1 + 50000 * b1 + 12800000) / 100000; + cr1 = (50000 * r1 - 41869 * g1 - 8131 * b1 + 12800000) / 100000; + + y2 = (299 * r2 + 587 * g2 + 114 * b2) / 1000; + cb2 = (-16874 * r2 - 33126 * g2 + 50000 * b2 + 12800000) / 100000; + cr2 = (50000 * r2 - 41869 * g2 - 8131 * b2 + 12800000) / 100000; + + cb = (cb1 + cb2) >> 1; + cr = (cr1 + cr2) >> 1; + + return (PNGU_u32) ((y1 << 24) | (cb << 16) | (y2 << 8) | cr); +} + + +void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2) +{ + PNGU_u8 *val = (PNGU_u8 *) &ycbycr; + int r, g, b; + + r = 1.371f * (val[3] - 128); + g = - 0.698f * (val[3] - 128) - 0.336f * (val[1] - 128); + b = 1.732f * (val[1] - 128); + + *r1 = pngu_clamp (val[0] + r, 0, 255); + *g1 = pngu_clamp (val[0] + g, 0, 255); + *b1 = pngu_clamp (val[0] + b, 0, 255); + + *r2 = pngu_clamp (val[2] + r, 0, 255); + *g2 = pngu_clamp (val[2] + g, 0, 255); + *b2 = pngu_clamp (val[2] + b, 0, 255); +} + + +int pngu_info (IMGCTX ctx) +{ + png_byte magic[8]; + png_uint_32 width; + png_uint_32 height; + png_color_16p background; + png_bytep trans; + png_color_16p trans_values; + int scale, i; + + // Check if there is a file selected and if it is a valid .png + if (ctx->source == PNGU_SOURCE_BUFFER) + memcpy (magic, ctx->buffer, 8); + + else if (ctx->source == PNGU_SOURCE_DEVICE) + { + // Open file + if (!(ctx->fd = fopen (ctx->filename, "rb"))) + return PNGU_CANT_OPEN_FILE; + + // Load first 8 bytes into magic buffer + if (fread (magic, 1, 8, ctx->fd) != 8) + { + fclose (ctx->fd); + return PNGU_CANT_READ_FILE; + } + } + + else + return PNGU_NO_FILE_SELECTED;; + + if (png_sig_cmp(magic, 0, 8) != 0) + { + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + return PNGU_FILE_IS_NOT_PNG; + } + + // Allocation of libpng structs + ctx->png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!(ctx->png_ptr)) + { + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + return PNGU_LIB_ERROR; + } + + ctx->info_ptr = png_create_info_struct (ctx->png_ptr); + if (!(ctx->info_ptr)) + { + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + png_destroy_read_struct (&(ctx->png_ptr), (png_infopp)NULL, (png_infopp)NULL); + return PNGU_LIB_ERROR; + } + + if (ctx->source == PNGU_SOURCE_BUFFER) + { + // Installation of our custom data provider function + ctx->cursor = 0; + png_set_read_fn (ctx->png_ptr, ctx, pngu_read_data_from_buffer); + } + else if (ctx->source == PNGU_SOURCE_DEVICE) + { + // Default data provider uses function fread, so it needs to use our FILE* + png_init_io (ctx->png_ptr, ctx->fd); + png_set_sig_bytes (ctx->png_ptr, 8); // We have read 8 bytes already to check PNG authenticity + } + + // Read png header + png_read_info (ctx->png_ptr, ctx->info_ptr); + + // Query image properties if they have not been queried before + if (!ctx->propRead) + { + png_get_IHDR(ctx->png_ptr, ctx->info_ptr, &width, &height, + (int *) &(ctx->prop.imgBitDepth), + (int *) &(ctx->prop.imgColorType), + NULL, NULL, NULL); + + ctx->prop.imgWidth = width; + ctx->prop.imgHeight = height; + switch (ctx->prop.imgColorType) + { + case PNG_COLOR_TYPE_GRAY: + ctx->prop.imgColorType = PNGU_COLOR_TYPE_GRAY; + break; + case PNG_COLOR_TYPE_GRAY_ALPHA: + ctx->prop.imgColorType = PNGU_COLOR_TYPE_GRAY_ALPHA; + break; + case PNG_COLOR_TYPE_PALETTE: + ctx->prop.imgColorType = PNGU_COLOR_TYPE_PALETTE; + break; + case PNG_COLOR_TYPE_RGB: + ctx->prop.imgColorType = PNGU_COLOR_TYPE_RGB; + break; + case PNG_COLOR_TYPE_RGB_ALPHA: + ctx->prop.imgColorType = PNGU_COLOR_TYPE_RGB_ALPHA; + break; + default: + ctx->prop.imgColorType = PNGU_COLOR_TYPE_UNKNOWN; + break; + } + + // Constant used to scale 16 bit values to 8 bit values + scale = 1; + if (ctx->prop.imgBitDepth == 16) + scale = 256; + + // Query background color, if any. + ctx->prop.validBckgrnd = 0; + if (((ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA)) && + (png_get_bKGD (ctx->png_ptr, ctx->info_ptr, &background))) + { + ctx->prop.validBckgrnd = 1; + ctx->prop.bckgrnd.r = background->red / scale; + ctx->prop.bckgrnd.g = background->green / scale; + ctx->prop.bckgrnd.b = background->blue / scale; + } + else if (((ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA)) && + (png_get_bKGD (ctx->png_ptr, ctx->info_ptr, &background))) + { + ctx->prop.validBckgrnd = 1; + ctx->prop.bckgrnd.r = ctx->prop.bckgrnd.g = ctx->prop.bckgrnd.b = background->gray / scale; + } + + // Query list of transparent colors, if any. + ctx->prop.numTrans = 0; + ctx->prop.trans = NULL; + if (((ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA)) && + (png_get_tRNS (ctx->png_ptr, ctx->info_ptr, &trans, (int *) &(ctx->prop.numTrans), &trans_values))) + { + if (ctx->prop.numTrans) + { + ctx->prop.trans = malloc (sizeof (PNGUCOLOR) * ctx->prop.numTrans); + if (ctx->prop.trans) + for (i = 0; i < ctx->prop.numTrans; i++) + { + ctx->prop.trans[i].r = trans_values[i].red / scale; + ctx->prop.trans[i].g = trans_values[i].green / scale; + ctx->prop.trans[i].b = trans_values[i].blue / scale; + } + else + ctx->prop.numTrans = 0; + } + } + else if (((ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA)) && + (png_get_tRNS (ctx->png_ptr, ctx->info_ptr, &trans, (int *) &(ctx->prop.numTrans), &trans_values))) + { + if (ctx->prop.numTrans) + { + ctx->prop.trans = malloc (sizeof (PNGUCOLOR) * ctx->prop.numTrans); + if (ctx->prop.trans) + for (i = 0; i < ctx->prop.numTrans; i++) + ctx->prop.trans[i].r = ctx->prop.trans[i].g = ctx->prop.trans[i].b = + trans_values[i].gray / scale; + else + ctx->prop.numTrans = 0; + } + } + + ctx->propRead = 1; + } + + // Success + ctx->infoRead = 1; + + return PNGU_OK; +} + + +int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlpha) +{ + png_uint_32 rowbytes; + int i; + + // Read info if it hasn't been read before + if (!ctx->infoRead) + { + i = pngu_info (ctx); + if (i != PNGU_OK) + return i; + } + + // Check if the user has specified the real width and height of the image + if ( (ctx->prop.imgWidth != width) || (ctx->prop.imgHeight != height) ) + return PNGU_INVALID_WIDTH_OR_HEIGHT; + + // Check if color type is supported by PNGU + if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_PALETTE) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_UNKNOWN) ) + return PNGU_UNSUPPORTED_COLOR_TYPE; + + // Scale 16 bit samples to 8 bit + if (ctx->prop.imgBitDepth == 16) + png_set_strip_16 (ctx->png_ptr); + + // Remove alpha channel if we don't need it + if (stripAlpha && ((ctx->prop.imgColorType == PNGU_COLOR_TYPE_RGB_ALPHA) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA))) + png_set_strip_alpha (ctx->png_ptr); + + // Expand 1, 2 and 4 bit samples to 8 bit + if (ctx->prop.imgBitDepth < 8) + png_set_packing (ctx->png_ptr); + + // Transform grayscale images to RGB + if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_GRAY_ALPHA) ) + png_set_gray_to_rgb (ctx->png_ptr); + + // Flush transformations + png_read_update_info (ctx->png_ptr, ctx->info_ptr); + + // Allocate memory to store the image + rowbytes = png_get_rowbytes (ctx->png_ptr, ctx->info_ptr); + if (rowbytes % 4) + rowbytes = ((rowbytes / 4) + 1) * 4; // Add extra padding so each row starts in a 4 byte boundary + + ctx->img_data = malloc (rowbytes * ctx->prop.imgHeight); + if (!ctx->img_data) + { + pngu_free_info (ctx); + return PNGU_LIB_ERROR; + } + + ctx->row_pointers = malloc (sizeof (png_bytep) * ctx->prop.imgHeight); + if (!ctx->row_pointers) + { + free (ctx->img_data); + pngu_free_info (ctx); + return PNGU_LIB_ERROR; + } + + for (i = 0; i < ctx->prop.imgHeight; i++) + ctx->row_pointers[i] = ctx->img_data + (i * rowbytes); + + // Transform the image and copy it to our allocated memory + png_read_image (ctx->png_ptr, ctx->row_pointers); + + // Free resources + pngu_free_info (ctx); + + // Success + return PNGU_OK; +} + + +void pngu_free_info (IMGCTX ctx) +{ + if (ctx->infoRead) + { + if (ctx->source == PNGU_SOURCE_DEVICE) + fclose (ctx->fd); + + png_destroy_read_struct (&(ctx->png_ptr), &(ctx->info_ptr), (png_infopp)NULL); + + ctx->infoRead = 0; + } +} + + +// Custom data provider function used for reading from memory buffers. +void pngu_read_data_from_buffer (png_structp png_ptr, png_bytep data, png_size_t length) +{ + IMGCTX ctx = (IMGCTX) png_get_io_ptr (png_ptr); + memcpy (data, ctx->buffer + ctx->cursor, length); + ctx->cursor += length; +} + + +// Custom data writer function used for writing to memory buffers. +void pngu_write_data_to_buffer (png_structp png_ptr, png_bytep data, png_size_t length) +{ + IMGCTX ctx = (IMGCTX) png_get_io_ptr (png_ptr); + memcpy (ctx->buffer + ctx->cursor, data, length); + ctx->cursor += length; +} + + +// Custom data flusher function used for writing to memory buffers. +void pngu_flush_data_to_buffer (png_structp png_ptr) +{ + // Nothing to do here +} + + +// Function used in YCbYCr to RGB decoding +int pngu_clamp (int value, int min, int max) +{ + if (value < min) + value = min; + else if (value > max) + value = max; + + return value; +} + diff --git a/source/libpng/pngu/pngu.h b/source/libpng/pngu/pngu.h new file mode 100644 index 0000000..b5e172b --- /dev/null +++ b/source/libpng/pngu/pngu.h @@ -0,0 +1,171 @@ +/******************************************************************************************** + +PNGU Version : 0.2a + +Coder : frontier + +More info : http://frontier-dev.net + +********************************************************************************************/ +#ifndef __PNGU__ +#define __PNGU__ + +// Return codes +#define PNGU_OK 0 +#define PNGU_ODD_WIDTH 1 +#define PNGU_ODD_STRIDE 2 +#define PNGU_INVALID_WIDTH_OR_HEIGHT 3 +#define PNGU_FILE_IS_NOT_PNG 4 +#define PNGU_UNSUPPORTED_COLOR_TYPE 5 +#define PNGU_NO_FILE_SELECTED 6 +#define PNGU_CANT_OPEN_FILE 7 +#define PNGU_CANT_READ_FILE 8 +#define PNGU_LIB_ERROR 9 + +// Color types +#define PNGU_COLOR_TYPE_GRAY 1 +#define PNGU_COLOR_TYPE_GRAY_ALPHA 2 +#define PNGU_COLOR_TYPE_PALETTE 3 +#define PNGU_COLOR_TYPE_RGB 4 +#define PNGU_COLOR_TYPE_RGB_ALPHA 5 +#define PNGU_COLOR_TYPE_UNKNOWN 6 + + +#ifdef __cplusplus + extern "C" { +#endif + +// Types +typedef unsigned char PNGU_u8; +typedef unsigned short PNGU_u16; +typedef unsigned int PNGU_u32; +typedef unsigned long long PNGU_u64; + +typedef struct +{ + PNGU_u8 r; + PNGU_u8 g; + PNGU_u8 b; +} PNGUCOLOR; + +typedef struct +{ + PNGU_u32 imgWidth; // In pixels + PNGU_u32 imgHeight; // In pixels + PNGU_u32 imgBitDepth; // In bitx + PNGU_u32 imgColorType; // PNGU_COLOR_TYPE_* + PNGU_u32 validBckgrnd; // Non zero if there is a background color + PNGUCOLOR bckgrnd; // Backgroun color + PNGU_u32 numTrans; // Number of transparent colors + PNGUCOLOR *trans; // Transparent colors +} PNGUPROP; + +// Image context, always initialize with SelectImageFrom* and free with ReleaseImageContext +struct _IMGCTX; +typedef struct _IMGCTX *IMGCTX; + + +/**************************************************************************** +* Pixel conversion * +****************************************************************************/ + +// Macro to convert RGB8 values to RGB565 +#define PNGU_RGB8_TO_RGB565(r,g,b) ( ((((PNGU_u16) r) & 0xF8U) << 8) | ((((PNGU_u16) g) & 0xFCU) << 3) | (((PNGU_u16) b) >> 3) ) + +// Macro to convert RGBA8 values to RGB5A3 +#define PNGU_RGB8_TO_RGB5A3(r,g,b,a) (PNGU_u16) (((a & 0xE0U) == 0xE0U) ? \ + (0x8000U | ((((PNGU_u16) r) & 0xF8U) << 7) | ((((PNGU_u16) g) & 0xF8U) << 2) | (((PNGU_u16) b) >> 3)) : \ + (((((PNGU_u16) a) & 0xE0U) << 7) | ((((PNGU_u16) r) & 0xF0U) << 4) | (((PNGU_u16) g) & 0xF0U) | ((((PNGU_u16) b) & 0xF0U) >> 4))) + +// Function to convert two RGB8 values to YCbYCr +PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2); + +// Function to convert an YCbYCr to two RGB8 values. +void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2); + + +/**************************************************************************** +* Image context handling * +****************************************************************************/ + +// Selects a PNG file, previosly loaded into a buffer, and creates an image context for subsequent procesing. +IMGCTX PNGU_SelectImageFromBuffer (const void *buffer); + +// Selects a PNG file, from any devoptab device, and creates an image context for subsequent procesing. +IMGCTX PNGU_SelectImageFromDevice (const char *filename); + +// Frees resources associated with an image context. Always call this function when you no longer need the IMGCTX. +void PNGU_ReleaseImageContext (IMGCTX ctx); + + +/**************************************************************************** +* Miscelaneous * +****************************************************************************/ + +// Retrieves info from selected PNG file, including image dimensions, color format, background and transparency colors. +int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties); + + +/**************************************************************************** +* Image conversion * +****************************************************************************/ + +// Expands selected image into an YCbYCr buffer. You need to specify context, image dimensions, +// destination address and stride in pixels (stride = buffer width - image width). +int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride); + +// Macro for decoding an image inside a buffer at given coordinates. +#define PNGU_DECODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \ + \ + PNGU_DecodeToYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ + (coordX) * 2, (bufferWidth) - (imgWidth)) + +// Expands selected image into a linear RGB565 buffer. You need to specify context, image dimensions, +// destination address and stride in pixels (stride = buffer width - image width). +int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride); + +// Macro for decoding an image inside a buffer at given coordinates. +#define PNGU_DECODE_TO_COORDS_RGB565(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \ + \ + PNGU_DecodeToRGB565 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ + (coordX) * 2, (bufferWidth) - (imgWidth)) + +// Expands selected image into a linear RGBA8 buffer. You need to specify context, image dimensions, +// destination address, stride in pixels and default alpha value, which is used if the source image +// doesn't have an alpha channel. +int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha); + +// Macro for decoding an image inside a buffer at given coordinates. +#define PNGU_DECODE_TO_COORDS_RGBA8(ctx,coordX,coordY,imgWidth,imgHeight,default_alpha,bufferWidth,bufferHeight,buffer) \ + \ + PNGU_DecodeToRGBA8 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ + (coordX) * 2, (bufferWidth) - (imgWidth), default_alpha) + +// Expands selected image into a 4x4 tiled RGB565 buffer. You need to specify context, image dimensions +// and destination address. +int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer); + +// Expands selected image into a 4x4 tiled RGB5A3 buffer. You need to specify context, image dimensions, +// destination address and default alpha value, which is used if the source image doesn't have an alpha channel. +int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha); + +// Expands selected image into a 4x4 tiled RGBA8 buffer. You need to specify context, image dimensions, +// destination address and default alpha value, which is used if the source image doesn't have an alpha channel. +int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha); + +// Encodes an YCbYCr image in PNG format and stores it in the selected device or memory buffer. You need to +// specify context, image dimensions, destination address and stride in pixels (stride = buffer width - image width). +int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride); + +// Macro for encoding an image stored into an YCbYCr buffer at given coordinates. +#define PNGU_ENCODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \ + \ + PNGU_EncodeFromYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ + (coordX) * 2, (bufferWidth) - (imgWidth)) + +#ifdef __cplusplus + } +#endif + +#endif + diff --git a/source/ngc/button_mapping.c b/source/ngc/button_mapping.c index bdea889..d6d8528 100644 --- a/source/ngc/button_mapping.c +++ b/source/ngc/button_mapping.c @@ -1,3 +1,14 @@ +/**************************************************************************** + * Snes9x 1.50 + * + * Nintendo Wii/Gamecube Port + * michniewski August 2008 + * + * button_mapping.c + * + * Controller button mapping + ****************************************************************************/ + #include #include #include @@ -13,156 +24,95 @@ * used for identifying which buttons have been pressed when configuring * and for displaying the name of said button ***/ -//CtrlrMap ctrlr_def[4]; -CtrlrMap ctrlr_def[4] = { +CtrlrMap ctrlr_def[4] = { // Nunchuk btn def -CTRLR_NUNCHUK, -13, -WPAD_BUTTON_DOWN, "DOWN", -WPAD_BUTTON_UP, "UP", -WPAD_BUTTON_LEFT, "LEFT", -WPAD_BUTTON_RIGHT, "RIGHT", -WPAD_BUTTON_A, "A", -WPAD_BUTTON_B, "B", -WPAD_BUTTON_1, "1", -WPAD_BUTTON_2, "2", -WPAD_BUTTON_PLUS, "PLUS", -WPAD_BUTTON_MINUS, "MINUS", -WPAD_BUTTON_HOME, "HOME", -WPAD_NUNCHUK_BUTTON_Z, "Z", -WPAD_NUNCHUK_BUTTON_C, "C", -0, "", -0, "", +{ + CTRLR_NUNCHUK, + 13, + { + {WPAD_BUTTON_DOWN, "DOWN"}, + {WPAD_BUTTON_UP, "UP"}, + {WPAD_BUTTON_LEFT, "LEFT"}, + {WPAD_BUTTON_RIGHT, "RIGHT"}, + {WPAD_BUTTON_A, "A"}, + {WPAD_BUTTON_B, "B"}, + {WPAD_BUTTON_1, "1"}, + {WPAD_BUTTON_2, "2"}, + {WPAD_BUTTON_PLUS, "PLUS"}, + {WPAD_BUTTON_MINUS, "MINUS"}, + {WPAD_BUTTON_HOME, "HOME"}, + {WPAD_NUNCHUK_BUTTON_Z, "Z"}, + {WPAD_NUNCHUK_BUTTON_C, "C"}, + {0, ""}, + {0, ""} + } +}, // Classic btn def -CTRLR_CLASSIC, -15, -WPAD_CLASSIC_BUTTON_DOWN, "DOWN", -WPAD_CLASSIC_BUTTON_UP, "UP", -WPAD_CLASSIC_BUTTON_LEFT, "LEFT", -WPAD_CLASSIC_BUTTON_RIGHT, "RIGHT", -WPAD_CLASSIC_BUTTON_A, "A", -WPAD_CLASSIC_BUTTON_B, "B", -WPAD_CLASSIC_BUTTON_X, "X", -WPAD_CLASSIC_BUTTON_Y, "Y", -WPAD_CLASSIC_BUTTON_PLUS, "PLUS", -WPAD_CLASSIC_BUTTON_MINUS, "MINUS", -WPAD_CLASSIC_BUTTON_HOME, "HOME", -WPAD_CLASSIC_BUTTON_FULL_L, "L TRIG", -WPAD_CLASSIC_BUTTON_FULL_R, "R TRIG", -WPAD_CLASSIC_BUTTON_ZL, "ZL", -WPAD_CLASSIC_BUTTON_ZR, "ZR", -// Gamecube controller btn def -CTRLR_GCPAD, -13, -PAD_BUTTON_DOWN, "DOWN", -PAD_BUTTON_UP, "UP", -PAD_BUTTON_LEFT, "LEFT", -PAD_BUTTON_RIGHT, "RIGHT", -PAD_BUTTON_A, "A", -PAD_BUTTON_B, "B", -PAD_BUTTON_X, "X", -PAD_BUTTON_Y, "Y", -PAD_BUTTON_MENU, "MENU", -PAD_BUTTON_START, "START", -PAD_TRIGGER_L, "L TRIG", -PAD_TRIGGER_R, "R TRIG", -PAD_TRIGGER_Z, "Z", -0, "", -0, "", +{ + CTRLR_CLASSIC, + 15, + { + {WPAD_CLASSIC_BUTTON_DOWN, "DOWN"}, + {WPAD_CLASSIC_BUTTON_UP, "UP"}, + {WPAD_CLASSIC_BUTTON_LEFT, "LEFT"}, + {WPAD_CLASSIC_BUTTON_RIGHT, "RIGHT"}, + {WPAD_CLASSIC_BUTTON_A, "A"}, + {WPAD_CLASSIC_BUTTON_B, "B"}, + {WPAD_CLASSIC_BUTTON_X, "X"}, + {WPAD_CLASSIC_BUTTON_Y, "Y"}, + {WPAD_CLASSIC_BUTTON_PLUS, "PLUS"}, + {WPAD_CLASSIC_BUTTON_MINUS, "MINUS"}, + {WPAD_CLASSIC_BUTTON_HOME, "HOME"}, + {WPAD_CLASSIC_BUTTON_FULL_L, "L TRIG"}, + {WPAD_CLASSIC_BUTTON_FULL_R, "R TRIG"}, + {WPAD_CLASSIC_BUTTON_ZL, "ZL"}, + {WPAD_CLASSIC_BUTTON_ZR, "ZR"} + } +}, +// Gamecube controller btn def +{ + CTRLR_GCPAD, + 13, + { + {PAD_BUTTON_DOWN, "DOWN"}, + {PAD_BUTTON_UP, "UP"}, + {PAD_BUTTON_LEFT, "LEFT"}, + {PAD_BUTTON_RIGHT, "RIGHT"}, + {PAD_BUTTON_A, "A"}, + {PAD_BUTTON_B, "B"}, + {PAD_BUTTON_X, "X"}, + {PAD_BUTTON_Y, "Y"}, + {PAD_BUTTON_MENU, "MENU"}, + {PAD_BUTTON_START, "START"}, + {PAD_TRIGGER_L, "L TRIG"}, + {PAD_TRIGGER_R, "R TRIG"}, + {PAD_TRIGGER_Z, "Z"}, + {0, ""}, + {0, ""} + } +}, // Wiimote btn def -CTRLR_WIIMOTE, -11, -WPAD_BUTTON_DOWN, "DOWN", -WPAD_BUTTON_UP, "UP", -WPAD_BUTTON_LEFT, "LEFT", -WPAD_BUTTON_RIGHT, "RIGHT", -WPAD_BUTTON_A, "A", -WPAD_BUTTON_B, "B", -WPAD_BUTTON_1, "1", -WPAD_BUTTON_2, "2", -WPAD_BUTTON_PLUS, "PLUS", -WPAD_BUTTON_MINUS, "MINUS", -WPAD_BUTTON_HOME, "HOME", -0, "", -0, "", -0, "", -0, "" +{ + CTRLR_WIIMOTE, + 11, + { + {WPAD_BUTTON_DOWN, "DOWN"}, + {WPAD_BUTTON_UP, "UP"}, + {WPAD_BUTTON_LEFT, "LEFT"}, + {WPAD_BUTTON_RIGHT, "RIGHT"}, + {WPAD_BUTTON_A, "A"}, + {WPAD_BUTTON_B, "B"}, + {WPAD_BUTTON_1, "1"}, + {WPAD_BUTTON_2, "2"}, + {WPAD_BUTTON_PLUS, "PLUS"}, + {WPAD_BUTTON_MINUS, "MINUS"}, + {WPAD_BUTTON_HOME, "HOME"}, + {0, ""}, + {0, ""}, + {0, ""}, + {0, ""} + } + } }; -/*** -* Default controller maps -* button press on left, and corresponding snes button on right -* arguably some data is unnecessary here but lets stick to one struct type ok? - -CtrlrMap defaultmap[4]; -// Nunchuk Default -defaultmap[0].type = CTRLR_NUNCHUK; -defaultmap[0].num_btns = 12; -defaultmap[0].map[] = { WPAD_BUTTON_A, "A", - WPAD_BUTTON_B, "B", - WPAD_NUNCHUK_BUTTON_C, "X", - WPAD_NUNCHUK_BUTTON_Z, "Y", - WPAD_BUTTON_MINUS, "L", - WPAD_BUTTON_PLUS, "R", - WPAD_BUTTON_2, "SELECT", - WPAD_BUTTON_1, "START", - WPAD_BUTTON_UP, "UP", - WPAD_BUTTON_DOWN, "DOWN", - WPAD_BUTTON_LEFT, "LEFT", - WPAD_BUTTON_RIGHT, "RIGHT" -}; -// Classic Default -defaultmap[1].type = CTRLR_CLASSIC; -defaultmap[1].num_btns = 12; -defaultmap[1].map[] = { WPAD_CLASSIC_BUTTON_A, "A", - WPAD_CLASSIC_BUTTON_B, "B", - WPAD_CLASSIC_BUTTON_Y, "X", - WPAD_CLASSIC_BUTTON_X, "Y", - WPAD_CLASSIC_BUTTON_FULL_L, "L", - WPAD_CLASSIC_BUTTON_FULL_R, "R", - WPAD_CLASSIC_BUTTON_MINUS, "SELECT", - WPAD_CLASSIC_BUTTON_PLUS, "START", - WPAD_CLASSIC_BUTTON_UP, "UP", - WPAD_CLASSIC_BUTTON_DOWN, "DOWN", - WPAD_CLASSIC_BUTTON_LEFT, "LEFT", - WPAD_CLASSIC_BUTTON_RIGHT, "RIGHT" -}; -// Gamecube Controller Default -defaultmap[2].type = CTRLR_GCPAD; -defaultmap[2].num_btns = 12; -defaultmap[2].map[] = {PAD_BUTTON_A, "A", - PAD_BUTTON_B, "B", - PAD_BUTTON_X, "X", - PAD_BUTTON_Y, "Y", - PAD_TRIGGER_L, "L", - PAD_TRIGGER_R, "R", - PAD_TRIGGER_Z, "SELECT", - PAD_BUTTON_START, "START", - PAD_BUTTON_UP, "UP", - PAD_BUTTON_DOWN, "DOWN", - PAD_BUTTON_LEFT, "LEFT", - PAD_BUTTON_RIGHT, "RIGHT" -}; -// Wiimote Default -defaultmap[3].type = CTRLR_WIIMOTE; -defaultmap[3].num_btns = 12; -defaultmap[3].map[] = { WPAD_BUTTON_B, "A", - WPAD_BUTTON_2, "B", - WPAD_BUTTON_1, "X", - WPAD_BUTTON_A, "Y", - 0x0000, "L", - 0x0000, "R", - WPAD_BUTTON_MINUS, "SELECT", - WPAD_BUTTON_PLUS, "START", - WPAD_BUTTON_RIGHT, "UP", - WPAD_BUTTON_LEFT, "DOWN", - WPAD_BUTTON_UP, "LEFT", - WPAD_BUTTON_DOWN, "RIGHT" -}; -// end default padmaps -***/ - - - -// eof diff --git a/source/ngc/button_mapping.h b/source/ngc/button_mapping.h index 1df9995..e9b211d 100644 --- a/source/ngc/button_mapping.h +++ b/source/ngc/button_mapping.h @@ -1,3 +1,14 @@ +/**************************************************************************** + * Snes9x 1.50 + * + * Nintendo Wii/Gamecube Port + * michniewski August 2008 + * + * button_mapping.h + * + * Controller button mapping + ****************************************************************************/ + #ifndef BTN_MAP_H #define BTN_MAP_H diff --git a/source/ngc/cheatmgr.cpp b/source/ngc/cheatmgr.cpp index 78e3615..16f95a5 100644 --- a/source/ngc/cheatmgr.cpp +++ b/source/ngc/cheatmgr.cpp @@ -9,13 +9,48 @@ * Cheat handling ****************************************************************************/ -#include "snes9xGx.h" #include "memmap.h" -#include "fileop.h" #include "cheats.h" + +#include "snes9xGx.h" +#include "fileop.h" #include "filesel.h" +#include "smbop.h" +#include "menudraw.h" extern SCheatData Cheat; +extern unsigned char savebuffer[]; + +/**************************************************************************** + * NGCLoadCheatFile + * + * Loads cheat file from save buffer + * Custom version of S9xLoadCheatFile() + ****************************************************************************/ + +bool8 NGCLoadCheatFile (int length) +{ + Cheat.num_cheats = 0; + + uint8 data [28]; + int offset = 0; + + while (offset < length) + { + memcpy (data, savebuffer+offset, 28); + offset += 28; + + Cheat.c [Cheat.num_cheats].enabled = (data [0] & 4) == 0; + Cheat.c [Cheat.num_cheats].byte = data [1]; + Cheat.c [Cheat.num_cheats].address = data [2] | (data [3] << 8) | (data [4] << 16); + Cheat.c [Cheat.num_cheats].saved_byte = data [5]; + Cheat.c [Cheat.num_cheats].saved = (data [0] & 8) != 0; + memmove (Cheat.c [Cheat.num_cheats].name, &data [8], 20); + Cheat.c [Cheat.num_cheats++].name [20] = 0; + } + + return (TRUE); +} /**************************************************************************** * SetupCheats @@ -26,11 +61,12 @@ extern SCheatData Cheat; void SetupCheats() { + char filepath[1024]; + int offset = 0; + S9xInitCheatData (); S9xDeleteCheats (); - char cheatFile[150] = { '\0' }; - int method = GCSettings.SaveMethod; if(method == METHOD_AUTO) @@ -38,14 +74,22 @@ SetupCheats() if(method == METHOD_SD || method == METHOD_USB) { - changeFATInterface(method, NOTSILENT); - sprintf (cheatFile, "%s/snes9x/cheats/%s.cht", ROOTFATDIR, Memory.ROMFilename); + if(ChangeFATInterface(method, NOTSILENT)) + { + sprintf (filepath, "%s/%s/%s.cht", ROOTFATDIR, GCSettings.CheatFolder, Memory.ROMFilename); + offset = LoadBufferFromFAT (filepath, SILENT); + } + } + else if(method == METHOD_SMB) + { + sprintf (filepath, "%s/%s.cht", GCSettings.CheatFolder, Memory.ROMFilename); + offset = LoadBufferFromSMB (filepath, SILENT); } // load cheat file if present - if(strlen(cheatFile) > 0) + if(offset > 0) { - if(S9xLoadCheatFile (cheatFile)) + if(NGCLoadCheatFile (offset)) { // disable all cheats loaded from the file for (uint16 i = 0; i < Cheat.num_cheats; i++) diff --git a/source/ngc/dkpro.h b/source/ngc/dkpro.h deleted file mode 100644 index 718d401..0000000 --- a/source/ngc/dkpro.h +++ /dev/null @@ -1,877 +0,0 @@ -/******************************************************************* - * Image File : /public/dkpro.bmp - * Width : 218 - * Height : 65 - * - * This header contains a compressed Zip image. - * Use zlib1.2.3 uncompress function to restore. - *******************************************************************/ - -#define dkpro_RAW 28340 -#define dkpro_COMPRESSED 6887 -#define dkpro_WIDTH 218 -#define dkpro_HEIGHT 65 - -unsigned char dkpro[6887] = { - 0x78, 0xda, 0xed, 0x9c, 0x67, 0x70, 0x54, 0x57, 0x96, 0xc7, 0xf9, 0xb8, - 0xb5, 0x55, 0xbb, 0x55, - 0x53, 0xb5, 0xb5, 0xb3, 0x9e, 0x31, 0xc6, 0x98, 0x20, 0x31, 0xf6, 0x38, - 0x7b, 0xc6, 0x33, 0x0e, - 0xe3, 0x34, 0x60, 0x03, 0x36, 0xc9, 0x80, 0x49, 0xb6, 0x41, 0x42, 0x59, - 0x42, 0x39, 0x20, 0x75, - 0xbf, 0xd3, 0x92, 0x90, 0x84, 0x32, 0x41, 0x02, 0x11, 0xd4, 0x48, 0xe4, - 0x60, 0x72, 0x0e, 0x22, - 0x98, 0x8c, 0x8d, 0x04, 0x26, 0x83, 0x31, 0xe0, 0xec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e8, 0x0c, 0x8b, - 0x0a, 0x69, 0xf4, 0x7a, 0xc7, 0x58, 0x58, 0xca, 0x1f, 0xa7, 0x94, 0x24, - 0xfd, 0x68, 0xff, 0x46, - 0x2e, 0x6a, 0x7c, 0x85, 0x25, 0x3e, 0x90, 0x06, 0x19, 0x8d, 0xb5, 0x06, - 0xcb, 0x70, 0x79, 0x41, - 0x5e, 0x6c, 0x83, 0x11, 0x32, 0x84, 0xde, 0x61, 0x32, 0x4e, 0x5e, 0xd5, - 0xd6, 0xbd, 0xa4, 0x67, - 0x5e, 0x22, 0x4f, 0x1e, 0x9a, 0x78, 0x4b, 0xca, 0xef, 0x9d, 0x37, 0x24, - 0xdd, 0xe0, 0xbc, 0x21, - 0x31, 0x74, 0x5d, 0xdb, 0xd5, 0xa1, 0xaa, 0x5d, 0x7a, 0x20, 0x9b, 0x85, - 0xcd, 0xea, 0x34, 0x7a, - 0x4d, 0x61, 0x6b, 0xee, 0xe7, 0xc6, 0x67, 0xf2, 0x99, 0x7c, 0x4e, 0xdc, - 0x9c, 0x93, 0x72, 0xe2, - 0x69, 0x08, 0x96, 0x19, 0x75, 0x19, 0x8c, 0xc4, 0x76, 0x03, 0x24, 0x81, - 0xac, 0xf9, 0x9d, 0x7c, - 0x21, 0x9f, 0x69, 0x7c, 0x65, 0x04, 0xaf, 0x34, 0x43, 0xb8, 0x3a, 0xac, - 0x99, 0xdc, 0x21, 0xb9, - 0x6d, 0xdd, 0xd1, 0x35, 0xb5, 0xc3, 0xc4, 0xe6, 0x94, 0xef, 0xed, 0x9f, - 0x88, 0xc2, 0x25, 0x62, - 0xac, 0x51, 0x86, 0x62, 0x89, 0xc8, 0xab, 0xc0, 0x48, 0x79, 0x4e, 0xc6, - 0xca, 0x19, 0xec, 0xf6, - 0xa9, 0x7c, 0x12, 0xc2, 0xcf, 0x05, 0xea, 0x8a, 0x39, 0x35, 0x1d, 0x92, - 0xda, 0xc6, 0x58, 0x97, - 0xc8, 0x23, 0xf2, 0x95, 0xfd, 0x43, 0x51, 0xf8, 0x42, 0x8e, 0x92, 0x0f, - 0x87, 0x73, 0x45, 0x5d, - 0x35, 0x46, 0x92, 0x45, 0x17, 0x90, 0x1d, 0x3f, 0x96, 0x0f, 0x43, 0xf8, - 0x79, 0x60, 0x7c, 0x21, - 0x8d, 0x35, 0x37, 0x27, 0xf9, 0xd7, 0xf6, 0xed, 0x27, 0xee, 0x4e, 0xbd, - 0x64, 0x7f, 0x5f, 0xde, - 0x67, 0xff, 0xfa, 0x5a, 0x56, 0x90, 0x0d, 0x47, 0x4b, 0xec, 0x4f, 0x44, - 0x8c, 0x3c, 0x2f, 0x42, - 0xa4, 0xaa, 0x5a, 0x32, 0x84, 0x6b, 0xc3, 0x87, 0x58, 0xe4, 0x7d, 0xe3, - 0x73, 0x69, 0xf0, 0xb3, - 0x99, 0xaa, 0x15, 0xe7, 0x17, 0x7c, 0x99, 0xf7, 0xae, 0xbc, 0x2b, 0xef, - 0x11, 0x8b, 0x33, 0x89, - 0xb0, 0x38, 0x89, 0xbf, 0x26, 0x44, 0x63, 0x37, 0xb5, 0xcb, 0x85, 0x70, - 0x2d, 0x18, 0x28, 0x47, - 0x88, 0xa1, 0x77, 0x8d, 0x4f, 0xc5, 0xe9, 0x67, 0xb3, 0x9b, 0xa7, 0x66, - 0xc4, 0x7d, 0x61, 0x7f, - 0xdb, 0xf1, 0x16, 0xe7, 0xad, 0xcf, 0x64, 0xaa, 0x44, 0x48, 0xa2, 0x24, - 0x5d, 0x33, 0x12, 0x43, - 0xb8, 0x66, 0x8c, 0x94, 0x63, 0xc4, 0xd1, 0x5b, 0xc6, 0x47, 0x52, 0x6f, - 0xb5, 0x59, 0x75, 0x97, - 0xd4, 0xbf, 0x95, 0x5f, 0x4c, 0xbf, 0x60, 0x9c, 0x97, 0xf3, 0xd8, 0x74, - 0x16, 0x95, 0x44, 0x4a, - 0x08, 0xbf, 0x11, 0x44, 0xc9, 0x6b, 0xf2, 0x96, 0x9c, 0x37, 0x3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x8a, 0xeb, 0x7c, 0xf4, 0x33, 0xd8, 0x47, 0xa2, - 0x40, 0xf8, 0x5a, 0x3f, - 0x7b, 0x9a, 0x43, 0x8c, 0x8e, 0x15, 0xc7, 0xcf, 0x2e, 0x69, 0x5b, 0xe4, - 0xc9, 0x6e, 0xfc, 0xaa, - 0xd9, 0x38, 0x26, 0xd5, 0x6e, 0x9b, 0xdd, 0x34, 0x71, 0x69, 0x6a, 0x8b, - 0x71, 0x80, 0x9c, 0xb9, - 0x5f, 0x8a, 0xd8, 0xcd, 0x8a, 0x2e, 0x8b, 0x62, 0xa0, 0xfe, 0x1d, 0xa7, - 0x33, 0x49, 0xab, 0x7c, - 0x6e, 0xa2, 0x55, 0xda, 0xe3, 0xf9, 0x81, 0x66, 0x78, 0xe7, 0xfd, 0x34, - 0x14, 0xc3, 0xfb, 0x48, - 0x59, 0x21, 0xdf, 0x9a, 0x6b, 0x7d, 0x45, 0x5e, 0xb8, 0x87, 0xd6, 0x60, - 0x34, 0xf3, 0xc8, 0x9c, - 0x1f, 0x11, 0x69, 0x17, 0xdd, 0x50, 0x36, 0x8b, 0xd0, 0x12, 0xa6, 0xd0, - 0xe7, 0xe5, 0xfa, 0x12, - 0x67, 0x9b, 0xfb, 0x89, 0x98, 0x22, 0xdd, 0x97, 0x43, 0xae, 0xb4, 0x4a, - 0x14, 0x1c, 0xad, 0x64, - 0xea, 0x61, 0x78, 0xd2, 0xb8, 0x9f, 0x20, 0x4b, 0xb1, 0x45, 0x2b, 0x97, - 0x87, 0x21, 0x3b, 0xd8, - 0x75, 0x0e, 0x18, 0x87, 0xa5, 0xb2, 0x16, 0x9b, 0x55, 0x87, 0xa5, 0xdc, - 0x56, 0x71, 0x32, 0x75, - 0xaf, 0xec, 0x25, 0xde, 0x97, 0xb2, 0x7e, 0x69, 0x50, 0x94, 0x81, 0x52, - 0x19, 0x2f, 0x25, 0x7a, - 0xad, 0x12, 0x3e, 0x95, 0x92, 0xd1, 0x93, 0xd0, 0xa2, 0xf7, 0x9e, 0x58, - 0xab, 0x74, 0x44, 0x8b, - 0xae, 0x91, 0xbe, 0x33, 0xc6, 0xb9, 0x65, 0x73, 0xcd, 0xf3, 0x8c, 0x08, - 0xbe, 0x8e, 0xff, 0x88, - 0x32, 0x68, 0x44, 0xc1, 0xe1, 0x25, 0x73, 0xad, 0xcf, 0x90, 0xe3, 0x7e, - 0xe8, 0x05, 0xa3, 0x95, - 0x0f, 0x6f, 0xff, 0x72, 0x3f, 0x13, 0x72, 0xd9, 0x4c, 0xd5, 0x91, 0x6a, - 0x6c, 0x06, 0x36, 0xfb, - 0xc6, 0xa4, 0xf3, 0x09, 0x67, 0x9f, 0x07, 0xd0, 0xbd, 0x8b, 0x8a, 0x8d, - 0x4a, 0xe3, 0xfb, 0x2b, - 0xbc, 0x03, 0xf8, 0x23, 0xd6, 0xcf, 0x80, 0x83, 0xc0, 0x72, 0x28, 0xb9, - 0x95, 0xb4, 0xe3, 0x03, - 0x68, 0xa3, 0xc8, 0xad, 0x8f, 0x62, 0xb7, 0x36, 0x4a, 0xff, 0x8d, 0x3e, - 0x4a, 0x89, 0xff, 0x6d, - 0xb2, 0x4f, 0xf6, 0x1a, 0xcd, 0x52, 0xae, 0x6a, 0x90, 0xea, 0xce, 0xa9, - 0x11, 0x25, 0xcd, 0x59, - 0x3b, 0xd9, 0xdb, 0xf7, 0x4b, 0x0d, 0x3b, 0x6c, 0x45, 0x10, 0x54, 0x72, - 0x95, 0xb3, 0x82, 0x50, - 0x31, 0x25, 0xe3, 0xb1, 0x69, 0xd8, 0xab, 0x10, 0xaf, 0x4c, 0x42, 0x2b, - 0xef, 0x9a, 0xf8, 0x5e, - 0x6e, 0x81, 0x97, 0x4a, 0x0d, 0x35, 0xab, 0x4c, 0x7b, 0x49, 0x26, 0xe3, - 0xe3, 0x75, 0xed, 0x36, - 0x86, 0xdc, 0x63, 0xc0, 0x69, 0x99, 0x9b, 0x66, 0x39, 0x1c, 0x15, 0x61, - 0xe5, 0x7c,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x3a, 0xf5, 0xda, 0x22, 0xd9, 0x48, 0xfd, 0xb0, 0x89, 0x99, 0x55, - 0x50, 0x88, 0x25, 0x7f, - 0x96, 0xd2, 0xaa, 0xc6, 0x14, 0xf3, 0x39, 0x85, 0x2a, 0x4c, 0x21, 0x09, - 0xaf, 0x55, 0x3d, 0x13, - 0x98, 0x5f, 0x05, 0xa7, 0x79, 0xcc, 0x4d, 0xd4, 0x3d, 0x63, 0xb0, 0xbb, - 0xb0, 0xef, 0x2f, 0x40, - 0x53, 0x9e, 0xb5, 0xde, 0x26, 0x63, 0x3c, 0xc4, 0xb8, 0x4a, 0xf4, 0x94, - 0x61, 0xd2, 0x48, 0xe4, - 0xd3, 0x58, 0xb4, 0x53, 0xae, 0xf5, 0x1f, 0x47, 0x75, 0x38, 0x50, 0x9e, - 0x05, 0x83, 0xb0, 0x45, - 0xaa, 0xf6, 0xef, 0x5c, 0x72, 0x6c, 0x16, 0xda, 0xf7, 0xd0, 0xb9, 0xc0, - 0x09, 0xe7, 0x2f, 0xd0, - 0xce, 0x40, 0xa2, 0x32, 0x68, 0x8d, 0xc4, 0x2f, 0xce, 0x59, 0xf0, 0x31, - 0x19, 0x55, 0xdd, 0x8d, - 0x48, 0x86, 0xaf, 0x3d, 0x96, 0x79, 0x0a, 0x5f, 0xca, 0x3f, 0xb1, 0x93, - 0xb2, 0x4f, 0xaa, 0x7b, - 0xfd, 0x64, 0x5d, 0x83, 0xd9, 0xb0, 0x4a, 0xae, 0x4c, 0x41, 0xee, 0x32, - 0x56, 0x74, 0xc9, 0x53, - 0x8a, 0xb7, 0xc6, 0xe1, 0xeb, 0x65, 0x48, 0xb1, 0x01, 0x2b, 0x6c, 0x95, - 0x97, 0x64, 0x2a, 0x72, - 0xc5, 0x60, 0xc5, 0x12, 0xfa, 0x27, 0x04, 0xd5, 0x7d, 0x05, 0x9a, 0xdb, - 0x21, 0xdb, 0x8d, 0xbd, - 0x52, 0x8c, 0xcd, 0xc2, 0x67, 0x75, 0x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, 0xef, 0x0d, 0xe8, - 0x25, 0x43, 0x75, 0xa7, 0xc9, 0xe9, 0x51, 0xc6, 0x77, 0x14, 0x75, 0x77, - 0x42, 0xf5, 0x9f, 0xe3, - 0xdc, 0x9f, 0x8a, 0xf6, 0x14, 0x2f, 0x53, 0x91, 0xfa, 0x44, 0x00, 0x6d, - 0x28, 0x7f, 0x5c, 0xcf, - 0xb8, 0x12, 0xb4, 0xe6, 0xd2, 0xb6, 0x3f, 0x6a, 0x64, 0x0d, 0x16, 0xda, - 0x68, 0x6c, 0x93, 0x82, - 0xda, 0x5b, 0x92, 0xba, 0xce, 0x78, 0x2a, 0xea, 0x65, 0xfb, 0x5a, 0xc7, - 0x5a, 0x66, 0xcd, 0x42, - 0x7b, 0x33, 0x03, 0x62, 0x06, 0x5a, 0xcc, 0x90, 0x85, 0xf0, 0xf3, 0x6a, - 0x1b, 0xbc, 0xe6, 0xf3, - 0xdb, 0x59, 0xf9, 0x33, 0x63, 0xa7, 0x63, 0x8b, 0x64, 0xe2, 0xf6, 0xb8, - 0xd9, 0x7e, 0x90, 0x1a, - 0xef, 0x08, 0xd7, 0x41, 0xb3, 0xe5, 0x04, 0xde, 0x93, 0x8e, 0x16, 0x4a, - 0xd0, 0xd1, 0x29, 0xb3, - 0xb5, 0x19, 0xe9, 0xfb, 0x41, 0x61, 0x06, 0x51, 0x92, 0x80, 0xdc, 0x9e, - 0xf6, 0xc3, 0x64, 0xd5, - 0x3f, 0x21, 0xbd, 0xd3, 0xb2, 0xde, 0x21, 0x32, 0xf4, 0xc3, 0x5a, 0x23, - 0x27, 0x2c, 0xf3, 0xcf, - 0xb1, 0x87, 0x75, 0x25, 0x5a, 0x66, 0x42, 0x7f, 0x0c, 0xb9, 0xac, 0xd9, - 0xec, 0x3b, 0xc9, 0x89, - 0x5a, 0x69, 0x78, 0xbb, 0xa5, 0xcd, 0x8a, 0x13, 0xf4, 0x67, 0xe1, 0x71, - 0xb1, 0x16, 0x7a, 0x2e, - 0x99, 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x7d, 0x78, 0x47, 0x0e, 0x36, - 0x19, 0x2a, 0x37, 0xca, - 0x53, 0x16, 0x3e, 0xb6, 0xe3, 0x33, 0x37, 0x63, 0x97, 0x4e, 0xf2, 0x77, - 0xbd, 0xa3, 0x27, 0x92, - 0x93, 0xad, 0x32, 0xed, 0x97, 0xde, 0xfa, 0xe4, 0x9c, 0x8f, 0xd7, 0xcd, - 0xb1, 0xc8, 0xa5, 0xd0, - 0x42, 0x16, 0x2e, 0x64, 0xc7, 0x5a, 0xae, 0x6b, 0x38, 0xaf, 0xc4, 0xd6, - 0x35, 0xd5, 0x3d, 0xce, - 0x55, 0x96, 0xfe, 0x6d, 0x50, 0x4c, 0x93, 0x47, 0x39, 0x07, 0x6e, 0x41, - 0x06, 0xeb, 0x3a, 0xc3, - 0x89, 0xe7, 0x46, 0xad, 0x71, 0x5f, 0x34, 0x62, 0x1d, 0x6c, 0x64, 0xac, - 0x91, 0xbc, 0xda, 0x4e, - 0x89, 0x9d, 0x6a, 0xd3, 0x12, 0x56, 0xda, 0x17, 0x8b, 0xc2, 0x82, 0x20, - 0x98, 0x8f, 0x06, 0x33, - 0x58, 0x73, 0x9d, 0x89, 0x0d, 0xec, 0x7e, 0x0f, 0xc8, 0x7f, 0x53, 0x41, - 0xa7, 0xa2, 0xd7, 0x75, - 0x16, 0xec, 0x92, 0x7b, 0x89, 0x11, 0x55, 0x5d, 0x6c, 0x36, 0xdb, 0xb6, - 0x22, 0x53, 0x7b, 0x64, - 0x9e, 0x82, 0xff, 0x0f, 0x67, 0xc7, 0x6e, 0x32, 0x7b, 0xb6, 0x93, 0xc5, - 0xab, 0xd0, 0x52, 0x2c, - 0xa3, 0xd7, 0xbb, 0xdb, 0x36, 0x52, 0x67, 0x0c, 0xa3, 0x2d, 0x07, 0xcf, - 0xf2, 0xb4, 0x6d, 0xc2, - 0xfb, 0xee, 0x84, 0x8b, 0x22, 0x64, 0xda, 0x64, 0xe1, 0x62, 0x01, 0xb2, - 0x6c, 0x74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x04, 0xd6, 0x86, 0xb6, - 0x96, 0xb1, 0x82, 0x93, 0xba, 0x7f, 0x8a, 0x39, 0x63, 0x0a, 0x55, 0x89, - 0xf7, 0x37, 0x27, 0x27, - 0xb3, 0x09, 0xec, 0xa1, 0x6b, 0x68, 0x33, 0x7c, 0x56, 0xf3, 0xc7, 0x14, - 0x72, 0xea, 0x14, 0xbc, - 0x69, 0xa3, 0x96, 0x64, 0xa9, 0xbe, 0x17, 0x32, 0xd9, 0xec, 0xad, 0x23, - 0x27, 0x4d, 0xa0, 0x67, - 0x03, 0x5e, 0x6f, 0xe5, 0x7a, 0x32, 0x79, 0xb8, 0x37, 0x5c, 0x6c, 0x42, - 0x22, 0x75, 0x77, 0x2d, - 0xcf, 0x6f, 0x8d, 0x5a, 0xf7, 0xb3, 0x6d, 0x17, 0xef, 0x31, 0x50, 0xf9, - 0xb3, 0xfc, 0x0f, 0x7b, - 0x40, 0xb1, 0xae, 0x8e, 0x36, 0xe1, 0x4b, 0xe5, 0x50, 0xf0, 0xae, 0xa3, - 0xf2, 0x7d, 0x8c, 0xae, - 0xd3, 0x14, 0xc5, 0x55, 0xb4, 0xe4, 0xfb, 0xf4, 0x46, 0x41, 0x65, 0xad, - 0xae, 0xba, 0x94, 0xef, - 0x58, 0xf9, 0xa8, 0xa4, 0xbe, 0x5e, 0xaa, 0x69, 0xfa, 0xda, 0xa0, 0x09, - 0x3f, 0xc0, 0x42, 0x46, - 0xbd, 0x8c, 0xc1, 0x66, 0x61, 0x33, 0x1e, 0x8d, 0x72, 0xda, 0x6b, 0x1c, - 0x6a, 0xe6, 0x06, 0xf6, - 0xcd, 0xa6, 0x36, 0xd8, 0x0a, 0x85, 0xd9, 0xac, 0x52, 0xa1, 0xef, 0xe0, - 0x95, 0xeb, 0x3b, 0xb8, - 0x25, 0xc4, 0xd9, 0x62, 0xc6, 0xaf, 0xc5, 0x4b, 0xf2, 0x2c, 0x3d, 0xe5, - 0x50, 0x79, 0x82, 0x1c, - 0xa4,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0xbc, 0x7b, 0x7a, 0x10, - 0x3a, 0x4d, 0xfa, 0xee, 0x6a, 0x46, 0x80, 0xb7, 0x34, 0xd5, 0xfb, 0x8c, - 0xde, 0xdf, 0xb2, 0xf0, - 0xe5, 0xed, 0xac, 0xb2, 0x06, 0x4d, 0xa6, 0x59, 0xc6, 0x67, 0x04, 0x98, - 0x6b, 0xc0, 0x63, 0x12, - 0xba, 0x70, 0xad, 0xb2, 0x8b, 0xbc, 0x19, 0xd9, 0x66, 0x54, 0x0e, 0xb9, - 0x36, 0x01, 0x3f, 0x3b, - 0x08, 0xf6, 0x92, 0xa1, 0x92, 0x2d, 0x7d, 0x99, 0x9c, 0x40, 0x63, 0xc9, - 0x41, 0xe3, 0x65, 0xa4, - 0x7e, 0x27, 0xd1, 0xbb, 0x56, 0x2c, 0x1e, 0xb8, 0x0d, 0x3d, 0x57, 0xe1, - 0x39, 0x5e, 0x8a, 0xd9, - 0xe4, 0x80, 0x06, 0xbd, 0x56, 0x13, 0x76, 0x49, 0x69, 0xc3, 0x4f, 0x36, - 0xb6, 0x99, 0x88, 0x7f, - 0x8c, 0x27, 0x97, 0xa5, 0xb7, 0x91, 0xe9, 0x60, 0xd0, 0xfb, 0xbb, 0x3b, - 0xf5, 0x5d, 0x01, 0x2b, - 0x9d, 0x7e, 0xc4, 0xea, 0x2b, 0xee, 0x19, 0x07, 0xf5, 0x5b, 0x5c, 0xe9, - 0x54, 0x25, 0x99, 0x41, - 0xdf, 0x74, 0x4d, 0xd7, 0xef, 0x7d, 0xa9, 0x7b, 0x45, 0x07, 0x02, 0xae, - 0x73, 0x84, 0xd3, 0x29, - 0x79, 0xdf, 0x28, 0x97, 0xc8, 0xda, 0x2e, 0x09, 0xed, 0xaa, 0xc3, 0x53, - 0xfe, 0x54, 0x51, 0x99, - 0x5a, 0xa8, 0xdf, 0x91, 0x99, 0xab, 0xef, 0x9e, 0xb6, 0x45, 0x0b, 0x56, - 0x9b, 0x43, 0xa5, 0x9c, - 0xae, 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, 0xab, 0x11, - 0xb5, 0x5d, 0x13, 0x5c, - 0xef, 0x11, 0x87, 0x8d, 0xca, 0x34, 0x72, 0x0d, 0xf5, 0xde, 0x73, 0x36, - 0xfd, 0x67, 0x7c, 0x9e, - 0xac, 0x7b, 0x71, 0x12, 0xad, 0x6d, 0x60, 0xbd, 0x7b, 0x24, 0x0c, 0xad, - 0xb7, 0x97, 0x9b, 0xf1, - 0x9c, 0x3a, 0x72, 0x80, 0xaa, 0x38, 0x5c, 0x3b, 0x96, 0x7a, 0xb3, 0x76, - 0xb5, 0xf9, 0xdc, 0xfe, - 0x14, 0x9f, 0x0e, 0xea, 0xea, 0xe5, 0x3e, 0xc6, 0x87, 0x11, 0x59, 0x1d, - 0xe5, 0x46, 0xfe, 0x7d, - 0x8c, 0x91, 0x4b, 0xb1, 0xd1, 0xeb, 0x7e, 0x2b, 0x9d, 0x82, 0xfe, 0x72, - 0x76, 0xb0, 0x74, 0xf7, - 0x3b, 0xd9, 0x8a, 0x5e, 0x11, 0x7e, 0xef, 0xed, 0x3f, 0x46, 0x85, 0x60, - 0x33, 0xfb, 0xb3, 0xc8, - 0xff, 0x4d, 0x50, 0x39, 0x0d, 0xad, 0x83, 0xec, 0x44, 0x19, 0x26, 0x32, - 0xf5, 0xb3, 0x4b, 0xf5, - 0xd4, 0xae, 0xde, 0xa7, 0x6d, 0x2a, 0xb6, 0xf2, 0xd0, 0x3a, 0xce, 0x8e, - 0x53, 0x8f, 0xae, 0xfa, - 0xcb, 0xe3, 0xd8, 0xf2, 0x51, 0xec, 0x34, 0x80, 0xda, 0x60, 0x1f, 0x3d, - 0x2d, 0xfa, 0x59, 0x92, - 0x97, 0x07, 0xab, 0x4c, 0x81, 0xa0, 0x9e, 0x9c, 0x2f, 0xd6, 0xbb, 0xba, - 0x67, 0x46, 0x25, 0xf9, - 0xf2, 0x4c, 0xc0, 0x71, 0x6b, 0xd0, 0xf0, 0x13, 0xd2, 0x15, 0x74, 0x46, - 0x13, 0x37, 0x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dvd.cpp index e44c56c..f306af8 100644 --- a/source/ngc/dvd.cpp +++ b/source/ngc/dvd.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.50 * * Nintendo Gamecube DVD * @@ -12,7 +12,13 @@ #include #include #include + +#include "menudraw.h" #include "snes9xGx.h" +#include "unzip.h" + +extern int offset; +extern int selection; /** DVD I/O Address base **/ volatile unsigned long *dvd = (volatile unsigned long *) 0xCC006000; @@ -21,6 +27,7 @@ volatile unsigned long *dvd = (volatile unsigned long *) 0xCC006000; unsigned char DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32); unsigned char dvdbuffer[2048]; + /** * dvd_driveid * @@ -38,11 +45,11 @@ int dvd_driveid() dvd[5] = 0x80000000; dvd[6] = 0x20; dvd[7] = 3; - + while( dvd[7] & 1 ) ; DCFlushRange((void *)0x80000000, 32); - + return (int)inquiry[2]; } @@ -282,7 +289,7 @@ getentry (int entrycount) } /** - * parsedirectory + * parseDVDdirectory * * This function will parse the directory tree. * It relies on rootdir and rootdirlength being pre-populated by a call to @@ -291,7 +298,7 @@ getentry (int entrycount) * The return value is number of files collected, or 0 on failure. */ int -parsedirectory () +ParseDVDdirectory () { int pdlength; u64 pdoffset; @@ -299,6 +306,9 @@ parsedirectory () int len = 0; int filecount = 0; + // initialize selection + selection = offset = 0; + pdoffset = rdoffset = rootdir; pdlength = rootdirlength; filecount = 0; @@ -326,6 +336,62 @@ parsedirectory () return filecount; } + +/**************************************************************************** + * LoadDVDFile + * This function will load a file from DVD, in BIN, SMD or ZIP format. + * The values for offset and length are inherited from rootdir and + * rootdirlength. + * + * The buffer parameter should re-use the initial ROM buffer. + ****************************************************************************/ + +int +LoadDVDFile (unsigned char *buffer) +{ + int offset; + int blocks; + int i; + u64 discoffset; + char readbuffer[2048]; + + // How many 2k blocks to read + blocks = rootdirlength / 2048; + offset = 0; + discoffset = rootdir; + ShowAction ((char*) "Loading..."); + dvd_read (readbuffer, 2048, discoffset); + + if (!IsZipFile (readbuffer)) + + { + for (i = 0; i < blocks; i++) + + { + dvd_read (readbuffer, 2048, discoffset); + memcpy (buffer + offset, readbuffer, 2048); + offset += 2048; + discoffset += 2048; + } + + /*** And final cleanup ***/ + if (rootdirlength % 2048) + + { + i = rootdirlength % 2048; + dvd_read (readbuffer, 2048, discoffset); + memcpy (buffer + offset, readbuffer, i); + } + } + + else + + { + return UnZipBuffer (buffer, discoffset, 1, NULL); // unzip from dvd + } + return rootdirlength; +} + /**************************************************************************** * uselessinquiry * diff --git a/source/ngc/dvd.h b/source/ngc/dvd.h index f8033b2..a67f3f7 100644 --- a/source/ngc/dvd.h +++ b/source/ngc/dvd.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.50 * * Nintendo Gamecube DVD * @@ -24,14 +24,11 @@ typedef struct extern u64 rootdir; extern int rootdirlength; #define MAXFILES 2000 /** Restrict to 2000 files per dir **/ - -extern int getpvd (); -extern int parsedirectory (); extern FILEENTRIES filelist[MAXFILES]; -int dvd_driveid(); - +int getpvd (); +int ParseDVDdirectory (); +int LoadDVDFile (unsigned char *buffer); int dvd_read (void *dst, unsigned int len, u64 offset); -extern void dvd_motor_off (); #endif diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index 56b0691..1b11e18 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -27,10 +27,10 @@ #include "preferences.h" #include "snes9xGx.h" -extern unsigned char savebuffer[]; -extern char output[16384]; FILE * filehandle; +extern unsigned char savebuffer[]; +extern char output[16384]; extern int offset; extern int selection; extern char currentdir[MAXPATHLEN]; @@ -41,7 +41,7 @@ extern FILEENTRIES filelist[MAXFILES]; * to check whether FAT media are detected. ****************************************************************************/ -bool fat_is_mounted(PARTITION_INTERFACE partition) { +bool FatIsMounted(PARTITION_INTERFACE partition) { char prefix[] = "fatX:/"; prefix[3] = partition + '0'; DIR_ITER *dir = diropen(prefix); @@ -57,7 +57,7 @@ bool fat_is_mounted(PARTITION_INTERFACE partition) { * Checks if the device (method) specified is available, and * sets libfat to use the device ****************************************************************************/ -bool changeFATInterface(int method, bool silent) +bool ChangeFATInterface(int method, bool silent) { bool devFound = false; @@ -66,19 +66,19 @@ bool changeFATInterface(int method, bool silent) // check which SD device is loaded #ifdef HW_RVL - if (fat_is_mounted(PI_INTERNAL_SD)) + if (FatIsMounted(PI_INTERNAL_SD)) { devFound = true; fatSetDefaultInterface(PI_INTERNAL_SD); } #endif - if (!devFound && fat_is_mounted(PI_SDGECKO_A)) + if (!devFound && FatIsMounted(PI_SDGECKO_A)) { devFound = true; fatSetDefaultInterface(PI_SDGECKO_A); } - if(!devFound && fat_is_mounted(PI_SDGECKO_B)) + if(!devFound && FatIsMounted(PI_SDGECKO_B)) { devFound = true; fatSetDefaultInterface(PI_SDGECKO_B); @@ -92,7 +92,7 @@ bool changeFATInterface(int method, bool silent) else if(method == METHOD_USB) { #ifdef HW_RVL - if(fat_is_mounted(PI_USBSTORAGE)) + if(FatIsMounted(PI_USBSTORAGE)) { devFound = true; fatSetDefaultInterface(PI_USBSTORAGE); @@ -108,51 +108,11 @@ bool changeFATInterface(int method, bool silent) return devFound; } -/**************************************************************************** - * fat_enable_readahead_all - ****************************************************************************/ - -void fat_enable_readahead_all() { - int i; - for (i=1; i <= 4; ++i) { - if (fat_is_mounted((PARTITION_INTERFACE)i)) fatEnableReadAhead((PARTITION_INTERFACE)i, 64, 128); - } -} - -/**************************************************************************** - * fat_remount - ****************************************************************************/ - -bool fat_remount(PARTITION_INTERFACE partition) { - //ShowAction("remounting..."); - /* // removed to make usb work... - if (fat_is_mounted(partition)) - { - fatUnmount(partition); - } - */ - - fatMountNormalInterface(partition, 8); - fatSetDefaultInterface(partition); - //fatEnableReadAhead(partition, 64, 128); - - if (fat_is_mounted(partition)) - { - //ShowAction("remount successful."); - sleep(1); - return 1; - } else { - ShowAction("FAT mount failed."); - sleep(1); - return 0; - } -} - /*************************************************************************** * Browse FAT subdirectories ***************************************************************************/ int -parseFATdirectory(int method) +ParseFATdirectory(int method) { int nbfiles = 0; DIR_ITER *fatdir; @@ -225,7 +185,7 @@ LoadFATFile (char *filename, int length) sprintf(filepath, "%s/%s",currentdir,filelist[selection].filename); else { - WaitPrompt((char*) "Maximum Filename Length reached !"); + WaitPrompt((char*) "Maximum filepath length reached!"); return -1; } @@ -236,7 +196,7 @@ LoadFATFile (char *filename, int length) if (IsZipFile (zipbuffer)) { - /*** Unzip the ROM ***/ + // Unzip the ROM size = UnZipBuffer (rbuffer, 0, 0, handle); // unzip from FAT fclose (handle); @@ -244,13 +204,11 @@ LoadFATFile (char *filename, int length) } else { - /*** Just load the file up ***/ + // Just load the file up fseek(handle, 0, SEEK_END); length = ftell(handle); // get filesize fseek(handle, 2048, SEEK_SET); // seek back to point where we left off - - ShowAction ((char *)"Loading..."); memcpy (rbuffer, zipbuffer, 2048); // copy what we already read fread (rbuffer + 2048, 1, length - 2048, handle); fclose (handle); @@ -274,7 +232,7 @@ int LoadBufferFromFAT (char *filepath, bool silent) { FILE *handle; - int offset = 0; + int boffset = 0; int read = 0; handle = fopen (filepath, "rb"); @@ -293,14 +251,14 @@ LoadBufferFromFAT (char *filepath, bool silent) memset (savebuffer, 0, 0x22000); /*** This is really nice, just load the file and decode it ***/ - while ((read = fread (savebuffer + offset, 1, 1024, handle)) > 0) + while ((read = fread (savebuffer + boffset, 1, 1024, handle)) > 0) { - offset += read; + boffset += read; } fclose (handle); - return offset; + return boffset; } /**************************************************************************** diff --git a/source/ngc/fileop.h b/source/ngc/fileop.h index de44974..2781102 100644 --- a/source/ngc/fileop.h +++ b/source/ngc/fileop.h @@ -23,10 +23,8 @@ #define ROOTFATDIR "fat:/" -bool fat_remount(PARTITION_INTERFACE partition); -bool fat_is_mounted(PARTITION_INTERFACE partition); -bool changeFATInterface(int method, bool silent); -int parseFATdirectory(int method); +bool ChangeFATInterface(int method, bool silent); +int ParseFATdirectory(int method); int LoadFATFile (char *filename, int length); int SaveBufferToFAT (char *filepath, int datasize, bool silent); int LoadBufferFromFAT (char *filepath, bool silent); diff --git a/source/ngc/filesel.cpp b/source/ngc/filesel.cpp index dbaf456..66837b8 100644 --- a/source/ngc/filesel.cpp +++ b/source/ngc/filesel.cpp @@ -26,24 +26,32 @@ #include "menudraw.h" #include "video.h" #include "aram.h" -#include "unzip.h" #include "filesel.h" #include "smbop.h" #include "fileop.h" -#include "mcsave.h" +#include "memcardop.h" int offset; int selection; char currentdir[MAXPATHLEN]; int maxfiles; extern int screenheight; - #define PAGESIZE 17 -int LoadDVDFile (unsigned char *buffer); extern unsigned long ARAM_ROMSIZE; int havedir = 0; int hasloaded = 0; +unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32); + +/**************************************************************************** + * Clear the savebuffer + ****************************************************************************/ +void +ClearSaveBuffer () +{ + memset (savebuffer, 0, SAVEBUFFERSIZE); +} + /**************************************************************************** * autoLoadMethod() * Auto-determines and sets the load method @@ -51,12 +59,16 @@ int hasloaded = 0; ****************************************************************************/ int autoLoadMethod() { - if(changeFATInterface(METHOD_SD, SILENT)) + ShowAction ((char*) "Attempting to determine load method..."); + + if(ChangeFATInterface(METHOD_SD, SILENT)) return METHOD_SD; - else if(changeFATInterface(METHOD_USB, SILENT)) + else if(ChangeFATInterface(METHOD_USB, SILENT)) return METHOD_USB; - //else if(ConnectShare ()) - // return METHOD_SMB; + else if(false) // FIX ME - WARNING - MOUNTING DVD in Wii mode hangs + return METHOD_DVD; + else if(ConnectShare (SILENT)) + return METHOD_SMB; else { WaitPrompt((char*) "Unable to auto-determine load method!"); @@ -71,16 +83,18 @@ int autoLoadMethod() ****************************************************************************/ int autoSaveMethod() { - if(changeFATInterface(METHOD_SD, SILENT)) + ShowAction ((char*) "Attempting to determine save method..."); + + if(ChangeFATInterface(METHOD_SD, SILENT)) return METHOD_SD; - else if(changeFATInterface(METHOD_USB, SILENT)) + else if(ChangeFATInterface(METHOD_USB, SILENT)) return METHOD_USB; else if(TestCard(CARD_SLOTA, SILENT)) return METHOD_MC_SLOTA; else if(TestCard(CARD_SLOTB, SILENT)) return METHOD_MC_SLOTB; - //else if(ConnectShare ()) - // return METHOD_SMB; + else if(ConnectShare (SILENT)) + return METHOD_SMB; else { WaitPrompt((char*) "Unable to auto-determine save method!"); @@ -179,8 +193,6 @@ void StripExt(char* returnstring, char * inputstring) loc_dot = strrchr(returnstring,'.'); if (loc_dot != NULL) *loc_dot = '\0'; // strip file extension - - return; } /**************************************************************************** @@ -190,7 +202,7 @@ void StripExt(char* returnstring, char * inputstring) ****************************************************************************/ static void -ShowFiles (int offset, int selection) +ShowFiles () { int i, j; char text[MAXPATHLEN]; @@ -245,23 +257,6 @@ ShowFiles (int offset, int selection) showscreen (); } -/**************************************************************************** -* SNESROMSOffset -* -* Function to check for and return offset to a directory called SNESROMS, if -* any -****************************************************************************/ -int SNESROMSOffset() -{ - int i; - - for ( i = 0; i < maxfiles; i++ ) - if (strcmp(filelist[i].filename, "SNESROMS") == 0) - return i; - return 0; -} - - /**************************************************************************** * FileSelector * @@ -277,8 +272,8 @@ FileSelector (int method) int haverom = 0; int redraw = 1; int selectit = 0; - float mag, mag2 = 0; - u16 ang, ang2 = 0; + float mag, mag2; + u16 ang, ang2; int scroll_delay = 0; bool move_selection = 0; #define SCROLL_INITIAL_DELAY 15 @@ -287,7 +282,7 @@ FileSelector (int method) while (haverom == 0) { if (redraw) - ShowFiles (offset, selection); + ShowFiles (); redraw = 0; VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads @@ -301,6 +296,10 @@ FileSelector (int method) #else wp = 0; wh = 0; + ang = 0; + ang2 = 0; + mag = 0; + mag2 = 0; #endif a = PAD_StickY (0); c = PAD_SubStickX (0); @@ -310,95 +309,84 @@ FileSelector (int method) return 0; /*** Check buttons, perform actions ***/ - if ( (p & PAD_BUTTON_A) || selectit || (wp & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) ) - { - if ( selectit ) - selectit = 0; - if (filelist[selection].flags) // This is directory - { - if (method == METHOD_SD || method == METHOD_USB || method == METHOD_SMB) - { - /* update current directory and set new entry list if directory has changed */ - int status = UpdateDirName(); - if (status == 1) // ok, open directory - { - if(method == METHOD_SMB) - maxfiles = parseSMBdirectory(); - else - maxfiles = parseFATdirectory(method); + if ( (p & PAD_BUTTON_A) || selectit || (wp & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) ) + { + if ( selectit ) + selectit = 0; + if (filelist[selection].flags) // This is directory + { + /* update current directory and set new entry list if directory has changed */ + int status = UpdateDirName(); + if (status == 1) // ok, open directory + { + switch (method) + { + case METHOD_SD: + case METHOD_USB: + maxfiles = ParseFATdirectory(method); + break; - if (!maxfiles) - { - WaitPrompt ((char*) "Error reading directory !"); - haverom = 1; // quit menu - } - } - else if (status == -1) // directory name too long - { - haverom = 1; // quit menu - } - } - else if(method == METHOD_DVD) - { - if ( (strcmp (filelist[selection].filename, "..") == 0) - && ((unsigned int)rootdir == filelist[selection].offset) ) - return 0; - else - { - rootdir = filelist[selection].offset; - rootdirlength = filelist[selection].length; - offset = selection = 0; - maxfiles = parsedirectory (); - } - } - } - else // this is a file - { - rootdir = filelist[selection].offset; - rootdirlength = filelist[selection].length; + case METHOD_DVD: + maxfiles = ParseDVDdirectory(); + break; - // store the filename (used for sram/freeze naming) - StripExt(Memory.ROMFilename, filelist[selection].filename); // store stripped filename in Memory.ROMFilename + case METHOD_SMB: + maxfiles = ParseSMBdirectory(); + break; + } - switch (method) - { - case METHOD_SD: - case METHOD_USB: - // Load from FAT - ARAM_ROMSIZE = LoadFATFile (filelist[selection].filename, - filelist[selection].length); - break; + if (!maxfiles) + { + WaitPrompt ((char*) "Error reading directory !"); + haverom = 1; // quit menu + } + } + else if (status == -1) // directory name too long + { + haverom = 1; // quit menu + } + } + else // this is a file + { + // store the filename (w/o ext) - used for sram/freeze naming + StripExt(Memory.ROMFilename, filelist[selection].filename); - case METHOD_DVD: - /*** Now load the DVD file to it's offset ***/ - ARAM_ROMSIZE = LoadDVDFile (Memory.ROM); - break; + ShowAction ((char *)"Loading..."); + + switch (method) + { + case METHOD_SD: + case METHOD_USB: + ARAM_ROMSIZE = LoadFATFile (filelist[selection].filename, + filelist[selection].length); + break; + + case METHOD_DVD: + ARAM_ROMSIZE = LoadDVDFile (Memory.ROM); + break; case METHOD_SMB: - /*** Load from SMB ***/ - ARAM_ROMSIZE = - LoadSMBFile (filelist[selection].filename, - filelist[selection].length); - break; - } + ARAM_ROMSIZE = + LoadSMBFile (filelist[selection].filename, + filelist[selection].length); + break; + } - if (ARAM_ROMSIZE > 0) - { - hasloaded = 1; - Memory.LoadROM ("BLANK.SMC"); - - Memory.LoadSRAM ("BLANK"); - haverom = 1; - - return 1; - } - else - { - WaitPrompt((char*) "Error loading ROM!"); - } - } - redraw = 1; - } // End of A + if (ARAM_ROMSIZE > 0) + { + hasloaded = 1; // indicator for memmap.cpp + Memory.LoadROM ("BLANK.SMC"); + Memory.LoadSRAM ("BLANK"); + haverom = 1; + return 1; + } + else + { + WaitPrompt((char*) "Error loading ROM!"); + } + } + redraw = 1; + } // End of A if ( (p & PAD_BUTTON_B) || (wp & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)) ) { while ( (PAD_ButtonsDown(0) & PAD_BUTTON_B) @@ -509,41 +497,28 @@ FileSelector (int method) int OpenDVD (int method) { - int romsdiroffset = 0; + if (!getpvd()) + { + ShowAction((char*) "Loading DVD..."); + DVD_Mount(); /* mount the DVD unit again */ + havedir = 0; /* this may be a new DVD: content need to be parsed again */ + if (!getpvd()) + return 0; /* no correct ISO9660 DVD */ + } - if (!getpvd()) - { - ShowAction((char*) "Loading DVD..."); - DVD_Mount(); /* mount the DVD unit again */ - havedir = 0; /* this may be a new DVD: content need to be parsed again */ - if (!getpvd()) - return 0; /* no correct ISO9660 DVD */ - } + if (havedir == 0) + { + maxfiles = ParseDVDdirectory(); + if (maxfiles > 0) + { + return FileSelector (method); + havedir = 1; + } + } + else + return FileSelector (method); - if (havedir == 0) - { - offset = selection = 0; /* reset file selector */ - - if ((maxfiles = parsedirectory ())) - { - if ( romsdiroffset = SNESROMSOffset() ) - { - rootdir = filelist[romsdiroffset].offset; - rootdirlength = filelist[romsdiroffset].length; - offset = selection = 0; - maxfiles = parsedirectory (); - } - - int ret = FileSelector (method); - havedir = 1; - return ret; - } - } - - else - return FileSelector (method); - - return 0; + return 0; } /**************************************************************************** @@ -555,12 +530,13 @@ int OpenSMB (int method) { // Connect to network share - if(ConnectShare ()) + if(ConnectShare (NOTSILENT)) { // change current dir to root dir sprintf(currentdir, "/%s", GCSettings.LoadFolder); - if (maxfiles = parseSMBdirectory ()) + maxfiles = ParseSMBdirectory (); + if (maxfiles > 0) { return FileSelector (method); } @@ -582,13 +558,14 @@ OpenSMB (int method) int OpenFAT (int method) { - if(changeFATInterface(method, NOTSILENT)) + if(ChangeFATInterface(method, NOTSILENT)) { // change current dir to snes roms directory sprintf ( currentdir, "%s/%s", ROOTFATDIR, GCSettings.LoadFolder ); // Parse initial root directory and get entries list - if (maxfiles = parseFATdirectory (method)) + maxfiles = ParseFATdirectory (method); + if (maxfiles > 0) { // Select an entry return FileSelector (method); @@ -634,62 +611,3 @@ OpenROM (int method) return loadROM; } - -/**************************************************************************** - * LoadDVDFile - * This function will load a file from DVD, in BIN, SMD or ZIP format. - * The values for offset and length are inherited from rootdir and - * rootdirlength. - * - * The buffer parameter should re-use the initial ROM buffer. - ****************************************************************************/ - -int -LoadDVDFile (unsigned char *buffer) -{ - int offset; - int blocks; - int i; - u64 discoffset; - char readbuffer[2048]; - - /*** SDCard Addition ***/ - if (rootdirlength == 0) - return 0; - - /*** How many 2k blocks to read ***/ - blocks = rootdirlength / 2048; - offset = 0; - discoffset = rootdir; - ShowAction ((char*) "Loading..."); - dvd_read (readbuffer, 2048, discoffset); - - if (!IsZipFile (readbuffer)) - - { - for (i = 0; i < blocks; i++) - - { - dvd_read (readbuffer, 2048, discoffset); - memcpy (buffer + offset, readbuffer, 2048); - offset += 2048; - discoffset += 2048; - } - - /*** And final cleanup ***/ - if (rootdirlength % 2048) - - { - i = rootdirlength % 2048; - dvd_read (readbuffer, 2048, discoffset); - memcpy (buffer + offset, readbuffer, i); - } - } - - else - - { - return UnZipBuffer (buffer, discoffset, 1, NULL); // unzip from dvd - } - return rootdirlength; -} diff --git a/source/ngc/filesel.h b/source/ngc/filesel.h index f139a83..bf9c749 100644 --- a/source/ngc/filesel.h +++ b/source/ngc/filesel.h @@ -10,6 +10,9 @@ #ifndef _NGCFILESEL_ #define _NGCFILESEL_ +#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4) + +void ClearSaveBuffer (); int OpenROM (int method); int autoLoadMethod(); int autoSaveMethod(); diff --git a/source/ngc/memfile.cpp b/source/ngc/freeze.cpp similarity index 55% rename from source/ngc/memfile.cpp rename to source/ngc/freeze.cpp index 25da3ce..0d3e1dd 100644 --- a/source/ngc/memfile.cpp +++ b/source/ngc/freeze.cpp @@ -26,13 +26,14 @@ #include "snapshot.h" #include "srtc.h" -#include "memfile.h" #include "Snes9xGx.h" +#include "images/saveicon.h" +#include "freeze.h" #include "filesel.h" #include "menudraw.h" #include "smbop.h" #include "fileop.h" -#include "mcsave.h" +#include "memcardop.h" #define MEMBUFFER (512 * 1024) @@ -40,7 +41,6 @@ extern void S9xSRTCPreSaveState (); extern void NGCFreezeStruct (); extern bool8 S9xUnfreezeGame (const char *filename); extern unsigned char savebuffer[]; -extern SMBCONN smbconn; static int bufoffset; static char membuffer[MEMBUFFER]; @@ -56,10 +56,10 @@ char freezecomment[2][32] = { {"Snes9x GX 004 Freeze"}, {"Freeze"} }; int GetMem (char *buffer, int len) { - memcpy (buffer, membuffer + bufoffset, len); - bufoffset += len; + memcpy (buffer, membuffer + bufoffset, len); + bufoffset += len; - return len; + return len; } /** @@ -70,22 +70,17 @@ GetMem (char *buffer, int len) static void PutMem (char *buffer, int len) { - memcpy (membuffer + bufoffset, buffer, len); - bufoffset += len; + memcpy (membuffer + bufoffset, buffer, len); + bufoffset += len; } void NGCFreezeBlock (char *name, uint8 * block, int size) { - char buffer[512]; - -// char msg[90]; -// sprintf (msg, "name=%s", name); -// WaitPrompt(msg); - - sprintf (buffer, "%s:%06d:", name, size); - PutMem (buffer, strlen (buffer)); - PutMem ((char *) block, size); + char buffer[512]; + sprintf (buffer, "%s:%06d:", name, size); + PutMem (buffer, strlen (buffer)); + PutMem ((char *) block, size); } /** @@ -131,71 +126,40 @@ NGCFreezeMemBuffer () int NGCFreezeGame (int method, bool8 silent) { + ShowAction ((char*) "Saving..."); + if(method == METHOD_AUTO) method = autoSaveMethod(); char filename[1024]; - SMBFILE smbfile; - FILE *handle; - int len = 0; - int wrote = 0; int offset = 0; - char msg[100]; - if (method == METHOD_SD || method == METHOD_USB) // SD - { - changeFATInterface(method, NOTSILENT); - sprintf (filename, "%s/%s/%s.frz", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); - } - else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC Slot A or B - { - sprintf (filename, "%s.snz", Memory.ROMFilename); - } - else if (method == METHOD_SMB) // SMB - { - sprintf (filename, "%s/%s.frz", GCSettings.SaveFolder, Memory.ROMFilename); - } - S9xSetSoundMute (TRUE); S9xPrepareSoundForSnapshotSave (FALSE); - NGCFreezeMemBuffer (); + NGCFreezeMemBuffer (); // copy freeze mem into membuffer + memcpy (savebuffer, membuffer, bufoffset); S9xPrepareSoundForSnapshotSave (TRUE); S9xSetSoundMute (FALSE); if (method == METHOD_SD || method == METHOD_USB) // FAT devices { - handle = fopen (filename, "wb"); - - if (handle > 0) + if(ChangeFATInterface(method, NOTSILENT)) { - if (!silent) - ShowAction ((char*) "Saving freeze game..."); - - len = fwrite (membuffer, 1, bufoffset, handle); - fclose (handle); - - if (len != bufoffset) - WaitPrompt((char*) "Error writing freeze file"); - else if ( !silent ) - { - sprintf (filename, "Written %d bytes", bufoffset); - WaitPrompt (filename); - } - } - else - { - changeFATInterface(GCSettings.SaveMethod, NOTSILENT); - sprintf(msg, "Couldn't save to %s/%s/", ROOTFATDIR, GCSettings.SaveFolder); - WaitPrompt (msg); + sprintf (filename, "%s/%s/%s.frz", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); + offset = SaveBufferToFAT (filename, bufoffset, silent); } } + else if (method == METHOD_SMB) // SMB + { + sprintf (filename, "%s/%s.frz", GCSettings.SaveFolder, Memory.ROMFilename); + offset = SaveBufferToSMB (filename, bufoffset, silent); + } else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC Slot A or B { - if (!silent) - ShowAction ((char*) "Saving freeze game..."); + sprintf (filename, "%s.snz", Memory.ROMFilename); ClearSaveBuffer (); @@ -242,46 +206,12 @@ NGCFreezeGame (int method, bool8 silent) WaitPrompt (filename); } } - else if (method == METHOD_SMB) // SMB + + if(offset > 0) // save successful! { - smbfile = SMB_OpenFile (SMBPath(filename), SMB_OPEN_WRITING | SMB_DENY_NONE, SMB_OF_CREATE | SMB_OF_TRUNCATE, smbconn); - - if (smbfile) - { - if (!silent) - ShowAction ((char*) "Saving freeze game..."); - - len = bufoffset; - offset = 0; - while (len > 0) - { - if (len > 1024) - wrote = - SMB_WriteFile ((char *) membuffer + offset, 1024, offset, - smbfile); - else - wrote = - SMB_WriteFile ((char *) membuffer + offset, len, offset, - smbfile); - - offset += wrote; - len -= wrote; - } - - SMB_CloseFile (smbfile); - - if ( !silent ) - { - sprintf (filename, "Written %d bytes", bufoffset); - WaitPrompt (filename); - } - } - else - { - char msg[100]; - sprintf(msg, "Couldn't save to SMB: %s", GCSettings.SaveFolder); - WaitPrompt (msg); - } + if(!silent) + WaitPrompt((char*) "Save successful"); + return 1; } return 0; } @@ -292,35 +222,35 @@ NGCFreezeGame (int method, bool8 silent) int NGCUnFreezeBlock (char *name, uint8 * block, int size) { - char buffer[20], *e; - int len = 0; - int rem = 0; + char buffer[20], *e; + int len = 0; + int rem = 0; - GetMem (buffer, 11); + GetMem (buffer, 11); - if (strncmp (buffer, name, 3) != 0 || buffer[3] != ':' || - buffer[10] != ':' || (len = strtol (&buffer[4], &e, 10)) == 0 || - e != buffer + 10) - { - return WRONG_FORMAT; - } + if (strncmp (buffer, name, 3) != 0 || buffer[3] != ':' || + buffer[10] != ':' || (len = strtol (&buffer[4], &e, 10)) == 0 || + e != buffer + 10) + { + return WRONG_FORMAT; + } - if (len > size) - { - rem = len - size; - len = size; - } + if (len > size) + { + rem = len - size; + len = size; + } - ZeroMemory (block, size); + ZeroMemory (block, size); - GetMem ((char *) block, len); + GetMem ((char *) block, len); - if (rem) - { - bufoffset += rem; - } + if (rem) + { + bufoffset += rem; + } - return SUCCESS; + return SUCCESS; } /** @@ -329,57 +259,31 @@ NGCUnFreezeBlock (char *name, uint8 * block, int size) int NGCUnfreezeGame (int method, bool8 silent) { - char filename[1024]; - SMBFILE smbfile; - FILE *handle; - int read = 0; - int offset = 0; - char msg[80]; + ShowAction ((char*) "Loading..."); + char filename[1024]; + int offset = 0; + char msg[80]; - bufoffset = 0; + bufoffset = 0; if(method == METHOD_AUTO) method = autoLoadMethod(); if (method == METHOD_SD || method == METHOD_USB) // SD & USB { - changeFATInterface(method, NOTSILENT); - sprintf (filename, "%s/%s/%s.frz", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); - - handle = fopen (filename, "rb"); - - if (handle > 0) + if(ChangeFATInterface(method, NOTSILENT)) { - if ( !silent ) - ShowAction ((char*) "Loading freeze file..."); - - offset = 0; - /*** Usual chunks into memory ***/ - while ((read = fread (membuffer + offset, 1, 2048, handle)) > 0) - offset += read; - - fclose (handle); - - if ( !silent ) - ShowAction ((char*) "Unpacking freeze file"); - - if (S9xUnfreezeGame ("AGAME") != SUCCESS) - { - WaitPrompt((char*) "Error thawing"); - return 0; - } - return 1; + sprintf (filename, "%s/%s/%s.frz", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); + offset = LoadBufferFromFAT (filename, silent); } - - WaitPrompt((char*) "Freeze file not found"); - return 0; - } - + } + else if (method == METHOD_SMB) // Network (SMB) + { + sprintf (filename, "%s/%s.frz", GCSettings.SaveFolder, Memory.ROMFilename); + offset = LoadBufferFromSMB (filename, silent); + } else if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC in slot A or slot B { - if ( !silent ) - ShowAction ((char*) "Loading freeze file..."); - sprintf (filename, "%s.snz", Memory.ROMFilename); int ret = 0; @@ -391,9 +295,6 @@ NGCUnfreezeGame (int method, bool8 silent) if ( ret ) { - if ( !silent ) - ShowAction ((char*) "Unpacking freeze file"); - // skip the saveicon and comment offset = (sizeof(saveicon) + 64); uLongf zipsize = 0; @@ -412,7 +313,7 @@ NGCUnfreezeGame (int method, bool8 silent) if ( err!=Z_OK ) { - sprintf (msg, "unzip error %s ",zError(err)); + sprintf (msg, "Unzip error %s ",zError(err)); WaitPrompt (msg); return 0; } @@ -422,49 +323,22 @@ NGCUnfreezeGame (int method, bool8 silent) WaitPrompt((char*) "Unzipped size doesn't match expected size!"); return 0; } - - if (S9xUnfreezeGame ("AGAME") != SUCCESS) - { - WaitPrompt((char*) "Error thawing"); - return 0; - } } - - WaitPrompt((char*) "Freeze file not found"); - return 0; } - else if (method == METHOD_SMB) // Network (SMB) - { - sprintf (filename, "%s/%s.frz", GCSettings.SaveFolder, Memory.ROMFilename); - // Read the file into memory - smbfile = SMB_OpenFile (SMBPath(filename), SMB_OPEN_READING, SMB_OF_OPEN, smbconn); + if(offset > 0) + { + memcpy (membuffer, savebuffer, offset); - if (smbfile) - { - if ( !silent ) - ShowAction ((char*) "Loading freeze file..."); - while ((read = - SMB_ReadFile ((char *) membuffer + offset, 1024, offset, - smbfile)) > 0) - offset += read; - - SMB_CloseFile (smbfile); - - if ( !silent ) - ShowAction ((char*) "Unpacking freeze file"); - if (S9xUnfreezeGame ("AGAME") != SUCCESS) - { - WaitPrompt((char*) "Error thawing"); - return 0; - } - } - else if ( !silent ) - { + if (S9xUnfreezeGame ("AGAME") == SUCCESS) + return 1; + else + WaitPrompt((char*) "Error thawing"); + } + else + { + if(!silent) WaitPrompt((char*) "Freeze file not found"); - return 0; - } - return 1; - } + } return 0; // if we reached here, nothing was done! } diff --git a/source/ngc/memfile.h b/source/ngc/freeze.h similarity index 100% rename from source/ngc/memfile.h rename to source/ngc/freeze.h diff --git a/source/ngc/gfx_bg.h b/source/ngc/images/gfx_bg.h similarity index 99% rename from source/ngc/gfx_bg.h rename to source/ngc/images/gfx_bg.h index 8105be2..16a16bb 100644 --- a/source/ngc/gfx_bg.h +++ b/source/ngc/images/gfx_bg.h @@ -3,12 +3,16 @@ * Width : 640 * Height: 480 */ + +#ifndef _IMGBG_ +#define _IMGBG_ + #define BG_WIDTH (640) #define BG_HEIGHT (480) #define BG_RAW (614400) #define BG_COMPRESSED (8789) - static unsigned char bg[]= +const unsigned char bg[]= { 0x78,0x9c,0xed,0xdd,0x77,0xb0,0x94,0xf5,0xbd,0xf8,0x71,0x9d,0x4c, 0x26,0xe3,0x24,0x93,0xdc,0xeb,0xe4,0xc6,0x4b,0x20,0x89,0xf1,0xc6, @@ -689,3 +693,4 @@ 0x14,0x14 }; +#endif diff --git a/source/ngc/gcglobals.cpp b/source/ngc/images/saveicon.h similarity index 60% rename from source/ngc/gcglobals.cpp rename to source/ngc/images/saveicon.h index b4cb1df..51e211f 100644 --- a/source/ngc/gcglobals.cpp +++ b/source/ngc/images/saveicon.h @@ -1,281 +1,139 @@ -/********************************************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2002 - 2004 Matthew Kendora - - (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) - - (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) - - (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Kris Bleakley (codeviolation@hotmail.com), - Nach (n-a-c-h@users.sourceforge.net), and - zones (kasumitokoduck@yahoo.com) - - BS-X C emulator code - (c) Copyright 2005 - 2006 Dreamer Nom, - zones - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), - Nach, - zsKnight (zsknight@zsnes.com) - - C4 C++ code - (c) Copyright 2003 - 2006 Brad Jorsch, - Nach - - DSP-1 emulator code - (c) Copyright 1998 - 2006 _Demo_, - Andreas Naive (andreasnaive@gmail.com) - Gary Henderson, - Ivar (ivar@snes9x.com), - John Weidman, - Kris Bleakley, - Matthew Kendora, - Nach, - neviksti (neviksti@hotmail.com) - - DSP-2 emulator code - (c) Copyright 2003 John Weidman, - Kris Bleakley, - Lord Nightmare (lord_nightmare@users.sourceforge.net), - Matthew Kendora, - neviksti - - - DSP-3 emulator code - (c) Copyright 2003 - 2006 John Weidman, - Kris Bleakley, - Lancer, - z80 gaiden - - DSP-4 emulator code - (c) Copyright 2004 - 2006 Dreamer Nom, - John Weidman, - Kris Bleakley, - Nach, - z80 gaiden - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, - pagefault (pagefault@zsnes.com), - Kris Bleakley, - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, - John Weidman, - Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive, - John Weidman - - S-RTC C emulator code - (c) Copyright 2001-2006 byuu, - John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, - John Weidman, - Kris Bleakley, - Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 _Demo_, - pagefault, - zsKnight, - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, - Gary Henderson, - John Weidman - - Sound DSP emulator code is derived from SNEeSe and OpenSPC: - (c) Copyright 1998 - 2003 Brad Martin - (c) Copyright 1998 - 2006 Charles Bilyue' - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - 2xSaI filter - (c) Copyright 1999 - 2001 Derek Liauw Kie Fa - - HQ2x filter - (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear - with all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software or it's derivatives. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes, - but is not limited to, charging money for Snes9x or software derived from - Snes9x, including Snes9x or derivatives in commercial game bundles, and/or - using Snes9x as a promotion for your commercial product. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -**********************************************************************************/ - -#include "snes9xGx.h" -START_EXTERN_C -struct SGCSettings GCSettings; -bool8 isWii; - -unsigned short saveicon[1024] = { - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF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E, 0x801B, 0x8017, 0x801E, 0x801B, 0x8018, 0x8015, - 0x801A, 0x8018, 0x8015, 0x8011, 0x8016, 0x8014, 0x8011, 0x800D, - 0x8012, 0x800B, 0x8848, 0xFFFF, 0x8010, 0x8009, 0x8003, 0xFFFF, - 0x800C, 0x8007, 0x8006, 0xFFFF, 0x8008, 0x8005, 0xA52E, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFBBD, 0xF1EF, 0xFFFF, 0xF508, 0xF000, 0xEC00, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xE56B, 0xE16B, 0xE673, 0xFFFF, 0xE800, 0xDC00, 0xCC00, 0xB400, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xDE94, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xEBBA, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xEFBA, 0xE378, 0xB2EB, 0x9AA4, 0x9AA5, 0x9AA5, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xE778, 0xF3BC, 0xFFFF, 0xFFFF, 0x9A84, 0x9623, 0x91E3, 0xB66C, - 0xD6BB, 0x800E, 0x800C, 0x8008, 0xFFFF, 0x8C6A, 0x8004, 0x8004, - 0xFFFF, 0xFFFF, 0xB191, 0xDAD8, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0x8006, 0x8004, 0xFFFF, 0xFFFF, 0x8006, 0xF39D, 0xFFFF, 0xFA94, - 0xFFFF, 0xFFFF, 0xFFFF, 0xEC21, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xF484, 0xF800, 0xF800, 0xF000, 0xF800, 0xF800, 0xFD6B, 0xF8C6, - 0xF400, 0xF400, 0xFDEF, 0xF4A5, 0xFF18, 0xEC63, 0xE400, 0xE000, - 0xE800, 0xE000, 0xD400, 0xC400, 0xE400, 0xE000, 0xD000, 0xC400, - 0xE000, 0xD800, 0xCC00, 0xC000, 0xD800, 0xD000, 0xC400, 0xB800, - 0xA400, 0xD673, 0xFFFF, 0xFFFF, 0xB400, 0x9000, 0xFFFF, 0xFFFF, - 0xB000, 0x9000, 0xFFFF, 0xFFFF, 0xA800, 0x9000, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xDB75, 0x9AE4, 0xFFFF, 0xFFFF, 0x9A84, 0xA6E7, - 0xFFFF, 0xFFFF, 0xA1E7, 0x9604, 0xFFFF, 0xFFFF, 0xFFFF, 0x8D03, - 0xA707, 0xA708, 0xAF2A, 0xAF2A, 0xA6E7, 0xA2C7, 0xBF4E, 0xCB71, - 0x9E46, 0x9E26, 0x9A25, 0x9604, 0x80E0, 0x8922, 0x8D22, 0x8D22, - 0xA2C7, 0xA2A7, 0x9E66, 0x95E4, 0xA2A6, 0x9E46, 0x9E25, 0x95C4, - 0x99E5, 0x95C4, 0x9163, 0x8D02, 0x88E2, 0x84A1, 0x8060, 0x8020, - 0x8500, 0xF7BD, 0xFFFF, 0xFFFF, 0x8901, 0xA148, 0xFFFF, 0xFFFF, - 0x8040, 0xB9ED, 0xFFFF, 0xFFFF, 0x9926, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,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FF, + 0xF484, 0xF800, 0xF800, 0xF000, 0xF800, 0xF800, 0xFD6B, 0xF8C6, + 0xF400, 0xF400, 0xFDEF, 0xF4A5, 0xFF18, 0xEC63, 0xE400, 0xE000, + 0xE800, 0xE000, 0xD400, 0xC400, 0xE400, 0xE000, 0xD000, 0xC400, + 0xE000, 0xD800, 0xCC00, 0xC000, 0xD800, 0xD000, 0xC400, 0xB800, + 0xA400, 0xD673, 0xFFFF, 0xFFFF, 0xB400, 0x9000, 0xFFFF, 0xFFFF, + 0xB000, 0x9000, 0xFFFF, 0xFFFF, 0xA800, 0x9000, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xDB75, 0x9AE4, 0xFFFF, 0xFFFF, 0x9A84, 0xA6E7, + 0xFFFF, 0xFFFF, 0xA1E7, 0x9604, 0xFFFF, 0xFFFF, 0xFFFF, 0x8D03, + 0xA707, 0xA708, 0xAF2A, 0xAF2A, 0xA6E7, 0xA2C7, 0xBF4E, 0xCB71, + 0x9E46, 0x9E26, 0x9A25, 0x9604, 0x80E0, 0x8922, 0x8D22, 0x8D22, + 0xA2C7, 0xA2A7, 0x9E66, 0x95E4, 0xA2A6, 0x9E46, 0x9E25, 0x95C4, + 0x99E5, 0x95C4, 0x9163, 0x8D02, 0x88E2, 0x84A1, 0x8060, 0x8020, + 0x8500, 0xF7BD, 0xFFFF, 0xFFFF, 0x8901, 0xA148, 0xFFFF, 0xFFFF, + 0x8040, 0xB9ED, 0xFFFF, 0xFFFF, 0x9926, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xE529, 0xD400, 0xFFFF, 0xFFFF, 0xFFFF, 0xD4C6, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0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F, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, +}; + +#endif diff --git a/source/ngc/mcsave.cpp b/source/ngc/memcardop.cpp similarity index 95% rename from source/ngc/mcsave.cpp rename to source/ngc/memcardop.cpp index 62f45fe..3efa833 100644 --- a/source/ngc/mcsave.cpp +++ b/source/ngc/memcardop.cpp @@ -5,9 +5,9 @@ * softdev July 2006 * crunchy2 May-June 2007 * - * mcsave.cpp + * memcardop.cpp * - * Memory Card Save Routines. + * Memory Card Routines. ****************************************************************************/ #include #include @@ -36,27 +36,17 @@ #include "menu.h" #include "sram.h" #include "preferences.h" -#include "mcsave.h" +#include "memcardop.h" +#include "fileop.h" #define VERIFBUFFERSIZE 65536 static u8 SysArea[CARD_WORKAREA] ATTRIBUTE_ALIGN (32); -unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32); +extern unsigned char savebuffer[]; unsigned char verifbuffer[VERIFBUFFERSIZE] ATTRIBUTE_ALIGN (32); card_dir CardDir; card_file CardFile; card_stat CardStatus; - -/**************************************************************************** - * Clear the savebuffer - ****************************************************************************/ -void -ClearSaveBuffer () -{ - memset (savebuffer, 0, SAVEBUFFERSIZE); -} - - /**************************************************************************** * CardFileExists * @@ -145,13 +135,12 @@ int MountCard(int cslot, bool silent) else WaitPrompt((char*) "Replug card in slot B!"); - ShowAction ((char*) ""); ret = CARD_Mount (cslot, SysArea, NULL); tries++; } tries = 0; - while ( tries < 5 && ret == CARD_ERROR_NOCARD ) + while ( tries < 2 && ret == CARD_ERROR_NOCARD ) { EXI_ProbeReset (); @@ -159,23 +148,18 @@ int MountCard(int cslot, bool silent) ShowAction ((char*) "Mounting card..."); CARD_Unmount (cslot); usleep(500000); // wait half second - ShowAction ((char*) ""); - usleep(500000); // wait half second ret = CARD_Mount (cslot, SysArea, NULL); tries++; } tries = 0; - while ( tries < 5 && ret == CARD_ERROR_UNLOCKED ) + while ( tries < 3 && ret == CARD_ERROR_UNLOCKED ) { EXI_ProbeReset (); if(!silent) ShowAction ((char*) "Waiting for unlock..."); usleep(500000); // wait half second - if(!silent) - ShowAction ((char*) ""); - usleep(500000); // wait half second ret = CARD_Probe(cslot); tries++; } diff --git a/source/ngc/mcsave.h b/source/ngc/memcardop.h similarity index 83% rename from source/ngc/mcsave.h rename to source/ngc/memcardop.h index 8128a56..86119ff 100644 --- a/source/ngc/mcsave.h +++ b/source/ngc/memcardop.h @@ -5,18 +5,14 @@ * softdev July 2006 * crunchy2 May 2007 * - * mcsave.cpp + * memcardop.h * - * Memory Card Save Routines. + * Memory Card Routines. ****************************************************************************/ #ifndef _NGCMCSAVE_ #define _NGCMCSAVE_ -#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4) - -void ClearSaveBuffer (); - int VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize); int LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent); diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 33e3221..d12ea08 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -30,13 +30,12 @@ #include "snes9xGx.h" #include "aram.h" #include "video.h" -#include "mcsave.h" #include "filesel.h" #include "unzip.h" #include "smbop.h" -#include "mcsave.h" +#include "memcardop.h" #include "fileop.h" -#include "memfile.h" +#include "freeze.h" #include "dvd.h" #include "s9xconfig.h" #include "sram.h" @@ -49,18 +48,23 @@ extern void DrawMenu (char items[][50], char *title, int maxitems, int selected, extern SCheatData Cheat; - -#define PSOSDLOADID 0x7c6000a6 extern int menu; extern unsigned long ARAM_ROMSIZE; #define SOFTRESET_ADR ((volatile u32*)0xCC003024) /**************************************************************************** - * Reboot + * Reboot / Exit ****************************************************************************/ -void Reboot() { +#ifndef HW_RVL +#define PSOSDLOADID 0x7c6000a6 +int *psoid = (int *) 0x80001800; +void (*PSOReload) () = (void (*)()) 0x80001800; +#endif + +void Reboot() +{ #ifdef HW_RVL SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); #else @@ -132,12 +136,14 @@ PreferencesMenu () { // some load/save methods are not implemented - here's where we skip them - #ifndef HW_RVL // GameCube mode + #ifndef HW_RVL + // no USB ports on GameCube if(GCSettings.LoadMethod == METHOD_USB) GCSettings.LoadMethod++; if(GCSettings.SaveMethod == METHOD_USB) GCSettings.SaveMethod++; - #else // Wii mode + #else + // Wii DVD access not implemented if(GCSettings.LoadMethod == METHOD_DVD) GCSettings.LoadMethod++; #endif @@ -145,11 +151,13 @@ PreferencesMenu () if(GCSettings.SaveMethod == METHOD_DVD) // saving to DVD is impossible GCSettings.SaveMethod++; - if(GCSettings.SaveMethod == METHOD_SMB) // disable SMB - network saving needs some work + #ifdef HW_RVL + // disable MC saving in Wii mode - does not work for some reason! + if(GCSettings.SaveMethod == METHOD_MC_SLOTA) GCSettings.SaveMethod++; - - if(GCSettings.LoadMethod == METHOD_SMB) // disable SMB - network loading needs some work - GCSettings.LoadMethod++; + if(GCSettings.SaveMethod == METHOD_MC_SLOTB) + GCSettings.SaveMethod++; + #endif // correct load/save methods out of bounds if(GCSettings.LoadMethod > 4) @@ -368,7 +376,7 @@ GameMenu () break; case 4: // Load SRAM - quit = retval = LoadSRAM(GCSettings.SaveMethod, SILENT); + quit = retval = LoadSRAM(GCSettings.SaveMethod, NOTSILENT); break; case 5: // Save SRAM @@ -376,7 +384,7 @@ GameMenu () break; case 6: // Load Freeze - quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, SILENT); + quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, NOTSILENT); break; case 7: // Save Freeze @@ -467,7 +475,7 @@ GetButtonMap(u16 ctrlr_type, char* btn_name) { u32 pressed, previous; char temp[50] = ""; - int k; + uint k; pressed = 0; previous = 1; switch (ctrlr_type) { @@ -487,7 +495,7 @@ GetButtonMap(u16 ctrlr_type, char* btn_name) /*** note which button we are remapping ***/ sprintf (temp, (char*)"Remapping "); - for (k=0; k<9-strlen(btn_name) ;k++) strcat(temp, " "); // add whitespace padding to align text + for (k=0; k<9-strlen(btn_name); k++) strcat(temp, " "); // add whitespace padding to align text strncat (temp, btn_name, 9); // snes button we are remapping strncpy (cfg_text[0], temp, 19); // copy this all back to the text we wish to display @@ -531,12 +539,13 @@ ConfigureButtons (u16 ctrlr_type) int ret = 0; int oldmenu = menu; menu = 0; - char* menu_title; + char* menu_title = NULL; u32 pressed; - unsigned int* currentpadmap; + unsigned int* currentpadmap = 0; char temp[50] = ""; - int i, j, k; + int i, j; + uint k; /*** Update Menu Title (based on controller we're configuring) ***/ switch (ctrlr_type) { @@ -737,8 +746,6 @@ mainmenu (int selectedMenu) { int quit = 0; int ret; - int *psoid = (int *) 0x80001800; - void (*PSOReload) () = (void (*)()) 0x80001800; // disable game-specific menu items if a ROM isn't loaded if ( ARAM_ROMSIZE == 0 ) diff --git a/source/ngc/menudraw.cpp b/source/ngc/menudraw.cpp index 27a444e..40c7bb0 100644 --- a/source/ngc/menudraw.cpp +++ b/source/ngc/menudraw.cpp @@ -25,17 +25,16 @@ #include #include #include +#include #include FT_FREETYPE_H -#include "video.h" -#include "menudraw.h" -#include "dkpro.h" -#include "snes9xGX.h" #include "memmap.h" -#include "aram.h" -#include -#include "gfx_bg.h" +#include "video.h" +#include "menudraw.h" +#include "snes9xGX.h" +#include "aram.h" +#include "images/gfx_bg.h" /*** Globals ***/ FT_Library ftlibrary; @@ -50,10 +49,6 @@ extern int screenheight; extern unsigned int *xfb[2]; extern int whichfb; -/**************************************************************************** - * Unpack the devkit pro logo - ****************************************************************************/ -static u32 *dkproraw; /*** Permanent backdrop ***/ #ifdef HW_RVL u32 *backdrop; @@ -219,59 +214,6 @@ setfontcolour (u8 r, u8 g, u8 b) fontlo = fontcolour & 0xffff; } -/**************************************************************************** - * dkunpack - * - * Support function to expand the DevkitPro logo - ****************************************************************************/ -int -dkunpack () -{ - unsigned long res, inbytes, outbytes; - - inbytes = dkpro_COMPRESSED; - outbytes = dkpro_RAW; - dkproraw = (u32 *) malloc (dkpro_RAW + 16); - - res = uncompress ((Bytef *) dkproraw, &outbytes, (Bytef *) dkpro, inbytes); - - if (res == Z_OK) - return 1; - - return 0; -} - -/**************************************************************************** - * showdklogo - * - * Display the DevkitPro logo - ****************************************************************************/ -void -showdklogo () -{ - int w, h, p, dispoffset; - p = 0; - dispoffset = - ((screenheight != 480 ? 365 : 355) * 320) + ((640 - dkpro_WIDTH) >> 2); - - dkunpack (); - - for (h = 0; h < dkpro_HEIGHT; h++) - { - for (w = 0; w < dkpro_WIDTH >> 1; w++) - { - if (dkproraw[p] != 0x00800080) - xfb[whichfb][dispoffset + w] = dkproraw[p++]; - else - p++; - } - - dispoffset += 320; - } - - free (dkproraw); -} - /**************************************************************************** * Display credits, legal copyright and licence * @@ -617,10 +559,8 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x) u32 p, wp; int ret = 0; signed char a; - float mag = 0; - float mag2 = 0; - u16 ang = 0; - u16 ang2 = 0; + float mag, mag2; + u16 ang, ang2; while (quit == 0) { @@ -636,6 +576,10 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x) wpad_get_analogues(0, &mag, &ang, &mag2, &ang2); // get joystick info from wii expansions #else wp = 0; + ang = 0; + ang2 = 0; + mag = 0; + mag2 = 0; #endif a = PAD_StickY (0); diff --git a/source/ngc/preferences.cpp b/source/ngc/preferences.cpp index ccf9576..3ef3074 100644 --- a/source/ngc/preferences.cpp +++ b/source/ngc/preferences.cpp @@ -14,11 +14,13 @@ #include #include "snes9x.h" -#include "snes9xGx.h" #include "memmap.h" #include "srtc.h" + +#include "snes9xGx.h" +#include "images/saveicon.h" #include "menudraw.h" -#include "mcsave.h" +#include "memcardop.h" #include "fileop.h" #include "smbop.h" #include "filesel.h" @@ -33,7 +35,7 @@ extern unsigned int ccpadmap[]; extern unsigned int ncpadmap[]; #define PREFS_FILE_NAME "snes9xGx.prf" -#define PREFSVERSTRING "Snes9x GX 005a Prefs" +#define PREFSVERSTRING "Snes9x GX 005 Prefs" char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} }; @@ -139,9 +141,11 @@ SavePrefs (int method, bool silent) if(method == METHOD_SD || method == METHOD_USB) { - changeFATInterface(GCSettings.SaveMethod, NOTSILENT); - sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME); - offset = SaveBufferToFAT (filepath, datasize, silent); + if(ChangeFATInterface(method, NOTSILENT)) + { + sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME); + offset = SaveBufferToFAT (filepath, datasize, silent); + } } else if(method == METHOD_SMB) { @@ -150,21 +154,18 @@ SavePrefs (int method, bool silent) } else if(method == METHOD_MC_SLOTA) { - offset = SaveBufferToMC (savebuffer, CARD_SLOTA, PREFS_FILE_NAME, datasize, silent); + offset = SaveBufferToMC (savebuffer, CARD_SLOTA, (char *)PREFS_FILE_NAME, datasize, silent); } else if(method == METHOD_MC_SLOTB) { - offset = SaveBufferToMC (savebuffer, CARD_SLOTB, PREFS_FILE_NAME, datasize, silent); + offset = SaveBufferToMC (savebuffer, CARD_SLOTB, (char *)PREFS_FILE_NAME, datasize, silent); } if (offset > 0) { retval = decodePrefsData (); if ( !silent ) - { - sprintf (filepath, "Wrote %d bytes", offset); - WaitPrompt (filepath); - } + WaitPrompt ((char *)"Preferences saved"); } return retval; } @@ -187,32 +188,31 @@ LoadPrefs (int method, bool silent) if(method == METHOD_SD || method == METHOD_USB) { - changeFATInterface(GCSettings.SaveMethod, NOTSILENT); - sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME); - offset = LoadBufferFromFAT (filepath, silent); + if(ChangeFATInterface(method, NOTSILENT)) + { + sprintf (filepath, "%s/%s/%s", ROOTFATDIR, GCSettings.SaveFolder, PREFS_FILE_NAME); + offset = LoadBufferFromFAT (filepath, silent); + } } else if(method == METHOD_SMB) { sprintf (filepath, "%s/%s", GCSettings.SaveFolder, PREFS_FILE_NAME); - LoadBufferFromSMB (filepath, silent); + offset = LoadBufferFromSMB (filepath, silent); } else if(method == METHOD_MC_SLOTA) { - offset = LoadBufferFromMC (savebuffer, CARD_SLOTA, PREFS_FILE_NAME, silent); + offset = LoadBufferFromMC (savebuffer, CARD_SLOTA, (char *)PREFS_FILE_NAME, silent); } else if(method == METHOD_MC_SLOTB) { - offset = LoadBufferFromMC (savebuffer, CARD_SLOTB, PREFS_FILE_NAME, silent); + offset = LoadBufferFromMC (savebuffer, CARD_SLOTB, (char *)PREFS_FILE_NAME, silent); } if (offset > 0) { retval = decodePrefsData (); if ( !silent ) - { - sprintf (filepath, "Loaded %d bytes", offset); - WaitPrompt(filepath); - } + WaitPrompt((char *)"Preferences loaded"); } return retval; } diff --git a/source/ngc/s9xconfig.cpp b/source/ngc/s9xconfig.cpp index 360207b..9765651 100644 --- a/source/ngc/s9xconfig.cpp +++ b/source/ngc/s9xconfig.cpp @@ -159,14 +159,20 @@ #include "snes9xGX.h" #include "smbop.h" +START_EXTERN_C +struct SGCSettings GCSettings; +bool8 isWii; +END_EXTERN_C + void DefaultSettings () { /************** GameCube/Wii Settings *********************/ GCSettings.LoadMethod = METHOD_AUTO; // Auto, SD, DVD, USB, Network (SMB) - sprintf (GCSettings.LoadFolder,"snes9x/roms"); // Path to game files GCSettings.SaveMethod = METHOD_AUTO; // Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, Network (SMB) + sprintf (GCSettings.LoadFolder,"snes9x/roms"); // Path to game files sprintf (GCSettings.SaveFolder,"snes9x/saves"); // Path to save files + sprintf (GCSettings.CheatFolder,"snes9x/cheats"); // Path to cheat files GCSettings.AutoLoad = 1; GCSettings.AutoSave = 1; diff --git a/source/ngc/s9xconfig.h b/source/ngc/s9xconfig.h index 946b7f5..9c479d0 100644 --- a/source/ngc/s9xconfig.h +++ b/source/ngc/s9xconfig.h @@ -132,8 +132,8 @@ Snes9x homepage: http://www.snes9x.com Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear + and source form, for non-commercial purposes, is hereby granted without + fee, providing that this license information and copyright notice appear with all copies and any derived work. This software is provided 'as-is', without any express or implied diff --git a/source/ngc/smbop.cpp b/source/ngc/smbop.cpp index f149a25..5cd500e 100644 --- a/source/ngc/smbop.cpp +++ b/source/ngc/smbop.cpp @@ -29,14 +29,22 @@ #include "smbop.h" #include "Snes9xGx.h" +bool networkInit = false; +bool networkShareInit = false; +unsigned int SMBTimer = 0; +#define SMBTIMEOUT ( 3600 ) // Some implementations timeout in 10 minutes + SMBCONN smbconn; - -extern char currentdir[MAXPATHLEN]; - -char output[16384]; -extern unsigned char savebuffer[]; #define ZIPCHUNK 16384 +extern unsigned char savebuffer[]; +extern char output[16384]; +extern int offset; +extern int selection; +extern char currentdir[MAXPATHLEN]; +extern FILEENTRIES filelist[MAXFILES]; + + /**************************************************************************** * InitializeNetwork * Initializes the Wii/GameCube network interface @@ -55,45 +63,55 @@ bool InitializeNetwork(bool silent) if (if_config(myIP, NULL, NULL, true) < 0) { - WaitPrompt((char*) "Error reading IP address."); + if(!silent) + WaitPrompt((char*) "Error reading IP address."); return false; } else { - if(!silent) - { - char msg[100]; - sprintf(msg, "Network initialized. IP address: %s", myIP); - WaitPrompt(msg); - } return true; } } - WaitPrompt((char*) "Unable to initialize network."); + if(!silent) + WaitPrompt((char*) "Unable to initialize network."); return false; } /**************************************************************************** * Mount SMB Share ****************************************************************************/ -bool -ConnectShare () -{ - bool networkInit = false; - bool networkShareInit = false; - networkInit = InitializeNetwork(SILENT); +bool +ConnectShare (bool silent) +{ + // Crashes system in GameCube mode - so disable for now + #ifdef HW_RVL // Wii mode + if(!networkInit) + networkInit = InitializeNetwork(silent); + #endif if(networkInit) { - ShowAction ((char*) "Connecting to network share..."); - - if(SMB_Connect(&smbconn, GCSettings.smbuser, GCSettings.smbpwd, - GCSettings.smbgcid, GCSettings.smbsvid, GCSettings.smbshare, GCSettings.smbip) == SMB_SUCCESS) - networkShareInit = true; + // connection may have expired + if (networkShareInit && SMBTimer > SMBTIMEOUT) + { + networkShareInit = false; + SMBTimer = 0; + SMB_Close(smbconn); + } if(!networkShareInit) + { + if(!silent) + ShowAction ((char*) "Connecting to network share..."); + + if(SMB_Connect(&smbconn, GCSettings.smbuser, GCSettings.smbpwd, + GCSettings.smbgcid, GCSettings.smbsvid, GCSettings.smbshare, GCSettings.smbip) == SMB_SUCCESS) + networkShareInit = true; + } + + if(!networkShareInit && !silent) WaitPrompt ((char*) "Failed to connect to network share."); } @@ -122,14 +140,19 @@ char * SMBPath(char * path) * Load the directory and put in the filelist array *****************************************************************************/ int -parseSMBdirectory () +ParseSMBdirectory () { + if(!ConnectShare (NOTSILENT)) + return 0; + int filecount = 0; char searchpath[1024]; - SMBDIRENTRY smbdir; - if(strlen(searchpath) <= 1) // root + // initialize selection + selection = offset = 0; + + if(strlen(currentdir) <= 1) // root sprintf(searchpath, "*"); else sprintf(searchpath, "%s/*", currentdir); @@ -154,7 +177,7 @@ parseSMBdirectory () do { if(strcmp(smbdir.name,".") != 0 && - !(strcmp(currentdir,"/") == 0 && strcmp(smbdir.name,"..") == 0)) + !(strlen(currentdir) <= 1 && strcmp(smbdir.name,"..") == 0)) { memset (&filelist[filecount], 0, sizeof (FILEENTRIES)); filelist[filecount].length = smbdir.size_low; @@ -189,123 +212,30 @@ parseSMBdirectory () int LoadSMBFile (char *filename, int length) { - int offset = 0; - int bytesread = 0; - char filepath[1024]; - SMBFILE smbfile; unsigned char *rbuffer; - char zipbuffer[16384]; - int pass = 0; - int zip = 0; - PKZIPHEADER pkzip; - z_stream zs; - int res, outbytes = 0; rbuffer = (unsigned char *) Memory.ROM; - int have = 0; + int boffset; + char filepath[MAXPATHLEN]; - if(strcmp(currentdir,"/") == 0) - sprintf(filepath, "/%s", filename); - else - sprintf(filepath, "%s/%s", currentdir, filename); - - ShowAction((char *)"Loading..."); - - // Open the file for reading - smbfile = - SMB_OpenFile (SMBPath(filepath), SMB_OPEN_READING, SMB_OF_OPEN, smbconn); - if (smbfile) - { - while (offset < length) - { - // Don't read past end of file - if (offset + bytesread > length) - bytesread = length - offset; - else - bytesread = 16384; - - SMB_ReadFile (zipbuffer, bytesread, offset, smbfile); - - if (pass == 0) - { - // Is this a Zip file ? - zip = IsZipFile (zipbuffer); - if (zip) - { - memcpy (&pkzip, zipbuffer, sizeof (PKZIPHEADER)); - pkzip.uncompressedSize = FLIP32 (pkzip.uncompressedSize); - memset (&zs, 0, sizeof (zs)); - zs.zalloc = Z_NULL; - zs.zfree = Z_NULL; - zs.opaque = Z_NULL; - zs.avail_in = 0; - zs.next_in = Z_NULL; - res = inflateInit2 (&zs, -MAX_WBITS); - - if (res != Z_OK) - { - SMB_CloseFile (smbfile); - return 0; - } - - zs.avail_in = - 16384 - (sizeof (PKZIPHEADER) + - FLIP16 (pkzip.filenameLength) + - FLIP16 (pkzip.extraDataLength)); - zs.next_in = - (Bytef *) zipbuffer + (sizeof (PKZIPHEADER) + - FLIP16 (pkzip.filenameLength) + - FLIP16 (pkzip.extraDataLength)); - } - } - - if (zip) - { - if (pass) - { - zs.avail_in = bytesread; - zs.next_in = (Bytef *) zipbuffer; - } - - do - { - zs.avail_out = ZIPCHUNK; - zs.next_out = (Bytef *) output; - - res = inflate (&zs, Z_NO_FLUSH); - - have = ZIPCHUNK - zs.avail_out; - - if (have) - { - memcpy (rbuffer + outbytes, output, have); - outbytes += have; - } - } while (zs.avail_out == 0); - } - else - { - memcpy (rbuffer + offset, zipbuffer, bytesread); - } - offset += bytesread; - - pass++; - } - - if (zip) - { - inflateEnd (&zs); - offset = outbytes; - } - - SMB_CloseFile (smbfile); - - return offset; - } + /* Check filename length */ + if ((strlen(currentdir)+1+strlen(filelist[selection].filename)) < MAXPATHLEN) + sprintf(filepath, "%s/%s",currentdir,filelist[selection].filename); else { - WaitPrompt((char*) "SMB Reading Failed!"); - return 0; + WaitPrompt((char*) "Maximum filepath length reached!"); + return -1; } + + boffset = LoadBufferFromSMB(SMBPath(filepath), NOTSILENT); + + if(boffset > 0) + { + if(IsZipFile ((char *)savebuffer)) + return UnZipBuffer(rbuffer, savebuffer); + else + memcpy (rbuffer, savebuffer, boffset); + } + return boffset; } /**************************************************************************** @@ -314,10 +244,13 @@ LoadSMBFile (char *filename, int length) int SaveBufferToSMB (char *filepath, int datasize, bool8 silent) { + if(!ConnectShare (NOTSILENT)) + return 0; + SMBFILE smbfile; int dsize = datasize; int wrote = 0; - int offset = 0; + int boffset = 0; smbfile = SMB_OpenFile (SMBPath(filepath), SMB_OPEN_WRITING | SMB_DENY_NONE, @@ -329,18 +262,18 @@ SaveBufferToSMB (char *filepath, int datasize, bool8 silent) { if (dsize > 1024) wrote = - SMB_WriteFile ((char *) savebuffer + offset, 1024, offset, smbfile); + SMB_WriteFile ((char *) savebuffer + boffset, 1024, boffset, smbfile); else wrote = - SMB_WriteFile ((char *) savebuffer + offset, dsize, offset, smbfile); + SMB_WriteFile ((char *) savebuffer + boffset, dsize, boffset, smbfile); - offset += wrote; + boffset += wrote; dsize -= wrote; } SMB_CloseFile (smbfile); - return offset; + return boffset; } else { @@ -358,6 +291,9 @@ SaveBufferToSMB (char *filepath, int datasize, bool8 silent) int LoadBufferFromSMB (char *filepath, bool8 silent) { + if(!ConnectShare (NOTSILENT)) + return 0; + SMBFILE smbfile; int ret; int offset = 0; @@ -367,7 +303,7 @@ LoadBufferFromSMB (char *filepath, bool8 silent) if (!smbfile) { - if (!silent) + if(!silent) { char msg[100]; sprintf(msg, "Couldn't open SMB: %s", SMBPath(filepath)); diff --git a/source/ngc/smbop.h b/source/ngc/smbop.h index 33d4cb1..c759d00 100644 --- a/source/ngc/smbop.h +++ b/source/ngc/smbop.h @@ -16,10 +16,10 @@ #define _NGCSMB_ bool InitializeNetwork(bool silent); -bool ConnectShare (); +bool ConnectShare (bool silent); char * SMBPath(char * path); -int updateSMBdirname(); -int parseSMBdirectory (); +int UpdateSMBdirname(); +int ParseSMBdirectory (); int LoadSMBFile (char *filename, int length); int LoadBufferFromSMB (char *filepath, bool8 silent); int SaveBufferToSMB (char *filepath, int datasize, bool8 silent); diff --git a/source/ngc/snes9xGX.cpp b/source/ngc/snes9xGX.cpp index 3a0cb78..2ad143e 100644 --- a/source/ngc/snes9xGX.cpp +++ b/source/ngc/snes9xGX.cpp @@ -187,7 +187,7 @@ #include "audio.h" #include "menu.h" #include "sram.h" -#include "memfile.h" +#include "freeze.h" #include "preferences.h" #include "gctime.h" #include "button_mapping.h" @@ -320,10 +320,8 @@ decodepad (int pad) //unsigned short jp, wp; // u32 jp, wp; float t; - float mag = 0; - float mag2 = 0; - u16 ang = 0; - u16 ang2 = 0; + float mag, mag2; + u16 ang, ang2; u32 exp_type; /*** Do analogue updates ***/ @@ -334,7 +332,12 @@ decodepad (int pad) exp_type = wpad_get_analogues(pad, &mag, &ang, &mag2, &ang2); // get joystick info from wii expansions wp = WPAD_ButtonsHeld (pad); // wiimote #else + exp_type = 0; wp = 0; + ang = 0; +ang2 = 0; +mag = 0; +mag2 = 0; #endif /*** diff --git a/source/ngc/snes9xGX.h b/source/ngc/snes9xGX.h index 790b4ed..c4356fa 100644 --- a/source/ngc/snes9xGX.h +++ b/source/ngc/snes9xGX.h @@ -180,9 +180,10 @@ struct SGCSettings{ uint8 AutoLoad; uint8 AutoSave; uint8 LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB) - char LoadFolder[200]; // Path to game files uint8 SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, SMB + char LoadFolder[200]; // Path to game files char SaveFolder[200]; // Path to save files + char CheatFolder[200]; // Path to cheat files char gcip[16]; char gwip[16]; char mask[16]; @@ -202,7 +203,6 @@ struct SGCSettings{ START_EXTERN_C extern struct SGCSettings GCSettings; -extern unsigned short saveicon[1024]; extern bool8 isWii; extern u32 wpad_get_analogues(int pad, float* mag1, u16* ang1, float* mag2, u16* ang2); diff --git a/source/ngc/sram.cpp b/source/ngc/sram.cpp index 46abb6d..76605eb 100644 --- a/source/ngc/sram.cpp +++ b/source/ngc/sram.cpp @@ -18,8 +18,9 @@ #include "srtc.h" #include "snes9xGx.h" +#include "images/saveicon.h" #include "menudraw.h" -#include "mcsave.h" +#include "memcardop.h" #include "fileop.h" #include "smbop.h" #include "filesel.h" @@ -239,6 +240,8 @@ decodesavedata (int readsize) int LoadSRAM (int method, bool silent) { + ShowAction ((char*) "Loading..."); + if(method == METHOD_AUTO) method = autoLoadMethod(); @@ -247,7 +250,7 @@ LoadSRAM (int method, bool silent) if(method == METHOD_SD || method == METHOD_USB) { - changeFATInterface(method, NOTSILENT); + ChangeFATInterface(method, NOTSILENT); sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); offset = LoadBufferFromFAT (filepath, silent); } @@ -271,10 +274,10 @@ LoadSRAM (int method, bool silent) { decodesavedata (offset); S9xSoftReset(); - return 1; } + // if we reached here, nothing was done! if(!silent) WaitPrompt ((char*) "SRAM file not found"); @@ -287,6 +290,8 @@ LoadSRAM (int method, bool silent) bool SaveSRAM (int method, bool silent) { + ShowAction ((char*) "Saving..."); + if(method == METHOD_AUTO) method = autoSaveMethod(); @@ -295,9 +300,6 @@ SaveSRAM (int method, bool silent) int datasize; int offset = 0; - if (!silent) - ShowAction ((char*) "Saving SRAM..."); - if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) datasize = prepareMCsavedata (); else @@ -307,9 +309,11 @@ SaveSRAM (int method, bool silent) { if(method == METHOD_SD || method == METHOD_USB) { - changeFATInterface(method, NOTSILENT); - sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); - offset = SaveBufferToFAT (filepath, datasize, silent); + if(ChangeFATInterface(method, NOTSILENT)) + { + sprintf (filepath, "%s/%s/%s.srm", ROOTFATDIR, GCSettings.SaveFolder, Memory.ROMFilename); + offset = SaveBufferToFAT (filepath, datasize, silent); + } } else if(method == METHOD_SMB) { @@ -330,10 +334,7 @@ SaveSRAM (int method, bool silent) if (offset > 0) { if ( !silent ) - { - sprintf (filepath, "Wrote %d bytes", offset); - WaitPrompt(filepath); - } + WaitPrompt((char *)"Save successful"); retval = true; } } diff --git a/source/ngc/tempgfx.h b/source/ngc/tempgfx.h deleted file mode 100644 index f9d3b3d..0000000 --- a/source/ngc/tempgfx.h +++ /dev/null @@ -1,556 +0,0 @@ -/******************************************************************* - * Image File : ..\snesGX2.bmp - * Width : 640 - * Height : 480 - * - * This header contains a compressed Zip image. - * Use zlib1.2.3 uncompress function to restore. - *******************************************************************/ - -#define tempgfx_RAW 614400 -#define tempgfx_COMPRESSED 8647 -#define tempgfx_WIDTH 640 -#define tempgfx_HEIGHT 480 - -unsigned char tempgfx[8647] = { -0x78,0xda,0xed,0x9d,0xd9,0x77,0x14,0x47,0x9e,0xef,0xf9,0xdb,0xee,0xcb,0x9d,0x99, -0x3b,0x67,0x66,0x7a,0xe6,0x9c,0xdb,0xe3,0xf6,0x9d,0xde,0x6c,0xb7,0xdb,0xdd,0xee, -0xf6,0xc2,0x8e,0xa9,0x88,0x5f,0xa6,0x58,0x8d,0x31,0x60,0xcc,0x2a,0x30,0x8b,0x58, -0x2c,0x10,0x48,0x2c,0x02,0x81,0x16,0xb4,0x21,0xb4,0x21,0xc4,0x22,0x21,0xc0,0x02, -0x03,0x9e,0x87,0xee,0x73,0x6e,0x9f,0xe3,0x7e,0xe8,0x97,0x7e,0xb8,0xf7,0x17,0x51, -0x59,0xa5,0xcc,0x92,0x4a,0xca,0x12,0x2a,0x55,0x09,0x3e,0xfd,0x3d,0x9f,0x36,0x52, -0xe5,0x12,0x99,0x59,0xf9,0x51,0x44,0x46,0x64,0xe6,0x32,0x59,0x46,0x08,0x21,0x84, -0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10, -0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0xbc,0xa6, -0xe9,0x91,0x2b,0x72,0x46,0x8e,0xcb,0x7e,0xd9,0x47,0x08,0x21,0x65,0xc9,0x7e,0x75, -0xcc,0x19,0x75,0x4d,0x4f,0xd5,0x98,0xaf,0x5d,0xce,0xcb,0x37,0x52,0x4b,0x08,0x21, -0x8b,0x96,0x6f,0xd4,0x3b,0xed,0x15,0xb7,0x5f,0xb3,0xfa,0x98,0x10,0x42,0x2a,0x91, -0xe6,0x0a,0xba,0xef,0x96,0x5c,0x94,0x7a,0x42,0x08,0xa9,0x58,0x2e,0xaa,0x87,0x2a, -0x61,0xbf,0x6e,0xb9,0xa4,0xeb,0x26,0x84,0x90,0x4a,0xe6,0x92,0xba,0x68,0xf1,0xfb, -0x3b,0xae,0x11,0x42,0x48,0x55,0xa4,0x67,0x91,0x5b,0xbe,0xad,0x84,0x10,0x52,0x35, -0x59,0xbc,0x56,0xf0,0x90,0x74,0x48,0xdb,0xb4,0x74,0x49,0xbf,0x19,0x92,0x3b,0xe6, -0x4e,0x00,0x00,0x50,0x1e,0x86,0xd4,0x33,0x5d,0xd2,0x66,0x0b,0xfd,0xd3,0xa1,0x5e, -0x5a,0xac,0xb6,0x6f,0x47,0x41,0x3a,0x65,0x88,0x63,0x03,0x00,0x8b,0x83,0xfa,0xa6, -0x53,0x3a,0x6c,0xd2,0x42,0x8b,0xd3,0x06,0xee,0x97,0x1b,0x05,0xe9,0xb3,0x23,0xd4, -0xfb,0x00,0x60,0x11,0x19,0x91,0x3e,0x53,0x68,0xa2,0xfe,0x45,0xf0,0x5f,0xaf,0xd6, -0xf6,0xe2,0xe9,0xc7,0x7d,0x00,0x50,0x01,0xfa,0xa5,0xd3,0xc6,0x5d,0xd4,0xbb,0x28, -0xad,0xdf,0xee,0x58,0xfa,0x2c,0xc7,0x01,0x00,0x2a,0xd3,0x0e,0xee,0x33,0x71,0x1b, -0x95,0xbf,0x05,0x3c,0xa8,0xeb,0x88,0x67,0x04,0xff,0x01,0x40,0x85,0xfc,0x77,0xdb, -0x24,0x7d,0x34,0x58,0x66,0xff,0x0d,0xc8,0xcd,0x58,0x68,0xfb,0x02,0x40,0x65,0xdb, -0xc0,0x37,0x6d,0xdc,0x48,0xe5,0xee,0xfd,0xe8,0x8b,0x85,0xf1,0x2e,0x00,0x50,0xd9, -0xf1,0x30,0x7d,0x76,0xca,0x48,0xb7,0xca,0x5e,0xff,0xeb,0x8f,0x65,0x84,0xfd,0x0f, -0x00,0x15,0xed,0x07,0xee,0xb7,0x71,0x27,0x95,0xdb,0x7f,0xf1,0xb0,0xff,0x01,0xa0, -0xb2,0xd7,0x00,0x07,0x6c,0xdc,0x49,0xe5,0xee,0xff,0x88,0x87,0xfd,0x0f,0x00,0x95, -0xf5,0xdf,0xa0,0x8d,0x3b,0xa9,0xbc,0xfe,0x1b,0x49,0x84,0xfd,0x0f,0x00,0x95,0xf5, -0xdf,0xb0,0x1d,0x96,0xa9,0x94,0xd7,0x7f,0xb7,0x13,0x61,0xff,0x03,0x40,0x85,0xc7, -0xc0,0xd8,0xb8,0x93,0xa8,0xff,0x01,0xc0,0x9b,0xe3,0xbf,0x11,0x1b,0x77,0x52,0x79, -0xfd,0x77,0x27,0x19,0xf6,0x3f,0x00,0x54,0xd4,0x7f,0x77,0x6c,0xdc,0x49,0xe5,0xf5, -0xdf,0xdd,0x44,0xd8,0xff,0x73,0x1d,0x9b,0xcb,0x66,0x9b,0xac,0xb6,0xab,0x65,0xee, -0x6c,0x93,0xba,0x45,0xbb,0x97,0xe6,0xb2,0x6c,0x33,0x69,0xca,0xa4,0xa5,0xb2,0x75, -0x6e,0x8c,0xa7,0x34,0xa6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90,0x1f,0xb3,0xf2,0x2c,0x3f,0xf6,0xe5,0x71,0x26,0x37,0x1e,0x66, -0x3c,0x3f,0x46,0xa6,0x90,0x7b,0x45,0xaf,0x57,0xc6,0x79,0x18,0x3c,0xd4,0x65,0x7d, -0x97,0xbf,0x76,0xf9,0x7c,0x09,0xf8,0x6f,0xa6,0xe7,0x15,0x36,0xcb,0x75,0x6d,0xbf, -0xdc,0xc4,0x81,0xfe,0xde,0xd1,0x5e,0xd3,0x1a,0x34,0x98,0x5a,0xf9,0x42,0xcf,0xf9, -0xcf,0xcc,0x1a,0x3d,0x17,0x92,0xb8,0xeb,0xee,0xab,0xcc,0x4a,0x65,0x9d,0x84,0x66, -0x87,0x1f,0xb3,0x76,0x5a,0xd9,0xaf,0x75,0xbd,0x1a,0x9d,0x67,0xab,0xd9,0x27,0xf5, -0xa6,0x45,0x97,0x33,0x1c,0x5b,0x66,0x8b,0xfe,0x6e,0x9f,0x7e,0x16,0xea,0x3c,0x5b, -0x65,0x8f,0x39,0x26,0x27,0x95,0xfd,0x66,0xbb,0xfe,0xbc,0x4e,0x97,0xb5,0xca,0xdf, -0x13,0x56,0xb8,0xae,0x35,0x7a,0x5e,0x66,0xec,0x46,0xd9,0x6e,0xf6,0xe8,0x7a,0x0e, -0xca,0x57,0xe6,0x73,0x9d,0xfe,0x33,0x59,0x33,0xad,0x5c,0xab,0xfd,0x32,0x56,0x2a, -0xeb,0x74,0x1d,0x3b,0x74,0xda,0xe3,0xe6,0x94,0xb2,0x6f,0x8e,0xed,0xc8,0xfa,0xd5, -0x18,0x77,0xef,0xfe,0x71,0x39,0xa3,0xed,0xf6,0x93,0x3a,0xef,0x76,0x9d,0x27,0xa3, -0x8e,0xde,0x68,0x77,0xca,0x37,0xa6,0x21,0xb8,0x62,0xae,0x29,0x0d,0xfa,0xef,0x9d, -0xb2,0x51,0x7f,0x9f,0xb1,0x5a,0xeb,0xd2,0x7d,0x54,0x6f,0xdc,0x33,0x9f,0x5a,0xa4, -0x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x37,0x6f,0x46,0xb3,0xcf,0x68,0x0b,0xb3, -0xcf,0x68,0x7b,0x5a,0x25,0xf7,0x42,0xe1,0xb9,0xa9,0x76,0xeb,0xa3,0xfc,0xf3,0xd5, -0x39,0x07,0x01,0xff,0x2d,0xd6,0xf3,0xfe,0xb3,0xcf,0x38,0x9a,0xc8,0xbf,0x13,0xfa, -0x05,0x5e,0x5a,0xf0,0x7b,0xc0,0x72,0xef,0x90,0x70,0x8e,0xcb,0xbd,0x07,0x8c,0x7e, -0x08,0xc0,0x7f,0xd5,0xfa,0xfe,0xf3,0x6c,0x5f,0xc2,0x98,0xef,0x33,0x98,0x88,0xfa, -0x3e,0xbf,0xe7,0x1a,0x63,0xd1,0x77,0xb8,0x3e,0x4d,0xf4,0xeb,0x8c,0xbd,0xf6,0xef, -0xc9,0x01,0xfc,0xf7,0x3a,0xfb,0xaf,0xb4,0x71,0x6f,0xb9,0xb1,0xbd,0xd9,0xb1,0x8b, -0xdf,0x57,0xd7,0xfd,0x5a,0xaf,0x30,0x46,0x2e,0xfe,0x6e,0x6a,0x37,0x56,0x2e,0x72, -0x5b,0x86,0x71,0x90,0x80,0xff,0xde,0x64,0xff,0x95,0x3e,0x8e,0x2e,0xdb,0xce,0xce, -0xfb,0x32,0x36,0x16,0x26,0xee,0xcd,0x99,0x79,0x51,0xc2,0x98,0xed,0xe2,0x4c,0xc6, -0xd6,0x37,0x31,0x35,0xfe,0x26,0x36,0x46,0x86,0x71,0xc0,0x80,0xff,0xf0,0x1f,0x00, -0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff, -0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f, -0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00, -0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00, -0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8, -0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00, -0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f, -0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00, -0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87, -0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03, -0x00,0xfc,0xc7,0xfe,0x07,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00, -0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0, -0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03, -0x00,0xc0,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f, -0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07, -0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0, -0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xd8, -0xff,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00, -0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80, -0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f, -0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0, -0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1, -0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00, -0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03, -0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00, -0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f, -0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0xc0,0x7f,0xf8,0x0f, -0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0, -0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1, -0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00, -0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00, -0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0x96,0xb6,0xff,0x86,0xf1, -0x1f,0x00,0x50,0xff,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01, -0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00, -0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f, -0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00, -0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87, -0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03, -0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xec,0x7f,0x00,0xc0, -0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07, -0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00, -0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0xf8,0x0f, -0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07, -0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0, -0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0, -0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x8f,0xfd,0x0f,0x00,0xf8,0x0f,0x00,0x00, -0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f, -0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00, -0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0, -0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1, -0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00, -0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc, -0x87,0xff,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff, -0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00, -0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0, -0x1f,0x00,0x00,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0, -0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1, -0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00, -0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc, -0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00, -0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80, -0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x80,0xff,0xf0, -0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00, -0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe, -0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff, -0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0x00,0x00,0xfc, -0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00, -0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80, -0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff, -0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff, -0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00, -0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f, -0xfe,0x03,0x00,0xfc,0xc7,0xfe,0x07,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0, -0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01, -0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00, -0xfe,0x03,0x00,0xc0,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f,0xfc,0x07,0x00, -0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f,0x00,0xe0,0x3f, -0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80,0xff,0xf0,0x1f, -0x00,0xe0,0x3f,0xfc,0x07,0x00,0xf8,0x0f,0xff,0x01,0x00,0xfe,0xc3,0x7f,0x00,0x80, -0xff,0xd8,0xff,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0, -0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0x00,0xfc,0x07, -0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00, -0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f, -0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00, -0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87, -0xff,0x00,0x00,0xff,0xe1,0x3f,0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0x00,0x00, -0xfe,0x03,0x00,0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f, -0x00,0x00,0xfc,0x07,0x00,0x80,0xff,0x00,0x00,0xf0,0x1f,0x00,0x00,0xfe,0x03,0x00, -0xc0,0x7f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xff,0x01,0x00,0xe0,0x3f,0x00,0xc0,0x7f, -0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00,0xff,0xe1,0x3f, -0x00,0xc0,0x7f,0xf8,0x0f,0x00,0xf0,0x1f,0xfe,0x03,0x00,0xfc,0x87,0xff,0x00,0x00, -0xff,0x95,0xe0,0xbf,0x11,0x19,0x31,0x00,0x00,0x95,0xa3,0x82,0xfe,0x0b,0x74,0xfd, -0x00,0x00,0x95,0x62,0x51,0xfd,0xf7,0x38,0x11,0xf6,0x3f,0x00,0x54,0xd6,0x7f,0x8f, -0x6d,0xdc,0x49,0xe5,0xf5,0xdf,0xa3,0x44,0xa8,0x7b,0x03,0x40,0x65,0x79,0x64,0xe3, -0x4e,0x2a,0xaf,0xff,0x26,0x12,0xb9,0x1d,0xdc,0x36,0x00,0x00,0x15,0x43,0x26,0x6c, -0xdc,0x49,0xf8,0x0f,0x00,0xf0,0x5f,0x39,0xf2,0x30,0x91,0xdb,0xe2,0xd6,0x0f,0x00, -0x50,0x29,0x1e,0xda,0xb8,0x93,0xca,0xeb,0xbf,0xf1,0x44,0x86,0x83,0x61,0x03,0x00, -0x50,0x31,0x64,0xdc,0xc6,0x9d,0x54,0x5e,0xff,0x8d,0x25,0x32,0x2c,0x6e,0xfd,0x00, -0x00,0x95,0x62,0xcc,0xc6,0x9d,0x54,0x5e,0xff,0x3d,0x48,0x64,0x48,0x86,0x0c,0x00, -0x40,0xe5,0x78,0x60,0xe3,0x4e,0x2a,0xaf,0xff,0xee,0x27,0xc2,0xbe,0x07,0x80,0xca, -0x72,0xdf,0xc6,0x9d,0x54,0x5e,0xff,0xdd,0x4b,0x64,0x50,0x06,0x0d,0x00,0x40,0xe5, -0xb8,0x67,0xe3,0x4e,0x2a,0xaf,0xff,0xee,0x26,0xa2,0xeb,0xb7,0x00,0x00,0x95,0xe3, -0xae,0x8d,0x3b,0xa9,0xbc,0xfe,0xbb,0x93,0xc8,0x80,0x0c,0x18,0x00,0x80,0xca,0x71, -0xc7,0xc6,0x9d,0x54,0x5e,0xff,0x8d,0x24,0xa2,0xeb,0xb7,0x00,0x00,0x95,0x63,0xc4, -0xc6,0x9d,0x54,0x5e,0xff,0xdd,0x4e,0xa4,0x5f,0xfa,0x0d,0x00,0x40,0xe5,0xb8,0x6d, -0xe3,0x4e,0x5a,0x64,0xff,0x59,0x00,0x80,0xca,0x31,0x6c,0x87,0x65,0x2a,0xe5,0xf5, -0xdf,0x60,0x22,0xb7,0xe4,0x96,0x05,0x00,0xa8,0x1c,0xbe,0x1f,0x24,0x9f,0xf2,0xfa, -0x6f,0x20,0x11,0xf6,0x3d,0x00,0x54,0x16,0x7f,0x1d,0x30,0x6f,0xa4,0x72,0xfb,0xaf, -0x3f,0x96,0x3e,0xe9,0xb3,0x00,0x00,0x95,0xc3,0xb7,0x83,0xa3,0x74,0x95,0xd9,0x7f, -0xde,0x79,0xf1,0xb0,0xff,0x01,0xa0,0xd2,0x44,0xb9,0x5a,0xf6,0xfa,0xdf,0xcd,0x64, -0x2c,0x00,0x40,0x85,0x89,0x72,0xae,0xec,0xfd,0x1f,0x3d,0x89,0xb0,0xef,0x01,0xa0, -0x72,0x24,0x7d,0x54,0x57,0x66,0xff,0x2d,0xd3,0x75,0x74,0xc7,0xd2,0x23,0xbd,0xd2, -0x6b,0x01,0x00,0x16,0x9f,0x1e,0x1b,0xb7,0x51,0x67,0xd9,0xed,0xb7,0x4c,0x7d,0xd7, -0x99,0x48,0x37,0xc7,0x01,0x00,0x2a,0x80,0x1a,0xcf,0xc6,0x5d,0x74,0x69,0x11,0xfc, -0xd7,0x2f,0x37,0x0a,0xd2,0xe5,0xea,0xa0,0x00,0x00,0x8b,0x48,0x97,0x2d,0x34,0xd1, -0xa9,0x45,0xf0,0x9f,0x6b,0x01,0x77,0x14,0xe4,0x86,0x74,0x73,0x3c,0x00,0x60,0x91, -0xe8,0x56,0xf7,0x15,0x5a,0xe8,0xc2,0xa2,0xd8,0x6f,0x99,0x0c,0xe9,0xba,0xda,0xa6, -0xa5,0x43,0x7d,0xdc,0xcd,0xb1,0x01,0x80,0x32,0xd2,0x2d,0x5d,0xce,0x3f,0xb6,0xd0, -0x3f,0x2d,0x8b,0x64,0x3f,0x97,0x5b,0xd2,0x4a,0x08,0x21,0x55,0x93,0x93,0x8b,0xe8, -0xbf,0x65,0xd2,0x2d,0xd7,0x08,0x21,0xa4,0x2a,0x72,0x76,0x51,0xed,0xe7,0xd2,0x21, -0x17,0x09,0x21,0xa4,0xe2,0x39,0xbd,0xe8,0xf6,0x73,0xe9,0x92,0x0b,0x52,0x4f,0x08, -0x21,0x15,0xcb,0x29,0x39,0x22,0xb5,0x15,0xf1,0x9f,0x4b,0xb3,0x1c,0x27,0x84,0x90, -0x8a,0xe4,0x88,0x1c,0xd2,0x2c,0xab,0x60,0xda,0xe5,0x9c,0x1c,0x56,0x03,0x13,0x42, -0xc8,0xe2,0xc5,0x99,0xef,0xb0,0xcf,0xb2,0x8a,0xa7,0x5b,0xae,0x68,0x5d,0xf4,0x98, -0xec,0x23,0x84,0x90,0xb2,0xe5,0x80,0x1c,0xf4,0xde,0x3b,0x92,0xcf,0x32,0x42,0x08, -0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21, -0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84, -0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x10,0x42,0x08,0x21,0x84,0x54, -0x79,0xfe,0x3f,0x57,0x9d,0xaa,0x31}; diff --git a/source/ngc/unzip.cpp b/source/ngc/unzip.cpp index 824efae..5832b29 100644 --- a/source/ngc/unzip.cpp +++ b/source/ngc/unzip.cpp @@ -29,25 +29,25 @@ u32 FLIP32 (u32 b) { - unsigned int c; + unsigned int c; - c = (b & 0xff000000) >> 24; - c |= (b & 0xff0000) >> 8; - c |= (b & 0xff00) << 8; - c |= (b & 0xff) << 24; + c = (b & 0xff000000) >> 24; + c |= (b & 0xff0000) >> 8; + c |= (b & 0xff00) << 8; + c |= (b & 0xff) << 24; - return c; + return c; } u16 FLIP16 (u16 b) { - u16 c; + u16 c; - c = (b & 0xff00) >> 8; - c |= (b & 0xff) << 8; + c = (b & 0xff00) >> 8; + c |= (b & 0xff) << 8; - return c; + return c; } /**************************************************************************** @@ -58,14 +58,14 @@ FLIP16 (u16 b) int IsZipFile (char *buffer) { - unsigned int *check; + unsigned int *check; - check = (unsigned int *) buffer; + check = (unsigned int *) buffer; - if (check[0] == PKZIPID) - return 1; + if (check[0] == PKZIPID) + return 1; - return 0; + return 0; } /***************************************************************************** @@ -73,112 +73,134 @@ IsZipFile (char *buffer) * * It should be noted that there is a limit of 5MB total size for any ROM ******************************************************************************/ -int -UnZipBuffer (unsigned char *outbuffer, u64 discoffset, short where, FILE* filehandle) +unsigned char * uzipbuffer; + +int UnZipBuffer(unsigned char *outbuffer, unsigned char *inbuffer) { - PKZIPHEADER pkzip; - int zipoffset = 0; - int zipchunk = 0; - char out[ZIPCHUNK]; - z_stream zs; - int res; - int bufferoffset = 0; - int have = 0; - char readbuffer[2048]; - char msg[128]; + uzipbuffer = inbuffer; + return UnZipBuffer(outbuffer, 0, 2, NULL); +} + +int +UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehandle) +{ + PKZIPHEADER pkzip; + int zipoffset = 0; + int zipchunk = 0; + char out[ZIPCHUNK]; + z_stream zs; + int res; + int bufferoffset = 0; + int have = 0; + char readbuffer[2048]; + char msg[128]; /*** Read Zip Header ***/ - switch (where) { - case 0: // SD Card + switch (where) + { + case 0: // SD Card fseek(filehandle, 0, SEEK_SET); - fread (readbuffer, 1, 2048, filehandle); break; - case 1: // DVD - dvd_read (readbuffer, 2048, discoffset); break; - } + fread (readbuffer, 1, 2048, filehandle); + break; + + case 1: // DVD + dvd_read (readbuffer, 2048, inoffset); + break; + + case 2: // From buffer + memcpy(readbuffer, uzipbuffer, 2048); + break; + } /*** Copy PKZip header to local, used as info ***/ - memcpy (&pkzip, readbuffer, sizeof (PKZIPHEADER)); + memcpy (&pkzip, readbuffer, sizeof (PKZIPHEADER)); - pkzip.uncompressedSize = FLIP32 (pkzip.uncompressedSize); + pkzip.uncompressedSize = FLIP32 (pkzip.uncompressedSize); - sprintf (msg, "Unzipping %d bytes ... Wait", - pkzip.uncompressedSize); - ShowAction (msg); + sprintf (msg, "Unzipping %d bytes ... Wait", + pkzip.uncompressedSize); + ShowAction (msg); /*** Prepare the zip stream ***/ - memset (&zs, 0, sizeof (z_stream)); - zs.zalloc = Z_NULL; - zs.zfree = Z_NULL; - zs.opaque = Z_NULL; - zs.avail_in = 0; - zs.next_in = Z_NULL; - res = inflateInit2 (&zs, -MAX_WBITS); + memset (&zs, 0, sizeof (z_stream)); + zs.zalloc = Z_NULL; + zs.zfree = Z_NULL; + zs.opaque = Z_NULL; + zs.avail_in = 0; + zs.next_in = Z_NULL; + res = inflateInit2 (&zs, -MAX_WBITS); - if (res != Z_OK) - return 0; + if (res != Z_OK) + return 0; /*** Set ZipChunk for first pass ***/ - zipoffset = - (sizeof (PKZIPHEADER) + FLIP16 (pkzip.filenameLength) + - FLIP16 (pkzip.extraDataLength)); - zipchunk = ZIPCHUNK - zipoffset; + zipoffset = + (sizeof (PKZIPHEADER) + FLIP16 (pkzip.filenameLength) + + FLIP16 (pkzip.extraDataLength)); + zipchunk = ZIPCHUNK - zipoffset; /*** Now do it! ***/ - do - { - zs.avail_in = zipchunk; - zs.next_in = (Bytef *) & readbuffer[zipoffset]; + do + { + zs.avail_in = zipchunk; + zs.next_in = (Bytef *) & readbuffer[zipoffset]; /*** Now inflate until input buffer is exhausted ***/ - do - { - zs.avail_out = ZIPCHUNK; - zs.next_out = (Bytef *) & out; + do + { + zs.avail_out = ZIPCHUNK; + zs.next_out = (Bytef *) & out; - res = inflate (&zs, Z_NO_FLUSH); + res = inflate (&zs, Z_NO_FLUSH); - if (res == Z_MEM_ERROR) - { - inflateEnd (&zs); - return 0; - } + if (res == Z_MEM_ERROR) + { + inflateEnd (&zs); + return 0; + } - have = ZIPCHUNK - zs.avail_out; - if (have) - { - /*** Copy to normal block buffer ***/ - memcpy (&outbuffer[bufferoffset], &out, have); - bufferoffset += have; - } - - } - while (zs.avail_out == 0); + have = ZIPCHUNK - zs.avail_out; + if (have) + { + /*** Copy to normal block buffer ***/ + memcpy (&outbuffer[bufferoffset], &out, have); + bufferoffset += have; + } + } + while (zs.avail_out == 0); /*** Readup the next 2k block ***/ - zipoffset = 0; - zipchunk = ZIPCHUNK; + zipoffset = 0; + zipchunk = ZIPCHUNK; - switch (where) { - case 0: // SD Card - fread (readbuffer, 1, 2048, filehandle); break; - case 1: // DVD - discoffset += 2048; - dvd_read (readbuffer, 2048, discoffset); break; - } + switch (where) + { + case 0: // SD Card + fread (readbuffer, 1, 2048, filehandle); + break; - } - while (res != Z_STREAM_END); + case 1: // DVD + inoffset += 2048; + dvd_read (readbuffer, 2048, inoffset); + break; - inflateEnd (&zs); + case 2: // From buffer + inoffset += 2048; + memcpy(readbuffer, uzipbuffer+inoffset, 2048); + break; + } + } + while (res != Z_STREAM_END); - if (res == Z_STREAM_END) - { - if (pkzip.uncompressedSize == (u32) bufferoffset) - return bufferoffset; - else - return pkzip.uncompressedSize; - } + inflateEnd (&zs); - return 0; + if (res == Z_STREAM_END) + { + if (pkzip.uncompressedSize == (u32) bufferoffset) + return bufferoffset; + else + return pkzip.uncompressedSize; + } + return 0; } diff --git a/source/ngc/unzip.h b/source/ngc/unzip.h index 7a862a7..c8ae9a4 100644 --- a/source/ngc/unzip.h +++ b/source/ngc/unzip.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.50 * * Nintendo Gamecube Unzip - borrowed from the GPP * @@ -9,6 +9,7 @@ #define _UNZIP_ extern int IsZipFile (char *buffer); +int UnZipBuffer(unsigned char *outbuffer, unsigned char *inbuffer); int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, short where, FILE* filehandle); /* * Zip file header definition diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index e3c29e1..c94fc73 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -18,19 +18,8 @@ #include #include "snes9x.h" #include "memmap.h" -//#include "debug.h" -//#include "cpuexec.h" -//#include "ppu.h" -//#include "apu.h" -//#include "display.h" -//#include "gfx.h" -//#include "soundux.h" -//#include "spc700.h" -//#include "spc7110.h" -//#include "controls.h" #include "aram.h" #include "snes9xGX.h" -//#include "video.h" /*** Snes9x GFX Buffer ***/ static unsigned char snes9xgfx[1024 * 512 * 2]; @@ -162,8 +151,7 @@ copy_to_xfb (u32 arg) } FrameTimer++; - //SMBTimer++; - + SMBTimer++; } /**************************************************************************** @@ -295,11 +283,6 @@ InitGCVideo () VIDEO_Init (); PAD_Init (); - //DVD_Init (); - - /*** Check to see if this is a GC or a Wii ***/ -// int driveid = dvd_driveid(); -// bool8 isWii = !((driveid == 4) || (driveid == 6) || (driveid == 8)); AUDIO_Init (NULL); AR_Init (NULL, 0); diff --git a/source/snes9x/snapshot.cpp b/source/snes9x/snapshot.cpp index d1c12c6..c8ff5b7 100644 --- a/source/snes9x/snapshot.cpp +++ b/source/snes9x/snapshot.cpp @@ -176,7 +176,7 @@ #include "spc7110.h" #include "movie.h" #include "controls.h" -#include "memfile.h" +#include "freeze.h" #include "gccore.h" #include "menudraw.h"