Ok so the following script should do the two jobs:
Code: Select all
get MYSIZE asize
get NAME basename
get EXT extension
if EXT == "IMG"
get SIZE long
get ZSIZE long
if ZSIZE > MYSIZE
# skip
else
savepos OFFSET
string NAME + ".IMG2"
clog NAME OFFSET ZSIZE SIZE
endif
else if EXT == "IMG2"
math OFFSET = 0x24
math MYSIZE - OFFSET
string NAME + ".dds"
log NAME OFFSET MYSIZE
endif
001_00676.IMG -> 001_00676.IMG2 (a temporary extension I assigned)
001_00676.IMG2 -> 001_00676.dds
It works also in reimport* mode as I just tested:
reimport: 001_00676.dds -> 001_00676.IMG2
reimport2: 001_00676.IMG2 -> 001_00676.IMG
Yeah, the only requirement is using reimport.bat for dds->img2 and reimport2 for img2->img because reimport2 refuses to corrupt the data in the first step.
Note: both reimport.bat and reimpor3 work in the first step, the difference is that reimport3 puts the new data in place of the old one shrinking/enlarging the original content, but this is not the case since the dds is at the end of img2 so there is no data at the end to preserve.