D
I've had a look at .txp files in the START_JP.dat, here's what I figured out in a hex editor. Little endian byte order here and everywhere else.I am having a hard time finding any information about txp files?
import os, sys, struct
datfname = 'START_JP.dat' # hardcoded for now
scriptdir = os.path.dirname(sys.argv[0])
if scriptdir != '': os.chdir(scriptdir) # else we're started from Python console
try:
datfile = open(datfname, 'rb')
except IOError:
print "Extraction aborted: no START_JP.dat file in the current directory"
exit()
fnum = struct.unpack('I', datfile.read(4))[0]
foffset = fnum * 32 + 16 # 1168, file table length
datfile.seek(16)
fentries = list()
for i in range(fnum):
fend = struct.unpack('I', datfile.read(4))[0] + foffset
fname = datfile.read(28).split('\x00')[0]
fentries.append((fname, fend))
dumpdir = os.path.splitext(os.path.basename(datfname))[0] # 'START_JP' for PSP
dumpdir = os.path.join(scriptdir, dumpdir)
try:
os.mkdir(dumpdir)
except WindowsError: pass
os.chdir(dumpdir)
for fentry in fentries:
fname, fend = fentry
print os.path.join(dumpdir, fname)
dumpfile = open(fname, 'wb')
dumpfile.write(datfile.read(fend - datfile.tell()))
dumpfile.close()
datfile.close()
I was hoping to have locations translated as well but somehow I screwed up during my hex editing tonight. It might take awhile to solve the issue. I think I found it but I have to re-encrypt everything.
-ChepChep