Initial commit: RE tooling and docs for The I of the Dragon localization/HD

This commit is contained in:
DragonHD
2026-09-20 09:57:07 +08:00
commit caf7376019
26 changed files with 1624 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import os
base = r"F:\steam\steamapps\common\The I of the Dragon\Data\Misc"
out = r"C:\Users\29452\AppData\Local\Temp\opencode\decoded"
os.makedirs(out, exist_ok=True)
key = b"GBDFYTNE"
for f in ["Fonts.dat", "UnitDescription.dat", "AIDescription.dat"]:
d = open(os.path.join(base, f), "rb").read()
assert d[:2] == b"==", d[:2]
body = d[2:]
dec = bytes(body[i] ^ key[i % len(key)] for i in range(len(body)))
fp = os.path.join(out, f + ".txt")
open(fp, "wb").write(dec)
print(f, "->", fp, len(dec), "bytes")
# also prove re-encode round trips
def enc(text_bytes):
return b"==" + bytes(text_bytes[i] ^ key[i % len(key)] for i in range(len(text_bytes)))
for f in ["Fonts.dat", "UnitDescription.dat", "AIDescription.dat"]:
d = open(os.path.join(base, f), "rb").read()
body = d[2:]
dec = bytes(body[i] ^ key[i % len(key)] for i in range(len(body)))
assert enc(dec) == d, f
print("round-trip OK")