aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


tools/client/link_game.py (1413B)


      1 """Link the currently translated Clientr graph with the strict Windows runtime."""
      2 
      3 import pathlib
      4 import subprocess
      5 
      6 
      7 root = pathlib.Path(__file__).resolve().parents[2]
      8 work = root / "local/client/game-14.9.1"
      9 runtime = root / "local/references/reconstruction-reference/pcrecomp/runtime"
     10 compiler = root / "toolchains/llvm-mingw-20261006-ucrt-x86_64/bin/i686-w64-mingw32-clang.exe"
     11 
     12 # Mapped game addresses stay below the host; translated call frames need a large
     13 # native stack. Missing translated entries still fail through the strict runtime.
     14 command = [str(compiler), "-mwindows", "-O2", "-fno-strict-aliasing", "-fms-extensions",
     15            "-I", str(runtime / "native32"), "-I", str(runtime / "recomp32"),
     16            "-I", str(work), str(root / "tools/client/game_host.c"),
     17            str(work.parent / "native32/native32.c"),
     18            str(runtime / "recomp32/image_loader.c"),
     19            str(runtime / "recomp32/recomp_trace.c"), str(work / "dispatch.c"),
     20            "@" + str(work / "objects.rsp"), "-Wl,--image-base,0x60000000",
     21            "-Wl,--stack,16777216", "-o", str(work / "game.exe")]
     22 result = subprocess.run(command, capture_output=True, text=True)
     23 (work / "link.log").write_text(subprocess.list2cmdline(command) + "\n" +
     24                               result.stdout + result.stderr)
     25 print(result.stdout + result.stderr, end="")
     26 result.check_returncode()
     27 print(f"Linked {work / 'game.exe'}")