HLE: implement remaining XAccessibility closed-caption, high-contrast, and speech-to-text slots #2076

Open
github-bot wants to merge 1 commit from github-bot/gh-2076 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 04:23 UTC · original
fuzeofficlal:feat/hle-xaccessibility-slots-865 → main · +274 −25 · 1 files · 1 commits · open

Closes #865.

Summary

  • Closed captions (0x18, 0x20): implement XClosedCaptionGetProperties (ClosedCaptionProperties matching the 28-byte GDK layout, returning HRESULT_FROM_WIN32(ERROR_NOT_FOUND) while captions are disabled and S_OK once enabled via XClosedCaptionSetEnabled).
  • High contrast (0x28): implement XHighContrastGetMode reporting XHighContrastMode::Off (0).
  • Speech-to-text (0x30, 0x38, 0x88, 0x90, 0x98, 0xa0): wire position hints, string submission, and monotonic non-zero hypothesis IDs across begin/update/finalize/cancel.

Testing

  • Added unit tests in crates/victory-hle/src/modules/speech.rs covering ClosedCaptionProperties field offsets/layout, disabled -> enabled -> disabled state transitions, null out-pointer checks, high-contrast mode, and all speech-to-text slots.
  • cargo test -p victory-hle --locked, cargo clippy --workspace --all-targets --all-features -- -D warnings, and cargo xtask policy.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2076) `fuzeofficlal:feat/hle-xaccessibility-slots-865` → `main` · +274 −25 · 1 files · 1 commits · open Closes #865. ### Summary - **Closed captions (`0x18`, `0x20`)**: implement `XClosedCaptionGetProperties` (`ClosedCaptionProperties` matching the 28-byte GDK layout, returning `HRESULT_FROM_WIN32(ERROR_NOT_FOUND)` while captions are disabled and `S_OK` once enabled via `XClosedCaptionSetEnabled`). - **High contrast (`0x28`)**: implement `XHighContrastGetMode` reporting `XHighContrastMode::Off` (`0`). - **Speech-to-text (`0x30`, `0x38`, `0x88`, `0x90`, `0x98`, `0xa0`)**: wire position hints, string submission, and monotonic non-zero hypothesis IDs across begin/update/finalize/cancel. ### Testing - Added unit tests in `crates/victory-hle/src/modules/speech.rs` covering `ClosedCaptionProperties` field offsets/layout, disabled -> enabled -> disabled state transitions, null out-pointer checks, high-contrast mode, and all speech-to-text slots. - `cargo test -p victory-hle --locked`, `cargo clippy --workspace --all-targets --all-features -- -D warnings`, and `cargo xtask policy`.
Wire XAccessibility vtable slots 0x18, 0x20, 0x28, 0x30, 0x38, 0x88, 0x90, 0x98, and 0xa0 in speech.rs against the public API reference:
- 0x18 (XClosedCaptionGetProperties) and 0x20 (XClosedCaptionSetEnabled)
- 0x28 (XHighContrastGetMode), reporting XHighContrastMode::Off (0)
- 0x30 (XSpeechToTextSetPositionHint), 0x38 (XSpeechToTextSendString), and 0x88..=0xa0 (XSpeechToTextBegin/Update/Finalize/CancelHypothesisString)

ClosedCaptionProperties matches the public XClosedCaptionProperties layout (28 bytes, 4-byte aligned). Slot 0x18 writes the current enabled state and default appearance and returns S_OK whether captions are enabled or disabled (and E_INVALIDARG if out is null).

Closes #865
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:09 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:29 UTC · original · edited 2026-11-25 14:47 UTC

Automated triage for the maintainers.

Merge candidate. This fills the remaining missing slots of the accessibility object in crates/victory-hle/src/modules/speech.rs: closed captions (0x18/0x20), high contrast (0x28, reports off) and speech-to-text (0x30/0x38, 0x88..0xa0, log-only stubs plus hypothesis ids). Both points from the last note are done at 8aa346c. caption_properties now always fills the struct with enabled following set_captions_enabled and returns S_OK (E_INVALIDARG only for a null pointer, through the shared put). The code no longer names the console SDK; it uses public function names only, as the rest of victory-hle does. The struct follows the public field order (28 bytes, asserted), and the tests cover the layout, the enable/disable cycle and the stubs. CI check: passing.

For the maintainer: the order of the four hypothesis slots inside 0x88..0xa0 is inferred from main's grouping, not from a trace. Only 0x88 writes through an argument (its fifth, on the stack), so that slot is the one to watch if a run shows trouble. The PR description still mentions the old ERROR_NOT_FOUND behaviour and the SDK name; please update it before merge so the squash message is clean.

Reply to @⁠fuzeofficlal: thanks, both changes are in and match what was asked.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 10:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2076#issuecomment-7159756818) · edited 2026-11-25 14:47 UTC <!-- victory-triage v1 head=8aa346c611cc4899453b5fd7c092f2cc7d35eb8b verdict=merge-candidate at=2026-11-25T14:47:06Z --> Automated triage for the maintainers. **Merge candidate.** This fills the remaining `missing` slots of the accessibility object in `crates/victory-hle/src/modules/speech.rs`: closed captions (0x18/0x20), high contrast (0x28, reports off) and speech-to-text (0x30/0x38, 0x88..0xa0, log-only stubs plus hypothesis ids). Both points from the last note are done at `8aa346c`. `caption_properties` now always fills the struct with `enabled` following `set_captions_enabled` and returns `S_OK` (`E_INVALIDARG` only for a null pointer, through the shared `put`). The code no longer names the console SDK; it uses public function names only, as the rest of `victory-hle` does. The struct follows the public field order (28 bytes, asserted), and the tests cover the layout, the enable/disable cycle and the stubs. CI check: passing. For the maintainer: the order of the four hypothesis slots inside 0x88..0xa0 is inferred from main's grouping, not from a trace. Only 0x88 writes through an argument (its fifth, on the stack), so that slot is the one to watch if a run shows trouble. The PR description still mentions the old `ERROR_NOT_FOUND` behaviour and the SDK name; please update it before merge so the squash message is clean. Reply to @⁠fuzeofficlal: thanks, both changes are in and match what was asked. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 10:53 UTC · original

Updated in 3ed35da8 per triage feedback:

  • Removed the header filename reference from ClosedCaptionProperties and reworded all comments to cite only the public Microsoft Learn GDK Game Accessibility (XAccessibility) API reference.
  • Documented each vtable slot offset against its public API (0x18 XClosedCaptionGetProperties, 0x20 XClosedCaptionSetEnabled, 0x28 XHighContrastGetMode, 0x30 XSpeechToTextSetPositionHint, 0x38 XSpeechToTextSendString, and 0x88..=0xa0 XSpeechToTextBegin/Update/Finalize/CancelHypothesisString).
  • Added an explicit note and // shortcut: on NOT_FOUND (0x8007_0490): the public XClosedCaptionGetProperties reference specifies that it succeeds only when closed captions are enabled (SUCCEEDED(...)) and otherwise returns an error HRESULT without naming a specific code, so HRESULT_FROM_WIN32(ERROR_NOT_FOUND) is used as a disabled-state error distinct from E_NOTIMPL, transitioning to S_OK once 0x20 enables captions.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 10:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2076#issuecomment-7160303062) Updated in `3ed35da8` per triage feedback: - Removed the header filename reference from `ClosedCaptionProperties` and reworded all comments to cite only the public Microsoft Learn GDK Game Accessibility (`XAccessibility`) API reference. - Documented each vtable slot offset against its public API (`0x18` `XClosedCaptionGetProperties`, `0x20` `XClosedCaptionSetEnabled`, `0x28` `XHighContrastGetMode`, `0x30` `XSpeechToTextSetPositionHint`, `0x38` `XSpeechToTextSendString`, and `0x88..=0xa0` `XSpeechToTextBegin/Update/Finalize/CancelHypothesisString`). - Added an explicit note and `// shortcut:` on `NOT_FOUND` (`0x8007_0490`): the public `XClosedCaptionGetProperties` reference specifies that it succeeds only when closed captions are enabled (`SUCCEEDED(...)`) and otherwise returns an error `HRESULT` without naming a specific code, so `HRESULT_FROM_WIN32(ERROR_NOT_FOUND)` is used as a disabled-state error distinct from `E_NOTIMPL`, transitioning to `S_OK` once `0x20` enables captions.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 13:09 UTC · original

Updated in 8aa346c6 (rebased onto 940d32f):

  • caption_properties (slot 0x18): Always writes ClosedCaptionProperties (DEFAULT_CAPTIONS with enabled reflecting CAPTIONS_ENABLED) and returns S_OK when out is non-null (E_INVALIDARG on null), removing NOT_FOUND. Updated closed_captions_follow_enabled_state_and_layout accordingly.
  • Comments: Removed all mentions of the console SDK name and cited only the public API reference and function names.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 13:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2076#issuecomment-7163382700) Updated in `8aa346c6` (rebased onto `940d32f`): - **`caption_properties` (slot `0x18`)**: Always writes `ClosedCaptionProperties` (`DEFAULT_CAPTIONS` with `enabled` reflecting `CAPTIONS_ENABLED`) and returns `S_OK` when `out` is non-null (`E_INVALIDARG` on null), removing `NOT_FOUND`. Updated `closed_captions_follow_enabled_state_and_layout` accordingly. - **Comments**: Removed all mentions of the console SDK name and cited only the public API reference and function names.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2076/head:github-bot/gh-2076'
git switch 'github-bot/gh-2076'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2076'
git switch 'github-bot/gh-2076'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2076'
git switch 'github-bot/gh-2076'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2076'
git switch 'main'
git merge --squash 'github-bot/gh-2076'
git switch 'main'
git merge --ff-only 'github-bot/gh-2076'
git switch 'main'
git merge 'github-bot/gh-2076'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/Marvisak--VIctory!2076
No description provided.