# HG changeset patch # User Michael Pavone # Date 1432258661 25200 # Node ID 7178d750efbdbe55c18f7c518ab6288c304c2de3 # Parent 8f5339961903942e5b67a136a45edc6ea4b9852d Process events while waiting for 68K debugger input. This prevents "not responsive" dialogs when sitting in the debugger diff -r 8f5339961903 -r 7178d750efbd debug.c --- a/debug.c Thu May 21 00:55:46 2015 -0700 +++ b/debug.c Thu May 21 18:37:41 2015 -0700 @@ -3,6 +3,8 @@ #include "68kinst.h" #include #include +#include +#include "render.h" static bp_def * breakpoints = NULL; static bp_def * zbreakpoints = NULL; @@ -508,8 +510,25 @@ printf("%X: %s\n", address, input_buf); uint32_t after = address + (after_pc-pc)*2; int debugging = 1; + int prompt = 1; + fd_set read_fds; + FD_ZERO(&read_fds); + struct timeval timeout; while (debugging) { - fputs(">", stdout); + if (prompt) { + fputs(">", stdout); + fflush(stdout); + } + process_events(); + timeout.tv_sec = 0; + timeout.tv_usec = 16667; + FD_SET(fileno(stdin), &read_fds); + if(select(fileno(stdin) + 1, &read_fds, NULL, NULL, &timeout) < 1) { + prompt = 0; + continue; + } else { + prompt = 1; + } if (!fgets(input_buf, sizeof(input_buf), stdin)) { fputs("fgets failed", stderr); break; diff -r 8f5339961903 -r 7178d750efbd render.h --- a/render.h Thu May 21 00:55:46 2015 -0700 +++ b/render.h Thu May 21 18:37:41 2015 -0700 @@ -33,6 +33,7 @@ int render_joystick_num_buttons(int joystick); int render_joystick_num_hats(int joystick); int render_num_joysticks(); +void process_events(); //TODO: Throw an ifdef in here once there's more than one renderer #include