# HG changeset patch # User Michael Pavone # Date 1488355204 28800 # Node ID ccf5c02610c665ccd78fc1cc7d6fa83f1e88a24d # Parent 6370b80491c7d1ba8ee038b55f7b8730c48196e8 Only allow keyboard capture if the emulated system has a keyboard attached diff -r 6370b80491c7 -r ccf5c02610c6 io.c --- 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();