startup: let X2W_PROBE_PRECHECK=0 turn the probe pre-check off under a debugger #3313

Merged
lukaslw-lab merged 1 commit from upstream-pr/3313 into main 2026-11-28 08:35:52 +00:00
lukaslw-lab commented 2026-11-28 08:09:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-28T08:09:48Z.


Change

precheck_enabled() (src/startup_stubs/local_log.h) now reads X2W_PROBE_PRECHECK first: 0 turns the probe
pre-check from #2846 off, any other value turns it on, and only an unset variable falls back to IsDebuggerPresent().
Before, the variable could only turn it on, so title runs, which always start under debug_launch.py, paid a
VirtualQuery before every probe_readable and guarded copy with no way out. Unset behaviour is unchanged. The
docs/startup-runtime.md row says the same. Fixes #3312. Refs #2846.

Verification

Commit cdce92da on main 1f07b2c1, Windows 10 22H2 (build 19045), Visual Studio 2026 18.12 (MSVC 19.52), Windows
SDK 10.0.26100, CMake 4.3.1, Python 3.13.7.

ctest --preset dev --no-tests=error -j 1 -R '^(startup_local_log.*|startup_acphal_xma.*)$'
100% tests passed, 0 tests failed out of 8
ctest --preset release --no-tests=error -j 1 -R '^(startup_local_log.*|startup_acphal_xma.*)$'
100% tests passed, 0 tests failed out of 8

Startup run of the main executable (local, same host, RTX 3080 Ti, NVIDIA 32.0.16.1047): main fd7ce57a with this
change and X2W_PROBE_PRECHECK=0 gave 11.2 fps between 140 and 190 s, against 1.2 at #2846 and 14.5 at its parent
(numbers and bisect in #3312).

Evidence and follow-up

  • New startup_local_log_precheck_off_debugger (source-built, MIT): sets the PEB's BeingDebugged byte, which is what
    IsDebuggerPresent reads, then with X2W_PROBE_PRECHECK=0 requires a free range to be refused by the touch, with
    one first-chance fault and nothing counted in faults_avoided. No real debugger is attached, so the fault reaches
    the test's vectored handler.
  • Negative control: with the old condition the new test fails (no refusal is counted as an avoided fault,
    the free range is found by the touch, one first-chance fault each; 2 of 5), while the existing
    startup_local_log_precheck_off still passes.
  • Not changed: the default under a debugger. Turning it off there by default would also make sense for title runs.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5538186244 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3313). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-28T08:09:48Z. --- ## Change `precheck_enabled()` (`src/startup_stubs/local_log.h`) now reads `X2W_PROBE_PRECHECK` first: `0` turns the probe pre-check from #2846 off, any other value turns it on, and only an unset variable falls back to `IsDebuggerPresent()`. Before, the variable could only turn it on, so title runs, which always start under `debug_launch.py`, paid a `VirtualQuery` before every `probe_readable` and guarded copy with no way out. Unset behaviour is unchanged. The `docs/startup-runtime.md` row says the same. Fixes #3312. Refs #2846. ## Verification Commit `cdce92da` on `main` `1f07b2c1`, Windows 10 22H2 (build 19045), Visual Studio 2026 18.12 (MSVC 19.52), Windows SDK 10.0.26100, CMake 4.3.1, Python 3.13.7. ctest --preset dev --no-tests=error -j 1 -R '^(startup_local_log.*|startup_acphal_xma.*)$' 100% tests passed, 0 tests failed out of 8 ctest --preset release --no-tests=error -j 1 -R '^(startup_local_log.*|startup_acphal_xma.*)$' 100% tests passed, 0 tests failed out of 8 Startup run of the main executable (local, same host, RTX 3080 Ti, NVIDIA 32.0.16.1047): `main` `fd7ce57a` with this change and `X2W_PROBE_PRECHECK=0` gave 11.2 fps between 140 and 190 s, against 1.2 at #2846 and 14.5 at its parent (numbers and bisect in #3312). ## Evidence and follow-up - New `startup_local_log_precheck_off_debugger` (source-built, MIT): sets the PEB's `BeingDebugged` byte, which is what `IsDebuggerPresent` reads, then with `X2W_PROBE_PRECHECK=0` requires a free range to be refused by the touch, with one first-chance fault and nothing counted in `faults_avoided`. No real debugger is attached, so the fault reaches the test's vectored handler. - Negative control: with the old condition the new test fails (`no refusal is counted as an avoided fault`, `the free range is found by the touch, one first-chance fault each`; 2 of 5), while the existing `startup_local_log_precheck_off` still passes. - Not changed: the default under a debugger. Turning it off there by default would also make sense for title runs. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. _AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3313
No description provided.