Skip to content

Instantly share code, notes, and snippets.

@NWPlayer123
Created December 29, 2019 06:56
Show Gist options
  • Save NWPlayer123/6ae2f541c9870ba6e6d071d503f6c772 to your computer and use it in GitHub Desktop.
Save NWPlayer123/6ae2f541c9870ba6e6d071d503f6c772 to your computer and use it in GitHub Desktop.
Ultimate I Spy for Wii
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