[PR #122] [CLOSED] runtime: fix MSVC build failures in acphal and console descriptor heap shims #174

Closed
opened 2026-11-26 20:17:02 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/122
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/9857


📝 Commits (1)

  • 58a4b58 runtime: fix MSVC build failures in acphal and console descriptor heap shims

📊 Changes

5 files changed (+45 additions, -17 deletions)

View changed files

📝 runtime/shims/acphal.cpp (+2 -2)
📝 runtime/shims/d3d12_vulkan_device.cpp (+3 -1)
📝 runtime/shims/d3d12_xs_device.cpp (+21 -7)
📝 runtime/shims/d3d12_xs_device.h (+8 -0)
📝 runtime/test/d3d12_console_descriptor_heap_test.cpp (+11 -7)

📄 Description

Carried over from old PR 9857 by liamhob in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9857, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
This branch conflicts with the current main and needs a rebase.
liamhob: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What and why

On \main\ (\2d53a8055), building the runtime on Windows with MSVC 19.44 fails in four files introduced by commits \ccd36246f\ and \3630610ca:

  1. **
    untime/shims/acphal.cpp**: \SHAPE_XMA_CONTEXT\ (60 bytes) and \SHAPE_PCM_CONTEXT\ (28 bytes) were each one \uint32_t\ short of their GDK \static_assert\ sizes (64 and 32 bytes). Updated
    eserved[10]\ ->
    eserved[11]\ and
    eserved[1]\ ->
    eserved[2].
  2. **
    untime/shims/d3d12_xs_device.h\ / \d3d12_xs_device.cpp**:
    • \proxy_create_descriptor_heap\ called
      t::d3d12::create_console_descriptor_heap\ directly without declaring it and broke linking in targets that compile \d3d12_xs_device.cpp\ without \gta6rt_d3d12_com\ (
      oot_sig_test, \device_proxy_test, \xs_proxy_mock_test, \pe_loader_test, etc.). Replaced with a registered \ConsoleDescriptorHeapHandler\ (\set_console_descriptor_heap_handler), matching the existing \PlacedAtVaHandler\ pattern.
    • Tightened the slot-14 console-extended desc check to require a plausible aligned canonical VA and matching non-zero heap byte size rather than any non-zero 64-bit word after the 16-byte struct—reading stack memory immediately after normal 16-byte PC \D3D12_DESCRIPTOR_HEAP_DESC\ structs was triggering false positives and causing 17+ D3D12 proxy tests to fail/segfault.
  3. **
    untime/shims/d3d12_vulkan_device.cpp**:
    • Registered \create_console_descriptor_heap\ in \Device::Device().
    • Added a non-const \DeviceState& state()\ overload and used \d->holder()\ instead of private \d->identity()\ in \create_console_descriptor_heap.
  4. **
    untime/test/d3d12_console_descriptor_heap_test.cpp**:
    • Added \operator->\ to \Ref, fixed \IID_PPV_ARGS\ + \AddRef()\ ownership when calling \create_device_proxy, and invoked Xbox heap proxy slot 9 via the Xbox-ABI RAX return convention.

Verification

  • Windows 11, MSVC 19.44, Ninja, Vulkan SDK 1.4.363.0, AMD Radeon RX 9070 XT (driver 26.10.1):
    • Full runtime build (\cmake --build runtime/build --parallel): 100% targets compile and link cleanly (exit 0).
    • ^Gcphal_test.exe: PASS (65/65 checks, 0 failures).
    • \d3d12_console_descriptor_heap_test.exe: PASS (\ok).
    • Full \ctest\ suite: 280/301 passed, 12 skipped, 0 segfaults (all 17 proxy-related regressions resolved).
    • \git diff --check\ and \python scripts/check_no_game_data.py: clean.
  • Synthetic tests only; no game files. AI-assisted.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/122 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/9857` --- ### 📝 Commits (1) - [`58a4b58`](https://github.com/ubiquitarianism/leonida/commit/58a4b58dd7a4be4ad5ed5347ebefd16e27b429ad) runtime: fix MSVC build failures in acphal and console descriptor heap shims ### 📊 Changes **5 files changed** (+45 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/acphal.cpp` (+2 -2) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+3 -1) 📝 `runtime/shims/d3d12_xs_device.cpp` (+21 -7) 📝 `runtime/shims/d3d12_xs_device.h` (+8 -0) 📝 `runtime/test/d3d12_console_descriptor_heap_test.cpp` (+11 -7) </details> ### 📄 Description > Carried over from **old PR 9857** by `liamhob` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9857`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > This branch conflicts with the current `main` and needs a rebase. > `liamhob`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ### What and why On \main\ (\2d53a8055\), building the runtime on Windows with MSVC 19.44 fails in four files introduced by commits \ccd36246f\ and \3630610ca\: 1. **\ untime/shims/acphal.cpp\**: \SHAPE_XMA_CONTEXT\ (60 bytes) and \SHAPE_PCM_CONTEXT\ (28 bytes) were each one \uint32_t\ short of their GDK \static_assert\ sizes (64 and 32 bytes). Updated \ eserved[10]\ -> \ eserved[11]\ and \ eserved[1]\ -> \ eserved[2]\. 2. **\ untime/shims/d3d12_xs_device.h\ / \d3d12_xs_device.cpp\**: - \proxy_create_descriptor_heap\ called \ t::d3d12::create_console_descriptor_heap\ directly without declaring it and broke linking in targets that compile \d3d12_xs_device.cpp\ without \gta6rt_d3d12_com\ (\ oot_sig_test\, \device_proxy_test\, \xs_proxy_mock_test\, \pe_loader_test\, etc.). Replaced with a registered \ConsoleDescriptorHeapHandler\ (\set_console_descriptor_heap_handler\), matching the existing \PlacedAtVaHandler\ pattern. - Tightened the slot-14 console-extended desc check to require a plausible aligned canonical VA and matching non-zero heap byte size rather than any non-zero 64-bit word after the 16-byte struct—reading stack memory immediately after normal 16-byte PC \D3D12_DESCRIPTOR_HEAP_DESC\ structs was triggering false positives and causing 17+ D3D12 proxy tests to fail/segfault. 3. **\ untime/shims/d3d12_vulkan_device.cpp\**: - Registered \create_console_descriptor_heap\ in \Device::Device()\. - Added a non-const \DeviceState& state()\ overload and used \d->holder()\ instead of private \d->identity()\ in \create_console_descriptor_heap\. 4. **\ untime/test/d3d12_console_descriptor_heap_test.cpp\**: - Added \operator->\ to \Ref<T>\, fixed \IID_PPV_ARGS\ + \AddRef()\ ownership when calling \create_device_proxy\, and invoked Xbox heap proxy slot 9 via the Xbox-ABI RAX return convention. ### Verification - Windows 11, MSVC 19.44, Ninja, Vulkan SDK 1.4.363.0, AMD Radeon RX 9070 XT (driver 26.10.1): - Full runtime build (\cmake --build runtime/build --parallel\): **100% targets compile and link cleanly** (exit 0). - \^Gcphal_test.exe\: **PASS** (65/65 checks, 0 failures). - \d3d12_console_descriptor_heap_test.exe\: **PASS** (\ok\). - Full \ctest\ suite: **280/301 passed**, 12 skipped, 0 segfaults (all 17 proxy-related regressions resolved). - \git diff --check\ and \python scripts/check_no_game_data.py\: clean. - Synthetic tests only; no game files. AI-assisted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:02 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#174
No description provided.