Conversation
Expose an experimental environment call for semantic game narration through the existing frontend speech backend. Respect accessibility settings, reject unavailable or invalid requests, and keep core text literal in platform speech backends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I built this connection so I could add accessibility to games through libretro cores. My current use case is Digimon World 2 accessibility in a Beetle PSX fork: the core identifies dialogue, menu focus, battle information, and navigation state, then asks the frontend to speak that information.
This PR proposes a general, experimental
RETRO_ENVIRONMENT_ACCESSIBILITY_SPEAKcall. It lets a core submit semantic game text to RetroArch's existing accessibility backend, using the player's accessibility settings and narrator speed. Game interpretation stays in the core; platform speech stays in the frontend. The PR contains no game-specific decoder, game data, OCR, or external AI service integration.For example, a core with a registered environment callback can request speech with:
The handler rejects null/empty text, nonzero reserved flags, disabled accessibility, and unavailable speech backends. It respects both the configuration setting and the
--accessibilityoverride. It forwards the backend's result; acceptance does not guarantee audible playback or completion. Priority is a best-effort hint, and the optional channel is advisory metadata.The small platform changes keep submitted text literal:
--separates text from options for Unix/legacy macOS command-line narrators, andSPF_IS_NOT_XMLprevents Windows SAPI from interpreting leading markup as XML.API review
This is a working experimental API proposal. Command 95 is provisional and was unused in the upstream header at the time of submission. I expect its allocation and final contract to need libretro API review and coordination with
libretro-commonbefore adoption. Earlier private prototypes used 82; this proposal does not reuse that number, which upstream now assigns to a netplay query.The header documents UTF-8 input, caller ownership through callback return, the calling thread, reserved flags, and the limits of priority and acceptance. The matching core source branch uses the proposed identifier.
Validation
python tests-other/test_accessibility_speech.py --source . --cc gcc: 279 assertions passed under C89 with-Wall -Wextra -Werror. The harness compiles the actual handler and accessibility functions with a recording frontend, plus the actual Unix/macOS argv construction. It covers disabled/enabled speech, CLI override, invalid inputs, missing hooks, backend failure, exact forwarding, and text beginning with option-like or markup-like characters.runloop.cwith accessibility enabled and disabled;platform_win32.cwith accessibility and SAPI enabled. The bundled DXSDK include directory was provided for the Win32 build.The harness launches no speech engine. Native Linux/macOS playback, a complete build of the current RetroArch frontend, and end-to-end playback of this rebased proposal remain unverified. The earlier Windows prototype has been used with the DW2 accessibility core during gameplay.
Related issues and pull requests
No existing issue or companion PR. Feedback on the API shape and the preferred
libretro-commonintegration path is welcome.