Toy Commander .GHQ Dreamcast.

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Gumbo
Posts: 12
Joined: Sun Oct 05, 2014 3:58 pm

Toy Commander .GHQ Dreamcast.

Post by Gumbo »

Hi Everyone,

Im looking for some help with Toy Commanders .GHQ files. I have done the QuickBMS Scan and although there was no conclusive results, i had 2 results that look promising, both using different algorithms. SCPACK and LZFU_RAW.

Im not really sure where to go from here, I have attached 2 different GHQ files, maybe there are some similarities i cannot see?

Any help would be fantastic. :D
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Toy Commander .GHQ Dreamcast.

Post by aluigi »

An idea of script can be the following, but the extracted data is not a known file format, it seems just raw data:

Code: Select all

    get OFFSET long
xmath MIN_OFF "OFFSET - 6"
for CUR_OFF = 0 < MIN_OFF
    get NEXT_OFFSET long
    if NEXT_OFFSET != 0
        xmath SIZE "NEXT_OFFSET - OFFSET"
        log "" OFFSET SIZE
        math OFFSET = NEXT_OFFSET
    endif
next CUR_OFF + 4
Gumbo
Posts: 12
Joined: Sun Oct 05, 2014 3:58 pm

Re: Toy Commander .GHQ Dreamcast.

Post by Gumbo »

Hi aluigi,

Thanks for the quick reply,
I see what you mean about the file contents, as far as I'm aware, they should be PVR textures, but i imagine there would be other files inside too.
There is a thread on assemblergames.com that mentions LZSS, memory address (0x8C04C930 & 0x8C04C928) along with the picture attached.
attach.png

If its OK, i will post a link to the thread.

I'm not sure if that's any help at all?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Toy Commander .GHQ Dreamcast.

Post by aluigi »

Yes, post the link.
Gumbo
Posts: 12
Joined: Sun Oct 05, 2014 3:58 pm

Re: Toy Commander .GHQ Dreamcast.

Post by Gumbo »

aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Toy Commander .GHQ Dreamcast.

Post by aluigi »

So the only missing thing is the compression algorithm, I tried to use my scanner but got nothing interesting.
The format of each file is simple, SIZE, ZSIZE and a 16bit value equal to 2 (probably the compression type).
Gumbo
Posts: 12
Joined: Sun Oct 05, 2014 3:58 pm

Re: Toy Commander .GHQ Dreamcast.

Post by Gumbo »

Hmmm, If there anyway of finding that out? or is it something that cant be found?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Toy Commander .GHQ Dreamcast.

Post by aluigi »

In that thread they say to have found the decompression function so it's just a matter of understanding what it does.

To be honest LZSS gives a result that is not so bad, in fact there are some 32bit integers in the output but I don't think it's the correct PVR you need.
If you want to try, the following is a script that extract and uncompress the files (the previous script + lzss unpack):

Code: Select all

    get OFFSET long
xmath MIN_OFF "OFFSET - 6"
for CUR_OFF = 0 < MIN_OFF
    get NEXT_OFFSET long
    if NEXT_OFFSET != 0
        xmath SIZE "NEXT_OFFSET - OFFSET"

        savepos TMP
        goto OFFSET
        get SIZE long
        get ZSIZE long
        get TYPE short
        savepos OFFSET
        goto TMP

        if TYPE == 2
            comtype lzss "12 4 2 2 0"
            clog "" OFFSET ZSIZE SIZE
        else
            log "" OFFSET SIZE
        endif

        math OFFSET = NEXT_OFFSET
    endif
next CUR_OFF + 4
Gumbo
Posts: 12
Joined: Sun Oct 05, 2014 3:58 pm

Re: Toy Commander .GHQ Dreamcast.

Post by Gumbo »

Thanks for taking the time to run through this :)

Ive just extracted a couple of different GHQ files with that script and ive noticed a couple of things,
It always finds 9 files (coincidence or issue?), and all of the dat files extracted from the GHQ files have a PVRT header in them, but as you predicted, its not the correct ones, they are all just a garbled mess.