Mercurial > repos > blastem
changeset 1256:ccf5c02610c6
Only allow keyboard capture if the emulated system has a keyboard attached
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 01 Mar 2017 00:00:04 -0800 |
parents | 6370b80491c7 |
children | db28178bd2a1 |
files | io.c |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/io.c Tue Feb 28 23:52:16 2017 -0800 +++ b/io.c Wed Mar 01 00:00:04 2017 -0800 @@ -392,6 +392,16 @@ int num_speeds = 1; uint32_t * speeds = NULL; +uint8_t is_keyboard(io_port *port) +{ + return port->device_type == IO_SATURN_KEYBOARD || port->device_type == IO_XBAND_KEYBOARD; +} + +uint8_t keyboard_connected(sega_io *io) +{ + return is_keyboard(io->ports) || is_keyboard(io->ports+1) || is_keyboard(io->ports+2); +} + void handle_binding_up(keybinding * binding) { switch(binding->bind_type) @@ -471,7 +481,9 @@ } break; case UI_TOGGLE_KEYBOARD_CAPTURE: - current_io->keyboard_captured = !current_io->keyboard_captured; + if (keyboard_connected(current_io)) { + current_io->keyboard_captured = !current_io->keyboard_captured; + } break; case UI_TOGGLE_FULLSCREEN: render_toggle_fullscreen();