]> git.sesse.net Git - pistorm/blobdiff - emulator.c
handle keyboard/mouse autoconnect
[pistorm] / emulator.c
index 3fd6ff880c0d0a35dad4471cab90e36c12ad625a..1174bd06f455e61f6fa2852d3214a0b6c5313ecf 100644 (file)
@@ -240,7 +240,6 @@ cpu_loop:
 //    printf("CPU emulation reset.\n");
   }
 
-
   if (mouse_hook_enabled && (mouse_extra != 0x00)) {
     // mouse wheel events have occurred; unlike l/m/r buttons, these are queued as keypresses, so add to end of buffer
     switch (mouse_extra) {
@@ -520,6 +519,12 @@ int main(int argc, char *argv[]) {
     printf("Failed to open keyboard event source.\n");
   }
 
+  if (cfg->mouse_autoconnect)
+    mouse_hook_enabled = 1;
+
+  if (cfg->keyboard_autoconnect)
+    kb_hook_enabled = 1;
+
   InitGayle();
 
   signal(SIGINT, sigint_handler);