xgameruntime_offline: one silent speech voice with WAVE streams, display power requests for timeout deferrals (RT-GDK-SPEECH-DISPLAY-LIFECYCLE) #401

Merged
Andretuta merged 4 commits from upstream-pr/401 into main 2026-11-24 13:44:39 +00:00
Andretuta commented 2026-11-24 04:43:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T04:43:47Z.


Claimed in the coordination issue as: RT-GDK-SPEECH-DISPLAY-LIFECYCLE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121796272)

Split after review: this PR keeps the speech and launcher stubs. The lifecycle callback and CreateWindowEx hook are now in #769, and XAppCaptureImpl is left to #537, which serves it with its full layout.

What and why

  • XAccessibilityImpl speech (runtime/shims/xgameruntime_offline.cpp), consistent now: XSpeechSynthesizerEnumerateInstalledVoices calls back once with one silent voice (leonida-silent, en-US), using the XSpeechSynthesizerVoiceInformation layout of the GDK reference (Description, DisplayName, Gender, VoiceId, Language). XSpeechSynthesizerCreate hands out a synthesizer that speaks with it. SetCustomVoice accepts that voice id only. Streams from text and SSML return a valid 44-byte RIFF/WAVE header (16 kHz, 16-bit mono PCM, no samples), so a title that plays narration reads a silent stream.
  • Argument order fixed: the GDK reference gives XSpeechSynthesizerEnumerateInstalledVoices(void* context, callback). main read them the other way round, so a null context was refused with E_INVALIDARG.
  • XLauncherImpl: XDisplayAcquireTimeoutDeferral creates a Win32 PowerCreateRequest / PowerSetRequest(PowerRequestDisplayRequired) request and returns its handle; XDisplayCloseTimeoutDeferralHandle clears and closes it. Side effect on the host: while the title holds a deferral, Windows keeps the PC's display on. XLaunchUri still fails (E_FAIL).
  • docs/runtime_imports.md: the speech and launcher bullets match the code. The served-classes table and its paragraph are left alone, because #537 rewrites them; the two merge cleanly.

Tested

  • MSVC 14.44 / Windows SDK 10.0.26100: xgameruntime_offline_test (69 checks, 0 failures) and xgameruntime_test pass under CTest. New checks: the enumeration passes its context back and reports one voice; SetCustomVoice accepts the enumerated id and refuses another id or null.
  • Merged with #537 in a scratch tree: both tests pass, no conflict.
  • Docs, test_gdk_runtime_calls and build-script pytest: 81 passed.

GPUs tested: n/a (CPU-only GDK runtime tests)

AI-assisted: yes

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 — runtime shims only)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466225666 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/401). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T04:43:47Z. --- Claimed in the coordination issue as: `RT-GDK-SPEECH-DISPLAY-LIFECYCLE` (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121796272) Split after review: this PR keeps the speech and launcher stubs. The lifecycle callback and `CreateWindowEx` hook are now in #769, and `XAppCaptureImpl` is left to #537, which serves it with its full layout. ### What and why - **`XAccessibilityImpl` speech (`runtime/shims/xgameruntime_offline.cpp`), consistent now:** `XSpeechSynthesizerEnumerateInstalledVoices` calls back once with one silent voice (`leonida-silent`, `en-US`), using the `XSpeechSynthesizerVoiceInformation` layout of the GDK reference (`Description`, `DisplayName`, `Gender`, `VoiceId`, `Language`). `XSpeechSynthesizerCreate` hands out a synthesizer that speaks with it. `SetCustomVoice` accepts that voice id only. Streams from text and SSML return a valid 44-byte RIFF/WAVE header (16 kHz, 16-bit mono PCM, no samples), so a title that plays narration reads a silent stream. - **Argument order fixed:** the GDK reference gives `XSpeechSynthesizerEnumerateInstalledVoices(void* context, callback)`. `main` read them the other way round, so a null context was refused with `E_INVALIDARG`. - **`XLauncherImpl`:** `XDisplayAcquireTimeoutDeferral` creates a Win32 `PowerCreateRequest` / `PowerSetRequest(PowerRequestDisplayRequired)` request and returns its handle; `XDisplayCloseTimeoutDeferralHandle` clears and closes it. **Side effect on the host:** while the title holds a deferral, Windows keeps the PC's display on. `XLaunchUri` still fails (`E_FAIL`). - `docs/runtime_imports.md`: the speech and launcher bullets match the code. The served-classes table and its paragraph are left alone, because #537 rewrites them; the two merge cleanly. ### Tested - MSVC 14.44 / Windows SDK 10.0.26100: `xgameruntime_offline_test` (69 checks, 0 failures) and `xgameruntime_test` pass under CTest. New checks: the enumeration passes its context back and reports one voice; `SetCustomVoice` accepts the enumerated id and refuses another id or null. - Merged with #537 in a scratch tree: both tests pass, no conflict. - Docs, `test_gdk_runtime_calls` and build-script pytest: 81 passed. GPUs tested: n/a (CPU-only GDK runtime tests) AI-assisted: yes ### 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 — runtime shims only) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ubiquitarianism commented 2026-11-24 04:51:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-11-24T04:51:25Z.


