Skip to content

Instantly share code, notes, and snippets.

@NWPlayer123
Last active August 22, 2021 21:02
Show Gist options
  • Save NWPlayer123/7044816c02e89075aa1af886269eb7f7 to your computer and use it in GitHub Desktop.
Save NWPlayer123/7044816c02e89075aa1af886269eb7f7 to your computer and use it in GitHub Desktop.
Metroid Samus Returns text
def getstr(f):
ret = "";char = f.read(1)
while char != "\x00":
ret += char
char = f.read(1)
return ret
def getustr(f):
ret = "";char = f.read(2)
while char != "\x00\x00":
ret += char
char = f.read(2)
return ret
data = []
with open("japanese.txt", "rb") as f:
# change this ^^^ to use
assert f.read(4) == b"BTXT"
assert f.read(4) == b"\x01\x00\x08\x00" #???
f.seek(0, 2)
size = f.tell()
f.seek(8)
while f.tell() < size:
name = getstr(f)
data.append(name.encode("UTF-16-LE"))
name = getustr(f)
data.append(name)
with open("japanese1.txt", "wb") as o:
# change this ^^^ to use
o.write("\xFF\xFE")
for line in data:
o.write(line + "\r\n".encode("UTF-16-LE"))
@JokerDKha
Copy link

JokerDKha commented Aug 22, 2021

Im try to translation this game and want to encrypt is back to binary. How can i do it with this?
And thanks for your hard work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment