Page 1 of 2

Rebuilding archives with QuickBMS

Posted: Wed Dec 30, 2009 5:30 pm
by aluigi
The contents of this post was deleted because of possible forum rules violation.

Re: Rebuilding archives with QuickBMS

Posted: Wed Dec 30, 2009 5:56 pm
by shekofte
adding more rebuilding functions to QuickBMS make it an acme tool ...

Re: Rebuilding archives with QuickBMS

Posted: Wed Dec 30, 2009 10:43 pm
by brienj
Yeah, I made a script to rebuild headers on pac files that the files are all the same size. Came in handy for what I used it for. :)

Re: Rebuilding archives with QuickBMS

Posted: Sun Jan 03, 2010 6:38 pm
by ahon
is there a script to rebuild Svr 2010 pac files with quickbms?

Re: Rebuilding archives with QuickBMS

Posted: Sat Jan 16, 2010 11:43 pm
by Caboose
I would love to have a script that rebuilds zip files with different compression methods and zip signatures.

Re: Rebuilding archives with QuickBMS

Posted: Sun Jan 17, 2010 12:01 am
by aluigi
I already tried to write that script just for my tests and was ok except for 2 things:
  • quickbms doesn't have a crc function and the zip archives need the crc of each archived file otherwise the extraction program doesn't extract them (yes I have already tried using the magic crc 0xdebb20e3)
  • you can only store the files because quickbms doesn't support recompression (it's an extractor)
except for the first point the zip file rebuilt with my script is perfect

Re: Rebuilding archives with QuickBMS

Posted: Wed Jul 28, 2010 5:58 pm
by aluigi
first an update for my previous post: both the "exception" have been solved some versions ago, indeed quickbms supports a complete crc engine (plus tons of hashing algorithms) and supports also some recompression algorithms (zlib, xmem, lzo and so on).

instead now I want to talk about a feature I have implemented in version 0.4.6 for providing a solution for the current requests about endianess conversions.
I have implemented the -E option that costed me only 3 lines of code and automatically convert the endianess of any number read from a file.

imagine to have a file with the following format:

Code: Select all

32bit signature
32bit size
16bit crc
the script for reading it would be:

Code: Select all

get signature long
get size long
get crc short
if you add the -E and -w options at the command-line of quickbms the SAME reading/extracting script will automatically change the endianess of those 3 values :)

it's also possible to avoid to add the -w option by loading the file into a memory file, like the following example:

Code: Select all

get file_size asize
log MEMORY_FILE 0 file_size
get signature long MEMORY_FILE
get size long MEMORY_FILE
get crc short MEMORY_FILE
log dump.dat 0 file_size MEMORY_FILE
cool :)

Re: Rebuilding archives with QuickBMS

Posted: Fri Mar 04, 2011 9:53 am
by Jurko
Sorry for my bad English.
Can you create repacking script for Bad Company 2. For no gzip files. Please

Re: Rebuilding archives with QuickBMS

Posted: Sun Mar 06, 2011 11:17 am
by aluigi
I have just released version 0.4.9 of QuickBMS which contains a feature that will make happy a lot of people :)

from now it's possible to use QuickBMS also for reimporting files back in the archives without modifying the original script, so just an automatic inverted operation.

obviously there are some limitations, the first of which is the size of the imported files that must be equal or minor than the original one (that's why it's a reimported and not a real rebuilder).

the following is the detail I have added in the documentation of quickbms.txt:

Code: Select all

The idea consists in being able to reimport the modified files for the
less complex archives without touching a single line of the script,
yeah just reusing the same bms scripts that already exist!

The function is experimental and it must be used in the following way:

- make a backup copy of the original archive!

- extract the files you want to modify (-f option) or just all the
  files as you do normally via the GUI or by command-line:

    quickbms script.bms archive.pak output_folder

- do your modifications to the extracted files and delete the files
  that have not been modified so that the reimporting process will be
  faster

- reimport the files in the archive:

    quickbms -w -r script.bms archive.pak output_folder

- test the game with the modified archive

Obviously you can use the GUI also for the reimporting procedure
because it's enough to create a file.bat containing the following line
and then double clicking it when you need to do this job:
quickbms.exe -w -r
anyway keep in mind that this is not guarantee with all the file formats and you can find an exaustive list of "exceptions" in the relative section quickbms.txt

@jurko
maybe you can try with this new feature but the result could not work, in any case I can't help.
but probably exist tools that already do the rebuilding job for that specific format

Re: Rebuilding archives with QuickBMS

Posted: Wed Mar 09, 2011 9:25 pm
by cozy
Thanx for the new features in a great tool,but when i come to rebuild the files back in a .cpk file the files are the same ones,i tested by filling the files with 1 byte,and the result is the same - 1650 files reimported in 5 seconds
Im` using the bms script for cpk files in a line command:-

quickbms cpk.bms *.cpk extracted

and to reimport:-

quickbms -w -r cpk.bms *.cpk extracted

thanx cozy

Re: Rebuilding archives with QuickBMS

Posted: Wed Mar 09, 2011 10:37 pm
by aluigi
oh finally a feedback about the new feature :)

can you check if you have the current version of quickbms?
it's 0.4.10, I have fixed various things lately after having implemented this feature

then the tool has reported that over 1600 files have been reimported so it seems correct, indeed the reimported files are counted only when each operation succeded at 100%.

are you sure the directory you selected contains the modified files?
if you have not modified all the 1600 files would be better to delete those that have not been modified.

as final test make a binary comparison between the original archive and the modified one.

I have verified the cpk.bms script and it uses a compression algorithm not supported in recompression mode so you can reimport in the archive ONLY the files that weren't compressed.
as far as I know doesn't exist code of the recompressor available publicly

Re: Rebuilding archives with QuickBMS

Posted: Thu Mar 10, 2011 6:05 pm
by cozy
aluigi wrote:oh finally a feedback about the new feature :)
I have verified the cpk.bms script and it uses a compression algorithm not supported in recompression mode so you can reimport in the archive ONLY the files that weren't compressed.
as far as I know doesn't exist code of the recompressor available publicly

I`ve got the new 0.4.10,and yes the files are compressed as i`ve looked at them using the CriPackedFileMaker.exe,so i guess thats why the files was not added,thanks for the reply,and keep up the good work!!!

Re: Rebuilding archives with QuickBMS

Posted: Thu Mar 10, 2011 8:47 pm
by aluigi
quickbms reports an error if the recompression algorithm is not available, so if you didn't see the error then it's something else

Re: Rebuilding archives with QuickBMS

Posted: Wed Mar 23, 2011 7:30 am
by shekofte
thanks Luigi
your tool is like a magic wand

Re: Rebuilding archives with QuickBMS

Posted: Sat Apr 30, 2011 10:55 am
by aluigi
I'm almost ready to release a new version of quickbms so if you have crazy ideas or suggestions, that's the moment to tell me :)