Hitman Sniper Challenge - sample files

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Hitman Sniper Challenge - sample files

Post by AnonBaiter »

Here are the samples. Just to let you know, there are possibly more files than this one, and there's little to no references of the file stored in the archives themselves, but as I said on my previous post...
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

Seems that the "_headerlib" files contains those references to the other files(be it "_resourcelib", "_binkvid" etc.). However, it only references archives that had filenames originally but now the filenames of these archives are now assigned to 32-char hashes(example: 3cdaca54371e1df7480e21347050cf12.ps3_headerlib), which only makes things confusing.

I could use the _index4.txt file on the PC version as a base, but the only conclusion I came was that it contains a list of archives that had something like this:

Code: Select all

[[assembly:/common/globalresources.ini].pc_resourcelibdef].pc_headerlib*3133BD95C91CCB418964E1B8BA3BB23D.pc_headerlib

The filename in these "[[" "]" symbols contain the original filename of the archive, followed by an extension, while after the "*" symbol this is the filename the archive file is now.

Just my two cents.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

forget what i just said with these two posts, i finally managed to figure these monsters out(about time!)

Code: Select all

# Hitman: Codename 47 -That Feeling When Your Creators Left You For a World War I MMO Edition- (PC, PS3, XBOX360)
# Hitman: Sniper Wreckage -GameStop Pre-Order Classics- (PC, PS3, XBOX360)
# Deus Ex: Narrative Divided (PC, PS4, XBOXONE)
# Deus Ex: Sixty-Hour Arcade Hacking Game (PC(Steam))

math glacier2_half_number == 0x7fffffff
math glacier2_full_number == 0xffffffff

get glacier2_extension extension
get glacier2_name filename
get glacier2_sign long
if glacier2_sign == 0x42494c48
   endian big
   math headerlib = 1
elif glacier2_sign == 0x484c4942
   endian little
   math headerlib = 1
endif
get glacier2_offset long
get glacier2_03 long
get glacier2_size long
get glacier2_05 long
get glacier2_06 long

# the XBOX360 version of either games are compressed with raw lzx data and nothing else(apart from engine.ini.scrambled - not sure what to make of it)
# in any case just use this script - http://aluigi.altervista.org/bms/xcompress_file.bms
# do keep in mind though that they're all extensionless on input, the output files will try to add extensions out of their first bytes

if headerlib = 1 # HLIB/BILH
   if glacier2_offset != 0
      savepos reference_position_01
      get reference_entries long
      get reference_02 long
      for acd = 0 < reference_entries
         get reference_string_offset long
         if acd = 0
            get reference_04 long
         endif
         
         if acd != 0
            math reference_string_offset & glacier2_half_number
         endif
         
         savepos reference_position_02
         math reference_string_offset + reference_position_01
         goto reference_string_offset
         get reference_string string
         savepos reference_final_position
         goto reference_position_02
         
         if acd == 0
            math reference_position_01 == reference_string_offset
         endif
      next acd
      
      goto reference_final_position
   endif
   idstring "BIN1"
   get bin1_01 long
   if glacier2_sign == 0x42494c48
      get bin1_02 long
   elif glacier2_sign == 0x484c4942
      endian big
      get bin1_02 long
      endian little
   endif
   savepos starting_position_01
   get bin1_03 long
   savepos starting_position_02
   xmath pre_info_offset "bin1_02 + starting_position_02"
   goto pre_info_offset
   get pre_info_01 long
   get pre_info_size long
   get pre_info_entries long
   for b1_01 = 1 <= pre_info_entries
      get pre_info_value long
   next b1_01
   goto starting_position_02
   for b1_01 = 1 <= 2
      callfunction get_info_01 1
      
      savepos b1_01_tmp1
      if info_offset_01 != glacier2_full_number
         if b1_01 = 1
            goto final_info_offset_01
            get step_01_entries long
            for step01_01 = 1 <= step_01_entries
               for step01_01_01 = 1 <= 2
                  callfunction get_info_02 1
               next step01_01_01
               get 01_03 long
               get 01_04 long
               for step01_01_02 = 1 <= 1
                  callfunction get_info_01 1
                  callfunction get_info_03 1
               next step01_01_02
               for step01_01_02 = 1 <= 4
                  get 01_08 long
               next step01_01_02
               for step01_01_03 = 1 <= 3
                  callfunction get_info_01 1
                  callfunction get_info_04 1
               next step01_01_03
            next step01_01
         elif b1_01 = 2
            goto final_info_offset_01
            get step_02_entries long
            for step02_01 = 1 <= step_02_entries
               callfunction get_info_02 1
            next step02_01
         endif
      endif
      goto b1_01_tmp1
   next b1_01
endif

startfunction get_info_01
   get info_offset_01 long
   get info_offset_02_01 long
   get info_offset_02_02 long
   
   xmath final_info_offset_01 "info_offset_01 + starting_position_01"
   if info_offset_02_01 == info_offset_02_02
      xmath final_info_offset_02 "info_offset_02_01 + starting_position_02"
   endif
endfunction

startfunction get_info_02
   get asset_string_count long
   get asset_string_offset long
   
   savepos info_tmp4
   math asset_string_offset + starting_position_01
   goto asset_string_offset
   get asset_string_size long
   getdstring asset_string asset_string_size
   goto info_tmp4
endfunction

startfunction get_info_03
   savepos info_tmp1
   goto final_info_offset_01
   get asset_string_entries long
   for asset = 1 <= asset_string_entries
      callfunction get_info_02 1
   next asset
   goto info_tmp1
endfunction

startfunction get_info_04
   if info_offset_01 != glacier2_full_number
      savepos info_tmp2
      goto final_info_offset_01
      get file_entries long
      if step01_01_03 = 1
         for ifo1 = 1 <= file_entries
            callfunction get_info_01 1
            
            savepos info_tmp3
            goto final_info_offset_01
            get file_info_total_size long
            get file_identifier long
            get file_offset long
            get file_03 long
            get file_size long
            get file_05 long
            get file_06 long
            if file_info_total_size >= 0x24
               get file_sub_entries long
               math file_sub_entries & glacier2_half_number
               for sf1 = 1 <= file_sub_entries
                  callfunction get_info_05 1
               next sf1
            endif
            goto info_tmp3
         next ifo1
      elif step01_01_03 = 2
         for ent_number = 1 <= file_entries
            get file_id long
         next ent_number
      elif step01_01_03 = 3
         for ifo2 = 1 <= file_entries
            callfunction get_info_05 1
         next ifo2
      endif
      goto info_tmp2
   endif
endfunction

startfunction get_info_05
   if glacier2_sign == 0x42494c48
      get hash01 long
      get hash02 long
   elif glacier2_sign == 0x484c4942
      get hash02 long
      get hash01 long
   endif
endfunction
although the only thing left is to figure out the hashing algorithm used for whatever string the game feels like storing into these HLIB/BILH files at the moment, from there on the rest will be a breeze
if this phrase feels confusing for you fret not - all of this is just the beginning

as for the script itself, this is basically WIP material and will never be ready for use just yet
Last edited by AnonBaiter on Tue Aug 28, 2018 8:16 pm, edited 3 times in total.
Sir Kane
Posts: 16
Joined: Sun Mar 27, 2016 7:20 pm

Re: Hitman Sniper Challenge - sample files

Post by Sir Kane »

Pretty sure this is mostly the same format as the DXMD stuff, except using 32 instead of 64 bits
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

speaking of DXMD ill be supporting DXB(Deus Ex Breach) instead since its basically free on Steam anyway, but also since most of the changes thatll be made into that script of mine will need to be revised later for compatibility reasons

Code: Select all

# Deus Ex: Narrative Divided (PC, PS4, XBOXONE)
# Deus Ex: Sixty-Hour Arcade Hacking Game (PC(Steam))
sorry i just couldnt resist
anyway, this is just a snippet of what will come next with that but dont expect anything else at the moment
Sir Kane
Posts: 16
Joined: Sun Mar 27, 2016 7:20 pm

Re: Hitman Sniper Challenge - sample files

Post by Sir Kane »

My DXMD tool probably works for the breach thing.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

should be good enough
say, which format does that tool of yours seem to handle?
Sir Kane
Posts: 16
Joined: Sun Mar 27, 2016 7:20 pm

Re: Hitman Sniper Challenge - sample files

Post by Sir Kane »

What do you mean?
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

if your tool can handle .archive files, and other such formats on the likes of .pc_headerlib, .pc_fsb, .pc_fsbm, .pc_binkvid and .pc_resourcelib
Sir Kane
Posts: 16
Joined: Sun Mar 27, 2016 7:20 pm

Re: Hitman Sniper Challenge - sample files

Post by Sir Kane »

Only does headerlibs & resource libs, haven't bothered with the sound/video ones, but those would probably be easy to support as well.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

well you can go ahead with that if you want

as for the .archive files themselves ive already written a .bms script for that, but it can only extract all of the files contained within that .archive as-is even if said file has a gazillion chunks for the script to get through
---
oh yeah, about that
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: Hitman Sniper Challenge - sample files

Post by AnonBaiter »

if anyone wants to know what happened with that gigantic post now that it was suddenly edited by me, i updated my WIP script to replace a rather glaring error in hindsight(on the get_info_05 part)

Code: Select all

get size long
get hash long
turns out there's some 64-bit variable that serves as its filename hash per each file, not this bozo info you saw before
---
actually scratch that, i came back to using two 32-bit variables for the get_info_05 part