From 6e7b96ca3a7d47b0441bed904a9b8bb25c3223de Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 12 Sep 2007 12:43:38 +0000 Subject: * added missed dependency PNGImage. * moved FUNCTION InitializePaths(), from uFiles to uMain as this is a more sane location for it. * updated files that used UFiles to point to UMain, and removed uFiles where its not needed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@385 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/PngImage/pngzlib.pas | 169 +++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 Game/Code/lib/PngImage/pngzlib.pas (limited to 'Game/Code/lib/PngImage/pngzlib.pas') diff --git a/Game/Code/lib/PngImage/pngzlib.pas b/Game/Code/lib/PngImage/pngzlib.pas new file mode 100644 index 00000000..12324f2c --- /dev/null +++ b/Game/Code/lib/PngImage/pngzlib.pas @@ -0,0 +1,169 @@ +{Portable Network Graphics Delphi ZLIB linking (16 May 2002) } + +{This unit links ZLIB to pngimage unit in order to implement } +{the library. It's now using the new ZLIB version, 1.1.4 } +{Note: The .obj files must be located in the subdirectory \obj} + +unit pngzlib; + +interface + +type + + TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; + TFree = procedure (AppData, Block: Pointer); + + // Internal structure. Ignore. + TZStreamRec = packed record + next_in: PChar; // next input byte + avail_in: Integer; // number of bytes available at next_in + total_in: Integer; // total nb of input bytes read so far + + next_out: PChar; // next output byte should be put here + avail_out: Integer; // remaining free space at next_out + total_out: Integer; // total nb of bytes output so far + + msg: PChar; // last error message, NULL if no error + internal: Pointer; // not visible by applications + + zalloc: TAlloc; // used to allocate the internal state + zfree: TFree; // used to free the internal state + AppData: Pointer; // private data object passed to zalloc and zfree + + data_type: Integer; // best guess about the data type: ascii or binary + adler: Integer; // adler32 value of the uncompressed data + reserved: Integer; // reserved for future use + end; + +function inflateInit_(var strm: TZStreamRec; version: PChar; + recsize: Integer): Integer; forward; +function inflate(var strm: TZStreamRec; flush: Integer): Integer; forward; +function inflateEnd(var strm: TZStreamRec): Integer; forward; +function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; + recsize: Integer): Integer; forward; +function deflate(var strm: TZStreamRec; flush: Integer): Integer; forward; +function deflateEnd(var strm: TZStreamRec): Integer; forward; + +const + zlib_version = '1.1.4'; + +function adler32(adler: Integer; buf: PChar; len: Integer): Integer; + + +const + Z_NO_FLUSH = 0; + Z_PARTIAL_FLUSH = 1; + Z_SYNC_FLUSH = 2; + Z_FULL_FLUSH = 3; + Z_FINISH = 4; + + Z_OK = 0; + Z_STREAM_END = 1; + Z_NEED_DICT = 2; + Z_ERRNO = (-1); + Z_STREAM_ERROR = (-2); + Z_DATA_ERROR = (-3); + Z_MEM_ERROR = (-4); + Z_BUF_ERROR = (-5); + Z_VERSION_ERROR = (-6); + + Z_NO_COMPRESSION = 0; + Z_BEST_SPEED = 1; + Z_BEST_COMPRESSION = 9; + Z_DEFAULT_COMPRESSION = (-1); + + Z_FILTERED = 1; + Z_HUFFMAN_ONLY = 2; + Z_DEFAULT_STRATEGY = 0; + + Z_BINARY = 0; + Z_ASCII = 1; + Z_UNKNOWN = 2; + + Z_DEFLATED = 8; + + _z_errmsg: array[0..9] of PChar = ( + 'need dictionary', // Z_NEED_DICT (2) + 'stream end', // Z_STREAM_END (1) + '', // Z_OK (0) + 'file error', // Z_ERRNO (-1) + 'stream error', // Z_STREAM_ERROR (-2) + 'data error', // Z_DATA_ERROR (-3) + 'insufficient memory', // Z_MEM_ERROR (-4) + 'buffer error', // Z_BUF_ERROR (-5) + 'incompatible version', // Z_VERSION_ERROR (-6) + '' + ); + +implementation + +{$L obj\deflate.obj} +{$L obj\trees.obj} +{$L obj\inflate.obj} +{$L obj\inftrees.obj} +{$L obj\adler32.obj} +{$L obj\infblock.obj} +{$L obj\infcodes.obj} +{$L obj\infutil.obj} +{$L obj\inffast.obj} + +procedure _tr_init; external; +procedure _tr_tally; external; +procedure _tr_flush_block; external; +procedure _tr_align; external; +procedure _tr_stored_block; external; +function adler32; external; +procedure inflate_blocks_new; external; +procedure inflate_blocks; external; +procedure inflate_blocks_reset; external; +procedure inflate_blocks_free; external; +procedure inflate_set_dictionary; external; +procedure inflate_trees_bits; external; +procedure inflate_trees_dynamic; external; +procedure inflate_trees_fixed; external; +procedure inflate_codes_new; external; +procedure inflate_codes; external; +procedure inflate_codes_free; external; +procedure _inflate_mask; external; +procedure inflate_flush; external; +procedure inflate_fast; external; + +procedure _memset(P: Pointer; B: Byte; count: Integer);cdecl; +begin + FillChar(P^, count, B); +end; + +procedure _memcpy(dest, source: Pointer; count: Integer);cdecl; +begin + Move(source^, dest^, count); +end; + + +// deflate compresses data +function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; + recsize: Integer): Integer; external; +function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; +function deflateEnd(var strm: TZStreamRec): Integer; external; + +// inflate decompresses data +function inflateInit_(var strm: TZStreamRec; version: PChar; + recsize: Integer): Integer; external; +function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; +function inflateEnd(var strm: TZStreamRec): Integer; external; +function inflateReset(var strm: TZStreamRec): Integer; external; + + +function zcalloc(AppData: Pointer; Items, Size: Integer): Pointer; +begin + GetMem(Result, Items*Size); +end; + +procedure zcfree(AppData, Block: Pointer); +begin + FreeMem(Block); +end; + +end. + + + -- cgit v1.2.3 From 12a7652fe6cf20441dec4aae8156978bf751861f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 10:47:12 +0000 Subject: pngimage is NOT ( yet ) lazarus compatible It might compile, however the object files are in borland obj format to use this, it will need to be in GCC object file format format Or we can use the lazarus / freepascal png unit if we decide that pngimage IS required ( and we cant use the lazarus unit ) then we should investigate how this developer went with the port. http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&t=3206 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@388 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/PngImage/pngzlib.pas | 41 ++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'Game/Code/lib/PngImage/pngzlib.pas') diff --git a/Game/Code/lib/PngImage/pngzlib.pas b/Game/Code/lib/PngImage/pngzlib.pas index 12324f2c..3155946a 100644 --- a/Game/Code/lib/PngImage/pngzlib.pas +++ b/Game/Code/lib/PngImage/pngzlib.pas @@ -6,6 +6,10 @@ unit pngzlib; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + interface type @@ -35,14 +39,12 @@ type reserved: Integer; // reserved for future use end; -function inflateInit_(var strm: TZStreamRec; version: PChar; - recsize: Integer): Integer; forward; -function inflate(var strm: TZStreamRec; flush: Integer): Integer; forward; -function inflateEnd(var strm: TZStreamRec): Integer; forward; -function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; - recsize: Integer): Integer; forward; -function deflate(var strm: TZStreamRec; flush: Integer): Integer; forward; -function deflateEnd(var strm: TZStreamRec): Integer; forward; +function inflateInit_(var strm: TZStreamRec; version: PChar; recsize: Integer): Integer; // forward; +function inflate(var strm: TZStreamRec; flush: Integer): Integer; //forward; +function inflateEnd(var strm: TZStreamRec): Integer; //forward; +function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; recsize: Integer): Integer; //forward; +function deflate(var strm: TZStreamRec; flush: Integer): Integer; //forward; +function deflateEnd(var strm: TZStreamRec): Integer; //forward; const zlib_version = '1.1.4'; @@ -97,15 +99,17 @@ const implementation -{$L obj\deflate.obj} -{$L obj\trees.obj} -{$L obj\inflate.obj} -{$L obj\inftrees.obj} -{$L obj\adler32.obj} -{$L obj\infblock.obj} -{$L obj\infcodes.obj} -{$L obj\infutil.obj} -{$L obj\inffast.obj} +{$IFNDef FPC} + {$L obj\deflate.obj} + {$L obj\trees.obj} + {$L obj\inflate.obj} + {$L obj\inftrees.obj} + {$L obj\adler32.obj} + {$L obj\infblock.obj} + {$L obj\infcodes.obj} + {$L obj\infutil.obj} + {$L obj\inffast.obj} +{$ENDIF} procedure _tr_init; external; procedure _tr_tally; external; @@ -146,8 +150,7 @@ function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; function deflateEnd(var strm: TZStreamRec): Integer; external; // inflate decompresses data -function inflateInit_(var strm: TZStreamRec; version: PChar; - recsize: Integer): Integer; external; +function inflateInit_(var strm: TZStreamRec; version: PChar; recsize: Integer): Integer; external; function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; function inflateEnd(var strm: TZStreamRec): Integer; external; function inflateReset(var strm: TZStreamRec): Integer; external; -- cgit v1.2.3