Help! I have no idea how to create a compression script for QuickBMS!

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
CommanderVideo
Posts: 9
Joined: Wed Nov 10, 2021 5:10 am

Help! I have no idea how to create a compression script for QuickBMS!

Post by CommanderVideo »

I found a decompression script for a Wii game, so I decided to use it in quickbms to extract the game files, but after I had finished altering them and was ready to recompress them so that I could play the game, I realized that i had no idea how to actually recompress them in the first place. The script that I used to decompress them is:

Code: Select all

get name FILENAME
get zsize asize
comtype lz77wii
clog name 0 zsize zsize


I've been googling for hours and tinkering with the script, but nothing I do compresses the files the same way that they were compressed before. Any help would be much appreciated. :)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Help! I have no idea how to create a compression script for QuickBMS!

Post by aluigi »

If you replace lz77wii with lz77wii_compress it will become a compressor script.

The problem is that lz77wii is more like a format including various algorithms rather than being an algorithm itself, that means the game may not be able to read the compressed file (for example because the algorithm chosen by quickbms isn't the one supported by the game).

So, keep your expectations very low.
CommanderVideo
Posts: 9
Joined: Wed Nov 10, 2021 5:10 am

Re: Help! I have no idea how to create a compression script for QuickBMS!

Post by CommanderVideo »

aluigi wrote:If you replace lz77wii with lz77wii_compress it will become a compressor script.

The problem is that lz77wii is more like a format including various algorithms rather than being an algorithm itself, that means the game may not be able to read the compressed file (for example because the algorithm chosen by quickbms isn't the one supported by the game).

So, keep your expectations very low.


Wait, so lz77wii contains multiple different algorithms and quickbms just chooses one? In that case, is there a way I can manually choose the algorithm that it uses and (hopefully) find the one supported by the game through trial and error?

Sorry for the slow reply by the way :p
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Help! I have no idea how to create a compression script for QuickBMS!

Post by aluigi »

I checked the source code of quickbms and apparently it can be done very easily:

Code: Select all

comtype lz77wii_compress 0x00 # copy
comtype lz77wii_compress 0x10 # lzs
comtype lz77wii_compress 0x11 # lzx (default)
comtype lz77wii_compress 0x20 # huffman
comtype lz77wii_compress 0x40 # lzx (default)
comtype lz77wii_compress 0x654c # lze