Someone could help to make it importing text? This script can bring english translation for Dies Irae to Switch and Android version.
Code: Select all
# -*- coding:utf-8 -*-
import struct,os,fnmatch,re,tempfile
def byte2int(byte):
long_tuple=struct.unpack('L',byte)
long = long_tuple[0]
return long
def int2byte(num):
return struct.pack('L',num)
def FormatString(string, count):
res = "Line%08d\n%s\n"%(count, string+'\n')
return res
def GetEntry(src):
start = 0x338CED
src.seek(start)
end = 0x389250 -4
count = (end-start)//8
entry_list = []
for i in range(0, count):
offset = byte2int(src.read(4))
length = byte2int(src.read(4))
entry_list.append([offset, length])
return entry_list
src = open('exec.dat', 'rb')
dst = open('switch.dat.txt', 'w', encoding='utf16')
entry = GetEntry(src)
j = 0
for [offset, length] in entry:
src.seek(offset + 0x389250)
bstring = src.read(length)
string = bstring.decode('sjis', errors='ignore')
dst.write(FormatString(string,j))
#dst.write(string[:-2]+'\n')
j += 1
src.close()
dst.close()
And in exec.zip from attachment is exec.dat.