Skip to content

d3d12_xs: gta6rt refuses unconfirmed Xbox device slots past 43 instead of forwarding them to unrelated PC methods - #9285

Closed
seblessa wants to merge 1 commit into
ProjectLeonida:mainfrom
seblessa:d3d12-strict-slots-upstream
Closed

seblessa wants to merge 1 commit into
ProjectLeonida:mainfrom
seblessa:d3d12-strict-slots-upstream

Conversation

@seblessa

Copy link
Copy Markdown
Contributor

Claimed in #9235 (#9235 (comment)) as a new item. Only the strict-mode part of that claim is here: the guarded table and the slot-48 flags are already in #6953/#8252 and #6954/#8258.

Depends on: none. It complements #6973, #7066 and #7240 (see "How it fits with the open PRs").

What and why

The device proxy forwards every slot it neither handles nor routes to the PC method with the same index. The console device keeps the PC order through the base ID3D12Device chain (slots 3-43). Past that it diverges: 48, 62, 67, 73, 76 and 78-80 are console methods sitting at the indices of unrelated PC methods.

On the retail 1.0.2.1 boot, slot 70 was forwarded to the PC slot 70, ID3D12Device8::CreatePlacedResource1. That method took one of the title's argument words for its output pointer and wrote into the title's code. The result was silent corruption, not a stop with a name.

This PR adds set_strict_console_slots(bool) (d3d12_xs_device.h):

  • gta6rt turns it on before the image's code runs (--init, --run).
  • While it is on, the generic thunk refuses any slot past 43 that nothing above it handled or routed. The slot gets E_NOTIMPL and one log line with its first four words, and nothing reaches the PC device.
  • The thunk checks in this order: the explicit slot handlers, the Xbox routes (also when LEONIDA_XS_*_SLOT moves them), the existing beyond-the-PC-vtable refusal, then the new strict check, and only then the forward. Everything before the strict check is unchanged.
  • PC callers, the tests included, keep the forwarding unless they turn strict slots on.
  • LEONIDA_XS_FORWARD_UNCONFIRMED=1 keeps the forwarding in gta6rt too, for experiments.
  • docs/d3d12_vulkan.md §4.9 gets a row for it.

How it fits with the open PRs

The strict check runs only on the generic forward path, so it never changes a slot that a PR handles explicitly.

Measured vs assumed

The executable was only run under gta6rt, on one PC. Nothing here quotes game bytes or addresses.

Measured on the retail 1.0.2.1 boot, with local stand-ins for the earlier stops:

Assumed:

  • Every slot from 3 to 43 keeps its PC meaning on the console. Only the slots above were measured.
  • Past 43, a slot nobody has measured is not the PC method with the same index. Some may be; refusing is the conservative answer, and the environment switch restores the forwarding.
  • The title may still fail on E_NOTIMPL, but the log then names the slot, and the title's memory isn't corrupted.

Tested

Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4080 SUPER, driver 617.42, MSVC 14.44, CMake + Ninja, RelWithDebInfo, no SDL3:

  • Built gta6rt, xs_proxy_mock_test, device_proxy_test and d3d12_vulkan_device_test. There were no warnings in the changed files.
  • ctest -R "^(xs_proxy_mock.*|device_proxy.*|d3d12_vulkan_device)$": 9 of 10 passed.
    • New xs_proxy_mock_strict_slots, its own process because the switch is process-wide:
      • 44, 47 and 69 are refused without reaching the device;
      • 30 and 43 are still forwarded;
      • 48 (a route) and 75 (handled) are unchanged;
      • 77 is refused as past the vtable;
      • LEONIDA_XS_FORWARD_UNCONFIRMED=1 forwards, and a value other than 1 doesn't.
    • xs_proxy_mock_env_slots: with the routes moved, the moved route still answers and its default slot is refused.
    • d3d12_vulkan_device fails at line 6574 (tiles == 1). It fails the same way on upstream/main 867d922f0 built and run without this change, so it is unrelated.
  • On a local merge with d3d12_xs: Xbox device slot 70 is handled by the proxy (a null SRV for now, its raw words logged), not the PC CreatePlacedResource1 (retail boot chain stop 14) #7066, the xs_proxy_mock* tests passed 8 of 8.
  • python -I scripts/check_no_game_data.py on the changed files: clean.

AI-assisted: yes (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)

🤖 Generated with Claude Code

…forwarding them

The device proxy forwards every slot it neither handles nor routes to the
PC method of the same index. The console device keeps the PC order through
the base ID3D12Device chain (3-43) and diverges past it: 48, 62, 67, 73,
76 and 78-80 are console methods at the indices of unrelated PC methods.
Measured with the retail 1.0.2.1 executable on an RTX 4080 SUPER: device
slot 70, forwarded to the PC slot 70 (ID3D12Device8::CreatePlacedResource1),
took one of the title's words for its output pointer and wrote into the
title's code, a silent corruption instead of a stop.

set_strict_console_slots(true), which gta6rt calls before the image's code
runs (--init, --run), makes the generic thunk refuse such a slot with
E_NOTIMPL and one line with its first four words; nothing reaches the PC
device. Handled slots, the Xbox routes (also when moved by
LEONIDA_XS_*_SLOT), the base chain and the beyond-vtable refusal are
unchanged. PC callers and the tests keep the forwarding, and
LEONIDA_XS_FORWARD_UNCONFIRMED=1 keeps it in gta6rt for experiments.

xs_proxy_mock_test --strict-slots (its own ctest, xs_proxy_mock_strict_slots:
the switch is process-wide): 44, 47 and 69 refused without reaching the
device; 30 and 43 forwarded; 48 (route) and 75 (handled) unchanged; 77
refused as past the vtable; the override, and a value that is not "1".
--env-slots: with the routes moved, the moved route answers and its default
slot is refused. docs/d3d12_vulkan.md 4.9 gets a row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Grimkaaah Grimkaaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Linux CPU review

Checked: strict console slots — unconfirmed device slots past 43 refused with E_NOTIMPL under gta6rt (opt-out LEONIDA_XS_FORWARD_UNCONFIRMED=1); docs + xs_proxy_mock_strict_slots test. Windows/D3D12 harness not run here.

Looks correct from review; no game files.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo), PR head 3816be318 merged onto main (6312c057f):

  • python -I scripts/check_no_game_data.py ... (all 6 changed files): clean (exit 0).
  • cmake --build runtime/build --target xs_proxy_mock_test gta6rt --parallel: built cleanly.
  • ctest --test-dir runtime/build -R xs_proxy_mock --output-on-failure: 7/7 passed (including xs_proxy_mock_strict_slots).

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants