Skip to content

xgameruntime: XSpeechSynthesizerEnumerateInstalledVoices takes (context, callback), as the retail executable calls it (RT-5) - #7262

Open
oVolkra wants to merge 1 commit into
ItsNotRexed:mainfrom
oVolkra:rt5-accessibility-measured
Open

oVolkra wants to merge 1 commit into
ItsNotRexed:mainfrom
oVolkra:rt5-accessibility-measured

Conversation

@oVolkra

@oVolkra oVolkra commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new RT-5 item, #7231 (comment)

Depends on: #7247 (it edits the lines next to this docs bullet in docs/runtime_imports.md; neither builds on the other, so only the second to land needs a rebase, and the shim and the test do not conflict)

What and why

Settles the two ASSUMPTION notes of the XAccessibilityImpl shim (#6810) with a static read of the retail 1.0.2.1 executable (nothing was run; call shapes and counts only, no addresses or bytes).

  • XSpeechSynthesizerEnumerateInstalledVoices (slot 8): the title's only call passes the context first and the callback second; the callback takes (voice entry, context) and returns true to go on, and the result is only tested for success. The shim and its test read the first argument as the callback. Nothing changed in behaviour for that call site (both pointers are non-null and no voice is installed, so the callback never runs), but the shim's E_INVALIDARG check looked at the wrong pointer. speech_enumerate_voices now takes (context, callback).
  • XHighContrastGetMode (5) and XClosedCaptionSetEnabled (4): the executable never calls them. Its XAccessibilityImpl class has 10 thunks, on slots 8-16 and 21 (9 referenced; 14 is not), none on slots 3-7. The notes now say so instead of marking the Off = 0 answer as an assumption.
  • docs/runtime_imports.md records what was measured and keeps ASSUMPTION only for the parameter lists of the other speech calls (10-13, 15, 16, 21), which are still known by argument count only. tools/exe_checklist.py goes from 15 to 13 notes.

No new behaviour: one parameter order, comments, a test and a doc paragraph.

Tested

Windows 11, MSVC 14.44 RelWithDebInfo, RTX 3060, driver 617.14 (no GPU test is involved), 8fd5d8fcc on main 8575d36ed:

  • xgameruntime_offline_test: 44 checks, 0 failures. The reworked case calls slot 8 as (context, callback) (S_OK), with a null context (S_OK), and with a null callback (E_INVALIDARG).
  • Negative control: the same test against main's xgameruntime_offline.cpp fails (44 checks, 1 failure, the EnumerateInstalledVoices case).
  • tests/test_exe_checklist.py, test_docs_table_rows.py, test_docs_repo_paths.py, test_docs_repeated_lines.py, test_docs_design_rows.py: OK.
  • tests/test_docs_links.py and tests/test_docs_cli_flags.py fail the same way on main (docs/dev-tools.md), with and without this change.
  • Static read with tools/gdk_runtime_calls.py and a read of the one call site of slots 8 and 9, on my own 1.0.2.1 copy (SHA-256 e95020b2…a08993).

Not covered: the argument shapes of slots 10-13, 15, 16 and 21 (counts only), and what the title does with the voice list afterwards.

AI-assisted: yes. Claude Code (Claude Sonnet 5.5) wrote and ran this; the numbers above are its unedited output.

Checklist

  • 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 rule)

🤖 Generated with Claude Code

…xt, callback), as the retail executable calls it (RT-5)

The retail executable's one call passes the context first and the callback second; the shim and its
test read them the other way round. The executable never calls XHighContrastGetMode or
XClosedCaptionSetEnabled, so the ASSUMPTION notes on them and on the argument order now say what
was measured (static read, nothing run).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sneylol

sneylol commented Nov 23, 2026

Copy link
Copy Markdown

Independent check against the retail executable (own 1.0.2.1 copy, exe 120,181,760 bytes): the call shape is confirmed. tools/gdk_runtime_calls.py finds one thunk for XAccessibilityImpl slot 8 (XSpeechSynthesizerEnumerateInstalledVoices), and the executable has exactly one call site that reaches it. There, rcx is a pointer into the caller's object (this + 0x90; the word before it is zeroed first), rdx is the address of a function in the image (the callback), and r8/r9 are not set in that function. After the call the result is tested as an HRESULT (test eax, eax; setns al). So (context, callback) with an HRESULT return is what the title passes, as this PR has it. Static check only: I read the call site with llvm-objdump, and didn't build or run this branch. Register roles only, no bytes. AI-assisted (Claude Code).

