Repository navigation
d3d12_xs: route the public HLE's Xbox device slots 48/73/78/79/80 - #6935
Conversation
6a3f371 to
9e4da12
Compare
The public HLE Freminet/ScarlettX puts CreateCommandQueueX at device slot 48, CreateCommandListX at 73, SetFrameIntervalX at 78, ScheduleFrameEventX at 79 and WaitFrameEventX at 80. The generic device thunk now answers those slots before it indexes the PC vtable, so a title that follows the public boot sequence no longer reaches CreateReservedResource2/CreateSampler2 (slots 78/79), falls past an 80-slot ID3D12Device11 table (slot 80), or reaches unrelated PC methods (48/73). Queue and list creation use the existing create paths. The command-list call takes the console shape (desc, allocator, initialState, riid, out): the type is the first word of the desc and there is no node mask. The three frame calls are a per-device token counter and return S_OK; WaitFrameEventX returns at once with a fresh non-zero token, because there is no vblank source behind the device before a presenter exists. The slot numbers are a third-party observation, not Microsoft documentation, so each route can be moved with LEONIDA_XS_QUEUE_X_SLOT, LEONIDA_XS_LIST_X_SLOT, LEONIDA_XS_FRAME_INTERVAL_SLOT, LEONIDA_XS_SCHEDULE_EVENT_SLOT and LEONIDA_XS_WAIT_EVENT_SLOT (3..127; anything else is logged once and ignored). Tests: xs_proxy_mock (mock device answering ID3D12Device11: the five slots reach the handlers, none reaches the mock's own PC slots, null arguments are refused, environment overrides move all five, out-of-range values are ignored) and device_proxy (WARP: the same five slots, including a command list and a queue proxy). 8/8 ctest targets pass: device_proxy, device_proxy_trace, xs_proxy_mock, xs_proxy_mock_no_reserve, xs_proxy_mock_no_protect, xs_proxy_mock_no_handler, xs_proxy_mock_env_slots, xs_proxy_mock_env_slots_invalid.
|
Independently tested |
9e4da12 to
49b2e79
Compare
|
Tested on the retail executable: two stops. Own 1.0.2.1 copy (exe sha256
After both, the next stop is the new list's console slots 131/132, which @tedin7's command-list order item covers. Details are in #6750 (comment). AI-assisted (Claude Code). |
|
Independent native Windows WARP check of 49b2e792. The focused This fixture checked the routing and return values using software D3D12. AI-assisted. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
runtime/shims/d3d12_xs_device.cpp installs XboxDeviceSlotRoutes that intercept device slots 48/73/78/79/80 before the PC vtable, via env_device_slot plus proxy_set_frame_interval_x, proxy_schedule_frame_event_x, proxy_wait_frame_event_x and proxy_create_command_list_x; env overrides and tests/docs are included.
Why merge
Restores Xbox-specific device calls that previously fell through to incompatible PC slots, with proxy outputs, hit counters and override coverage. Important for executable emulation fidelity.
Verdict: Approve
|
Summary Why merge Verdict: Approve |
|
Measured on the 1.0.2.1 executable (own copy, Windows 11, RTX 4070 SUPER, local
PC Next stop on the same routing, for information (I'm still checking it, not claiming it in this comment): slot 73 AI-assisted (Claude Code). |
Route the Xbox GraphicsCommandList6 request from ItsNotRexed#6935 through ItsNotRexed#2490's list factory. Query the host's GraphicsCommandList6 capability, preserve public PC list requests and count the Xbox call at the device slot that was actually invoked. The mock checks allocator unwrapping, COM identity, Close, capability refusal, a neighbouring unknown IID, and public PC-list compatibility. The retail IID was independently reported in ItsNotRexed#6935 (comment 7105882597) and ItsNotRexed#3918 (comment 7086980056). AI-assisted.
Route the Xbox GraphicsCommandList6 request from ItsNotRexed#6935 through ItsNotRexed#2490's list factory. Query the host's GraphicsCommandList6 capability, preserve public PC list requests and count the Xbox call at the device slot that was actually invoked. The mock checks allocator unwrapping, COM identity, Close, capability refusal, a neighbouring unknown IID, and public PC-list compatibility. The retail IID was independently reported in ItsNotRexed#6935 (comment 7105882597) and ItsNotRexed#3918 (comment 7086980056). AI-assisted.
|
Heads-up, @Kam471: since this merged, For reference, the retail title does call 78 and 79 with HRESULT-checked console arguments (78 AI-assisted (Claude Code). |
ItsNotRexed#6935 routes device slot 48 to CreateCommandQueueX and passes the title's description to the PC path unchanged. The retail executable creates its four compute queues there with console Flags 1, 2 and 3 (node mask 0) and 0 (node mask 1). 2 and 3 are no PC queue flag, so the Vulkan device refuses the second queue with E_INVALIDARG and the title asserts. CreateCommandQueueX now copies the description, drops Flags (each value logged once) and takes slot 8's path; a null description is refused before the PC device. xs_proxy_mock's mock keeps slot 8's description as received (the forwarded one is a local copy), and both it and device_proxy_test check the forwarded fields for console Flags 1, 2 and 3; device_proxy_test also signals a fence from each compute queue on WARP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in the coordination issue as: #6910 (comment)
Depends on: none
What and why
The public HLE
Freminet/ScarlettXrecords five Xbox device methods outside the PC vtable:CreateCommandQueueXat slot 48,CreateCommandListXat 73,SetFrameIntervalXat 78,ScheduleFrameEventXat 79 andWaitFrameEventXat 80 (a third-party observation, not Microsoft documentation). Today the proxy forwards those indices, so 78/79 reachCreateReservedResource2/CreateSampler2, 80 falls past an 80-slotID3D12Device11table, and 48/73 reach unrelated PC methods. A title that follows the public boot sequence stops there before it can create its first queue or list.This routes the five slots in the generic device thunk before it indexes the PC vtable:
CreateCommandQueueX(desc, riid, out)uses the existing queue-proxy path (the first fields of the Xbox desc areD3D12_COMMAND_QUEUE_DESC's).CreateCommandListX(desc, allocator, initialState, riid, out)calls PCCreateCommandList(0, type, allocator, initialState, riid, out): the type is the first word of the console desc, there is no node mask, and a Leonida allocator proxy is unwrapped first. The desc's second word is logged once, not interpreted, because its public layout is not established.SetFrameIntervalX/ScheduleFrameEventX/WaitFrameEventXanswerS_OKfrom a per-device token counter.WaitFrameEventXreturns at once with a fresh non-zero token andE_POINTERfor a null token pointer. There is no vblank source behind the device before a presenter exists, so these calls do not pace the title yet.Because the indices are an observation rather than an ABI, each can be moved without a code change:
LEONIDA_XS_QUEUE_X_SLOT,LEONIDA_XS_LIST_X_SLOT,LEONIDA_XS_FRAME_INTERVAL_SLOT,LEONIDA_XS_SCHEDULE_EVENT_SLOTandLEONIDA_XS_WAIT_EVENT_SLOT(3..127; an invalid value is logged once and ignored). The table is read once, on the first generic slot call.Not in this PR: queue-side
PresentX/SuspendX/ResumeXrouting. That is separate work (see #6230 and #2490), and the queue slots are not guessed here.docs/d3d12_vulkan.md§4.9 gains one row naming the five variables and the three caveats above.Tested
Windows 11 26200, MSVC 19.44.35228, Ninja, RelWithDebInfo.
xs_proxy_mock(mock device answeringID3D12Device11, 80 PC slots): all five slots reach their handlers; none reaches the mock's own PC slot 48/73/78/79/80; the queue and command list are the created objects;WaitFrameEventXreturns fresh non-zero tokens andE_POINTERfor null; a null desc/allocator isE_INVALIDARG;device_slot_overriddenreturns true for the configured indices.xs_proxy_mock --env-slots: all five routes move to 96-100 and the default 78 is then forwarded to the mock.xs_proxy_mock --env-slots-invalid: values outside 3..127 are ignored and the five defaults still answer.device_proxy(real PC device over WARP): slots 78/79/80 returnS_OKand fresh tokens, 48 returns a queue proxy, and 73 creates a command list through PCCreateCommandList.ctest -R "xs_proxy_mock|device_proxy": 8/8 passed (device_proxy,device_proxy_trace,xs_proxy_mock,_no_reserve,_no_protect,_no_handler,_env_slots,_env_slots_invalid).python -m pytest tests/test_docs_links.py tests/test_docs_table_rows.py tests/test_docs_table_ids.py tests/test_docs_list_items.py tests/test_docs_repo_paths.py tests/test_docs_pr_template.py tests/test_docs_design_rows.py tests/test_docs_env_vars.py tests/test_docs_cli_flags.py tests/test_docs_python_deps.py -q: 33 passed, 6 subtests passed.python -I tests/test_check_no_game_data.py: OK.python -I tests/test_d3d12_xs_surface.py: OK (SCARAB cross-check skipped withoutSCARAB_REF).python -I scripts/merge_check.py --main origin/main 0=HEAD: clean, 0/1 commit already on main.Limitations, recorded rather than hidden: the Xbox desc layouts beyond their first fields, the frame-token semantics and the
ScaleFilter/frame-statistics values are not measured; the frame calls do not pace; and the slots are the HLE's, so a trace that disagrees moves them with the variables above.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (No translator rule changed.)