Cyberpunk 2077 archive-files [RDAR]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Haoose
Posts: 68
Joined: Thu Aug 07, 2014 9:43 pm

Cyberpunk 2077 archive-files [RDAR]

Post by Haoose »

tbmq008
Posts: 62
Joined: Thu Nov 26, 2020 2:13 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by tbmq008 »

Code: Select all

get radr long
if radr != 0x52414452
   cleanexit
endif
get num1 long
if num1 != 0xc
   cleanexit
endif
get io1 longlong
get is1 longlong
get is2 longlong
get full_size longlong
if is2 == 0
   log MEMORY_FILE io1 is1
   math tn1 = -1
   callfunction read_toc 1
else
   cleanexit
endif

startfunction read_toc
   goto 0 tn1
   get toc1 long tn1
   get toc2 long tn1
   get toc3 longlong tn1
   get toc4 long tn1
   get toc5 long tn1
   get toc6 long tn1
   # first TOC (file checksum info)
   for i1 = 0 < toc4
      get entinf1 longlong tn1
      get entinf2 time64 tn1
      getdstring entinf3 0x14 tn1
      getdstring entinf4 0x14 tn1
   next i1
   # second TOC (file offset + file size info)
   for i2 = 0 < toc5
      get entinf5 longlong tn1
      get entinf6 long tn1
      get entinf7 long tn1
      log "" entinf5 entinf6 0
   next i2
   # third TOC (present in voice archives)
   for i3 = 0 < toc6
      get entinf8 longlong tn1
   next i3
endfunction
KARK files are not covered.
Last edited by tbmq008 on Tue Dec 08, 2020 4:39 pm, edited 2 times in total.
tbmq008
Posts: 62
Joined: Thu Nov 26, 2020 2:13 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by tbmq008 »

actually i changed my mind about the third TOC, i just wanted to cover it 'cuz it makes no sense to just ignore it at this point.
with this in mind, i updated the script i just wrote that can be found above this post.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by aluigi »

http://aluigi.org/bms/cyberpunk_2077.bms

Obviously I expect more updates coming but the structure is all covered.
And no, there are no filenames stored, just 64bit hashes.
PlanK69
Posts: 73
Joined: Thu Sep 10, 2015 10:17 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by PlanK69 »

This file is supposed to contain audio files, but your script doesn't work on it (your script worked perfectly on the video files though).

Can you have a look perhaps? It's mega appreciated

https://www.dropbox.com/s/tlez6v3ij9tyk ... chive?dl=0
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by aluigi »

Everything works perfectly here:

Code: Select all

- 4376 files found in 54 seconds
  coverage file 0    95%   180544507  189554688  . offset 000000000b4c5edc
PlanK69
Posts: 73
Joined: Thu Sep 10, 2015 10:17 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by PlanK69 »

nevermind, seems I was using a version of BMS from 2015. i just downloaded the new one from your website and now it's working with that specific file. thanks
PlanK69
Posts: 73
Joined: Thu Sep 10, 2015 10:17 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by PlanK69 »

are you guys able to get usable audio files out of the file I linked? i'm able to extract it but i just get tiny 50kb-150kb files out of it that won't play even after I tried to convert them to .ogg or .wav
Haoose
Posts: 68
Joined: Thu Aug 07, 2014 9:43 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by Haoose »

PlanK69
I'm use audio_2_soundbanks.archive and lang_ru_voice.archive - all works fine

Here music (RAW) to OGG to MP3 converter
https://mega.nz/file/TvRCmLjS#bXmyMfLsr ... nfNYp2tHmA
cad5150
Posts: 3
Joined: Wed Nov 13, 2019 9:13 am

Re: Cyberpunk 2077 archive-files [RDAR]

Post by cad5150 »

I managed to extract audio files with quickbms but I cant play the .wav files. Any help?
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Cyberpunk 2077 archive-files [RDAR]

Post by DJ Normality »

Any chance in finding the models ?
tbmq008
Posts: 62
Joined: Thu Nov 26, 2020 2:13 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by tbmq008 »

here is a new version of the script i just posted just days ago

Code: Select all

get radr long
if radr != 0x52414452 # "RDAR"/"RADR"
   cleanexit
endif
get num1 long
if num1 != 0xc
   cleanexit
endif
get io1 longlong
get is1 longlong
get is2 longlong
get full_size longlong
if is2 == 0
   log MEMORY_FILE io1 is1
   math tn1 = -1
   callfunction read_toc 1
else
   cleanexit
endif

startfunction read_toc
   goto 0 tn1
   get toc1 long tn1
   get toc2 long tn1
   get toc3 longlong tn1
   get toc4 long tn1
   get toc5 long tn1
   get toc6 long tn1
   math toc4_io = 0x1c
   xmath toc5_io "toc4_io + (toc4 * 0x38)"
   xmath toc6_io "toc5_io + (toc5 * 0x10)"
   math toc4_sz = 0x38
   math toc5_sz = 0x10
   math toc6_sz = 8
      goto toc4_io tn1
      get hash1 longlong tn1
      get date time64 tn1
      get chunks_per_file long tn1
      get init_en1 long tn1
      get last_en1 long tn1
      get init_en2 long tn1
      get last_en2 long tn1
      getdstring entinf4 0x14 tn1
      math toc4_io + toc4_sz
      xmath h1_1 "hash1 & 0xffffffff"
      xmath h1_2 "(hash1 >> 32) & 0xffffffff"
      string en1_fn p "%08x%08x" h1_2 h1_1
      append
      for j1 = init_en1 < last_en1
         goto toc5_io tn1
         get en1_ofst longlong tn1
         get en1_sz1 long tn1
         get en1_sz2 long tn1
         math toc5_io + toc5_sz
         if en1_sz1 == en1_sz2
            log en1_fn en1_ofst en1_sz1 0
         else
            goto en1_ofst 0
            get comp_id long 0
            get original_size long 0
            math comp_algo_is_found = 0
            if comp_id == 0x4b52414b # "KARK"/"KRAK"
               comtype oodle
               math comp_algo_is_found = 1
            else
               string comp_id_2 = comp_id
               print " unknown ID for compressed file - %comp_id_2% "
               cleanexit
            endif
            if comp_algo_is_found = 1
               xmath en1_comp_ofst "en1_ofst + 8"
               xmath en1_sz3 "en1_sz1 - 8"
               clog en1_fn en1_comp_ofst en1_sz3 en1_sz2 0
            else
               log en1_fn en1_ofst en1_sz1 0
            endif
         endif
      next j1
      append
      for j1 = init_en2 < last_en2
         goto toc6_io tn1
         get entinf8 longlong tn1
         math toc6_io + toc6_sz
      next j1
   next i1
endfunction
downloadable version is in the attachment as seen below.
of course, it doesn't solve the problem of bogus extensions and most of the files being extracted into dozens of folders every single time a file is being extracted (sometimes a folder can have 12 files!).
on the other hand, it parses the whole structure much more... "accurately", so to speak. i'll explain why once i feel the time is right to make another post here since right now the game is going through an brutal post-hype period where people have actually lost their grip on reality over this game, as well as a lot of disappointment in some circles over all the issues related to performance, code stability (the actual game exe is over 60MB for a reason), graphics, and of course the game's so-called "maturity". welcome to the dark future.

---

as for the script itself i rewrote it all the way so the focus here is on parsing the first TOC, the second and third TOCs are parsed through the one that precedes both of them. the second TOC is the "file" part, and the third TOC is there because i wanted to cover it. support for "KARK" decompression is now possible.
tbmq008
Posts: 62
Joined: Thu Nov 26, 2020 2:13 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by tbmq008 »

the script has been updated with a massive difference in how the structure is handled.
in other words you won't get a folder with dozens of files anymore.
instead you'll get THE one file as the file structure was chunk-based and so there was no need to make up a separate folder with dozens of files inside.
Zmkiy
Posts: 27
Joined: Mon Mar 09, 2020 3:14 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by Zmkiy »

Here's a hook for filenames.
If you want to contribute to Cyberpunk 2077 modding tool, please use this.

Download
Last edited by Zmkiy on Sun Dec 13, 2020 11:26 am, edited 1 time in total.
Amirtbayat81
Posts: 10
Joined: Mon May 04, 2020 11:27 am

Re: Cyberpunk 2077 archive-files [RDAR]

Post by Amirtbayat81 »

Hello, I found the subtitles files, but how do I convert them?
sample: https://mega.nz/file/eJdVyQSb#qrWD24laI ... GWIdUJXPxM
The files are .json
Help me.
h3x3r
Posts: 165
Joined: Wed Jun 01, 2016 5:53 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by h3x3r »

I tried that script but it gives me infinite loop of unpacking into a single file which never ends. So here is my script which unpacks files with extension. Not a complete solution and i also skiped TOC tables since they are more less hashes.
Also there is a problem with ZSIZE and SIZE. Some entry has same ZSIZE as SIZE but files seems to be compressed. But they are few. I will check for solution. There should be some flag for that.

Code: Select all

####################################
comtype OODLE

get FNAME basename
idstring "RDAR"
get Version long
get TableOffset longlong
get ArchiveID longlong
get DUMMY longlong
get TotalFileSize longlong

GoTo TableOffset

get SIGN long
get HashTableSize long
get HashTableID longlong
get HashTableCount long
get ItemCount long
get DUMMY long

for i = 0 < HashTableCount
   GetDString HASHES 0x38
next i

for i = 0 < ItemCount

get OFFSET longlong
get ZSIZE long
get SIZE long

if ZSIZE == SIZE

   if SIZE u> 16
      log MEMORY_FILE OFFSET SIZE
callfunction GETEX 1
   endif
   string NAME p "%s/%u.%s" FNAME OFFSET EXT
   log NAME OFFSET SIZE   
else
   math OFFSET + 8
   math ZSIZE - 8
   
   if SIZE u> 16
      clog MEMORY_FILE OFFSET ZSIZE SIZE
callfunction GETEX 1
   endif
   string NAME p "%s/%u.%s" FNAME OFFSET EXT
   clog NAME OFFSET ZSIZE SIZE
endif
next i

startfunction GETEX
      goto 0 MEMORY_FILE
      get SIGN1 byte MEMORY_FILE
      goto 0 MEMORY_FILE
      getdstring SIGN3 3 MEMORY_FILE
      goto 0 MEMORY_FILE
      getdstring SIGN4 4 MEMORY_FILE
      goto 4 MEMORY_FILE
      getdstring SIGN8 4 MEMORY_FILE
      goto 12 MEMORY_FILE
      getdstring SIGN12 4 MEMORY_FILE
   
      if SIGN4 == "KB2j" || SIGN4 == "BIKi"
            set EXT string "bik"
         elif SIGN4  == "CR2W"
            set EXT string "cr2w"            
         elif SIGN4 == "DDS "
            set EXT string "dds"
         elif SIGN4 == "RIFF"
            set EXT string "riff"      
         elif SIGN3 == "CFX" || SIGN3 == "GFX"
            set EXT string "swf"
         elif SIGN12  == "GDEF"
            set EXT string "ttf"
         elif SIGN3  == "NXS"
            set EXT string "mesh"
         elif SIGN4  == "KARK"
            set EXT string "kraken"
         elif SIGN4  == "BKHD"
            set EXT string "bnk"
         elif SIGN3  == "SND"
            set EXT string "snd"
         else
            string EXT f= dat
      endif
endfunction


Just to be clear. That is the thing i was talked about. As you can see the decompressed size in table doesn't match decompresed size in header of file.
Image
Last edited by h3x3r on Sun Dec 13, 2020 11:27 am, edited 2 times in total.
Puterboy1
Posts: 382
Joined: Wed Sep 12, 2018 2:22 am

Re: Cyberpunk 2077 archive-files [RDAR]

Post by Puterboy1 »

Here I am using CP77 tools and all I get it this: "A fatal error occurred. The required library hostfxr.dll could not be found."

Help me please obtain this.
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Cyberpunk 2077 archive-files [RDAR]

Post by DJ Normality »

Did you put your game .dll in the folder as instructed ?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Cyberpunk 2077 archive-files [RDAR]

Post by aluigi »

tbmq008 wrote:the script has been updated with a massive difference in how the structure is handled.
in other words you won't get a folder with dozens of files anymore.
instead you'll get THE one file as the file structure was chunk-based and so there was no need to make up a separate folder with dozens of files inside.

I agree that the "folders" are just files but I'm not sure they are chunks because their decompressed size is ever different, example:

Code: Select all

000000000007e02f 12         fb664fe9b43f1a5f\000000000000015d.dat
000000000007e03b 12         fb664fe9b43f1a5f\000000000000015e.dat
000000000007e047 240        fb664fe9b43f1a5f\000000000000015f.dat
000000000007e13f 420        fb664fe9b43f1a5f\0000000000000160.dat
000000000007e1df 24         fb664fe9b43f1a5f\0000000000000161.dat
000000000007e1f7 48         fb664fe9b43f1a5f\0000000000000162.dat
000000000007e227 240        fb664fe9b43f1a5f\0000000000000163.dat

So should these chunks being just concatenated to each other?
Or do they have a fixed decompressed size (like 0xc0000) that must be filled with zeroes?
There is not even a full file size for checking if it's concatenation or concatenation+padding.
FortyP
Posts: 1
Joined: Sun Dec 13, 2020 11:34 am

Re: Cyberpunk 2077 archive-files [RDAR]

Post by FortyP »

Hi. Need some help with audio files, in game I found wwise files, opus banks and something like this https://drive.google.com/file/d/1UlYN1y ... sp=sharing , however ww2ogg cant decode and find vorbis header, how to decode this or play