Jump to content


Photo

kbzip Extension


  • Please log in to reply
68 replies to this topic

#1 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 05 January 2011 - 07:47 AM

I am now releasing my kbzip extension. No credit is required, so feel free. There is a help file included.

***There is now another new version, 1.2. I had to remove encryption since it wasn't working anyway, but I added a couple of functions, one for checking if specific files exist in archives, and another for getting the amount of files in the archives.

**Note there is now a new version. The link is updated.
There are a couple of bug fixes, and a couple new functions for directly loading individual sprites or backgrounds from archives, without using the graphic archive loading functions.

My extension is help in run-time and content creation time. During content creation, you use my external programs to create the archives. You can use the general archives, which can contain anything you want. And you can use the graphics archives, which can only contain Game Maker files for sprites and backgrounds(.gm***) files. For the graphic archives, you also specify a variable that you want the sprite/background to be loaded into, and once you load it at run-time, it will have that graphic loaded into the variable you specify. Details are given in the help file, but you can use globals, local variables, or you can force it to be local to another instance instead of the function calling instance.

During run-time, my extension can be used to extract the general archives, either as a whole, or specific files as you need them. You can also create archives during run-time, for example if you want to take advantage of the zip password encryption to atleast somewhat thwart hackers, by zipping your save games, config files, insert whatever you want here. And of course you can load in the graphics archives.

The archives themselves are actually zip files, though you can name them whatever you want to, including .nameofgame of you wanted to. The extension will load and save them all the same. For the general archives, you can use my program, which makes it easy to specify the zip password, or you could use another program, such as WinRAR, or the WindowsOS integrated SendToZip functionality. As long as you are creating normal zip files, with or without password encryption, they are compatible with my extension. But, the graphics archives must be created with my program. They are also normal zip files, but a text file is included that specifies what files are loaded into what variables, so if you want that functionality, you use the program.

About Game Maker compatibility, I'm using GM8, and the graphics loading functions are using the ones in GM8. The general archives should be fine for GM7 though. I haven't tested this, but it should work fine.

OK, enough chit-chat, the download link follows.

HERE IT IS, MEDIAFIRE LINK

The download includes the extension(which includes the help file), and the two external programs.

Any questions, comments, bugs, anything, please let me know. Thanks.

Edited by kburkhart84, 29 August 2011 - 03:58 AM.

  • 5

#2 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 08 January 2011 - 05:56 PM

Nice work
  • 0

#3 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 08 January 2011 - 11:52 PM

Nice work


Thanks. I only have 3 downloads according to mediafire, so if you downloaded it, then I assume two more have downloaded it, and still have not had anything to say. I guess that could be a good thing, since everybody rushes to say the negative, and are pretty slow to say the positive.

Do you plan on using it?? If so, how?
  • 0

#4 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 27 January 2011 - 06:59 PM

There is now an update. The first post has the new link for the download.

I fixed a couple of bugs, and added a known bugs topic in the help file. If anyone is able to help me isolate the specific details of that bug, I would greatly appreciate it.

I have also added a couple of functions for directly loading sprites and backgrounds from archives. You don't have to use graphics archives for this, rather you can use regular archives. You still have to use GM8's file formats (.gmspr, .gmbck), but you can still store whatever files you want, and extract, load, delete them yourself. I use GM8's files because they already include all of the details, including everything in the sprite properties sheet.

As usual, any comments and criticisms is appreciated.

I am also looking at adding a few features.

One is similar to how the classic R.E.A.L. extension works, where you make a loading bar( or whatever you want really) and little by little the resources get loaded, so that there is no freeze meanwhile.

Another involves the external programs. I need to add buttons in the graphic archiver creator so that you can either only change the file, or the variable, without having to change both at once.

The last one with the external programs would be to have you specify a directory, and the regular archiver would add all files in the directory, that aren't already in the directory, and remove the files that are no longer there. This one also applies to the graphics archiver, except that it would filter out the sprites/backgrounds in case something else was there, and for new files, would ask for the name of the variable to use.

What do you guys think??? Would the above features make the extension much better?? I'm probably going to add them anyway for my personal use, but I would still like some opinions.
  • 0

#5 M_I_Soft

M_I_Soft

    GMC Member

  • GMC Member
  • 198 posts
  • Version:GM8

Posted 29 January 2011 - 01:47 PM

Found a slight bug when I try to unzip all the files on start up - it gives a dll error saying that MSVCR100.dll is missing.

Here's a screenshot of the error...
Posted Image
  • 0

#6 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 30 January 2011 - 06:49 AM

Found a slight bug when I try to unzip all the files on start up - it gives a dll error saying that MSVCR100.dll is missing.

Here's a screenshot of the error...
Posted Image


