[PR #1050] runtime: replay the console list's inline records as their vtable calls (BL-3) #1087

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1050
Author: @baldyb4242
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: bl3/console-slot-drop-check


📝 Commits (1)

  • 675c3fb runtime: replay the console list's inline records as their vtable calls (BL-3)

📊 Changes

4 files changed (+490 additions, -0 deletions)

View changed files

📝 docs/boot_leads.md (+5 -0)
📝 runtime/CMakeLists.txt (+4 -0)
➕ runtime/src/console_list_records.h (+183 -0)
➕ runtime/test/console_list_records_test.cpp (+298 -0)

📄 Description

Claimed in the coordination issue as: BL-3 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138403816)

What and why

A console DLL writes a command into the list object itself while the list has room, instead of calling the vtable (docs/d3d12_command_objects.md §3.5a). The list proxy avoids this today by keeping the cursor at its limit, so every command goes through the vtable. An inline write the title makes without checking the cursor first would be lost.

This adds the decoder half of BL-3:

  • runtime/src/console_list_records.h decodes the measured inline records into the vtable calls they replace:

    Record Fallback slot
    0x4002C400 dispatch 14
    0x4003CC00 dispatch with an extra word 80
    one root constant 37
    several root constants 39
    descriptor table 35
    root CBV / SRV / UAV 41 / 43 / 45
    pipeline record 25
  • The root-argument header is the list's table entry at +0x344, which the runtime fills. The header defines an encoding for it that keeps bits 30–31 clear (the DLL writes inline only then) and leaves room for the DLL's measured + 4*offset and + ((n-1) << 16) adjustments.

  • An unknown or truncated record stops decoding and reports its offset. It is never skipped.

  • docs/boot_leads.md: a status line for BL-3.

Not in this PR (draft for that reason):

  • Wiring the decoder into runtime/shims/d3d12_xs_device.cpp: replay pending records before each vtable call and at Close.
  • The bytes our PSOs expose as the 28-byte pipeline record. The decoder takes a resolver for now.
  • Widening the 32-bit descriptor-table address (BL-4).

Slot 80 → Dispatch on the vtable path is #687's change and is not duplicated here.

Tested

  • console_list_records_test (new) models the DLL independently from §3.5a. It runs 1,200 seeded sequences at six cursor limits (0 to 4,096 bytes), and the inline path and the all-vtable path give the same call stream (13,190 commands written inline and replayed). It also has one case per measured form and 11 refusal cases.
  • Eight planted decoder bugs (slot swap, dropped VA high half, offset and count arithmetic, field masks, skipping unknown records, the combined-adjustment check) each make the test fail.
  • Portable ctest on macOS (AppleClang 21, Apple Silicon): 75/75 passed, 2 skipped (shader_library_corpus and vk_sync_validation need game files). Before the change: 72/72.
  • Builds clean with -Wall -Wextra -Wpedantic -Werror.
  • check_no_game_data.py passes on the changed files.
  • Not built with MSVC or run under Wine: this change touches no Windows-only code.

GPUs tested: n/a (CPU-only test)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 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/1050 **Author:** [@baldyb4242](https://github.com/baldyb4242) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `bl3/console-slot-drop-check` --- ### 📝 Commits (1) - [`675c3fb`](https://github.com/ubiquitarianism/leonida/commit/675c3fb1b9bc5a25627a2de9025fbd1a355dbd2b) runtime: replay the console list's inline records as their vtable calls (BL-3) ### 📊 Changes **4 files changed** (+490 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/boot_leads.md` (+5 -0) 📝 `runtime/CMakeLists.txt` (+4 -0) ➕ `runtime/src/console_list_records.h` (+183 -0) ➕ `runtime/test/console_list_records_test.cpp` (+298 -0) </details> ### 📄 Description Claimed in the coordination issue as: BL-3 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138403816) ### What and why A console DLL writes a command into the list object itself while the list has room, instead of calling the vtable (`docs/d3d12_command_objects.md` §3.5a). The list proxy avoids this today by keeping the cursor at its limit, so every command goes through the vtable. An inline write the title makes without checking the cursor first would be lost. This adds the decoder half of BL-3: - `runtime/src/console_list_records.h` decodes the measured inline records into the vtable calls they replace: | Record | Fallback slot | |---|---| | `0x4002C400` dispatch | 14 | | `0x4003CC00` dispatch with an extra word | 80 | | one root constant | 37 | | several root constants | 39 | | descriptor table | 35 | | root CBV / SRV / UAV | 41 / 43 / 45 | | pipeline record | 25 | - The root-argument header is the list's table entry at `+0x344`, which the runtime fills. The header defines an encoding for it that keeps bits 30–31 clear (the DLL writes inline only then) and leaves room for the DLL's measured `+ 4*offset` and `+ ((n-1) << 16)` adjustments. - An unknown or truncated record stops decoding and reports its offset. It is never skipped. - `docs/boot_leads.md`: a status line for BL-3. Not in this PR (draft for that reason): - Wiring the decoder into `runtime/shims/d3d12_xs_device.cpp`: replay pending records before each vtable call and at Close. - The bytes our PSOs expose as the 28-byte pipeline record. The decoder takes a resolver for now. - Widening the 32-bit descriptor-table address (BL-4). Slot 80 → `Dispatch` on the vtable path is #687's change and is not duplicated here. ### Tested - `console_list_records_test` (new) models the DLL independently from §3.5a. It runs 1,200 seeded sequences at six cursor limits (0 to 4,096 bytes), and the inline path and the all-vtable path give the same call stream (13,190 commands written inline and replayed). It also has one case per measured form and 11 refusal cases. - Eight planted decoder bugs (slot swap, dropped VA high half, offset and count arithmetic, field masks, skipping unknown records, the combined-adjustment check) each make the test fail. - Portable `ctest` on macOS (AppleClang 21, Apple Silicon): 75/75 passed, 2 skipped (`shader_library_corpus` and `vk_sync_validation` need game files). Before the change: 72/72. - Builds clean with `-Wall -Wextra -Wpedantic -Werror`. - `check_no_game_data.py` passes on the changed files. - Not built with MSVC or run under Wine: this change touches no Windows-only code. GPUs tested: n/a (CPU-only test) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1087
No description provided.