From eb3e0eaa1ed99b22c94871f5366d931e6a361c34 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 6 Apr 2016 22:58:30 +0300 Subject: [PATCH] Pause the debugger on SIGINT in the SDL port --- SDL/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SDL/main.c b/SDL/main.c index ef01bed..ecd6128 100644 --- a/SDL/main.c +++ b/SDL/main.c @@ -126,12 +126,18 @@ static uint32_t rgb_encode(GB_gameboy_t *gb, unsigned char r, unsigned char g, u return SDL_MapRGB(screen->format, r, g, b); } +GB_gameboy_t gb; + +static void debugger_interrupt(int ignore) +{ + gb.debug_stopped = true; +} + #ifdef __APPLE__ extern void cocoa_disable_filtering(void); #endif int main(int argc, char **argv) { - GB_gameboy_t gb; bool dmg = false; #define str(x) #x @@ -174,6 +180,9 @@ usage: exit(1); } + + signal(SIGINT, debugger_interrupt); + SDL_Init( SDL_INIT_EVERYTHING ); screen = SDL_SetVideoMode(160, 144, 32, SDL_SWSURFACE ); #ifdef __APPLE__