Zelda BOTW (msbt) text export script

How to translate the files of a game
n97t7f7b57f
Posts: 27
Joined: Tue Apr 21, 2015 2:15 pm

Zelda BOTW (msbt) text export script

Post by n97t7f7b57f »

export .msbt files from content\Pack\Bootup_EUen.pack(SARC)

Use this script to export .txt

Code: Select all

endian big
//header 0x20
idstring "MsgStd"
get unk short
get encoding short // feff UTF-16
get unk long
get unk long
get FSIZE long
get unk long
get unk long
get unk short

//ATR1
goto 0x00
FindLoc OFFSET string "ATR1"
goto OFFSET
idstring "ATR1"
get BODYSIZE long
get unk longlong
get count long
get unk long

//LBL1 - file names
goto 0x00
FindLoc OFFSET string "LBL1"
goto OFFSET
idstring "LBL1"
get BODYSIZE long
get unk longlong
get Ecount long

for i = 0 < Ecount
get unk long
get unk long
next i

putarray 0 count 0
for i = 0 < count
get size byte
GetDString FileName size
get IDX long
putarray 0 IDX FileName // 0 - filenames array with correct order
next i

//TXT2 - text
goto 0x00
FindLoc OFFSET string "TXT2"
goto OFFSET
idstring "TXT2"
get BODYSIZE long
get unk longlong

get Tcount long
putarray 1 Tcount 0
for i = 0 < Tcount
get TextOffset long
putarray 1 i TextOffset // 1 - array with text offsets
next i

putarray 1 i BODYSIZE // add end of text offset to math size later

//text
math OFFSET + 0x10
log MEMORY_FILE OFFSET BODYSIZE

//output
for i = 0 < count
get PATH basename
string PATH += /
getarray NAME 0 i
string NAME + .txt
string PATH + NAME
getarray TextOffset 1 i
math i + 1
getarray TextOffset2 1 i
math i - 1
Xmath SIZE "TextOffset2 - TextOffset"

set MEMORY_FILE2 binary "\xfe\xff"
append
log MEMORY_FILE2 TextOffset SIZE MEMORY_FILE
append
get SIZE asize MEMORY_FILE2

log PATH 0 SIZE MEMORY_FILE2

next i