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

QCMP (QuickCompression) - Mod Nation Racers (PS3)

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
mnrhacker
ultra-n00b
Posts: 3
Joined: Tue Dec 21, 2021 8:42 am

QCMP (QuickCompression) - Mod Nation Racers (PS3)

Post by mnrhacker »

I'm trying to decompress the track files from ModNation Racers (PS3 kart game).

When I open the .TRK files in a hex-editor I see the following hex:

Code: Select all

51 43 4D 50 00 01 00 01 00 00 00 40 00 00 00 38
...
Where the first four would decode to

Code: Select all

QCMP
There is an old thread about Sleeping Dogs (on this forum) and a github repo that deals with decompression of QCMP. And QuickBMS has a script/plugin to decode/decompress QCMP files but when I try it I get the following error:

Code: Select all

  offset   filesize   filename
--------------------------------------
  00000040 1170056    000A0199_SUZUKUCITYMKIII_unpack.TRK

Error: the compressed zlib/deflate input is wrong or incomplete (-3)
Info:  algorithm   1
       offset      00000040
       input size  0x0004ef10 323344
       output size 0x0011da88 1170056
       result      0xffffffff -1

Error: uncompressed data (-1) bigger than allocated buffer (1170056)
       It usually means that data is not compressed or uses another algorithm

Last script line before the error or that produced the error:
  20  clog NAME dataOffset compressedSize uncompressedSize

- OFFSET       0x00000040
- ZSIZE        0x0004ef10
- SIZE         0x0011da88
  coverage file 0    99%   323384     323408     . offset 0004ef50

Press ENTER or close the window to quit
Is QCMP just zlib compressed streams? I tried to decompress them using Python but got various error messages.

Does anyone have any idea how to proceed?
User avatar
DKDave
ultra-veteran
ultra-veteran
Posts: 357
Joined: Mon May 06, 2019 6:07 pm
Location: On board the USS Callister
Has thanked: 9 times
Been thanked: 167 times

Re: QCMP (QuickCompression) - Mod Nation Racers (PS3)

Post by DKDave »

I've looked into these files a bit previously, still a long way to go on them though because of all the file IDs referring to other files, etc.

Basically, "QCMP" is the start of the header for each compressed file. This is usually a header of 0x40 bytes, then the compresssed data starts. Offset 0x14 after "QCMP" is the compressed size (subtract 0x40 to get actual compressed size), and offset 0x1c is the decompressed size.

Sounds like your script is trying to use deflate still. You need to set ComType QCMP in your script to tell QuickBMS what decompression method to use.
I see a vision rising, dreary, Fading in as children play twilight games, In the town called Ordinary, An eye of light reveals a gateway to doomsday
mnrhacker
ultra-n00b
Posts: 3
Joined: Tue Dec 21, 2021 8:42 am

Re: QCMP (QuickCompression) - Mod Nation Racers (PS3)

Post by mnrhacker »

Thanks for the reply.
This is the script from the QuickBMS site:

Code: Select all

# QuickCompression QCMP PMCQ

quickbmsver "0.8.5"

get NAME basename
get EXT extension
string NAME + "_unpack."
string NAME + EXT

endian big
idstring "QCMP"
get type short      # 1
get version short   # 1
get dataOffset long
get extraSize long
get compressedSize longlong
get uncompressedSize longlong
get uncompressedHash longlong
math compressedSize - dataOffset
clog NAME dataOffset compressedSize uncompressedSize
After adding ComType QCMP befor clog NAME ... it actually managed to unpack the file properly. The compressed size and uncompressed size are there and correct. Let's see how far I get.
Post Reply