Jump to content


Photo

Pak Archive Dll


  • Please log in to reply
63 replies to this topic

#41 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 15 January 2009 - 11:24 PM

Huffman is used for RAR compression, I don't know about ZIP. I do know that Huffman on it's own is slow and the reason WinRAR isn't open source is cause they got an epic implementation of it. Fastest that I know of.

I may be wrong, I'm no expert.
  • 1

#42 Schalk

Schalk

    GMC Member

  • GMC Member
  • 487 posts
  • Version:GM:HTML5

Posted 16 January 2009 - 12:04 AM

Huffman coding today is often used as a "back-end" to some other compression method. DEFLATE (PKZIP's algorithm) and multimedia codecs such as JPEG and MP3 have a front-end model and quantization followed by Huffman coding.

From the reliable Wikipedia
  • 0

#43 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 30 January 2009 - 01:22 AM

Update:
- Saving to Files is Complete!
- Loading from Files is Complete!

Please notify me of any crashes (i.e. "An unexpected error has occurred when running the game") or bugs such as files not writing fully/encryption issue.
  • 1

#44 ShingingDB

ShingingDB

    GMC Member

  • New Member
  • 27 posts

Posted 19 April 2009 - 06:53 PM

Wait, so how would you use this? Cause I've tried to customly add new files into the .pak but it always seem to just overwrite everything I had in it before >.>
  • 0

#45 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 19 April 2009 - 07:17 PM

To add a file to it you load the PAK then add to it, don't execute AddFile and then save without loading the old PAK.

Warning: This seems to crash on binary files, I have not found any way to fix this.

Edited by GMREC1111, 10 May 2009 - 11:18 AM.

  • 1

#46 ShingingDB

ShingingDB

    GMC Member

  • New Member
  • 27 posts

Posted 19 April 2009 - 07:38 PM

To add a file to it you load the PAK then add to it, don't execute AddFile and then save without loading the old PAK.

Warning: This seems to crash on binary files, I have not found any way to fix this.


Alright I think I got it working. Thanks :D But how can I use GM to read files off the .pak file?
  • 0

#47 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 19 April 2009 - 08:52 PM

Using my DLL, you can do it. Look at the scripts, I am sure I commented them all (like I always do), if not, the name should help.
  • 1

#48 ShingingDB

ShingingDB

    GMC Member

  • New Member
  • 27 posts

Posted 19 April 2009 - 09:34 PM

Oh alright thanks! :]

Edit: Oh what's the difference between "pak_file_add", "pak_file_add_from_file", and "pak_file_save_to_file"?

Edited by ShingingDB, 19 April 2009 - 09:40 PM.

  • 0

#49 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 19 April 2009 - 10:23 PM

pak_file_add - Add file to the current pak file (in memory). The added file's data is passed as a string.
pak_file_add_from_file - Add file to the current pak file (in memory). The added file's data is read from a real file.
pak_file_save_to_file - Save the data of a file in a pak file (in memory) to a file on the disk.

Regards,
Chris.
  • 0

#50 Mister_M

Mister_M

    GMC Member

  • New Member
  • 499 posts

Posted 22 April 2009 - 10:56 AM

Put more detail on how to use each and every function. The comments you put are understandable only to yourself...
Im working on a pak file - I want to add a file to the pak file. Why do I need to put two arguments?

Oh, and by the way, the example you provided wont work.

EDIT: It fails to load any pak file.
This is what I tried:
pak_init(true);
   show_message("Initiated");
   pak_load(working_directory + "\AFs.pak");
   show_message("Loaded AFs.pak");
   pak_file_save_to_file(working_directory + "\Files.txt", "Files.txt");
   show_message("Saved Files.txt");
   file = file_text_open_read("Files.txt");
   while (!file_text_eof(file))
   {

	  filename = file_text_read_string(file);
	  show_message("File found: " + filename);
	  file_text_readln(file);
	  pak_file_save_to_file(working_directory + "\" + filename, filename);
	  show_message("Saved " + filename);
   }
   pak_reset();
   show_message("
Reset complete");
   pak_free();
   show_message("Free complete");
   game_end();
The pak file exists. I get a message "Initiated" and I dont get the second message after the loading.

Edited by Mister_M, 22 April 2009 - 11:12 AM.

  • 0

#51 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 22 April 2009 - 12:21 PM

I think you switched the arguments for:
pak_file_save_to_file
  • 0

#52 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 22 April 2009 - 07:41 PM

Actually, uuf6429, I think I used the wrong PAK unit. I am sure this is the one you created and I never edited, the one where I fixed that infinite loop. I will need to either find the newer one or redo the changes.

The problem should only occur when you have an "empty" PAK, meaning it has no files in it. Correction, it crashes on an empty file.

Edited by GMREC1111, 22 April 2009 - 07:54 PM.

  • 2

#53 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • Retired Staff
  • 9259 posts
  • Version:Unknown

Posted 24 April 2009 - 05:24 AM

I'm having an issue with this.

Everything works fine, but when I try to unpack a .BMP, nothing gets created. The file in the .PAK is called "8.bmp". I checked pak_file_index("8.bmp") and it returns 0, so the file is there. However, after calling pak_file_save_to_file(working_directory+"/8.bmp","8.bmp"), no file is created. I even tried swapping the arguments, but nothing works. I'm not getting any errors, either.

Any ideas?

-IMP :P ;)
  • 0

#54 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 10 May 2009 - 03:49 AM

I have fixed the DLL and it shouldn't crash anymore (stupid source code reverted). It should load PAK files faster, too.

IceMetalPunk, can you make sure the index is not negative one before trying to save the file, that if, if you didn't already. There may be a problem loading non-text files. It still counts the strings as null-terminated, not good.

Update: You can now store (and retrieve) non-text files in the PAK without problems.

Edited by GMREC1111, 10 May 2009 - 11:12 AM.

  • 2

#55 Eli

Eli

    GMC Member

  • New Member
  • 14 posts

Posted 15 May 2009 - 08:49 PM

cool man this works and ima thinkin of using this for sumthin, its good to pack everything (images and ini's ect...). thanks man.
  • 0

#56 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 16 May 2009 - 01:38 AM

I know it works, at least now. :( You're welcome.

If you do use it for anything, please PM me as I'd like to see how you used it. It can do much more then file storing. Now, I think I will begin working on that encryption (needs an upgrade).
  • 2

#57 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 22 May 2009 - 11:19 AM

Update:
- Added an archive manager.

To use the archive manager, right click on the window to see a list of commands. You can also drag files into the PAK, you can open a PAK by dragging it into the window, too.

Update:
- Hopefully fixed a small glitch that occurred with the Covac Software link.

Update:
- Fixed the directory dropping into the PAK Manager, it will add all files and folders (including their files and folders) into the PAK. Please note that forward slashes are more commonly used for directories (see PAK Explorer).

If you encounter a bug with the PAK Manager, kindly PM me with details about it, and how/when it occurs.

Edited by GMREC1111, 24 May 2009 - 05:47 PM.

  • 2

#58 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 06 June 2009 - 11:19 PM

Hmm perfect, good job. :)

[Edit]
Oh Covac software, no wonder. ;P

Edited by Krisando, 06 June 2009 - 11:20 PM.

  • 0

#59 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 07 June 2009 - 12:42 PM

Very funny... He made a pretty rough attempt at all of this, I just fixed the things up. :D

The PAK code was glitchy, the archive manager was annoying. He didn't do all of it.
  • 2

#60 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 11 June 2009 - 08:56 PM

The PAK code was glitchy, the archive manager was annoying. He didn't do all of it.

The PAK code used a better reading system and is faster. The archieve manager was my idea. :(

Just to clear some points ^_^
  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users