use the frontend keyboard callback, with port polling as a fallback - #174
Open
wescopeland wants to merge 1 commit into
Open
use the frontend keyboard callback, with port polling as a fallback#174wescopeland wants to merge 1 commit into
wescopeland wants to merge 1 commit into
Conversation
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.
At the moment, the core only polls the keyboard on ports configured as
RETRO_DEVICE_SPECTRUM_KEYBOARD. Frontends without a controller-type selection UI can remove that assignment.RALibretro sets every declared port to
RETRO_DEVICE_NONEright afterretro_load_game(). After that, the core polls no input device. Spectrum games load and then the player is effectively stuck in the game's menu. Keys pressed by the player never reach the game. This issue is documented as "requires ability to map keyboard to port 3" in RetroAchievements' unsupported cores page for fuse-libretro.The Spectrum's keyboard is not an optional peripheral. This PR registers the frontend keyboard callback (
RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK) and uses it as the keyboard source. Frontends deliver the callback regardless of their controller port configuration. Given all ports are set to joysticks, the keyboard will no longer be silenced or configured away. This is consistent with what other computer cores (C64, CPC, DOS) already do.When a frontend does not support the callback, the core falls back to polling
RETRO_DEVICE_KEYBOARDon the first port set to Sinclair Keyboard, or on port 0 when there is none.RetroArch behavior is unchanged by this PR in practice. It already supports the callback, so the keyboard source moves from port 3 polling to the callback and defaults keep working. RALibretro also supports the callback, so keyboard input now works there even with every port set to
RETRO_DEVICE_NONE. The polling fallback only matters for frontends that do not implement the callback.