Thanks. It looks like some kind of thing to do with linking in Visual C++. Most people who have done any testing don't get that error, but a couple(including you) do, so I need to figure out what I'm linking to, and if I need it, link static, and if I don't, remove it altogether.

Thanks.

EDIT**

Can you test this version here??

I recompiled it and it may have fixed the problem. But, since I don't have a machine that was causing the error, I have no way to confirm if it fixed the problem. Thanks in advance.

Edited by kburkhart84, 30 January 2011 - 07:48 AM.

  • 0

#7 M_I_Soft

M_I_Soft

    GMC Member

  • GMC Member
  • 198 posts
  • Version:GM8

Posted 30 January 2011 - 01:39 PM

Yep that's sorted it out - only thing I can't get running is the extraction with password, but that's not too much of an issue really.

Seems to be pretty damn rapid too I must admit - I'm extracting a full directory with my sound files in and it's almost unnoticeable where it's extracting the files, no slow down at all.

Thanks for the update.

Leigh
  • 0

#8 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 30 January 2011 - 06:56 PM

Yep that's sorted it out - only thing I can't get running is the extraction with password, but that's not too much of an issue really.

Seems to be pretty damn rapid too I must admit - I'm extracting a full directory with my sound files in and it's almost unnoticeable where it's extracting the files, no slow down at all.

Thanks for the update.

Leigh


Two things: Are you using a string for the password??

And two, I know there is a bug somewhere in the encrypted file extraction. Some files survive, and some come out corrupt. I first though it had to do with a space(' ') character in the file name, but then I found a 7MB excel worksheet that has a space in the name, and it survives fine. I need someone to help test if I can find them, so I can figure out what survives and what doesn't.

In any case, simply not using the encryption works perfectly fine, and since you can have the archives be whatever file extension you want, it isn't obvious what kind of file it is unless you load up the binary header of the file(or rename it to .zip).

Thanks for testing the issue for me!!
  • 0

#9 M_I_Soft

M_I_Soft

    GMC Member

  • GMC Member
  • 198 posts
  • Version:GM8

Posted 30 January 2011 - 08:00 PM

Yep, bog standard string for the encryption password with no spaces or anything like that in the password or file name. It managed to extract the folder ok, just not any of the files in it (which seems to be normal as the files are encrypted but not the folders it seems in zips).

I've adjusted the file extraction location now on the main exe so all is fine as it cleans itself up after the game has ended and is pretty well nested too so very unlikely it'll be picked up. Not that it matters anyway as it's just the sound files but I was testing it as a matter of course just in case I did need it in future.
  • 0

#10 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 30 January 2011 - 10:11 PM

I've never worked with my extension using directorys, rather only individual files, and if it somehow works like that, it wasn't my doing. That may have something to do with it as well. Thanks for testing though.
  • 0

#11 M_I_Soft

M_I_Soft

    GMC Member

  • GMC Member
  • 198 posts
  • Version:GM8

Posted 31 January 2011 - 12:43 PM

Yeah I just zipped up the directory I wanted and made sure it had the directory structure in place then when I did the kbzipUnzipAll it recreates the directory structure for me.
I agree though it's probably that stopping the decryption from working, but still a great extension and incredibly fast!
  • 0

#12 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 31 January 2011 - 02:12 PM

Yeah I just zipped up the directory I wanted and made sure it had the directory structure in place then when I did the kbzipUnzipAll it recreates the directory structure for me.
I agree though it's probably that stopping the decryption from working, but still a great extension and incredibly fast!


Wow, I guess I'll have to do some testing working with directories. It may be that when using directories internal to the zip, it suddenly includes that as part of the filename, and therefore when extracted, it includes it. When I was coding the dll part, I wasn't thinking about how zips can do that.

On the other hand, I don't think that has anything to do with the decryption because I was never testing with directories at all, and sometimes it works, sometimes it doesn't. I need some more testing done, but it may be exclusive the gmspr files, but then may not. I really don't know.

About the speed, I'm using a really small and simple API for zip/unzip called ziputils. It takes code from gzip and zlib and removes a lot of the unneeded overhead, which makes it fast. I didn't have anything to compare it to, but you have confirmed the speed, so thanks for that!!
  • 0

#13 M_I_Soft

M_I_Soft

    GMC Member

  • GMC Member
  • 198 posts
  • Version:GM8

Posted 02 February 2011 - 02:05 AM

If you want a quick challenge try downloading my current Haunted Mansion beta and see if you can spot where I do the extraction. Even on my old laptop it's barely noticable!
I'll be adding another archive in the next release too for the map data don't think that'll be causing any trouble either though...
  • 0

#14 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 02 February 2011 - 03:55 AM

