Can somebody help me with this? Here's the hdr file: https://1fichier.com/?xsdgouf75qwg63xpip53
I understand the structure but can't get the script to work.
Here's how it works:
- FOLDER_ID == some index -> change current subfolder to given name, don't write anything
- FOLDER_ID == 0xffffffff -> normal file, put file name in current folder and write current file
- FOLDER_ID && FILE_ID == 0xffffffff -> given file is last in current folder, move one folder layer up and write current file
I know it's easy, I'm just having a logical blackout.
Here's a basic script structure (missing the folder creation):
Code: Select all
open FDDE hdr 0
open FDDE dat 1
set LAYER 0 # for folder hierarchy
get FILES long 0
get NAMES_BIAS long 0
for i = 0 < FILES
get NAME_OFF long 0
math NAME_OFF += NAMES_BIAS
get SIZE long 0
get OFFSET long 0
get ZERO long 0
get FOLDER_ID long 0
get FILE_ID long 0
get ZERO longlong
savepos MYOFF 0
goto NAME_OFF 0
get FNAME string 0
callfunction construct_folder 1
log NAME OFFSET SIZE 1
goto MYOFF 0
next i
startfunction construct_folder
set NAME ""
if FOLDER_ID == -1 && FILE_ID == -1
math LAYER -= 1 # current layer one up
endif
if FOLDER_ID != -1
putArray LAYER 0 FNAME
else
for l = 0 < LAYER
getArray C_FOLDER LAYER 0
string NAME += C_FOLDER
string NAME += "\"
next l
string NAME += FNAME
endif
endfunction