Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-03

Alternatives available to zlibex (from delphi) under Lazarus

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hello,

I used to have a delphi program that relies on expanding files encoded in a gzip looking format with some methods that uses zlibex. The files are w3g files, the replay format that warcraft III uses for storing the data of a given game, they are stored with zlib,

I am quoting the documentation of the w3g format I have here: -----
offset | size/type | Description
-------+-----------+----------------------------------------------------------- 0x0000 | 1 word | size n of compressed data block (excluding header) 0x0002 | 1 word | size of decompressed data block (currently 8k) 0x0004 | 1 dword | unknown (probably checksum)
0x0008 | n bytes | compressed data (decompress using zlib)

To decompress one block with zlib:
1. call 'inflate_init'
2. call 'inflate' with Z_SYNC_FLUSH for the block

The last block is padded with 0 bytes up to the 8K border. These bytes can be disregarded.
-----

The code sample I am using under Delphi can be seen there http://pastebin.com/m51e7b030
(that used to work under delphi 6 with zlibex) :

One w3g file is available here
http://esby.free.fr/prog/dW3gParser/other/test.w3g ( The header_size is equal to 68 for this file )

I used to rely on the TZDecompressionStream class provided by zlibex.

I tried to use the TDecompressionStream provided by ZStream, but it seems to be failing here,
as I am getting a decompression error when trying to decode the data.

I shortly tried to use a few alternatives, but I could not find anything that would work here.

What would be the alternatives or possibility I could use to sucessfully do what I used to perform under Delphi without problem?

esby / Yves Tennevin

Reply by email