Jane's Combat Simulations: Advanced Tactical Fighters - compression

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by AlphaTwentyThree »

Hi!
I've written a script for the game that extracts the contents of the EALIB archives but I cannot find the compression used in the *.11k files. Can somebody help me out here? Here's a sample including the script: http://*USE_ANOTHER_FILEHOSTING*/9557887 ... 5/EALIB.7z
Thanks!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by aluigi »

You have cut 2 bytes from the filenames, that's not a short there.
I don't know if it's a compression algorithm because there are no info about the decompressed size.

I used my scanner on a file from both offset 0 and 2 but I have no idea of how should look the decompressed file because it's not a known format.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by AlphaTwentyThree »

You're right about the file names, I was confused there.
The UNK byte is a depictor for compression (4=compressed, 0=uncompressed). The first 4 bytes of each compressed file hold the decompressed size as it looks like.
The uncompressed *.11k files should be 8bit mono raw PCM streams with 11025 Hz.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by Ekey »

pkware implode / explode
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by aluigi »

My fault, I was using an old script that was available on xentax.

The updated script: http://aluigi.org/papers/bms/others/ealib.bms
Would be cool to have also the files with a ZIP value different than 4 to know what algorithm they use.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by AlphaTwentyThree »

Hey cool! Hehe, now you've decided to use the first two as path? Looking into the other archives, the file name is really stored as 0xd, otherwise it wouldn't make any sese. Same with the expansion "NATO Fighters". Sadly there's only 0x00 and 0x04 available as compression identifier. :\
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by aluigi »

I'm not totally sure if they are a path/folder so I just used the name and commented the line to build the PATH+NAME string.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by AlphaTwentyThree »

I've added a clumsy part that automatically converts the 11k files to valid wave files.
Can you tell me if there's a smarter option for the splitname function? All I want to do is split the name and the extension into two separate variables...

Code: Select all

comtype pkware
idstring "EALIB"
get FILES short
for i = 1 <= FILES
   getDstring NAME 0xd
   # getDstring PATH 2
   # getDstring NAME 0xb
   get ZIP byte
   get OFFSET long
   putArray 0 i NAME
   putArray 1 i OFFSET
   putArray 2 i ZIP
next i
for i = 1 <= FILES
   getArray NAME   0 i
   getArray OFFSET 1 i
   getArray ZIP    2 i
   if i != FILES
      xmath n "i + 1"
      getArray SIZE 1 n
   else
      get SIZE asize
   endif
   math SIZE -= OFFSET
   set FNAME basename NAME
   set EXT extension NAME
   
   if EXT != "11k"
      if ZIP == 0
         log NAME OFFSET SIZE
      else
         goto OFFSET
         get XSIZE long
         math OFFSET + 4
         math SIZE   - 4
         clog NAME OFFSET SIZE XSIZE
      endif
   else
      callfunction process11k 1
   endif
next i

startfunction process11k
   set CODEC 1
   set FREQ 11025
   set CH 1
   set BITS 8
   set BLOCKALIGN 1
   
   set PRE SIZE
   math PRE += 0x2c
   putVarChr MEMORY_FILE PRE 0
   log MEMORY_FILE 0 0
   set MEMORY_FILE binary "\x52\x49\x46\x46\x20\xC0\xB1\x00\x57\x41\x56\x45\x66\x6D\x74\x20\x10\x00\x00\x00\x01\x00\x02\x00\x44\xAC\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00\x64\x61\x74\x61\xFC\xBF\xB1\x00"
   
   append
   if ZIP == 0
      log MEMORY_FILE OFFSET SIZE
   else
      set CSIZE SIZE
      goto OFFSET
      get SIZE long
      math OFFSET + 4
      math CSIZE   - 4
      clog MEMORY_FILE OFFSET CSIZE SIZE
   endif
   append
   
   set RIFFSIZE SIZE
   math RIFFSIZE += 36
   set AVGBYTES FREQ
   if CODEC != 2
      math AVGBYTES *= BLOCKALIGN
   endif
   
   putvarchr MEMORY_FILE 0x04 RIFFSIZE long
   putvarchr MEMORY_FILE 0x14 CODEC short          # wFormatTag: Microsoft PCM Format (0x0001)
   putvarchr MEMORY_FILE 0x16 CH short   # wChannels
   putvarchr MEMORY_FILE 0x18 FREQ short   # dwSamplesPerSec
   putvarchr MEMORY_FILE 0x1c AVGBYTES long    # dwAvgBytesPerSec
   putvarchr MEMORY_FILE 0x20 BLOCKALIGN short # wBlockAlign
   putvarchr MEMORY_FILE 0x22 BITS short       # wBitsPerSample
   putvarchr MEMORY_FILE 0x28 SIZE long
   
   set NAME FNAME
   string NAME += ".wav"
   get SIZE asize MEMORY_FILE
   log NAME 0 SIZE MEMORY_FILE
