diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-03-01 00:00:04 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-03-01 00:00:04 -0800 |
commit | 05e931ae02e3290566dcca0ca639dc019084edd7 (patch) | |
tree | 6318d81bf72c60e6144adb74b188984dbe71abff /io.c | |
parent | f4fd7c6b726b1c454209b627d6fc4795ebb22531 (diff) |
Only allow keyboard capture if the emulated system has a keyboard attached
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -392,6 +392,16 @@ int current_speed = 0; 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 @@ void handle_binding_up(keybinding * binding) } 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(); |