Decompression and recompression (Gzip)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
lastdreamer
Posts: 6
Joined: Sun Jul 03, 2016 12:20 pm

Decompression and recompression (Gzip)

Post by lastdreamer »

Hello everyone,

I have a small problem with this file. I know it's a gzip file (normally) which contains the DDS file. (I had to rename the file, the extension ".gz" was not present in the original file, but the forum doesn't accept .dds extension...)

My problem is to recreate the compressed file. Even using the decompressed file, I can't get to the same original archive... So I must not have the right compression algorithm... So, when I reimport into the game, it crashes...

Can someone help me to find out how to recompress the file to the same original format?

Thanks a lot!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Decompression and recompression (Gzip)

Post by aluigi »

Automatic decompression and recompression:

Code: Select all

get NAME filename
string NAME + ".new"

goto 4
get SIGN long
goto 0
if SIGN == 0x00088b1f
    comtype gzip
    get SIZE long
    savepos OFFSET
    get ZSIZE asize
    math ZSIZE - OFFSET
    clog NAME OFFSET ZSIZE SIZE
else
    comtype gzip_compress
    get SIZE asize
    log MEMORY_FILE 0 0
    put SIZE long MEMORY_FILE
    append
    clog MEMORY_FILE 0 SIZE SIZE
    append
    get SIZE asize MEMORY_FILE
    log NAME 0 SIZE MEMORY_FILE
endif