Page 1 of 2

Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 8:05 pm
by caws
So, i'm translating this game, and i have to edit some files that are inside others that have this structure... i need help, please, it would be great if anyone coul help me, thx. i attached on file as a example. thx for the attention.. :ninja:

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 9:08 pm
by Rheini
Indeed compressed.
The question is, which algorithm. LZH?

Code: Select all

char magic[4];
uint compressedSize;
uint decompressedSize;

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 9:25 pm
by caws
The contents of this post was deleted because of possible forum rules violation.

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 9:42 pm
by Rheini
Good idea, but didn't help very much. This just seems to be some debug information referencing the hgz.cc source file.
Can't imagine what HGZ should stand for, Huffman Gzip doesn't make any sense since Gzip already incorporates Huffman due to zlib.
Maybe the executable would help.

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 9:46 pm
by caws
Rheini wrote:Good idea, but didn't help very much. This just seems to be some debug information referencing the hgz.cc source file.
Can't imagine what HGZ should stand for, Huffman Gzip doesn't make any sense since Gzip already incorporates Huffman due to zlib.
Maybe the executable would help.

What do u mean by executable? the pbp? prx? :oops:

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 9:52 pm
by Rheini
Dunno, not familiar with consoles. The main file containing the program code.

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 9:57 pm
by caws
Rheini wrote:Dunno, not familiar with consoles. The main file containing the program code.
hmm, basically on the consoles there is no executable, he prx is like a plugin (there is two of'em in the game) an there is the pbp that's like the executable, but the only pbp that i can get is the one that update the firmware (this one has no affect in the game)... in the end all i got is the two prx (plugins)..

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 10:07 pm
by Rheini
You might try to search the files for some strings like gzip, zlib, lib, lzh, or whatever. Maybe this gives an indication.

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 10:25 pm
by caws
Rheini wrote:You might try to search the files for some strings like gzip, zlib, lib, lzh, or whatever. Maybe this gives an indication.
Already tried... no sucess, i even opened the full iso file, but could't get anything, i've uploaded many files in a pack... here is the link:

http://rapidshare.de/files/47465570/ROTER_C1.rar.html

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 11:07 pm
by aluigi
the file uses the zlib compression, that's clear.
what is not clear is why it's composed by 2 zipped blocks that don't have much sense if you look at their size because the size specified in the two 32bit values at the beginning is the total size (so the total compressed and uncompressed size without references to each single block).
example:

Code: Select all

offzip -a -1 UNFREED.HGZ c:\ 0
then is possible to start with the analysis of the obtained 00000014.dat

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 11:38 pm
by aluigi
the following is the bms script for extracting the files from these HOG archives:

Code: Select all

# Resistance Retribution (HOG extractor)
# for generating the HOG file from an HGZ one:
#   use "offzip -a -1 UNFREED.HGZ c:\ 0x14"
#   rename c:\00000014.dat to UNFREED.HOG
# script for QuickBMS http://aluigi.org/papers.htm#quickbms

#get DUMMY69 long
idstring "iiii"
get FILES long
get DUMMY long
get NAMES_OFF long
get FILES_OFF long
get OFFSET long
savepos OFFSETS_OFF

for i = 0 < FILES
    goto OFFSETS_OFF
    get NEXT_OFFSET long
    savepos OFFSETS_OFF

    goto NAMES_OFF
    get NAME string
    savepos NAMES_OFF

    set SIZE long NEXT_OFFSET
    math SIZE -= OFFSET
    math OFFSET += FILES_OFF

    log NAME OFFSET SIZE

    set OFFSET long NEXT_OFFSET
next i
I have checked the new files and seems that the compressed blocks have a size of 0x17ff8 bytes except the first one of 0x17fec bytes, anyway offzip does the job correctly so it's not much important

Re: Need help with a .hgz file from resistance retribution...

Posted: Mon Jun 08, 2009 11:46 pm
by caws
Bugtest wrote:the following is the bms script for extracting the files from these HOG archives:

Code: Select all

# Resistance Retribution (HOG extractor)
# for generating the HOG file from an HGZ one:
#   use "offzip -a -1 UNFREED.HGZ c:\ 0x14"
#   rename c:\00000014.dat to UNFREED.HOG
# script for QuickBMS http://aluigi.org/papers.htm#quickbms

#get DUMMY69 long
idstring "iiii"
get FILES long
get DUMMY long
get NAMES_OFF long
get FILES_OFF long
get OFFSET long
savepos OFFSETS_OFF

for i = 0 < FILES
    goto OFFSETS_OFF
    get NEXT_OFFSET long
    savepos OFFSETS_OFF

    goto NAMES_OFF
    get NAME string
    savepos NAMES_OFF

    set SIZE long NEXT_OFFSET
    math SIZE -= OFFSET
    math OFFSET += FILES_OFF

    log NAME OFFSET SIZE

    set OFFSET long NEXT_OFFSET
next i
I have checked the new files and seems that the compressed blocks have a size of 0x8000 bytes except the first one of 0x17ff4 bytes, anyway offzip does the job correctly so it's not much important

yes, thx man, i managed to unpack the data, but, can i repack it? An thx for the HOG script.


eidt: Already figured out, if u delete the first 20bytes (14 in hex) this files turns out into a zlib compressed, then i can compress and decompress with any zlib p\zcker\unpaker. thx for all the efforts a big thanks man..

Re: Need help with a .hgz file from resistance retribution...

Posted: Tue Jun 09, 2009 11:48 am
by aluigi
remember that thing I said about the size of the compressed blocks, so you can't just compress the whole HOG file and then adding a new header.
anyway I guess that the game could work also with the HOG files without recompressing them

Re: Need help with a .hgz file from resistance retribution...

Posted: Tue Jun 09, 2009 11:59 am
by Rheini
Bugtest wrote:the file uses the zlib compression, that's clear.
lol I refused to be believe it's zlib since it seemed too obvious.

Re: Need help with a .hgz file from resistance retribution...

Posted: Tue Jun 09, 2009 4:30 pm
by caws
Bugtest wrote:remember that thing I said about the size of the compressed blocks, so you can't just compress the whole HOG file and then adding a new header.
anyway I guess that the game could work also with the HOG files without recompressing them
Really? i will try recompressing the hog back and insert it on the game, if this doesnt work i will try to put it back whitout compression.