Retail game: XGTextureAddressComputer subresource layout, DSV format … #169

Closed
github-bot wants to merge 1 commit from gh-pr/169/head into gh-pr/169/base
Owner

@⁠sandhani01 on GitHub · 2026-11-23 18:38 UTC · original
sandhani01:fix/gta6-startup-fixes → main · +173 −7 · 4 files · 1 commits · closed without merging

…118 remap

  • hle/xg.rs: implement XGTextureAddressComputer::#10 and #11 (GetSubresourceLayout and GetSubresourceOffsetBytes) to resolve the null-write crash at +0x2215c35.

  • hle/d3d12x/real.rs: remap console DSV format 118 (D16_UNORM_S8_UINT) to format 45 (D24_UNORM_S8_UINT) with format 20 fallback, fixing 620 rejected PSOs.

  • hle/d3d12x/real.rs: disambiguate mesh pipeline stream AS/MS subobject fallback.

  • HANDOFF.md: document first-run analysis and fixes.

  • .github/workflows/ci.yml: add GitHub Actions CI workflow for Windows.

**@⁠sandhani01** on GitHub · 2026-11-23 18:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/169) `sandhani01:fix/gta6-startup-fixes` → `main` · +173 −7 · 4 files · 1 commits · closed without merging …118 remap - hle/xg.rs: implement XGTextureAddressComputer::#10 and #11 (GetSubresourceLayout and GetSubresourceOffsetBytes) to resolve the null-write crash at +0x2215c35. - hle/d3d12x/real.rs: remap console DSV format 118 (D16_UNORM_S8_UINT) to format 45 (D24_UNORM_S8_UINT) with format 20 fallback, fixing 620 rejected PSOs. - hle/d3d12x/real.rs: disambiguate mesh pipeline stream AS/MS subobject fallback. - HANDOFF.md: document first-run analysis and fixes. - .github/workflows/ci.yml: add GitHub Actions CI workflow for Windows.
- hle/xg.rs: implement XGTextureAddressComputer::#10 and #11 (GetSubresourceLayout and GetSubresourceOffsetBytes) to resolve the null-write crash at +0x2215c35.

- hle/d3d12x/real.rs: remap console DSV format 118 (D16_UNORM_S8_UINT) to format 45 (D24_UNORM_S8_UINT) with format 20 fallback, fixing 620 rejected PSOs.

- hle/d3d12x/real.rs: disambiguate mesh pipeline stream AS/MS subobject fallback.

- HANDOFF.md: document first-run analysis and fixes.

- .github/workflows/ci.yml: add GitHub Actions CI workflow for Windows.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:29 +00:00
github-bot closed this pull request 2026-11-26 04:13:30 +00:00
Author
Owner

@⁠TheFrenchPepeAI on GitHub · 2026-11-23 19:25 UTC · original

Tested on a third machine: #169 does clear the null-write.

RTX 4090, Windows 10 22H2 (19045), driver 32.0.16.2114, main@956a476 + #169, device_type = anaconda, title_memory = auto. The run presents its first frame, then dies at a different, later stop:

unhandled exception 0x80000003 in game_scarlett_master.exe+0x344196
stack: +0x71c1560, +0x71c27c0, +0x6a0a6, +0x51fbdb5, +0x4fac3d7, +0x4b95b