@cdomergue

Copy link
Copy Markdown

Tested 8fd5d8fccc1f6db4ac239d51402f7593fc349cfe on native Windows 11 x64 with MSVC 19.44, Release. The voice enumeration change passes an independent check against the retail 1.0.2.1 executable.

  • In a static read of the caller, the first argument points into the caller's data object and the second points to a function. The caller tests the sign of the returned status. This agrees with the proposed context/callback order for slot 8.
  • The accessibility interface has ten thunks. Nine are referenced. Slot 14 is the unreferenced one, and there are no thunks for slots 3–7 in that interface.
  • The PR’s xgameruntime_offline_test passed all 44 checks. As a negative control I kept the same test and rebuilt it with only the shim implementation from the parent commit. Exactly one check failed, for the voice enumeration callback requirement.

Static inspection and synthetic tests only. No game code or GPU workload ran. AI-assisted verification.

@McNartin

Copy link
Copy Markdown

Tested 8fd5d8f (on main 8575d36) on Windows 11, MSVC 2022 (VS 17, Ninja) RelWithDebInfo, RTX 5070 Ti (no GPU test involved): pass.

  • xgameruntime_offline_test at this head: 44 checks, 0 failures; the slot 8 case passes as (context, callback).
  • Negative control: the same test built against main's runtime/shims/xgameruntime_offline.cpp (8575d36): 44 checks, 1 failure, the XSpeechSynthesizerEnumerateInstalledVoices(context, callback) case. Same result as the description's.

Not re-checked: the static read of the executable (sneylol's comment above covers the call shape), the docs tests and tools/exe_checklist.py.

AI-assisted (Claude Code).

@crastinator

Copy link
Copy Markdown
Contributor

Tested 8fd5d8fcc merged onto main 042c5f37 (clean merge) under Wine on Linux: pass.

Windows build cross-compiled with clang-cl 23.1.5 + xwin (SDK 10.0.26100) on CachyOS (Linux 7.3.5), run under Wine 11.22 (ctest). No GPU involved.

xgameruntime_offline
main 042c5f37 pass
main + this PR pass (44 checks, 0 failures)
this PR's test against main's xgameruntime_offline.cpp (negative control) 44 checks, 1 failure: XSpeechSynthesizerEnumerateInstalledVoices(context, callback)

The slot counts in the description match a static tools/gdk_runtime_calls.py scan of a 1.0.2.1 game_scarlett_master.exe (120,181,760 bytes; nothing executed): XAccessibilityImpl has 10 thunks on slots 8-16 and 21, 9 of them referenced (all except 14), and none on slots 3-7. tools/exe_checklist.py --gdk-calls on main still lists xgameruntime_offline.cpp:538 and :550 as called, which this PR settles. Not checked: the context-first argument order itself (I didn't read the call site).

AI-assisted (Claude Code).

@MaxtorCoder

Copy link
Copy Markdown

Checked 8fd5d8fcc against my own retail 1.0.2.1 copy, static read in IDA (nothing run), Windows 11: the executable's one caller of the slot-8 thunk passes a data pointer as the first argument and a function address as the second, and the xgameruntime.lib thunk forwards them to slot 8 in that order after the interface pointer. That matches this PR's (context, callback). The caller only tests the HRESULT for success, as the PR says. Code read of the shim and test change: pass. I didn't build or run the test.

AI-assisted.

@eizispark

eizispark commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 8fd5d8f (merged cleanly with main edc722c) on AMD Radeon RX 9070 XT, Adrenalin 26.11.1 (LLPC / Vulkan 1.4.359), Windows 11: pass (ctest ^xgameruntime 8/8 passed including xgameruntime_offline_test 44/44 checks, xgameruntime_offline_hdr, xgameruntime, xgameruntime_user, xgameruntime_user_gamertag, xgameruntime_user_gamertag_long, xgameruntime_gamesave, xgameruntime_store; tests/test_exe_checklist.py 11/11 passed; scripts/check_no_game_data.py passed; gta6rt --dry-run exit 0). AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants