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

Merged
FIocker merged 1 commit from upstream-pr/2390 into main 2026-11-30 14:12:03 +00:00
FIocker commented 2026-11-29 12:37:07 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by FIocker on 2026-11-29T12:37:07Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5550770850 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2390). Originally posted by [FIocker](https://github.com/FIocker) on 2026-11-29T12:37:07Z. --- `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)
Dukestar69 commented 2026-11-29 12:48:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-29T12:48:31Z.

Review: APPROVED


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6102939190 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2390#pullrequestreview-6102939190). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-29T12:48:31Z. **Review:** APPROVED --- 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).
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
trustno1-coder/VIctory-NVIDIA!2390
No description provided.