Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Dump Nayuta no Kiseki item.tbl
- # 1. Put this script and item.orig (renamed item.tbl) in same folder
- # 2. Run script
- # Output is itemdata.csv (tab-separated)
- import os
- def get_data(filename):
- totalbytes = os.path.getsize(filename)
- infile = open(filename, 'rb')
- totalfiledata = infile.read(totalbytes)
- infile.close()
- return totalfiledata
- filedata = get_data('item.orig')
- pos = 0x10
- output = ""
- while pos < len(filedata):
- if filedata[pos] != '\x00' or filedata[pos + 0x18] != '\x00':
- text = filedata[pos:filedata.find('\x00',pos)]
- output += hex(pos) + '\t' + text + '\n'
- pos += 0x18
- text = filedata[pos:filedata.find('\x00',pos)]
- output += '\t' + text + '\n'
- pos += 0x74
- else:
- pos += 0x8C
- outfile = open('itemdata.csv','wb')
- outfile.write(output)
- outfile.close()
Add Comment
Please, Sign In to add comment