263 lines
14 KiB
Python
263 lines
14 KiB
Python
#!/usr/bin/env python3
|
|
"""Stage the pinned E9+V44 Linux/Wine direct-entry compatibility tuple.
|
|
|
|
This opt-in profile reuses linux_client_package's client copy and fresh-prefix
|
|
functions. It never publishes a release or changes the accepted-client pointer.
|
|
The original launcher REA contract and bounded native results are recorded at
|
|
runtime/continuation-20261106/loader-final-rea-comparison-private/handoff.private.json.
|
|
"""
|
|
|
|
import argparse
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import linux_client_package as base
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE = ROOT / "runtime/continuation-20261106/candidate-integration-private"
|
|
BRIDGE = ROOT / "runtime/continuation-20261106/e9-one-shot-fallback-private/maintained-integration-build/GWNativeBridge.dll"
|
|
LOADER = ROOT / "build/profile5-v44-loader-package-20261103/WowB_loader.dll"
|
|
DXVK = (ROOT / "runtime/continuation-20261105/nohelper-direct-route-private/"
|
|
"guarded-wrapper-lease-frame-r12/runtime/native-wine-prefix/drive_c/windows/system32")
|
|
|
|
CLIENT_ROOT = "211ddb7798d81db2c5066d8488bff509"
|
|
BUILD_INFO_SHA = "da41c477f6722b1bf17a4401c300a7b1d26e1b685cc2ac0d2b9c25cd202ad552"
|
|
EXE_SHA = "c49ce22c3e0aaeb7a7007a5c5cb792e4c3e6cdecc55a1145a5933fc113e3e57f"
|
|
ORIGINAL_LOADER_SHA = "ce09256540963a1920fe375af5b6fb37817f65ba0756b7c859c23288990f98dd"
|
|
V44_LOADER_SHA = "061822ced913c69c4927b6ab7c329f2da4449be0add490dfa43cbf771ae26faf"
|
|
ORIGINAL_BRIDGE_SHA = "6faabd4140e583be7061cfde0a8adda2adade836ba9cf2100c1241927f53cdf4"
|
|
E9_BRIDGE_SHA = "2495861616ef70c0914adeae2adb4182d653516d3409900a240c0623e20a497d"
|
|
|
|
SYSTEM_PIN = {
|
|
"GWNativeWire.dll": "d2fcc0457f9a3347e0089f85876e934786e1953c6603aa535b63360ded0e5f2f",
|
|
"version-hash.bin": "de47c9b27eb8d300dbb5f2c353e632c393262cf06340c4fa7f1b40c4cbd36f90",
|
|
"addon-tail.bin": "5ea22956b952e7ad1a4f345a7fafe4f3d203a914e969357c1dd2f579255b4abb",
|
|
}
|
|
ELF_PIN = {
|
|
"build/libgateway_wine_wire.so": "3ef4bc2d6cc86b211fed1abf5044a22082e49c1f471cf96b74ade3eec5b58edb",
|
|
"build/libgateway_native.so": "18677494e431cf33ddc377000f42d3a40aa4ac5e0a01aa5366b61cfea4fbffaf",
|
|
"build/forever-schema/libforever_codec.so": "5f67686e091e84b4da148ce64a0a9d06d8f2dd3b44ede7ca40ff4e379128e8e8",
|
|
}
|
|
GRAPHICS_PIN = {
|
|
"d3d11.dll": {
|
|
"source": "950c71193694cb4230133a23f2459187296d8f52c6235a32d6dc19a9461949ce",
|
|
"fresh_wine_preimage": "d25db6576954ce348b72bcf976410d0f6b225ca963e4f83d7e01e519d4996c3f",
|
|
},
|
|
"dxgi.dll": {
|
|
"source": "17cb4fac0e840ac3ae6049c01bfefdc077f4023b24cb985faf282c5b93f455c4",
|
|
"fresh_wine_preimage": "7134587d71bffdcf04382e2763fa5d55f06a12acd3d73e6757a23dfa5ccd79e3",
|
|
},
|
|
}
|
|
|
|
|
|
def pinned(path, digest):
|
|
path = base.owned_regular(path)
|
|
if base.sha(path) != digest:
|
|
raise ValueError("Pinned compatibility input differs: " + str(path))
|
|
return path
|
|
|
|
|
|
def source_admission():
|
|
if SOURCE.is_symlink() or not SOURCE.is_dir() or not SOURCE.resolve().is_relative_to(ROOT):
|
|
raise ValueError("Pinned source bundle missing")
|
|
receipt = base.read_json(SOURCE / "bundle-readback.private.json")
|
|
if (receipt.get("status") != "PASS_PRIVATE_THREE_PART_BUNDLE"
|
|
or receipt.get("client_root") != CLIENT_ROOT):
|
|
raise ValueError("Source content/bundle receipt differs")
|
|
client = SOURCE / "runtime/native-client"
|
|
pinned(client / ".build.info", BUILD_INFO_SHA)
|
|
pinned(client / "_classic_beta_/WowB.exe", EXE_SHA)
|
|
pinned(client / "_classic_beta_/WowB_loader.dll", ORIGINAL_LOADER_SHA)
|
|
system = SOURCE / "runtime/native-wine-prefix/drive_c/windows/system32"
|
|
pinned(system / "GWNativeBridge.dll", ORIGINAL_BRIDGE_SHA)
|
|
for name, digest in SYSTEM_PIN.items():
|
|
pinned(system / name, digest)
|
|
for relative, digest in ELF_PIN.items():
|
|
pinned(SOURCE / relative, digest)
|
|
pinned(BRIDGE, E9_BRIDGE_SHA)
|
|
pinned(LOADER, V44_LOADER_SHA)
|
|
for name, row in GRAPHICS_PIN.items():
|
|
pinned(DXVK / name, row["source"])
|
|
indices = base.read_json(SOURCE / "parent-index-preimages.private.json")
|
|
if (indices.get("status") != "PASS_16_SELECTED_PARENT_PREIMAGES"
|
|
or indices.get("count") != 16 or len(indices.get("rows", [])) != 16):
|
|
raise ValueError("Selected parent index preimage receipt differs")
|
|
for row in indices["rows"]:
|
|
relative = Path(row["relative"])
|
|
if relative.is_absolute() or ".." in relative.parts or not str(relative).startswith("Data/data/"):
|
|
raise ValueError("Unsafe parent index path")
|
|
if not Path(row["backup"]).resolve().is_relative_to(ROOT):
|
|
raise ValueError("Parent index preimage escaped workspace")
|
|
pinned(row["backup"], row["backup_sha256"])
|
|
return indices
|
|
|
|
|
|
def overlay(source, target, backup, source_sha, preimage_sha):
|
|
pinned(source, source_sha)
|
|
pinned(target, preimage_sha)
|
|
base.copy_file(target, backup, cow=True)
|
|
pinned(backup, preimage_sha)
|
|
temporary = target.with_name(target.name + ".compat-new")
|
|
base.copy_file(source, temporary, cow=True)
|
|
pinned(temporary, source_sha)
|
|
os.replace(temporary, target)
|
|
pinned(target, source_sha)
|
|
|
|
|
|
def stage(output, indices, *, resume_sandbox_prefix_failure=False):
|
|
output = Path(output).absolute()
|
|
runtime = ROOT / "runtime"
|
|
if (output.exists() or output.is_symlink() or not output.parent.is_dir()
|
|
or output.parent.is_symlink() or output.parent.resolve() != runtime.resolve()
|
|
or not output.name.startswith("nohelper-compat-")):
|
|
raise ValueError("Fresh runtime/nohelper-compat-* output directory required")
|
|
work = output.with_name(output.name + ".partial")
|
|
if resume_sandbox_prefix_failure:
|
|
if work.is_symlink() or not work.is_dir():
|
|
raise ValueError("Exact preserved partial required for prefix resume")
|
|
elif work.exists() or work.is_symlink():
|
|
raise ValueError("Existing partial preserved")
|
|
pointer = ROOT / "runtime/current-clean-test-client"
|
|
pointer_before = os.readlink(pointer) if pointer.is_symlink() else None
|
|
client = work / "runtime/native-client"
|
|
if resume_sandbox_prefix_failure:
|
|
failure = work / "runtime/wine-prefix-init-failure.log"
|
|
prefix = work / "runtime/native-wine-prefix"
|
|
if (failure.is_symlink() or not failure.is_file()
|
|
or "wineserver: bind: Operation not permitted" not in failure.read_text(errors="replace")
|
|
or prefix.is_symlink() or not prefix.is_dir()):
|
|
raise ValueError("Preserved sandbox Wine initialization failure differs")
|
|
names = [*base.PRODUCT_FILES, *("_classic_beta_/" + name for name in base.GAME_FILES)]
|
|
for name in names:
|
|
base.owned_regular(client / name)
|
|
copied = dict.fromkeys(names)
|
|
trees = {"Data/" + name: None for name in base.DATA_TREES}
|
|
for name in base.GAME_TREES:
|
|
if (SOURCE / "runtime/native-client/_classic_beta_" / name).is_dir():
|
|
if not (client / "_classic_beta_" / name).is_dir():
|
|
raise ValueError("Preserved copied game tree differs")
|
|
trees["_classic_beta_/" + name] = None
|
|
for name in base.DATA_TREES:
|
|
if not (client / "Data" / name).is_dir():
|
|
raise ValueError("Preserved copied Data tree differs")
|
|
else:
|
|
work.mkdir(mode=0o700)
|
|
copied, trees = base.copy_client_subset(SOURCE / "runtime/native-client", client)
|
|
ui_addon = base.package_profession_icon_addon(ROOT, client, include_talents=True, discard_copied=True)
|
|
pinned(client / ".build.info", BUILD_INFO_SHA)
|
|
pinned(client / "_classic_beta_/WowB.exe", EXE_SHA)
|
|
pinned(client / "_classic_beta_/WowB_loader.dll", ORIGINAL_LOADER_SHA)
|
|
|
|
prefix = work / "runtime/native-wine-prefix"
|
|
if resume_sandbox_prefix_failure:
|
|
failed = output.with_name(output.name + ".sandbox-failed-prefix")
|
|
if failed.exists() or failed.is_symlink():
|
|
raise ValueError("Existing failed prefix preserved")
|
|
prefix.rename(failed)
|
|
failure.rename(failed / "initial-failure.log")
|
|
env = base.initialize_prefix(prefix)
|
|
system = prefix / "drive_c/windows/system32"
|
|
base.install_prefix_dlls(SOURCE, prefix, {
|
|
"GWNativeBridge.dll": ORIGINAL_BRIDGE_SHA,
|
|
"GWNativeWire.dll": SYSTEM_PIN["GWNativeWire.dll"],
|
|
}, env)
|
|
source_system = SOURCE / "runtime/native-wine-prefix/drive_c/windows/system32"
|
|
for name in ("version-hash.bin", "addon-tail.bin"):
|
|
base.copy_file(source_system / name, system / name)
|
|
pinned(system / name, SYSTEM_PIN[name])
|
|
for relative, digest in ELF_PIN.items():
|
|
base.copy_file(SOURCE / relative, work / relative, cow=True)
|
|
pinned(work / relative, digest)
|
|
|
|
backup_root = work / "rollback-preimages"
|
|
(backup_root / "binaries").mkdir(parents=True)
|
|
(backup_root / "graphics").mkdir(parents=True)
|
|
parent_indices = {}
|
|
for row in indices["rows"]:
|
|
relative = Path(row["relative"])
|
|
backup = backup_root / "parent-indices" / relative
|
|
base.copy_file(row["backup"], backup, cow=True)
|
|
pinned(backup, row["backup_sha256"])
|
|
parent_indices[str(relative)] = row["backup_sha256"]
|
|
|
|
overlay(BRIDGE, system / "GWNativeBridge.dll", backup_root / "binaries/GWNativeBridge.dll",
|
|
E9_BRIDGE_SHA, ORIGINAL_BRIDGE_SHA)
|
|
overlay(LOADER, client / "_classic_beta_/WowB_loader.dll",
|
|
backup_root / "binaries/WowB_loader.dll", V44_LOADER_SHA, ORIGINAL_LOADER_SHA)
|
|
|
|
# Graphics parity is the exact R12 DXVK pair, not the new Wine builtins.
|
|
graphics_preimages = {}
|
|
for name, row in GRAPHICS_PIN.items():
|
|
target = system / name
|
|
pinned(target, row["fresh_wine_preimage"])
|
|
overlay(DXVK / name, target, backup_root / "graphics" / name,
|
|
row["source"], row["fresh_wine_preimage"])
|
|
graphics_preimages[name] = row["fresh_wine_preimage"]
|
|
registry = (prefix / "user.reg").read_text(errors="replace").lower()
|
|
if '"d3d11"="native"' not in registry or '"dxgi"="native"' not in registry:
|
|
raise ValueError("Fresh prefix lacks native graphics overrides")
|
|
metadata = prefix / "gateway-private-prefix.json"
|
|
record = base.read_json(metadata)
|
|
record["native_dlls"].update({
|
|
"GWNativeBridge.dll": E9_BRIDGE_SHA,
|
|
"d3d11.dll": GRAPHICS_PIN["d3d11.dll"]["source"],
|
|
"dxgi.dll": GRAPHICS_PIN["dxgi.dll"]["source"],
|
|
})
|
|
base.write_json(metadata, record)
|
|
if (os.readlink(pointer) if pointer.is_symlink() else None) != pointer_before:
|
|
raise ValueError("Accepted client pointer changed during private stage")
|
|
|
|
manifest = {
|
|
"kind": "private-nohelper-e9-v44-direct-entry-compatibility-v1",
|
|
"status": "STAGED_OFFLINE_NOT_PUBLISHED",
|
|
"native_acceptance": "Exact earlier R12 tuple World+152.323s and separate fresh DXVK package World at launch+871.954s; this newly staged copy has not run",
|
|
"content_root": CLIENT_ROOT,
|
|
"ui_addon": ui_addon,
|
|
"client_copy": {"copied_files": len(copied), "copied_trees": list(trees), "independent_copy_on_write": True},
|
|
"changed_files": {"GWNativeBridge.dll": E9_BRIDGE_SHA, "WowB_loader.dll": V44_LOADER_SHA},
|
|
"preimages": {"GWNativeBridge.dll": ORIGINAL_BRIDGE_SHA, "WowB_loader.dll": ORIGINAL_LOADER_SHA, **graphics_preimages},
|
|
"graphics": {name: row["source"] for name, row in GRAPHICS_PIN.items()},
|
|
"inherited_siblings": {**SYSTEM_PIN, **{Path(k).name: v for k, v in ELF_PIN.items()}},
|
|
"selected_parent_index_preimages": parent_indices,
|
|
"index_baseline_names": sorted(p.name for p in (client / "Data/data").glob("*.idx")),
|
|
"derived_mapping_baseline": {relative: (client / relative).exists() for relative in
|
|
("Data/data/shmem", "Data/ecache/shmem", "Data/wow_classic_beta/shmem")},
|
|
"direct_entry": "WINEPREFIX=<this output>/runtime/native-wine-prefix wine <this output>/runtime/native-client/_classic_beta_/WowB.exe",
|
|
"external_loader_or_heartbeat_required": False,
|
|
"credentials_included": False,
|
|
"accepted_client_pointer_changed": False,
|
|
"rollback_order": "After exact process exit, restore all selected parent indices before deleting generated indices; quarantine Data/data/shmem; restore Bridge, loader and graphics from rollback-preimages; preserve journal.",
|
|
"held": ["V44 suppresses all first-error status stores", "long-run gameplay and reconnect", "fresh-copy gameplay policy", "Windows native backend/graphics acceptance"],
|
|
}
|
|
base.write_json(work / "nohelper-compat-package.private.json", manifest)
|
|
if output.exists() or output.is_symlink():
|
|
raise ValueError("Fresh output appeared during staging; preserve partial")
|
|
work.rename(output)
|
|
return manifest
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--check", action="store_true", help="Check pinned inputs without copying or launching")
|
|
parser.add_argument("--output", type=Path, help="Stage one fresh private runtime candidate")
|
|
parser.add_argument("--resume-sandbox-prefix-failure", action="store_true",
|
|
help="Complete an exact preserved copy after sandbox denied wineboot socket")
|
|
args = parser.parse_args()
|
|
if args.check == bool(args.output):
|
|
parser.error("Choose exactly one of --check or --output")
|
|
if args.check and args.resume_sandbox_prefix_failure:
|
|
parser.error("Prefix resume requires --output")
|
|
indices = source_admission()
|
|
if args.check:
|
|
print("PASS_PINNED_NOHELPER_E9_V44_DXVK_INPUTS")
|
|
return 0
|
|
stage(args.output, indices, resume_sandbox_prefix_failure=args.resume_sandbox_prefix_failure)
|
|
print("PASS_PRIVATE_NOHELPER_COMPAT_STAGED_NOT_PUBLISHED")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|