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

Open
fuzeofficlal wants to merge 1 commit from upstream-pr/2076 into main
fuzeofficlal commented 2026-11-25 04:23:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T04:23:33Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6597163959 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2076). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T04:23:33Z. --- 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`.
catminou4 commented 2026-11-25 05:06:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:26:32Z.

Review: COMMENTED


Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

Remaining XAccessibility closed-caption/high-contrast implementations — accessibility API completeness; large-ish surface, statics only on macOS.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051851358 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2076#pullrequestreview-6051851358). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T04:26:32Z. **Review:** COMMENTED --- Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff. Remaining XAccessibility closed-caption/high-contrast implementations — accessibility API completeness; large-ish surface, statics only on macOS.
DenRakEiw commented 2026-11-25 05:06:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:44:50Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-hle --lib speech:: — 4 passed, 0 failed
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean implementation of the remaining XAccessibility closed-caption, high-contrast, and speech-to-text slots with unit tests. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6051980879 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2076#pullrequestreview-6051980879). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T04:44:50Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-hle --lib speech::` — 4 passed, 0 failed - `cargo clippy -p victory-hle --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean implementation of the remaining XAccessibility closed-caption, high-contrast, and speech-to-text slots with unit tests. Looks good. AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-25 11:05:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:29:03Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159756818 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2076#issuecomment-7159756818). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T10:29:03Z. --- <!-- 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)_
fuzeofficlal commented 2026-11-25 11:05:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T10:53:09Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7160303062 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2076#issuecomment-7160303062). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T10:53:09Z. --- 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 commented 2026-11-25 14:07:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T13:09:54Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7163382700 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2076#issuecomment-7163382700). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T13:09:54Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2076:upstream-pr/2076'
git switch 'upstream-pr/2076'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2076'
git switch 'upstream-pr/2076'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2076'
git switch 'upstream-pr/2076'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2076'
git switch 'main'
git merge --squash 'upstream-pr/2076'
git switch 'main'
git merge --ff-only 'upstream-pr/2076'
git switch 'main'
git merge 'upstream-pr/2076'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2074
No description provided.