Commandos 3 - HD Remaster game.pak

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Slappy
Posts: 12
Joined: Mon Mar 20, 2017 11:52 am

Commandos 3 - HD Remaster game.pak

Post by Slappy »

The remastered version of the game uses different format of the game archives.

Can anyone unpack/repack this new format? (preview attached)

File is huge (1.7 GB) but there is a free demo version available.

Commandos 3 HD Remaster game.pak
herbert3000
Posts: 6
Joined: Wed Nov 09, 2016 12:44 am

Re: Commandos 3 - HD Remaster game.pak

Post by herbert3000 »

Here you go!

The SDPC files are compressed though, they require further research.

Code: Select all

# Commandos 3 - HD Remaster
#    \Data\Game.pak
# script for QuickBMS http://quickbms.aluigi.org

idstring "30KP"
endian little

get UNKNOWN long # 00000000
get FILE_COUNT long

for i = 0 < FILE_COUNT
   get ID long
   get UNKNOWN long # 00000000
   get OFFSET long
   get UNKNOWN long  # 00000000
   get SIZE long
   get UNKNOWN long  # 00000000 or 80000000
   
   savepos HEADER
   goto OFFSET
   
   set NAME string "OUT_"
   string NAME += i
   
   getdstring MAGIC 4
   if MAGIC == "SDPC"
      string NAME += ".sdpc"
   elif MAGIC == "DDS "
      string NAME += ".dds"
   elif MAGIC == "RIFF"
      string NAME += ".wav"
   elif MAGIC == "GFRL"
      string NAME += ".grl"
   elif MAGIC == "[sha"
      string NAME += ".shader"
   else
      string NAME += ".txt"
   endif
   
   log NAME OFFSET SIZE
   
   goto HEADER
next i
herbert3000
Posts: 6
Joined: Wed Nov 09, 2016 12:44 am

Re: Commandos 3 - HD Remaster game.pak

Post by herbert3000 »

Here are some of the compressed files.
I've also added the files from the original Commandos 3 for reference.
C3HD_SDPC_samples.zip
Slappy
Posts: 12
Joined: Mon Mar 20, 2017 11:52 am

Re: Commandos 3 - HD Remaster game.pak

Post by Slappy »

@herbert3000 amazing, thanks!

I found the exact compressed file for Missiones.dat (both attached)

How to detect the file compression? Looks like some LZ to me. (23 kB to 4.6 kB)

Image
herbert3000
Posts: 6
Joined: Wed Nov 09, 2016 12:44 am

Re: Commandos 3 - HD Remaster game.pak

Post by herbert3000 »

Found the compression algorithm! It's the LZO1X compression algorithm, whatever the F that means.
Used this awesome guide to find it: https://zenhax.com/viewtopic.php?t=23

Here's the updated script:

Code: Select all

# Commandos 3 - HD Remaster
#    \Data\Game.pak
# script for QuickBMS http://quickbms.aluigi.org
#   2022-09-07

idstring "30KP"
endian little
comtype COMP_LZO1X

get UNKNOWN long # 00000000
get FILE_COUNT long

for i = 0 < FILE_COUNT
   get ID long
   get UNKNOWN long # 00000000
   get OFFSET longlong
   get SIZE long
   get UNKNOWN long  # 00000000=compressed 80000000=raw
   
   savepos HEADER
   goto OFFSET
   
   set NAME string "OUT_"
   string NAME += i
   
   getdstring MAGIC 4
   if MAGIC == "SDPC"
      string NAME += ".sdpc"
      
      get UNCOMPRESSED_SIZE long
      math OFFSET += 8
      clog MEMORY_FILE OFFSET SIZE UNCOMPRESSED_SIZE
      
      getdstring MAGIC2 4 MEMORY_FILE
      if MAGIC2 == "DDS "
         string NAME += ".dds"
      elif MAGIC2 == "XPrt"
         string NAME += ".xprt"
      elif MAGIC2 == "DXBC"
         string NAME += ".dxbc"
      elif MAGIC2 == "LDMB"
         string NAME += ".abi"   # C3 file format
      elif MAGIC2 == "2IBM"
         string NAME += ".mbi"   # C3 file format
      elif MAGIC2 == "BSMB"
         string NAME += ".bsmb"   # C3 file format
      elif MAGIC2 == "GFRL"
         string NAME += ".grl"   # C3 file format
      elif MAGIC2 == "TOKE"
         string NAME += ".mac"   # C3 file format
      elif MAGIC2 == "[sha"
         string NAME += ".shader"
      elif MAGIC2 == "#ver"
         string NAME += ".glsl"
      elif MAGIC2 == "-- L"
         string NAME += ".lua"
      else
         goto 0 MEMORY_FILE
         getdstring MAGIC2 1 MEMORY_FILE
         if  MAGIC2 == "["   # C3 script
            string NAME += ".txt"
         else
            goto 0 MEMORY_FILE
            get v0 long MEMORY_FILE
            get v1 long MEMORY_FILE
            if v0 == 2 && v1 == 1
               string NAME += ".sec"   # C3 file format
            else
               string NAME += ".unk"
            endif
         endif
      endif
      
      log NAME 0 UNCOMPRESSED_SIZE MEMORY_FILE
      
   elif MAGIC == "DDS "
      string NAME += ".dds"
   elif MAGIC == "RIFF"
      string NAME += ".wav"
   elif MAGIC == "GFRL"
      string NAME += ".grl"
   elif MAGIC == "[sha"
      string NAME += ".shader"
   else
      string NAME += ".txt"
   endif
   
   if MAGIC != "SDPC"
      log NAME OFFSET SIZE
   endif
   
   goto HEADER
next i