The Surge .toc/.dat

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Panzerdroid
Posts: 66
Joined: Sun Aug 30, 2015 12:51 pm

The Surge .toc/.dat

Post by Panzerdroid »

Could anyone take a look?

http://www2.zippyshare.com/v/wNALqK6Z/file.html

I bet the game uses the same LZ4 compression as Lords of the Fallen, but now the container switched from pkg to toc/dat format, so old tools don't work :(
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

Re: The Surge .toc/.dat

Post by spider91 »

Code: Select all

comtype lz4f
endian big
goto 0x5A
get DAT_NAME_SIZE short
getdstring DAT_NAME DAT_NAME_SIZE
string DAT_NAME += "_"
xmath ZERO_SIZE "4 - (DAT_NAME_SIZE % 4)"
if ZERO_SIZE < 4
   getdstring DUMMY ZERO_SIZE
endif
get DATS byte
get FILES long
math DAT_INDEX = -1
for i = 0 < FILES
   getdstring DUMMY 0x0E
   get NAME_SIZE short
   getdstring NAME NAME_SIZE
   xmath ZERO_SIZE "4 - (NAME_SIZE % 4)"
   if ZERO_SIZE < 4
      getdstring DUMMY ZERO_SIZE
   endif
   get OFFSET long
   if OFFSET == 0
      math DAT_INDEX += 1
      string NAME_INDEX p= "%01d" DAT_INDEX
      set NEW_DAT_NAME string DAT_NAME
      string NEW_DAT_NAME += NAME_INDEX
      string NEW_DAT_NAME += ".dat"
      open FDSE NEW_DAT_NAME 1
   endif
   get ZSIZE long
   get SIZE long
   getdstring DUMMY 0x0A
   clog NAME OFFSET ZSIZE SIZE 1
next i
Minimum
Posts: 4
Joined: Sun Apr 05, 2015 3:02 pm

Re: The Surge .toc/.dat

Post by Minimum »

sorry. fixed :mrgreen:
Last edited by Minimum on Tue May 16, 2017 11:18 am, edited 1 time in total.
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

Re: The Surge .toc/.dat

Post by spider91 »

What file you are trying to unpack?
Panzerdroid
Posts: 66
Joined: Sun Aug 30, 2015 12:51 pm

Re: The Surge .toc/.dat

Post by Panzerdroid »

Thank you, Spider81!
Is recompression possible?
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

Re: The Surge .toc/.dat

Post by spider91 »

I've made a script for repack and game crashes with repacked files. Probably it uses some custom CRC calculations for packages like last game from this developers, but i don't have any skills on debugging and don't know what kind of CRC is this.

You can ask Ekey, he made a unpacker for LotF, maybe he can help.