It happens while pixel-shader pipelines are being set up (the log's last lines are [SHADER] ps …), with an xcl-dstorage thread parked. Without #169 the same build dies earlier at +0x2215c35 (write at 0), so #169 moves the frontier on NVIDIA too.

device_type = "lockhart" with title_memory = "8192" dies before any present, at the old +0x2215c35; anaconda + auto is the working pair here.

Also: xcl shaders <shaders.rpf> --precompile --pipelines works as documented (26 503 programs, ~10/s on 31 threads).

**@⁠TheFrenchPepeAI** on GitHub · 2026-11-23 19:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/169#issuecomment-7111579104) Tested on a third machine: **#169 does clear the null-write.** RTX 4090, Windows 10 22H2 (19045), driver 32.0.16.2114, main@956a476 + #169, `device_type = anaconda`, `title_memory = auto`. The run presents its first frame, then dies at a different, later stop: ``` unhandled exception 0x80000003 in game_scarlett_master.exe+0x344196 stack: +0x71c1560, +0x71c27c0, +0x6a0a6, +0x51fbdb5, +0x4fac3d7, +0x4b95b ``` It happens while pixel-shader pipelines are being set up (the log's last lines are `[SHADER] ps …`), with an `xcl-dstorage` thread parked. Without #169 the same build dies earlier at `+0x2215c35` (write at 0), so #169 moves the frontier on NVIDIA too. `device_type = "lockhart"` with `title_memory = "8192"` dies before any present, at the old `+0x2215c35`; `anaconda` + auto is the working pair here. Also: `xcl shaders <shaders.rpf> --precompile --pipelines` works as documented (26 503 programs, ~10/s on 31 threads).
Author
Owner

@⁠TheFrenchPepeAI on GitHub · 2026-11-23 19:35 UTC · original

Isolation follow-up on the same machine (RTX 4090, Windows 10 22H2):

  • #169 alone → 0x80000003 at game_scarlett_master.exe+0x344196, while [SHADER] ps … lines are streaming (pixel pipelines being built), xcl-dstorage thread parked.
  • #169 + #163 + #170 → that int3 is gone, but the run now dies in vcruntime140.dll+0x1989 (write at 0x0, rdx = 0, a game vtable in rbx) immediately after D3D12.X: video-memory arena for title addresses 0x19844000000..0x1984c000000. It looks like a virtual call on a null object reached through the new arena path.
  • Dropping #168 does not change that (same vcruntime crash), so #168 is not involved.

Both runs present one frame first. Every build here is anaconda + title_memory = auto; lockhart + "8192" dies before any present at the old +0x2215c35.

**@⁠TheFrenchPepeAI** on GitHub · 2026-11-23 19:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/169#issuecomment-7111823563) Isolation follow-up on the same machine (RTX 4090, Windows 10 22H2): - **#169 alone** → `0x80000003` at `game_scarlett_master.exe+0x344196`, while `[SHADER] ps …` lines are streaming (pixel pipelines being built), `xcl-dstorage` thread parked. - **#169 + #163 + #170** → that int3 is gone, but the run now dies in `vcruntime140.dll+0x1989` (write at 0x0, `rdx = 0`, a game vtable in `rbx`) immediately after `D3D12.X: video-memory arena for title addresses 0x19844000000..0x1984c000000`. It looks like a virtual call on a null object reached through the new arena path. - Dropping **#168** does not change that (same vcruntime crash), so #168 is not involved. Both runs present one frame first. Every build here is `anaconda` + `title_memory = auto`; `lockhart` + `"8192"` dies before any present at the old `+0x2215c35`.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-23 20:40 UTC · original

A note on this PR's xg.rs part, from a CPU-only probe at 4283131 (synthetic textures, no console library). The full comparison with #192 and #195 is at https://github.com/ivall/xcl/pull/192#issuecomment-7113394778.

Slots 10 and 11 are answered as GetSubresourceLayout / GetSubresourceOffsetBytes, and the code picks a form by checking which arguments look like pointers. Called with GetResourceTiling's real arguments, legal calls go wrong, because the first four outputs are [out, optional]:

  • All six arguments given: returns E_INVALIDARG, because the "plane" is the low half of a pointer.
  • (NULL, NULL, &shape, &count, 0, tilings): returns S_OK, but writes a 0x70-byte XG_SUBRESOURCE_LAYOUT into the 12-byte D3D12_TILE_SHAPE, 100 bytes past it.
  • Only the tile count requested: returns S_OK and writes nothing.
  • Slot 11 called as #192's GetDescriptor(0, 32-byte buffer): writes 0x70 bytes, 80 past the buffer, and returns S_OK.

TheFrenchPepeAI's runs show that this PR gets past the null write at +0x2215c35. The probe can't tell which answer did that. If #192 on its own also gets past it, this PR's slots 10 and 11 could be dropped in favour of #192. The DSV-118 and mesh parts aren't affected. Could someone with the title try #192 alone?

AI-assisted (Claude Code).

**@⁠Kalmarv** on GitHub · 2026-11-23 20:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/169#issuecomment-7113395132) A note on this PR's `xg.rs` part, from a CPU-only probe at `4283131` (synthetic textures, no console library). The full comparison with #192 and #195 is at https://github.com/ivall/xcl/pull/192#issuecomment-7113394778. Slots 10 and 11 are answered as `GetSubresourceLayout` / `GetSubresourceOffsetBytes`, and the code picks a form by checking which arguments look like pointers. Called with `GetResourceTiling`'s real arguments, legal calls go wrong, because the first four outputs are `[out, optional]`: - **All six arguments given:** returns E_INVALIDARG, because the "plane" is the low half of a pointer. - **`(NULL, NULL, &shape, &count, 0, tilings)`:** returns S_OK, but writes a 0x70-byte `XG_SUBRESOURCE_LAYOUT` into the 12-byte `D3D12_TILE_SHAPE`, **100 bytes past it**. - **Only the tile count requested:** returns S_OK and writes nothing. - **Slot 11 called as #192's `GetDescriptor(0, 32-byte buffer)`:** writes 0x70 bytes, **80 past the buffer**, and returns S_OK. TheFrenchPepeAI's runs show that this PR gets past the null write at `+0x2215c35`. The probe can't tell which answer did that. If #192 on its own also gets past it, this PR's slots 10 and 11 could be dropped in favour of #192. The DSV-118 and mesh parts aren't affected. Could someone with the title try #192 alone? AI-assisted (Claude Code).
Author
Owner

@⁠ivall on GitHub · 2026-11-23 20:52 UTC · original

Closing: this is covered on main now. XG computer #10 is GetResourceTiling, checked against the console library (resource_tiling_matches_the_console_library, 8 960 cases, none differ). The D16S8 family (118-120) has the console's layouts and PC formats, and mesh streams with the MS in the AS slot are handled (38b05b7). The argument mismatch your probe found is what led there. Thanks!

**@⁠ivall** on GitHub · 2026-11-23 20:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/169#issuecomment-7113686871) Closing: this is covered on main now. XG computer #10 is GetResourceTiling, checked against the console library (`resource_tiling_matches_the_console_library`, 8 960 cases, none differ). The D16S8 family (118-120) has the console's layouts and PC formats, and mesh streams with the MS in the AS slot are handled (38b05b7). The argument mismatch your probe found is what led there. Thanks!
Author
Owner

@⁠TheFrenchPepeAI on GitHub · 2026-11-23 21:27 UTC · original

One more isolation result, same machine: main moved under #169. After af20b4b, xg.rs already carries get_resource_tiling in the vtable and the merge conflicts in that slot list.

With that conflict resolved either way — subresource slots after tiling (#10 tiling, #11/#12 subresource) or before it (#10/#11 subresource, #12 tiling) — the run is back to 0xc0000005 write at 0x0 at +0x2215c35 and never presents. On 956a476 (no get_resource_tiling in that table) the same #169 build presents a frame and stops later at +0x344196.

So on this machine the #169 fix does not survive the new vtable entry; whoever owns the slot numbering should reconcile it. Back on 956a476 + #169 here, which is the only build that presents.

**@⁠TheFrenchPepeAI** on GitHub · 2026-11-23 21:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/169#issuecomment-7114477734) One more isolation result, same machine: **main moved under #169.** After `af20b4b`, `xg.rs` already carries `get_resource_tiling` in the vtable and the merge conflicts in that slot list. With that conflict resolved either way — subresource slots after tiling (#10 tiling, #11/#12 subresource) **or** before it (#10/#11 subresource, #12 tiling) — the run is back to `0xc0000005` write at 0x0 at `+0x2215c35` and never presents. On `956a476` (no `get_resource_tiling` in that table) the same #169 build presents a frame and stops later at `+0x344196`. So on this machine the #169 fix does not survive the new vtable entry; whoever owns the slot numbering should reconcile it. Back on `956a476 + #169` here, which is the only build that presents.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.