Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / Zappo Decompress Plugin (DBPro)

Author
Message
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 21st May 2007 19:05 Edited at: 22nd May 2007 12:02
Hi all. Just created this DLL which I thought might be useful to some of you looking for a way to distribute compressed files with your software and decompress them from within DarkBasic Pro. Its a tiny DLL (39kb) so adds very little to your final exe size. Here is most of the ReadMe file explaining what it does...

Zappo Decompression DLL for DarkBasic Pro

Description:
This is a simple DLL wrapper for the Windows built-in decompression
system. I am sure you will have seen lots of files ending with an
underscore on your Windows installation CD (e.g. file.ex_) and in
other install packages. These files are compressed using Microsofts
'compress.exe' command which by default uses a flavour of the LZX
compression algorithm. This DLL lets you decompress files from
inside your DarkBasic Pro programs.

Installation:
Copy the 'ZappoDecompress.dll' file to the 'plugins-user' folder of
your DarkBasic Pro installation, usually something like:
C: \Program Files\Dark Basic Professional\Compiler\plugins-user

Copy the 'keywords_zappodecompress.ini' file to the 'keywords'
folder of the DarkBasic Pro Editor directory, usually like:
C: \Program Files\Dark Basic Professional\Editor\Keywords

Run or restart your DarkBasic Pro IDE and give it a try!

Usage:
There is only one command which takes the form:
Zappo Decompress("filename")
This will decompress the given archive file to the current
directory. It will automatically pull out the original filename
from the file so you don't need to worry about that. It returns a
zero if the archive could not be accessed. A quick example would be



This snippet will decompress the archive 'testpic.bm_' and then
open the uncompressed 'testpic.bmp' if it exists. Otherwise it will
report the error.

Compressing your own files:
You can compress your own files using the Microsoft 'compress.exe'
program. Drop to a DOS prompt (e.g. click the 'Start' button, click
'Run' and type 'cmd') and browse to your desired folder. On the
command line type:
compress -R filename
Don't forget the -R so that it stores the original name inside the
archive, and don't forget to type the extension of the file. If the
command is not on your machine you can download it as part of the
Windows 2003 Resource Kit, which also works fine in XP.

Once completed you should see a compressed version of your file
with a filename ending in an underscore, e.g. myfile.bmp would
become myfile.bm_

NOTE: Although the 'compress.exe' program does allow you to create
MS-ZIP files too, they will not work with this DLL. I may add
support for this later if people want it.

Usage Restrictions:
See ReadMe file.

I hope you find it useful. You can download it from here and it includes an example compressed file and DBPro app:
ZappoDecompress.zip (35kb)
Syncaidius
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: United Kingdom
Posted: 21st May 2007 19:27
Nice plugin Zappo. I'll add a link to this thread on the list of 'Useful TPC plugin' list here.

Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 22nd May 2007 12:11
Thanks DBking.
I think its a great way to add compressed file support to DBPro without having to add large archive libraries to your programs - especially when Windows has it already built in. The compression ratio is pretty good too. The included test BMP file is only small to begin with but it still compresses down to 23% of its original size, and of course its lossless. Any file can be compressed so you could use it to save disk space and stop people easily browsing your media.

I have tested it successfully in Windows XP and 2000 and am eager to hear if someone could test it with Vista. I am sure it should work fine but it would be nice to know for sure.

I can't see any reasons why it wouldn't work with DarkSDK too, but I don't use it so if someone wants to give that a shot I would love to hear if it works okay.

There was one thing I forgot to mention above... its COMPLETELY FREE to use in commercial and noncommercial DBPro apps. Enjoy!
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 22nd May 2007 19:36
So can u compress multiple files?


[B] - LINKIN PARK - [/B]
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 22nd May 2007 23:55
Quote: "So can u compress multiple files?"

Nope. The Microsoft 'compress.exe' command compresses each file individually. For example, a file called bigpic.bmp would become bigpic.bm_ by using the command line:
compress -R bigpic.bmp

You can of course have as many compressed files as you like and then decompress each of them in DarkBasic Pro individually when they are required.

Login to post a reply

Server time is: 2024-11-23 08:10:06
Your offset time is: 2024-11-23 08:10:06