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
+22
View File
@@ -0,0 +1,22 @@
import re, shutil, sys
GAME = r"F:\steam\steamapps\common\The I of the Dragon"
BK = r"C:\Users\29452\AppData\Local\Temp\opencode\backup\Strings.dat"
p = GAME + r"\Data\Misc\Strings.dat"
shutil.copyfile(BK, p)
enc = open(p, "rb").read()
test = b"\xc1\xfa"
pat = re.compile(rb'(Id\s*=\s*"([^"]*)"\s*[\r\n]+\s*English\s*=\s*")[^"]*(")')
def repl(m):
sid = m.group(2)
if b"Filename" in sid or b"Path" in sid:
return m.group(0)
return m.group(1) + test + m.group(3)
enc2, n = pat.subn(repl, enc)
open(p, "wb").write(enc2)
print("strings replaced:", n)