Here's a really easy task for you: Extract the DATA.BAG from the above game - http://*USE_ANOTHER_FILEHOSTING*/452a45a ... d4/DATA.7z. I thought I understood the folder structure but I cancelled after the 20th try to get it right. So... could somebody quickly write a correct script for the file? That'd be great! Thanks in advance.
It isn't as complicated as it may look. Starting at 0x13a0304c: Leave out the first 0x30 bytes, that's the root folder with no name The structure is as follows: 0x20 bytes - file name or folder name 4 bytes - identifier: 0xffffffff = last file in folder = next name is a folder name = reset FOLDER to "" (automatically set the next name as new folder in the next step); anything else = file id, not needed 4 bytes - zero 4 bytes - offset OR 0xffffffff 4 bytes - size OR 0xffffffff both offset and size 0xffffffff means that there's a subfolder in the current folder only size 0xffffffff means that the current folder is the last subfolder and the next name is a file
Somehow I'm too dumb to write this into a script. :\
Well, it's more complicated than I thought... I couldn't figure out when a folder is contained inside an upper branch folder but the files are in their according folder. So, some of the folders that are extracted belong inside another folder, like "english", "french" and so on belong into "text/" but hey, it's an effort.
get UNK long get ENTRIES long # including folders get TOC_OFF long
math ENTRIES -= 1 # skip the root folder math TOC_OFF += 0x30 # first "file" is the root directory -> skip that goto TOC_OFF set FOLDER "" set NXTFOLDER 0 for i = 1 <= ENTRIES getDstring NAME 0x20 get LAST long get ZERO long get OFFSET long get SIZE long if FOLDER == "/" # next folder in root dir, NEVER file string FOLDER p= "%s" NAME else if OFFSET != 0xffffffff if NXTFOLDER == 1 string FOLDER p= "%s/%s" FOLDER NAME set NXTFOLDER 0 else string NAME p= "%s/%s" FOLDER NAME log NAME OFFSET SIZE #print "%i% - %NAME%" endif else if NXTFOLDER == 1 string FOLDER p= "%s/%s" FOLDER NAME set NXTFOLDER 0 endif endif endif if SIZE == 0xffffffff set NXTFOLDER 1 endif if LAST == 0xffffffff if OFFSET != 0xffffffff # only if current is file, no folder set FOLDER "/" endif endif next i