Home | Reviews | GUIpedia | Forum | Fun500
SonicBrit | SB unZipI couldn't wait any longer I have to announce I'm working on an unzip program in Quick Basic.
I currently have it decoding files which use the static built Huffman tree which sadly are are like 0.1% of zip files if that. (I could only get it to work on a text file with 12 't' in a row, basically everything zip compresses it using the dynamic version), but its not lost though, because the dynamic version uses the same decoding methods just different trees.
I'm currently working on the Dynamic Huffman Tree piece of which I currently have it building the first tree and am working on building the other trees.
I wrote most of it inside of QB but moved to VB6 so I could debug easier (yeah I know cheating :P), but I'll make it work under QB once I've debugged the current issue with the second tree generation.
Its slow for sure, and as it is I'll probably end up writing the bit manipulation in asm because at the moment that is the slowest part.
In case your curious I used the [url link=http://www.faqs.org/rfcs/rfc1951.html]RFC[/url] which details the compression method and http://www.pkware.com/documents/casestudies/APPNOTE.TXT PKWares App Note which details the spec as well as the compression methods. | 2009-06-03 | 11:24 PM |
SonicBrit | First Beta ReleaseWell here is the first beta version, please note that this is highly beta, it will crash on most zip files.
There is a problem with the later lengths which don't get decoded correctly. (I'm still investigating why that is)
But I figured I would release it so people can look at it, you should be able to decompress small files, and it will only decompress the first file in a zip.
Attached is a zip with the sbunzip.exe (along with brun45.exe to prove its written in qb) and a test zip file you can use, texted.zip
WARNING When you extract a file it doesnt check that it exists!!!, which is why I defaulted it to writing the file to the root
When you run it sbunzip texted.zip
it will create texted.bas in c: not the current directory (I'll change this, but wanted to make sure it wouldnt overwrite what I was working on inside of my qb folder) [file name=SBUZ.zip size=63986]http://theguiblog.com/images/fbfiles/files/SBUZ.zip[/file] | 2009-06-05 | 12:12 AM |
trolly | Re:First Beta Releaseno sources? | 2009-06-05 | 10:00 PM |
SonicBrit | Re:First Beta ReleaseThere will be sources once I fix the bugs, fixed 2 bugs so far.
1. miscalculating the distance tree
2. one of the length case statements was using the wrong value (so would seek back a few characters instead of +131), so would garble data.
I still am getting a garbled data near the end of the stream so there still is a bug to be fix.
I hope to finish it tonight though. | 2009-06-05 | 10:16 PM |
SonicBrit | Second Beta Release (Source)Well I fixed the main bugs, the code is not optimized and it shows but it does work, and is able to extract itself which was what I was aiming for before a source release. (it doesn't handle stored parts of a zip file yet, will add that next, just the compressed parts :P)
you'll need to edit the source to alter the input
change open "sbunzip3.zip" for binary as #1 to change the filename (will eventually use command$ and alike)
and the output
open "" + f$ for binary as #2
remove the "" + to store in current folder
also it only writes the first file, again I'll be fixing that in the next release.
The main buffer string is only 24000 bytes long (it needs to be at least 32768 long). QB Strings are currently the issue, but I have ideas floating around my head and will play around with some ideas for tomorrow.
I will also implement the input and output buffers too, one of the other biggest slow downs since its reading/writing single bytes at a time.
Enjoy the source, if you have any questions feel free to ask. [file name=SBUNZIP3.zip size=3265]http://theguiblog.com/images/fbfiles/files/SBUNZIP3.zip[/file] | 2009-06-06 | 12:31 AM |
Blog
2021 Brandon Cornell