Open reimplementation of the Iggy flash-player C API (240+ symbols) as iggy_shim_w64.dll. Object model: interned names, value-path resolution over a Flash-like display/property tree, method-call dispatch hooks. Scene identity via SWF byte fingerprinting (gen-scenes-tsv.py, 366 scenes) since the game passes a null config. Verified: client runs with no RAD code loaded; scenes create/tick; game drives HUD+Intro methods. patches/0002: upstream CMakeLists hard-set IGGY_LIBS; now overridable.
51 lines
2.1 KiB
Python
51 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Generate uiassets/scenes.tsv for the iggy-shim: fingerprints every SWF the
|
|
game may load and joins it with the extracted layout manifest metadata."""
|
|
import json
|
|
import os
|
|
import sys
|
|
import zlib
|
|
|
|
GAME = os.path.expanduser(
|
|
os.environ.get("GAME_DIR", "~/neoLegacy/build/windows64-clang-mac/Minecraft.Client"))
|
|
LAYOUT = os.path.expanduser(os.environ.get("LAYOUT_DIR", "~/neoLegacy-mac/ui-layout"))
|
|
OUT = os.path.join(os.path.expanduser(os.environ.get("OUT_DIR", GAME)), "uiassets")
|
|
|
|
rows = []
|
|
seen = set()
|
|
for root in (os.path.join(GAME, "Common/Media"), os.path.join(GAME, "Windows64Media/Media")):
|
|
for dirpath, _, files in os.walk(root):
|
|
for fn in files:
|
|
if not fn.endswith(".swf"):
|
|
continue
|
|
path = os.path.join(dirpath, fn)
|
|
name = fn[:-4]
|
|
data = open(path, "rb").read()
|
|
if data[:2] == b"MZ": # upstream's mislabeled PE files
|
|
continue
|
|
crc = zlib.crc32(data[:4096]) & 0xFFFFFFFF
|
|
key = (len(data), crc)
|
|
if key in seen:
|
|
continue
|
|
seen.add(key)
|
|
w, h, fps, doc = 1280, 720, 30.0, ""
|
|
manifest = os.path.join(LAYOUT, name + ".json")
|
|
if os.path.exists(manifest):
|
|
try:
|
|
m = json.load(open(manifest))
|
|
w, h, fps = int(m["width"]), int(m["height"]), float(m["fps"])
|
|
for exp in m.get("exports", {}):
|
|
if exp.startswith("fourj.documents."):
|
|
doc = exp
|
|
break
|
|
except Exception as e:
|
|
print(f"warn: bad manifest {name}: {e}", file=sys.stderr)
|
|
rows.append((name, len(data), crc, w, h, fps, doc))
|
|
|
|
os.makedirs(OUT, exist_ok=True)
|
|
with open(os.path.join(OUT, "scenes.tsv"), "w") as f:
|
|
f.write("# name\tsize\tcrc32(first4k,hex)\twidth\theight\tfps\tdocClass\n")
|
|
for name, size, crc, w, h, fps, doc in sorted(rows):
|
|
f.write(f"{name}\t{size}\t{crc:08x}\t{w}\t{h}\t{fps}\t{doc}\n")
|
|
print(f"wrote {len(rows)} scenes to {os.path.join(OUT, 'scenes.tsv')}")
|