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

Tomb Raider (2013) Compressed DRM (CDRM)

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
sephiroth99
ultra-n00b
Posts: 8
Joined: Fri Sep 23, 2011 8:23 pm
Has thanked: 2 times
Been thanked: 2 times

Tomb Raider (2013) Compressed DRM (CDRM)

Post by sephiroth99 »

This is kinda the continuation of this thread.

There is a new compression format for TR9. But before continuing, let's see the layout of a CDRM file (which was intrudced in TRU, TMYK!).

Code: Select all

CDRM Header
  u32 magic; // Always "CDRM", so 0x4344524d in BE, 0x4d524443 in LE
  u32 version; // Always 0 for TR9? Was 0x2 for some files in DX3 I think.
  u32 count; // number of blocks
  u32 pad; // pretty much everything is 16 byte aligned

CDRM BlockHeader (repeaded "count" times, 16 byte aligned at the end)
  u32 var1
    24 MSB = uncompressedSize; //size of uncompressed data chunk, max 0x40000
     8 LSB = blockType; // 1 is uncompressed, 2 is zlib, 3 is the new one
  u32 compressedSize; //size of the compressed data block

Data blocks (of "compressedSize" length, "count" number of blocks, each 16 byte aligned between each other)
OK so now an example of the new type of blocks.
Image

You see that there is one block of type 3, with uncompressed size of 28952 bytes, and a compressed size of 20552 bytes.

If you look at offset 0x20, it's the start of the data. We obviously see that it's not a valid zlib header; it starts with 0xFF. But we see that the first 3 bytes are very similar to the bytes of the uncompressed size, just one line over (well except for 0x00 that became 0xFF). I looked at a bunch of CDRM files (not all) and they all share that pattern.

Let's look at another CDRM header.
Image

This one has 2 blocks, the first one with the max uncompressed size of 0x40000. For the first block, the observation I previously made does't work. But it does work for the last block, which isn't the max uncompressed size! Look:

Image
0x004158 <-> 0xFF4158

I tried to see if I could reconstruct the zlib header without success. So now the question is, what is it? What other compression method is usually used in game archives?

(I posted extracts of the game files as images, I hope it's OK :ninja: )
Last edited by sephiroth99 on Fri Mar 01, 2013 4:57 am, edited 1 time in total.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: Tomb Raider (2013) Compressed DRM (CDRM)

Post by Ekey »

Cut block and try use

Code: Select all

http://aluigi.altervista.org/papers/bms/comtype_scan2.bms
http://aluigi.altervista.org/papers/bms/comtype_scan2.bat
sephiroth99
ultra-n00b
Posts: 8
Joined: Fri Sep 23, 2011 8:23 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Tomb Raider (2013) Compressed DRM (CDRM)

Post by sephiroth99 »

Ekey wrote:Cut block and try use

Code: Select all

http://aluigi.altervista.org/papers/bms/comtype_scan2.bms
http://aluigi.altervista.org/papers/bms/comtype_scan2.bat
Thanks for the link, didn't know about this tool. Looks very useful!

I tried it but unfortuanately didn't have any positive results. Guess we will have to wait for the PC version to unlock in order to poke around.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: Tomb Raider (2013) Compressed DRM (CDRM)

Post by Ekey »

Well for PS3 used ZLIB, seems for XBOX used inflate ?

Here simple files http://www.sendspace.com/file/ohklwk

Uncompressed files have PS3T header and compressed again lol. Data begin from offset 0x24
sephiroth99
ultra-n00b
Posts: 8
Joined: Fri Sep 23, 2011 8:23 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Tomb Raider (2013) Compressed DRM (CDRM)

Post by sephiroth99 »

So the PC version uses zlib too (block type 2), so only the xbox version has the new block type 3.

Guess it's not really useful to try and reverse this compression stuff. oh well
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: Tomb Raider (2013) Compressed DRM (CDRM)

Post by aluigi »

I don't have the xbox files but my guess (xbox + first byte equal to 0xff) is that the version for this platform uses xmemdecompress.
Post Reply