hle: the title's VirtualProtect forwards only the CPU protection; the GPU bits are noted either way #2390

Manually merged
github merged 1 commit from github-bot/gh-2390 into main 2026-11-30 14:16:07 +00:00 AGit
Owner

@⁠FIocker on GitHub · 2026-11-29 12:37 UTC · original
FIocker:contrib/virtual-protect-gpu-bits → main · +23 −6 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC

title_virtual_protect passed the console's protection value straight to Windows. With PAGE_GRAPHICS_* bits in it Windows refuses the call. note_gpu_protection only runs when the call succeeds (ok != 0), so a GPU protection changed after allocation was never noted, and the GPU-read-only clip could not act on it.

Now:

  • Windows gets protect & HOST_PROTECTION.
  • With GPU bits alone, the CPU protection is left as it is, and old reports the current protection via VirtualQuery.
  • The GPU part is noted in every case.

Checked: workspace check clean. The modules::xmem tests are as on main: a_read_by_range_waits_only_for_a_remapping_that_meets_it fails there too when the xmem module runs alone (a race with other tests' global remaps), with or without this change.

🤖 Generated with Claude Code

**@⁠FIocker** on GitHub · 2026-11-29 12:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2390) `FIocker:contrib/virtual-protect-gpu-bits` → `main` · +23 −6 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC `title_virtual_protect` passed the console's protection value straight to Windows. With `PAGE_GRAPHICS_*` bits in it Windows refuses the call. `note_gpu_protection` only runs when the call succeeds (`ok != 0`), so a GPU protection changed after allocation was never noted, and the GPU-read-only clip could not act on it. Now: - Windows gets `protect & HOST_PROTECTION`. - With GPU bits alone, the CPU protection is left as it is, and `old` reports the current protection via `VirtualQuery`. - The GPU part is noted in every case. Checked: workspace check clean. The `modules::xmem` tests are as on main: `a_read_by_range_waits_only_for_a_remapping_that_meets_it` fails there too when the xmem module runs alone (a race with other tests' global remaps), with or without this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title's own VirtualProtect passed the console value through. With
PAGE_GRAPHICS_* bits in it Windows refuses the call, so note_gpu_protection
(behind `ok != 0`) never saw a GPU protection changed after allocation and
the GPU-read-only clip could not act on it. Forward `protect &
HOST_PROTECTION`; with GPU bits alone, leave the CPU protection as it is
and report the old one; note the GPU part in every case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 12:38:11 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-29 12:48 UTC · original · approved these changes

Tested locally merged onto main (829188e9).

  • Merge: Clean merge in crates/victory-hle/src/modules/xmem.rs.
  • Tests: cargo test -p victory-hle --lib xmem -- --test-threads=1 passed (46 passed; 0 failed; 1 ignored, including gpu_protection_clears_ro_on_rw_or_plain_protect and gpu_protection_page_alignment) with 0 warnings in victory-hle.

Clean separation of CPU vs. GPU protection bits in VirtualProtect. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-29 12:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2390#pullrequestreview-6102939190) · **approved these changes** Tested locally merged onto `main` (`829188e9`). - **Merge**: Clean merge in `crates/victory-hle/src/modules/xmem.rs`. - **Tests**: `cargo test -p victory-hle --lib xmem -- --test-threads=1` passed (`46 passed; 0 failed; 1 ignored`, including `gpu_protection_clears_ro_on_rw_or_plain_protect` and `gpu_protection_page_alignment`) with 0 warnings in `victory-hle`. Clean separation of CPU vs. GPU protection bits in `VirtualProtect`. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github manually merged commit 3aebd85635 into main 2026-11-30 14:16:07 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2390
No description provided.