diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index f317958f12..435ccd091c 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -166,6 +166,7 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME) shims/registry.cpp shims/d3d12_xs.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_link_libraries(root_sig_test PRIVATE gta6rt_d3d12_xs_rootsig ${D3D12_LIBRARY}) target_compile_definitions(root_sig_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) @@ -190,6 +191,7 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME) shims/registry.cpp shims/d3d12_xs.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_link_libraries(device_proxy_test PRIVATE gta6rt_d3d12_xs_rootsig ${D3D12_LIBRARY} ${DXGI_LIBRARY}) target_compile_definitions(device_proxy_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) @@ -203,6 +205,7 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME) add_executable(xs_proxy_mock_test test/xs_proxy_mock_test.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_compile_definitions(xs_proxy_mock_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) target_compile_options(xs_proxy_mock_test PRIVATE /W4 /permissive- /utf-8 /EHsc) @@ -615,6 +618,7 @@ if(BUILD_TESTING) shims/xmem.cpp shims/d3d12_xs.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_include_directories(pe_loader_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src @@ -756,6 +760,7 @@ if(BUILD_TESTING) shims/xmem.cpp shims/d3d12_xs.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_include_directories(test_pe_loader_bounds PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src @@ -780,6 +785,7 @@ if(BUILD_TESTING) shims/xmem.cpp shims/d3d12_xs.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_include_directories(pe_loader_fuzz PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src @@ -1302,6 +1308,7 @@ if(LEONIDA_D3D12_SHIM_TESTS) shims/d3d12_xs.cpp shims/registry.cpp shims/d3d12_xs_device.cpp + shims/d3d12_console_heap_stub.cpp ) target_include_directories(d3d12_xs_root_signature_test PRIVATE shims) target_compile_definitions(d3d12_xs_root_signature_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) diff --git a/runtime/shims/acphal.cpp b/runtime/shims/acphal.cpp index 553f57f207..98ada97b0b 100644 --- a/runtime/shims/acphal.cpp +++ b/runtime/shims/acphal.cpp @@ -141,7 +141,7 @@ struct SHAPE_XMA_CONTEXT { uint32_t reserved1 : 6; uint32_t loopStartOffset : 26; uint32_t loopEndOffset : 6; - uint32_t reserved[10]; + uint32_t reserved[11]; }; static_assert(sizeof(SHAPE_XMA_CONTEXT) == 64, "SHAPE_XMA_CONTEXT is 64 bytes per GDK"); @@ -162,7 +162,7 @@ struct SHAPE_PCM_CONTEXT { uint32_t reserved6 : 15; uint32_t format : 2; uint32_t reserved7 : 14; - uint32_t reserved[1]; + uint32_t reserved[2]; }; static_assert(sizeof(SHAPE_PCM_CONTEXT) == 32, "SHAPE_PCM_CONTEXT is 32 bytes per GDK"); diff --git a/runtime/shims/d3d12_console_heap_stub.cpp b/runtime/shims/d3d12_console_heap_stub.cpp new file mode 100644 index 0000000000..d2b45381fe --- /dev/null +++ b/runtime/shims/d3d12_console_heap_stub.cpp @@ -0,0 +1,22 @@ +// The standalone proxy tests (root_sig_test, device_proxy_test, xs_proxy_mock_test) compile shims/d3d12_xs_device.cpp, +// whose Xbox slot-14 console path calls rt::d3d12::create_console_descriptor_heap. The real definition lives in +// d3d12_vulkan_device.cpp, which those tests do not link (it pulls in the Vulkan device). They never create a console +// descriptor heap, so this inert definition satisfies the reference. The runtime links the real one instead. +#include +#include + +#include + +namespace rt::d3d12 { +HRESULT create_console_descriptor_heap(ID3D12Device* device, const D3D12_DESCRIPTOR_HEAP_DESC* desc, + D3D12_GPU_VIRTUAL_ADDRESS console_address, std::uint64_t console_size, + REFIID riid, void** out) { + (void)device; + (void)desc; + (void)console_address; + (void)console_size; + (void)riid; + if (out) *out = nullptr; + return E_NOTIMPL; +} +} // namespace rt::d3d12 diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index a6911d0f4e..68c3dd888d 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp @@ -5499,6 +5499,7 @@ class Device final leonida::VulkanContext& context() { return *state_.context; } const leonida::BindlessSet* bindless() const { return state_.bindless.get(); } const DeviceState& state() const { return state_; } + DeviceState& state() { return state_; } IUnknown* holder() { return identity(); } bool bind_sampler(const leonida::gfx10::SamplerWords& words) { return state_.bind_sampler(words); } void own(const OwnedRuntime& owned) { owned_ = owned; } @@ -9999,7 +10000,7 @@ HRESULT create_console_descriptor_heap(ID3D12Device* device, const D3D12_DESCRIP if (!d) return E_INVALIDARG; auto* heap = new DescriptorHeap(d->state(), *desc, console_address, console_size); - heap->attach_device(d->identity()); + heap->attach_device(d->holder()); if (!heap->ok()) { heap->Release(); return E_OUTOFMEMORY; diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp index 187406e3d8..6f88585f90 100644 --- a/runtime/shims/d3d12_xs_device.cpp +++ b/runtime/shims/d3d12_xs_device.cpp @@ -41,6 +41,16 @@ #include #include +// Xbox slot 14's console CreateDescriptorHeap helper: defined in d3d12_vulkan_device.cpp and declared in +// d3d12_com.h. Declared here instead of including d3d12_com.h, because that header pulls in gfx10_descriptors.h and +// vulkan_backend.h, and this translation unit is also compiled by the standalone proxy tests, which do not carry the +// Vulkan include path. +namespace rt::d3d12 { +HRESULT create_console_descriptor_heap(ID3D12Device* device, const D3D12_DESCRIPTOR_HEAP_DESC* desc, + D3D12_GPU_VIRTUAL_ADDRESS console_address, std::uint64_t console_size, + REFIID riid, void** out); +} // namespace rt::d3d12 + namespace rt::d3d12_xs { namespace {