here is a new version of the script i just posted just days ago
Code:
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.