Skip to content

use the frontend keyboard callback, with port polling as a fallback - #174

Open
wescopeland wants to merge 1 commit into
libretro:masterfrom
wescopeland:poll-keyboard-without-port
Open

use the frontend keyboard callback, with port polling as a fallback#174
wescopeland wants to merge 1 commit into
libretro:masterfrom
wescopeland:poll-keyboard-without-port

Conversation

@wescopeland

@wescopeland wescopeland commented Aug 9, 2026

Copy link
Copy Markdown

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_NONE right after retro_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_KEYBOARD on 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant