AVA2 client Windows parity passes (gr2 BitKnit2/64-bit, GamePhase handlers, python modules)
- gr2: BitKnit2 decompression, 64-bit LE files, compressed curves - net: remaining GamePhase handlers, generated GC packet table - python: event/chat/chr/minimap/guild/quest/messenger/shop-search and other native modules ported against the AVA2 Windows client - render: D3D8 fixed-function lighting in Gr2ModelRenderer, terrain without baked shade; cape/NPC equipment attachment - tests + audits updated; docs/PORT-PLAN.md and WINDOWS-PARITY.md Batch 4 (render pipeline: background.*, app.RenderGame/UpdateGame, camera bindings, main.cpp fake-content removal) is still in progress. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9f748eb05a
commit
9077aa389a
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build a client-root style run directory for asset-backed tests.
|
||||
|
||||
The decoded AVA2 pack_maker tree keeps each pack in its own folder, and each
|
||||
pack's <name>_create.xml lists the root-relative path ("ArchivedPath") the
|
||||
Windows pack manager serves for every file (d:/ymir work/pc/..., icon/item/...,
|
||||
locale/es/ui/...). This rebuilds that single root out of per-file symlinks,
|
||||
without copying any asset:
|
||||
|
||||
1. every upstream/python-root file (the repository's scripts win)
|
||||
2. every *_create.xml entry, "d:/" stripped; packs PC, ETC, root first, then
|
||||
the rest alphabetically; first file wins, names compared case-insensitively
|
||||
3. map -> pack_maker/Maps (tests read map/metin2_map_a1/...)
|
||||
mark, svside -> pack_maker/../<name> (loose client-root folders, not in any pack)
|
||||
|
||||
The output is generated data: keep it out of the repository (default
|
||||
build/dev/test-rundir, which CMake passes to the tests as AVA2_TEST_RUNDIR).
|
||||
|
||||
usage: tools/make_test_rundir.py [--pack-maker DIR] [--python-root DIR] [--out DIR]
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
MARKER = ".ava2_test_rundir"
|
||||
FIRST_PACKS = ["PC", "ETC", "root"]
|
||||
DIR_LINKS = {
|
||||
"map": "Maps",
|
||||
"mark": "../mark",
|
||||
"svside": "../svside",
|
||||
}
|
||||
MANIFEST_ENTRY = re.compile(r'ArchivedPath="([^"]*)"><!\[CDATA\[([^\]]*)\]\]>')
|
||||
|
||||
|
||||
def pack_manifests(pack_maker):
|
||||
packs = sorted(p.name[: -len("_create.xml")] for p in pack_maker.glob("*_create.xml"))
|
||||
first = [p for p in FIRST_PACKS if p in packs]
|
||||
for pack in first + [p for p in packs if p not in first]:
|
||||
yield pack_maker / f"{pack}_create.xml"
|
||||
|
||||
|
||||
class RunDir:
|
||||
"""Per-file symlink tree; the first file for a case-insensitive path wins."""
|
||||
|
||||
def __init__(self, out):
|
||||
self.out = out
|
||||
self.dirs = {"": out} # lower-case relative dir -> real directory
|
||||
self.files = set()
|
||||
|
||||
def _dir(self, parts):
|
||||
key = ""
|
||||
for part in parts:
|
||||
parent = self.dirs[key]
|
||||
key = f"{key}/{part.lower()}" if key else part.lower()
|
||||
if key not in self.dirs:
|
||||
self.dirs[key] = parent / part
|
||||
self.dirs[key].mkdir()
|
||||
return self.dirs[key]
|
||||
|
||||
def add(self, rel, source):
|
||||
parts = [p for p in rel.replace("\\", "/").split("/") if p]
|
||||
key = "/".join(parts).lower()
|
||||
if not parts or key in self.files or key in self.dirs:
|
||||
return False
|
||||
self.files.add(key)
|
||||
os.symlink(source, self._dir(parts[:-1]) / parts[-1])
|
||||
return True
|
||||
|
||||
|
||||
def archived_root_path(archived):
|
||||
archived = archived.replace("\\", "/")
|
||||
return archived[3:] if archived.lower().startswith("d:/") else archived
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("--pack-maker", type=Path,
|
||||
default=ROOT.parent / "AVA2" / "TEST" / "1. Client DEV" / "pack_maker")
|
||||
ap.add_argument("--python-root", type=Path, default=ROOT / "upstream" / "python-root")
|
||||
ap.add_argument("--out", type=Path, default=ROOT / "build" / "dev" / "test-rundir")
|
||||
args = ap.parse_args()
|
||||
|
||||
pack_maker = args.pack_maker.resolve()
|
||||
out = args.out.resolve()
|
||||
if not pack_maker.is_dir():
|
||||
sys.exit(f"pack_maker not found: {pack_maker}")
|
||||
|
||||
# Only ever replace a directory this script made.
|
||||
if out.exists():
|
||||
if not (out / MARKER).exists():
|
||||
sys.exit(f"refusing to replace {out}: not made by this script (no {MARKER})")
|
||||
shutil.rmtree(out)
|
||||
out.mkdir(parents=True)
|
||||
(out / MARKER).write_text(f"pack_maker={pack_maker}\n")
|
||||
|
||||
tree = RunDir(out)
|
||||
linked = 0
|
||||
python_root = args.python_root.resolve()
|
||||
if python_root.is_dir():
|
||||
for dirpath, _dirnames, filenames in os.walk(python_root):
|
||||
for name in sorted(filenames):
|
||||
source = Path(dirpath) / name
|
||||
linked += tree.add(source.relative_to(python_root).as_posix(), source)
|
||||
else:
|
||||
print(f"warning: missing {python_root}", file=sys.stderr)
|
||||
|
||||
for manifest in pack_manifests(pack_maker):
|
||||
text = manifest.read_text(encoding="latin-1")
|
||||
for archived, source in MANIFEST_ENTRY.findall(text):
|
||||
# CDATA sources are relative to the directory holding pack_maker.
|
||||
source = pack_maker.parent / source
|
||||
if source.is_file():
|
||||
linked += tree.add(archived_root_path(archived), source)
|
||||
|
||||
for name, rel in DIR_LINKS.items():
|
||||
target = (pack_maker / rel).resolve()
|
||||
if target.is_dir() and name not in tree.dirs:
|
||||
os.symlink(target, out / name)
|
||||
else:
|
||||
print(f"warning: not linking {name} -> {target}", file=sys.stderr)
|
||||
|
||||
print(f"{out}: {linked} files linked")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user