i want to compress with a raw deflate stream with zlib

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Bleech Studios
Posts: 11
Joined: Tue May 19, 2020 10:15 am

i want to compress with a raw deflate stream with zlib

Post by Bleech Studios »

i want to compress with a raw deflate stream with zlib but whenever I do it comes out with some weird header '2q..', I need the header to be 0xED like I normally see (complicated to explain). Im using zlib 1.2.8 and this version should do it.
I use this for deflate init:

Code: Select all

deflateInit2(&stream, 1, Z_DEFLATED, -15, 1, Z_FILTERED);
. Most deflate streams start with a 0xe*, so why isnt it giving me that? the stream is valid, i checked using offzip.

Basically, if anyone can find the exact options for zlib (ive tried many) and version of zlib on the want_unpack.dat to get the want.dat then thats what Im aiming for
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: i want to compress with a raw deflate stream with zlib

Post by aluigi »

Have you tried the default deflateInit or the following?

Code: Select all

deflateInit2(&stream, 9, Z_DEFLATED, -15, 9, Z_FILTERED)

packzip is quite useful for these tests: packzip -w -15 -m 1 want_unpack.dat output.dat
Both -m 1 and -m 3 gives the initial 0xed that you want.

I don't think it makes any difference in decompression, I'm just answering to your request :)
Bleech Studios
Posts: 11
Joined: Tue May 19, 2020 10:15 am

Re: i want to compress with a raw deflate stream with zlib

Post by Bleech Studios »

Thanks aluigi that worked!!