If you want a quick challenge try downloading my current Haunted Mansion beta and see if you can spot where I do the extraction. Even on my old laptop it's barely noticable!
I'll be adding another archive in the next release too for the map data don't think that'll be causing any trouble either though...


I think I'll just have to believe you, especially considering that for the most part, on my not too bad laptop, I sometimes don't see the files ever, atleast through windows explorer. Every so often, a full-screen size background will show up, and even then, it is a very short time, not near enough for someone to try to copy it somehwere else.
  • 0

#15 reek

reek

    GMC Member

  • New Member
  • 66 posts

Posted 03 February 2011 - 03:02 AM

Thanks for the nice work. I have been looking for this kind of an add-on to GM for some time. I've used Ultra-crypt in the past and I was tired of all the hoops you need to jump through to use it. After getting the same "MSVCR100.dll is missing" error I finally got an example GMK test working, but without using password protection on the zip file.

The drawback to me is that that is one of the main reasons I want this type of zip/unzip ability, so that the data files can be password protected. But the password function is basically "broken" and doesn't yet work. Obfuscating the filename is a weak protection and I would feel a lot better being able to have an actual password for the zip file.

Edited by reek, 03 February 2011 - 03:02 AM.

  • 0

#16 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 03 February 2011 - 04:52 AM

Thanks for the nice work. I have been looking for this kind of an add-on to GM for some time. I've used Ultra-crypt in the past and I was tired of all the hoops you need to jump through to use it. After getting the same "MSVCR100.dll is missing" error I finally got an example GMK test working, but without using password protection on the zip file.

The drawback to me is that that is one of the main reasons I want this type of zip/unzip ability, so that the data files can be password protected. But the password function is basically "broken" and doesn't yet work. Obfuscating the filename is a weak protection and I would feel a lot better being able to have an actual password for the zip file.


About the dll error, you can look through the above posts and download one that has that error fixed. I haven't put that in the first post yet, but you can still use it.

About the encryption problem, do you think you could do some tests and figure out what files exactly(atleast for you) work and don't work with encryption. I'm sure they encrypt fine using my program, because I have used WinRAR to confirm them, but when my extension decrypts the files, some work and some don't. It isn't a size thing, and it isn't completely having anything to do with space characters in the file name, so I'm not sure what it is. I'm doing some tests myself too, so I can try to figure it out, but any help I can get would be appreciated. If I can't get this, I may end up having to redo the back end API, instead of using ziputils.
  • 0

#17 AndrewFM

AndrewFM

    GMC Member

  • GMC Member
  • 155 posts
  • Version:GM:Studio

Posted 07 February 2011 - 12:29 PM

This is really nice... works like a charm! :)

However, one suggestion. Can you add a function to check if a file exists inside the archive? I mean, right now you technically could do it just by attempting to extract the file and checking if the return value was 0, but that seems messy.

Regarding the encryption problem: I tried txt, wav, and png files so far. None of them worked (encrypted) except for wav. And for wav, I was using the SuperSound dll, so I'm not even sure if they would have worked with GM's sound_add().

Edited by AndrewFM, 07 February 2011 - 04:44 PM.

  • 0

#18 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 07 February 2011 - 04:59 PM

This is really nice... works like a charm! :)

However, one suggestion. Can you add a function to check if a file exists inside the archive? I mean, right now you technically could do it just by attempting to extract the file and checking if the return value was 0, but that seems messy.

Regarding the encryption problem: I tried txt, wav, and png files so far. None of them worked (encrypted) except for wav. And for wav, I was using the SuperSound dll, so I'm not even sure if they would have worked with GM's sound_add().


Thanks for the testing. I don't see why I couldn't add that function for you. I don't want to promise, but I should have it within a couple days.
  • 0

#19 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 09 February 2011 - 09:46 PM

I have now added two requested functions. One is for confirming whether a file exists in an archive or not, and the other is for getting how many files are in an archive. I have also fixed the missing dll error.

See the first post for the new link.
  • 0

#20 AndrewFM

AndrewFM

    GMC Member

  • GMC Member
  • 155 posts
  • Version:GM:Studio

Posted 10 February 2011 - 02:11 AM

Minor issue: There's a typo in one of the function names. In GM8's dropdown box, it shows the new function name as kbzipFilesExists(), when it's actually kbzipFileExists()
  • 0

#21 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 10 February 2011 - 03:23 AM

Minor issue: There's a typo in one of the function names. In GM8's dropdown box, it shows the new function name as kbzipFilesExists(), when it's actually kbzipFileExists()


I have uploaded a new one here!!

Sorry about that. It was a typo in the extension creator where you define what goes in the intellisense. That's why the functions wasn't working right. The correct name is without the 's' of course. Grab the new one.
  • 0

