Created
December 29, 2019 06:56
-
-
Save NWPlayer123/6ae2f541c9870ba6e6d071d503f6c772 to your computer and use it in GitHub Desktop.
Ultimate I Spy for Wii
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from struct import unpack | |
with open("enUS.dat", "rb") as f: | |
header = unpack("<5I", f.read(0x14)) | |
table1 = unpack("<%sI" % header[2], f.read(4 * header[2])) | |
table1 += tuple([header[3] - (4 * header[2])]) | |
strings1 = [] | |
for i in range(len(table1) - 1): | |
strings1.append(f.read((table1[i+1] & 0xFFFFFF) - (table1[i] & 0xFFFFFF)).rstrip("\x00")) | |
table2 = [] | |
for i in range(header[2]): | |
table2.append(unpack("<IH", f.read(6))) | |
table2 += (tuple([header[4] - 0x14 - header[3], 0]),) | |
strings2 = [] | |
for i in range(len(table2) - 1): | |
strings2.append(f.read(table2[i+1][0] - table2[i][0]).rstrip("\x00")) | |
for i in range(len(table1) - 1): | |
print(strings2[i] + ": " + strings1[i].rstrip() + "\n---------------------------------------------") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment