# sorry, by "rigged up a script", i really meant that. # this is built to be copy&pasted directly into the python interpreter and run from there. # you'll have to change the hardcoded paths. # the textures are dumped as .vtf files, which can be opened with vtfedit. that is the only tool i'm familiar with that works with dxt5 compressed data. from struct import unpack as u, pack as p from zlib import decompress as d from binascii import unhexlify txtchars = (0x09, 0x0A, 0x0D, *range(0x20, 0x7F)) VTFDXT5HEADER = unhexlify('56544600070000000200000050000000000200020023000001000000000000000000803F0000803F0000803F000000000000803F0F00000001FFFFFFFF00000100000000000000000000000000000000') DDIR=r'C:\Users\Inuk\Desktop\dump' # output directory f=open(r'C:\Users\Inuk\Desktop\common.xfs','rb') f.seek(0xc74c) file = 0 while 1: ctype,dsize,csize=u('3L',f.read(4*3)) data=d(f.read(csize)) ext='' if file>=1634 and file<=2619: ext='.tex' u1,u2,textures=u('3L',data[:4*3]) readpointer=4*3 for texture in range(1):#textures): width, height, u1, u2 = u('4L',data[readpointer:readpointer+4*4]) readpointer+=4*4 o=open(DDIR+'/%i %i.vtf'%(file,texture), 'wb') _=o.write(VTFDXT5HEADER + data[readpointer:readpointer+width*height]) # DXT5 is effectively 1 byte per pixel _=o.seek(0x10) _=o.write(p('2H', width, height)) _=o.close() readpointer+=width*height elif data[:4]==b'XDD ':ext='.xdd' # models elif data[:4]==b'XSD\0':ext='.xsd' # animations? elif data[:4]==b'RIFF':ext='.wav' elif file==1633:ext='.tga' else: for b in data: if b not in txtchars: break else:ext='.txt' _=open(DDIR+'/%i%s'%(file,ext), 'wb').write(data) file+=1