Page 1 of 1

decompress (zlib) bytes

Posted: Mon Jul 23, 2018 8:03 pm
by asrael
Hi.

I've looked around a bit, but I couldn't find a way to decompress an array of bytes.
The Zip and XAD plugins only allow, also the CompressFile/DecompressFile functions only work on files.

Am I missing something?


Cheers,
Manfred

Re: decompress (zlib) bytes

Posted: Mon Jul 23, 2018 9:12 pm
by SamuraiCrow
Look into Virtual Files. It's just one extra step.

Re: decompress (zlib) bytes

Posted: Mon Jul 23, 2018 9:19 pm
by asrael
Hmm, not bad.
That should work, thanks.



Manfred

Re: decompress (zlib) bytes

Posted: Tue Jul 24, 2018 12:57 pm
by airsoftsoftwair
Keep in mind that both CompressFile() and DecompressFile() use a custom format so for raw zlib compressed bytes you'd have to imitate this custom format. I think there is a "HWPK" identifier, then 4 reserved bytes, and then the raw zlib compressed bytes. So by composing your virtual file like this you should be able to decompress raw bytes with DecompressFile():

Code: Select all

f$ = "HWPK" .. "\0\0\0\0" .. rawbytes$

Re: decompress (zlib) bytes

Posted: Tue Jul 24, 2018 5:25 pm
by asrael
Ah, OK, thanks for this pointer.
I was thinking that the virtual files also work with the ZIP or XAD plugin.
But if I don't need a plugin it's even better.


Manfred