From 695e2f3a3ba99817cb4ebf61655ee30ee4c946cd Mon Sep 17 00:00:00 2001 From: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com> Date: Sat, 14 Nov 2026 03:10:34 -0500 Subject: [PATCH 1/2] Tools: the in-game run script and the offline create preflight, config-driven tools/ingame: one in-game run of a candidate build with evidence and a byte-for-byte restore (run.py), as used for Model L in two games (#89). Every path comes from a game config (examples/*.json, placeholders only) or from arguments; nothing is specific to one PC. - run.py: preflight, prepare (manifest, backups, aside / hash-only files, the launcher's update, the model choice in runtime_options and OptiScaler's UpscalerIndex, the model in the game's data folder, settings), launch (the GPU flag per game run, released by game_hold.py in finally), hold, shot, collect (our logs only, proof.json, launch trace counts), restore (verified against the manifest), all --dry-run. - offline_create.py: the harness create test of Model L on D3D12 before any game run, and the L / M synthetic timing; an optional GPU-slot wrapper after "--". - make_record.py: the timing record from the runtime's own timing lines, scenes from a JSON file. - settings_edit.py: graphics settings backup / stage / restore (ini and Cyberpunk 2077's UserSettings.json). - The helpers: game_manifest, game_backup, game_restore, game_hold, aside, check_record, set_upscaler_index, vram_log. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com> --- tools/ingame/README.md | 101 ++++ tools/ingame/aside.py | 88 ++++ tools/ingame/check_record.py | 47 ++ tools/ingame/examples/cyberpunk2077.json | 22 + tools/ingame/examples/re9.json | 22 + tools/ingame/game_backup.py | 57 ++ tools/ingame/game_hold.py | 73 +++ tools/ingame/game_manifest.py | 89 ++++ tools/ingame/game_restore.py | 53 ++ tools/ingame/make_record.py | 119 +++++ tools/ingame/offline_create.py | 217 ++++++++ tools/ingame/run.py | 633 +++++++++++++++++++++++ tools/ingame/set_upscaler_index.py | 25 + tools/ingame/settings_edit.py | 100 ++++ tools/ingame/vram_log.py | 60 +++ 15 files changed, 1706 insertions(+) create mode 100644 tools/ingame/README.md create mode 100644 tools/ingame/aside.py create mode 100644 tools/ingame/check_record.py create mode 100644 tools/ingame/examples/cyberpunk2077.json create mode 100644 tools/ingame/examples/re9.json create mode 100644 tools/ingame/game_backup.py create mode 100644 tools/ingame/game_hold.py create mode 100644 tools/ingame/game_manifest.py create mode 100644 tools/ingame/game_restore.py create mode 100644 tools/ingame/make_record.py create mode 100644 tools/ingame/offline_create.py create mode 100644 tools/ingame/run.py create mode 100644 tools/ingame/set_upscaler_index.py create mode 100644 tools/ingame/settings_edit.py create mode 100644 tools/ingame/vram_log.py diff --git a/tools/ingame/README.md b/tools/ingame/README.md new file mode 100644 index 00000000..33321aa1 --- /dev/null +++ b/tools/ingame/README.md @@ -0,0 +1,101 @@ +# In-game run tools + +One in-game run of a WrongGPU candidate build, with evidence and a byte-for-byte restore. Used for Model L in +Cyberpunk 2077 and Resident Evil Requiem (#89). Windows only, Python 3, no GPU work of their own except +`offline_create.py`. + +Nothing in these tools is specific to one PC. Every path comes from a game config (`run.py --config`) or from +arguments (`offline_create.py`, `make_record.py`). + +## Before a game: the offline create test + +``` +python offline_create.py build --work +python offline_create.py create --work --runtime-dir --model --model-sha [-- ] +``` + +`create` runs the interop harness once: +- `model=L` and `executor=dx12`; +- 600 frames, 1280x720 to 1920x1080, with a launch trace. + +It passes only if all of these hold: +- the runtime ran on D3D12; +- the timing windows came back; +- Model L kernels appear in the trace. + +Run it before every game run with a new build. + +`timing` measures Model L against Model M on six shapes, interleaved, and writes `l-timing-harness.json`. + +Everything after a lone `--` wraps each GPU run, for example a GPU-slot tool. + +## The game run + +1. Copy `examples/.json` and fill in every ``: + - `game_root`, `exe_dir`, `exe`, `launchers`; + - `out`: an empty folder for this run; + - `launcher_package` and `payload`: from `build.py --model-l`; + - `model`: the file and its SHA-256; + - `aside`: files moved out of the game for the run, then moved back. Never opened, only hashed and renamed; + - `hash_only`: files hashed before and after but never touched, for example a script loader the game needs; + - `settings`: the file, its format (`ini` or `cp2077`) and the keys to set; + - `gpu_flag`: the GPU flag file; + - `disk_free_gb`: minimum free space per drive. + + `%VARIABLES%` are expanded. `exe_dir` is relative to `game_root`. + +2. Run the phases: + +``` +python run.py --config my.json all --dry-run every phase, nothing changed +python run.py --config my.json preflight +python run.py --config my.json prepare +python run.py --config my.json launch then start the game in its launcher +python run.py --config my.json hold +python run.py --config my.json shot