#22 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 481 posts
  • Version:GM:Studio

Posted 14 February 2011 - 02:51 PM

Does this add folders as whole? If yes, how?
  • 0

#23 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 14 February 2011 - 04:53 PM

Does this add folders as whole? If yes, how?


As far as using my zipping programs, you just select files. A planned feature is to simply select a folder and have it add all of those files automatically.

As far is folders internal to the zip files, I think when using my extension to extract, it should not matter, but I have no way to create them that way. But, if you use a program such as WinRAR, WinZip, 7-zip, to create the zip files, you should be able to create folders that way inside the zip files.

But, for game usage, I don't think it really matter too much inside the zip itself, since it all gets extracted. And for both the graphics and regular zip programs that I have created for this extension, I have the folder search feature planned.
  • 0

#24 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 481 posts
  • Version:GM:Studio

Posted 14 February 2011 - 04:55 PM

I want the feature to be able to zip the folder, and the files in it. Can you do that?
  • 0

#25 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 17 February 2011 - 04:04 AM

I want the feature to be able to zip the folder, and the files in it. Can you do that?


I will look into it. I'm for sure that I will add to my programs the ability to add all files inside of a specified folder, but about the folders internal to the zip, I'm not sure. It is something that I don't have a use for, and so depending on how much work I would have to do to make it happen will determine whether it does or not.

BTW, exactly what are you trying to accomplish that you couldn't do in another way. Since I'm using it for external resource loading, all I do is extract files to a directory, load the resources into Game Maker, and then delete the files. Since I know the file names, there is no need to worry about directories, as long as I'm looking in the same place for the files as where I extracted them.

If you need files in directories after doing extraction, you could simply create one zip per directory, and extract each zip to wherever you want the files. So a zip named "graphics.zip" you could extract to a sub-folder called "Graphics", and so on for other resource types.

But like I said, what exactly are you trying to accomplish? Why do you have to have directories internal to the zip files? Maybe I could help you get around your problem in another manner.
  • 0

#26 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 481 posts
  • Version:GM:Studio

Posted 17 February 2011 - 02:02 PM

It's ok. I found another DLL that can do that.
  • 0

#27 57E

57E

    GMC Member

  • GMC Member
  • 61 posts
  • Version:GM:Studio

Posted 09 June 2011 - 10:00 AM

Is this another case of "does not work properly with gm81"?
Becouse no matter what I try the kbzipAddFileToZip() function always fails.
  • 0

#28 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 09 June 2011 - 04:13 PM

It worked fine for me, using GM 8.1 newest release.

You first create the new zip using the kbzipCreateZip() function. Then you use the add file to zip, using the kbzipAddFileToZip() function. Then use kbzipCloseZip() to close the file, after adding all the files you needed. You can only use one zip at a time when creating zips, and you must close it when you are finished.

If you can't get it to work, you could give me an example .gm81 showing that it doesn't work, and I can check why.
  • 0

#29 57E

57E

    GMC Member

  • GMC Member
  • 61 posts
  • Version:GM:Studio

Posted 10 June 2011 - 08:12 AM

Here is an example file.
  • 0

#30 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1935 posts
  • Version:GM:Studio

Posted 10 June 2011 - 05:04 PM

Here is an example file.


Your test isn't working on my computer either.

I think it has to do somehow with using working_directory to grab the file locations. I believe that working_directory is whatever the last place GM did something with external files. So, when you create that text file, that directory is now the working directory. What I don't get is that when trying to create the zip, it gets it right, but not when adding. So, I got it working by instead of using working_directory, creating your global variable to simply be "Level Board/TEMP", without that. Here is the catch though. It appears that you must use forward slash '/' to get it all to work right as well. I had to adjust that.

The reason my extension works without using working_directory is because though GM changes it's version of working_directory, it doesn't change for dll's or other windows processes of course. So, my dll still works based off of wherever the executable is, and so simply omitting the working_directory part fixes the problem, and since you aren't going to be having those folders moved around once you are done with the game, it won't be a problem.


Also, you had forgotten the slash before the filename BIN.txt when adding it to the zip, though you had added it when you were creating the file.

Now, I also got it working with the .u3d model files. Your problem is here.
kbzipAddFileToZip(global.temp_folder+file);
        //show_error(global.temp_folder+"\"+file,false);
You put the '/' in the show_error line, but didn't put it when adding the file to the zip. When you make it...
[code
kbzipAddFileToZip(global.temp_folder+'/'+file);
//show_error(global.temp_folder+"\"+file,false);
[/code]
It suddenly works. But, I tried with a backslash '\' instead of the forward '/' and it no longer works. So now you know, anytime you use my extension, just make sure you use forward slashes.

Here is my "fixed" version.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users