So, I decided to do this thing...
Code: Select all
if BF_EXT == "001"
sortarray 0 1
math BF_NUM = 1
math BF_OFF = 0
get BF_SIZE asize
for f2 = 0 < FILES
getarray OFFSET 5 f2
getarray SIZE 6 f2
getarray NAME 10 f2
math OFFSET + 4
math TMP_OFF = OFFSET
math OFFSET - BF_OFF
if OFFSET >= BF_SIZE
math BF_NUM + 1
string BF_EXT p "%03d" BF_NUM
open FDDE BF_EXT
math BF_OFF + OFFSET
get BF_SIZE asize
math OFFSET = 0
endif
string FNAME p= "%08x." DUMMY1
if BF_SIGN == "BUG"
log MEMORY_FILE OFFSET SIZE
get SIGN1 long MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
else
log NAME OFFSET SIZE
endif
next f2
endif
Basically, I want to load the splitted archive based on the offset field. Although it works only with sequential offsets, in the case of the archive I'm trying to handle with there are offset fields that bounce back-and-forth from one file to the next, like this one right here:
Code: Select all
.
. 00000000000000c6
. 00000000 getarr OFFSET 0x000000002bc09800 5:198
. 00000000 getarr SIZE 0x00000000000037fc 6:198
. 00000000 getarr NAME "de_ha_05a_trex_05.wad" 10:198
. 0000000000000000 get BF_SIZE 0x0000000018c07000 -2 # .002
. 0000000000000000 get SIGN1 0x00000000fba13169 4
0000000000000000 14332 de_ha_05a_trex_05.wad
.
. 00000000000000c7
. 00000000 getarr OFFSET 0x000000002bc3a800 5:199
. 00000000 getarr SIZE 0x000000000000affc 6:199
. 00000000 getarr NAME "de_ha_05a_trex_17.wad" 10:199
. 0000000000000000 get SIGN1 0x00000000280aba90 4
0000000000000000 45052 de_ha_05a_trex_17.wad
.
. 00000000000000c8
. 00000000 getarr OFFSET 0x000000000e8c6000 5:200 <-- .001
. 00000000 getarr SIZE 0x00000000000007fc 6:200
. 00000000 getarr NAME "fe21468a.bin" 10:200
Regardless, when executed, the script will still stick to the latest loaded extension when it reaches to this point, therefore it's guaranteed to throw out an error when the script is faced with an offset from another splitted part of the archive that it can't reach.
Any ideas as to how I can actually handle this?