Important information: this site is currently scheduled to go offline indefinitely by end of the year.

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

Read or post about compression. And decompression. Or ask questions how to decompress your files.
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post 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:
You do not have the required permissions to view the files attached to this post.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

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

Post by Rheini »

Indeed compressed.
The question is, which algorithm. LZH?

Code: Select all

char magic[4];
uint compressedSize;
uint decompressedSize;
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post by caws »

The contents of this post was deleted because of possible forum rules violation.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

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

Post 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.
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post 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:
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

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

Post by Rheini »

Dunno, not familiar with consoles. The main file containing the program code.
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post 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)..
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

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

Post by Rheini »

You might try to search the files for some strings like gzip, zlib, lib, lzh, or whatever. Maybe this gives an indication.
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post 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
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

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

Post 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
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

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

Post 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
Last edited by aluigi on Thu Jun 11, 2009 6:15 pm, edited 1 time in total.
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post 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..
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

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

Post 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
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

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

Post 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.
caws
veteran
Posts: 120
Joined: Sat Mar 01, 2008 7:57 pm
Been thanked: 4 times

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

Post 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.
Post Reply