Jump to content


Photo

kbzip Extension


  • Please log in to reply
52 replies to this topic

#21 kburkhart84

kburkhart84

    GMC Member

  • GMC Member
  • 1659 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
  • 434 posts
  • Version:GM8

Posted 14 February 2011 - 02:51 PM

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

#23 kburkhart84

kburkhart84

    GMC Member

  • GMC Member
  • 1659 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
  • 434 posts
  • Version:GM8

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

    GMC Member

  • GMC Member
  • 1659 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
  • 434 posts
  • Version:GM8

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
  • 44 posts

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

    GMC Member

  • GMC Member
  • 1659 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
  • 44 posts

Posted 10 June 2011 - 08:12 AM

Here is an example file.
  • 0

#30 kburkhart84

kburkhart84

    GMC Member

  • GMC Member
  • 1659 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

#31 57E

57E

    GMC Member

  • GMC Member
  • 44 posts

Posted 11 June 2011 - 08:54 AM

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.


You might want to change that in future versions. As in game maker all file path strings like those working_directory, program_directory and temp_directory as well as get_open_filename() use backslash '\'.

BTW the fixed version you uploaded isn't fixed. It is the original file with an added executable wich doesn't seem to be working either.
But I'll see if I could get it working with these things in mind.
  • 0

#32 kburkhart84

kburkhart84

    GMC Member

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

Posted 11 June 2011 - 02:55 PM

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.


You might want to change that in future versions. As in game maker all file path strings like those working_directory, program_directory and temp_directory as well as get_open_filename() use backslash '\'.

BTW the fixed version you uploaded isn't fixed. It is the original file with an added executable wich doesn't seem to be working either.
But I'll see if I could get it working with these things in mind.


Sorry about that, I believe I may have simply zipped up the files, and forgot to hit the save button in GM first. If you can't get it to work, I'll redo it.

And yeah, I still have the code for this, so I may eventually add that. I also need to figure out how to get the extraction of encrypted files to work too. I can't promise anything though, because I'm in the middle of a project.
  • 0

#33 57E

57E

    GMC Member

  • GMC Member
  • 44 posts

Posted 12 June 2011 - 09:10 AM

Well I got it working, sort of.

When packing files it seems to save the directories as well.
If I pack a file "Level Board/TEMP/BIN.txt" and then open the zip the bin.txt is located inside "Level Board/TEMP/" there as well?
Not a big deal, but kind of unnecessary for me.

Packing files from any where else than the game's exe location does not work at all. Which means that I can't use temp_directory (tried replacing all '\' with '/' via string_replace_all(), no use).


Now let's see how complicated the file extraction is...
  • 0

#34 57E

57E

    GMC Member

  • GMC Member
  • 44 posts

Posted 20 June 2011 - 05:25 PM

I know you said youre busy, but I noticed few more things, when trying to get the extraction code working, that you might be intrested of if you some day decide to update this.
kbzipUnzipAll('Level Board/LoadTest.zip',working_directory);
For kbzipUnzipAll function the first argument (location of the file) must be without working_directory and backslash characters, as with kbzipAddFileToZip.
BUT the second argument i.e. the location where the files are extracted must have working_directory and it doesn't seem to mind about backslashes in the string. Without the working_directory variable (for example just 'Level Board/Loadtest contents') the unziping fails,
But if the second argument is an empty string '' the files are unziped to the root of the drive which contains the game files, in my case they appear in G:\

It's most likely same thing with kbzipUnzipFile, but I haven't tested it yet.

Edited by 57E, 20 June 2011 - 05:28 PM.

  • 0

#35 kburkhart84

kburkhart84

    GMC Member

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

Posted 21 June 2011 - 12:18 AM

I know you said youre busy, but I noticed few more things, when trying to get the extraction code working, that you might be intrested of if you some day decide to update this.

kbzipUnzipAll('Level Board/LoadTest.zip',working_directory);
For kbzipUnzipAll function the first argument (location of the file) must be without working_directory and backslash characters, as with kbzipAddFileToZip.
BUT the second argument i.e. the location where the files are extracted must have working_directory and it doesn't seem to mind about backslashes in the string. Without the working_directory variable (for example just 'Level Board/Loadtest contents') the unziping fails,
But if the second argument is an empty string '' the files are unziped to the root of the drive which contains the game files, in my case they appear in G:\

It's most likely same thing with kbzipUnzipFile, but I haven't tested it yet.


That is indeed interesting. Knowing the code, I'm not sure why it would do that. I may look into it, thanks for the heads up.

So, who wants a gml version?? No dlls, and so it would work on a Mac, but it still wouldn't be appliable to mobile platforms. I don't know if gml can do it fast enough to make it useful, but it might.
  • 0

#36 Gamer_Dude64

Gamer_Dude64

    GM Html5 Programmer

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

Posted 23 June 2011 - 06:40 PM

gml version sounds great!.... only thing is the speed...;

still, even if it is slower than crap, i still think you should post the gml version, i would like to see it.



good luck! :)
  • 0

#37 57E

57E

    GMC Member

  • GMC Member
  • 44 posts

Posted 04 July 2011 - 09:37 AM

It looks like that the filepath problems were fixed by the latest gm8.1 version.

At least adding files from outside games working directory and temp_directory is working now.
It also looks like that the use "/" instead of "\" rule doesn't matter anymore either. :D

I haven't got time to test the unpacking functions throughly, but I guess it should now work normaly too.

Edited by 57E, 04 July 2011 - 09:38 AM.

  • 0

#38 kburkhart84

kburkhart84

    GMC Member

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

Posted 04 July 2011 - 10:42 PM

It looks like that the filepath problems were fixed by the latest gm8.1 version.

At least adding files from outside games working directory and temp_directory is working now.
It also looks like that the use "/" instead of "\" rule doesn't matter anymore either. :D

I haven't got time to test the unpacking functions throughly, but I guess it should now work normaly too.


Awesomeness!!!

It never occurred to me that a change in GM would have affected that, considering the dll does the actual file functions, not GM. But hey, I'll take it. :)
  • 0

#39 57E

57E

    GMC Member

  • GMC Member
  • 44 posts

Posted 05 July 2011 - 06:33 AM

Extraction too is working flawlessly now.
You can ignore all the things that I posted here earlier.
  • 0

#40 Orswen

Orswen

    GMC Member

  • New Member
  • 103 posts

Posted 05 July 2011 - 09:29 AM

i just ask
is it possible to load ini file or read data structure file from the zip directly? :wacko:
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users