endfunction
Last edited by AlphaTwentyThree on Wed Jun 10, 2015 1:30 pm, edited 1 time in total.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by AlphaTwentyThree »

Here's also a script that demultiplexes the *.cb8 videos (possibly for other Jane's Combat Simulation games too)

Code: Select all

# demultiplex *.cb8 movies from Jane's Combat Simulation games
# (c) 2015-06-10 by AlphaTwentyThree
# script for QuickBMS http://quickbms.aluigi.org

idstring "DRBC"
get CH long
get UNK short
get FREQ short
get UNK long
get FSIZE asize
putVarChr MEMORY_FILE FSIZE 0
log MEMORY_FILE 0 0
set MEMORY_FILE binary "\x52\x49\x46\x46\x20\xC0\xB1\x00\x57\x41\x56\x45\x66\x6D\x74\x20\x10\x00\x00\x00\x01\x00\x02\x00\x44\xAC\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00\x64\x61\x74\x61\xFC\xBF\xB1\x00"
putVarChr MEMORY_FILE2 FSIZE 0
putVarChr MEMORY_FILE3 FSIZE 0
log MEMORY_FILE2 0 0
log MEMORY_FILE3 0 0
set OFFSET 0x40
set FIRST 1
do
   goto OFFSET
   getDstring IDENT 4
   get SIZE long
   math SIZE -= 0x8
   savepos OFFSET
   if IDENT == "MRFA"
      math OFFSET += 0x10
      math SIZE -= 0x10
      if FIRST == 1
         math OFFSET += 0x10
         math SIZE -= 0x10
         set FIRST 0
      endif
      append
      log MEMORY_FILE OFFSET SIZE
      append
   elif IDENT == "VooM"
      append
      log MEMORY_FILE2 OFFSET SIZE
      append
   elif IDENT == "MRFI"
      append
      log MEMORY_FILE3 OFFSET SIZE
      append
   else
      print "%IDENT%"
      cleanexit
   endif
   math OFFSET += SIZE
while OFFSET != FSIZE

get NAME basename

string WNAME p= "%s.wav" NAME
get SIZE asize MEMORY_FILE
set RIFFSIZE SIZE
math RIFFSIZE += 36
set AVGBYTES FREQ
if CH == 1
   set BLOCKALIGN 1
else
   set BLOCKALIGN 2
endif
set CODEC 1
set BITS 8
putvarchr MEMORY_FILE 0x04 RIFFSIZE long
putvarchr MEMORY_FILE 0x14 CODEC short          # wFormatTag: Microsoft PCM Format (0x0001)
putvarchr MEMORY_FILE 0x16 CH short   # wChannels
putvarchr MEMORY_FILE 0x18 FREQ short   # dwSamplesPerSec
putvarchr MEMORY_FILE 0x1c AVGBYTES long    # dwAvgBytesPerSec
putvarchr MEMORY_FILE 0x20 BLOCKALIGN short # wBlockAlign
putvarchr MEMORY_FILE 0x22 BITS short       # wBitsPerSample
putvarchr MEMORY_FILE 0x28 SIZE long
log WNAME 0 SIZE MEMORY_FILE

string WNAME p= "%s.VooM" NAME
get SIZE asize MEMORY_FILE2
log WNAME 0 SIZE MEMORY_FILE2

string WNAME p= "%s.mrfi" NAME
get SIZE asize MEMORY_FILE3
log WNAME 0 SIZE MEMORY_FILE3
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by aluigi »

set EXT extension NAME
set NAME basename NAME
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Jane's Combat Simulations: Advanced Tactical Fighters - compression

Post by AlphaTwentyThree »

haha LOL! ;)
Updated the script.