import os import shutil import struct import textwrap #Up to 50 characters used in original file (counting the star as 1 character) INPUT_COL = 3 #Changes non-ASCII characters to ASCII (can add or delete entries as needed) trans_tbl_fr = ( ('|',';'), ('é','<'), ('è','>'), ('à','^'), ('ê','_'), ('ù','+'), ('…','...'), ('ç','c'), ('â','a'), ('ä','a'), ('î','i'), ('ï','i'), ('ö','o'), ('ô','o'), ('ü','u'), ('û','u'), ('ë','e'), ('æ','ae'), ('œ','oe')) trans_tbl_fr = dict((ord(x[0]), x[1]) for x in trans_tbl_fr) if os.path.isfile('T_QUEST.orig'): pass elif os.path.isfile('T_QUEST ._DT'): shutil.copy('T_QUEST ._DT', 'T_QUEST.orig') else: print('Missing T_QUEST. Place in this tool\'s folder.') quit() if not os.path.isfile('t_quest.tsv'): print('Missing input file t_quest.tsv. Place in this tool\'s folder.') quit() inputdata = [] with open('t_quest.tsv', 'r', encoding='utf-8') as f: for line in f: line = line.split('\t') if len(line) < 3: print('hit') break if line[0] != '': inputdata.append([]) if line[1] != '': inputdata[-1].append([line[INPUT_COL]]) else: inputdata[-1][-1].append(line[INPUT_COL]) #First 0x12 bytes of each quest are unknown unknown_data = [] with open('T_QUEST.orig', 'rb') as f: filedata = f.read() ptr_start = 0x0 ptr_end = 0xAE ptrs = tuple(struct.unpack( '