From 682a6034bd672671929e61aa7358f9b5412f42cd Mon Sep 17 00:00:00 2001 From: louisdibiasi <59670693+louisdibiasi@users.noreply.github.com> Date: Thu, 26 Nov 2026 10:09:12 -0500 Subject: [PATCH] startup: read the literal data directory manifest --- tests/startup_run_ps1_check.py | 22 +++++++++++++++++----- tools/startup/run.ps1 | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/startup_run_ps1_check.py b/tests/startup_run_ps1_check.py index 2f90f43b49..e4f5c42205 100644 --- a/tests/startup_run_ps1_check.py +++ b/tests/startup_run_ps1_check.py @@ -31,7 +31,7 @@ import time from pathlib import Path -record = [sys.argv[1:], os.environ.get("X2W_TRACE_API")] +record = [sys.argv[1:], os.environ.get("X2W_TRACE_API"), os.environ.get("X2W_TITLE_ID"), os.environ.get("X2W_STORAGE_MB")] Path(__file__).with_name("debugger.json").write_text(json.dumps(record), encoding="utf-8") # Under -Translate, wait until the watcher stub has started so run.ps1 cannot stop it before then. watch = Path(__file__).with_name("watch.json") @@ -136,7 +136,7 @@ def alive(pid): def run_case(shell, script, code, work, translate=False, switches=(), passed=(), fake_user_env=False, - early_exit=False, trace_api_env=None, absolute_build=False, missing_build=False): + early_exit=False, trace_api_env=None, absolute_build=False, missing_build=False, manifest="absent"): """Run one copy of the script on a stub that exits with `code`; return what is wrong. `switches` are extra run.ps1 switches and `passed` the debugger arguments they must add. @@ -154,11 +154,19 @@ def run_case(shell, script, code, work, translate=False, switches=(), passed=(), build.mkdir() for dll in DLLS: # the stand-ins the script copies next to the executable (build / f"{dll}.dll").write_bytes(b"") - exe, data, log = root / "run" / "t.exe", root / "data", root / "log" + exe, data, log = root / "run" / "t.exe", root / ("data [test]" if manifest.startswith("bracket") else "data"), root / "log" exe.parent.mkdir() exe.write_bytes(b"") data.mkdir() + if manifest in ("normal", "bracket"): + (data / "MicrosoftGame.config").write_text("123442", encoding="utf-8") + if manifest.startswith("bracket"): + decoy = root / "data t" + decoy.mkdir() + (decoy / "MicrosoftGame.config").write_text("999999", encoding="utf-8") env = dict(os.environ) + env.pop("X2W_TITLE_ID", None) + env.pop("X2W_STORAGE_MB", None) # Compare PowerShell's warning text consistently on hosts that enable ANSI colors. env["NO_COLOR"] = "1" env.pop("X2W_FAKE_USER", None) @@ -215,9 +223,11 @@ def run_case(shell, script, code, work, translate=False, switches=(), passed=(), "--trace-files", "1", "--continue-asserts", "4", *passed] record = startup / "debugger.json" got = json.loads(record.read_text(encoding="utf-8")) if record.is_file() else None - expected = [want, "1" if "-TraceApi" in switches else trace_api_env] + expected = [want, "1" if "-TraceApi" in switches else trace_api_env, + "1234" if manifest in ("normal", "bracket") else None, + "42" if manifest in ("normal", "bracket") else None] if got != expected: - found.append(f"stub exit {code}: debugger [argv, X2W_TRACE_API] was {got}, expected {expected}") + found.append(f"stub exit {code}: debugger [argv, trace, title ID, storage MB] was {got}, expected {expected}") watch = startup / "watch.json" if translate: started = json.loads(watch.read_text(encoding="utf-8")) if watch.is_file() else None @@ -242,6 +252,8 @@ def run_problems(shell, script, work, first_only): if found and first_only: return found found += run_case(shell, script, 7, work, absolute_build=True) + for manifest in ("normal", "bracket", "bracket_missing"): + found += run_case(shell, script, 0, work, manifest=manifest) if found and first_only: return found found += run_case(shell, script, 0, work, switches=["-FakeUser"]) diff --git a/tools/startup/run.ps1 b/tools/startup/run.ps1 index e9fceffffb..5dbb5e7fa6 100644 --- a/tools/startup/run.ps1 +++ b/tools/startup/run.ps1 @@ -42,8 +42,8 @@ foreach ($dll in "xmem", "d3d12_xs", "AcpHal", "XCRDAPI", "chad", "xapu", "xg_xs $env:X2W_AUDIO_PERMISSIVE = "1"; $env:X2W_D3D12_DEVICE_NOOP = "1"; $env:X2W_D3D12_LIST_NOOP = "1" $env:X2W_D3D12_PERMISSIVE = "1"; $env:X2W_XMEM_PERMISSIVE = "1"; $env:X2W_RUNTIME_PROXY = "1" $config = Join-Path $DataDir "MicrosoftGame.config" -if (Test-Path $config) { - $text = Get-Content $config -Raw +if (Test-Path -LiteralPath $config) { + $text = Get-Content -LiteralPath $config -Raw if ($text -match "([^<]*)") { $env:X2W_TITLE_ID = $Matches[1] } if ($text -match "([^<]*)") { $env:X2W_STORAGE_MB = $Matches[1] } }