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.

DLL Talk / Searching for a zip / archive plugin

Author
Message
Grasmann
15
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 5th Dec 2012 01:06 Edited at: 5th Dec 2012 09:44
Hi,

I'm searching for a zip / archive plugin for dark basic.
I'm using the free version of dark basic, so I'm affraid the official addons aren't an option for me.

What I need:
- decompress files from archives to memory
- compress files to archives
- inspect files in read-only ( should be fast )

I found this one: http://forum.thegamecreators.com/?m=forum_view&t=84374&b=5
Unfortunately the download there doesn't include a valid source file ( the .dba is empty ) for whatever reason ( I guess it was a mistake ).
Also there is no documentation provided.

I feel like this plugin could be exactly what I need ... but how can I find out the supported commands?
Is there a way to inspect the dll, to see the commands?

Does anyone maybe know how to use it?

Does anyone know a better plugin?

Actually the compression isn't really important, I just want to pack the files to an archive.
Note: The mentioned plugin seems to work with single files only, but I think I can cope with that, and use a mixture of rar and this.


EDIT:
Ok I could figure out the commands myself:



I was able to compress a file and decompress it again.

The interesting thing for me is: If I decompress a file to memory, how can I use the content? XD

EDIT2:

I created keyword and help files for this plugin really quick.
The help files are incomplete, because I'm not yet finished figuring out what the results are XD.

I attached my repack of the original plugin.

Included:
- Compiled test application + source code
- Keyword file
- Help files ( currently pretty useless, plugin has only 4 commands anyways )

NOTE: The plugin wasn't made by me, I just created the keyword file and help files.
Creater of the plugin is "OSX Using Happy Dude"
Original Post: http://forum.thegamecreators.com/?m=forum_view&t=84374&b=5

Task:
Currently I'm trying to figure out what's going on with ZLib_DeCompressFileToMemory.
I don't even know if it's working XD.

PS: I wish I could change the topic title a bit, to signalise that I'm not only searching XD.

EDIT3:
The result of ZLib_DeCompressFileToMemory looks like a memory adress.
If that is true we can use the result of ZLib_GetDecompressFileSize to pin down the exact memory area.

Now ... the question is: What can we do with that in Dark Basic?
Any ideas? Anybody? XD

Attachments

Login to view attachments
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 5th Dec 2012 14:32
Create memblock from memory?

I'm not sure but I think that's a command you've got to work with. You'll then access the data using memblock commands.


Good luck
Grasmann
15
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 5th Dec 2012 15:06 Edited at: 5th Dec 2012 15:29
Well, I tried several things.
Actually I don't have such a command, I don't know if that's a limitation of the free version of dbpro.

However, I tried to map the memory to a bank and create a memblock from that.
Unfortunately this doesn't work with images, sounds, etc.

That's a no-go. It has to work with everything.

Currently I'm writing my own encryption system within dark basic, using IanM's datafiles, and this could really work out.
I got a working proof of concept, where I can encrypt an image and decrypt it again.

The design of the file format isn't finished yet, but I got some good ideas, and I guess if I do this correctly, this will be really fast.

The file format should look like this:

|HEADER|
Name
Author
Version
Description
|TABLE|(an entry for each file)
Filename
Adress
Size
|DATA|
BYTE

|HEADER|
So basically I'm starting with a header, that provides basic informations about the archive.

|TABLE|
Followed by the "Table" of content, a list of all files that are encrypted into the archive, providing the name, start-adress within the file and size.

|DATA|
And then comes the data of the encrypted files, which is pretty much just a big byte block.

With the information from the Table I can then read the bytes of a file precisely, and create a memblock from it. Of course the files have to be encrypted from a memblock before.

This memblock can then be converted to an image, sound, ...

With my proof of concept the size of the decrypted image differs a bit from the original, but the "Size-on-disk" fits exactly. Also if I open both pictures they look exactly the same, so I'm not sure if there is problem XD.
EDIT: OK, according to what I read the other size has to fit XD, so there IS still a little problem.

The proof-project will encrypt the provided image into a ".via" file and decrypt it again with another name.

I attached my proof of concept.
Included:
- Source code
- Test Image

Attachments

Login to view attachments
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 5th Dec 2012 17:48
Seems like I've seen this before. I usually use Gdk (c++) so I can't be much help. I'd say to comb the forums and if you haven't already ask in the darkbasic forum.
Grasmann
15
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 5th Dec 2012 22:05 Edited at: 5th Dec 2012 23:38
I guess I will just continue with this.
Actually I like it that I have full control of the file design like this.

I started to create an encryption system from this piece of code.
I'm now able to read the header.
It takes 3-4ms to read 4 strings from the file, this includes the check if the file exists, opening the file, and closing it after I read the header.

Maybe it's too early to say that, but I think that's pretty fast.

Well, we will see if it has more features XD.

EDIT:
Ok, if I remove the debugging messages ( simple print ) it only takes 1ms to read the 4 strings.

Login to post a reply

Server time is: 2024-04-18 23:20:43
Your offset time is: 2024-04-18 23:20:43