Holding. Please split this into separate PRs (one topic per PR): the speech, capture and launcher stubs in one, and the lifecycle callback and CreateWindowEx hook in another. For the speech stubs:

  • make them consistent: either enumerate a voice, or keep Create failing. Right now Create succeeds with an empty WAV while zero voices are reported;
  • update docs/runtime_imports.md, which still says Create fails (lines 452-453, 487-542).

For the hook:

  • make the PR text match the code: the deadline is 1 s, and the DLLs are api-ms-win-core-psm-appnotify and kernelbase;
  • call out the host display power request as a side effect.

Drop 'Depends on #357' if it's unused.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7122400487 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/401#issuecomment-7122400487). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-11-24T04:51:25Z. --- Holding. Please split this into separate PRs (one topic per PR): the speech, capture and launcher stubs in one, and the lifecycle callback and `CreateWindowEx` hook in another. For the speech stubs: - make them consistent: either enumerate a voice, or keep Create failing. Right now Create succeeds with an empty WAV while zero voices are reported; - update `docs/runtime_imports.md`, which still says Create fails (lines 452-453, 487-542). For the hook: - make the PR text match the code: the deadline is 1 s, and the DLLs are `api-ms-win-core-psm-appnotify` and kernelbase; - call out the host display power request as a side effect. Drop 'Depends on #357' if it's unused.
tengotengo commented 2026-11-24 09:59:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tengotengo on 2026-11-24T09:59:10Z.


Coordination note from the RT-XAPPCAPTURE claim (#14): open pull request #537 also serves XAppCaptureImpl, and both pull requests update runtime/test/xgameruntime_test.cpp, tests/test_gdk_runtime_calls.py and docs/runtime_imports.md. If both merge, class a4f1aee2-4bf1-4485-b008-a7c26d52ac27 is served by two objects (one per xgameruntime*.cpp file), and the shared test/doc files conflict on whichever merges second.

The difference: #537's layout was measured against the retail executable - it queries that class id for IXAppCaptureImpl4 and calls slot 5 (XAppCaptureTakeScreenshot), the executable's one thunk of the class; #537 serves the full 18-slot layout answering the class id and the v1-v4 interface ids, every method E_NOTIMPL offline. With it, all 158 thunks the executable references are served (the data point reported in #14).

Proposal: drop the XAppCaptureImpl part from this pull request (the speech, display and lifecycle work has no overlap), or rebase this one after #537 lands and remove the duplicate class object plus its test/doc updates. Happy to discuss on the Discord if easier.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128155370 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/401#issuecomment-7128155370). Originally posted by [tengotengo](https://github.com/tengotengo) on 2026-11-24T09:59:10Z. --- Coordination note from the RT-XAPPCAPTURE claim (#14): open pull request #537 also serves XAppCaptureImpl, and both pull requests update runtime/test/xgameruntime_test.cpp, tests/test_gdk_runtime_calls.py and docs/runtime_imports.md. If both merge, class a4f1aee2-4bf1-4485-b008-a7c26d52ac27 is served by two objects (one per xgameruntime*.cpp file), and the shared test/doc files conflict on whichever merges second. The difference: #537's layout was measured against the retail executable - it queries that class id for IXAppCaptureImpl4 and calls slot 5 (XAppCaptureTakeScreenshot), the executable's one thunk of the class; #537 serves the full 18-slot layout answering the class id and the v1-v4 interface ids, every method E_NOTIMPL offline. With it, all 158 thunks the executable references are served (the data point reported in #14). Proposal: drop the XAppCaptureImpl part from this pull request (the speech, display and lifecycle work has no overlap), or rebase this one after #537 lands and remove the duplicate class object plus its test/doc updates. Happy to discuss on the Discord if easier.
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
ProjectLeonida/mandy!401
No description provided.