From 9096f629c9fab8f279043911d818cd6f3703a003 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 28 Mar 2025 13:11:26 +0300 Subject: [PATCH] Fix double ^C quit on non-Windows SDL builds --- SDL/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SDL/main.c b/SDL/main.c index 2ceed71..88149a8 100644 --- a/SDL/main.c +++ b/SDL/main.c @@ -123,6 +123,9 @@ retry: { #endif SDL_Event event; SDL_WaitEvent(&event); + if (pending_command == GB_SDL_QUIT_COMMAND) { + return strdup("c"); + } switch (event.type) { case SDL_DISPLAYEVENT: update_swap_interval(); @@ -673,7 +676,15 @@ static void rumble(GB_gameboy_t *gb, double amp) static void debugger_interrupt(int ignore) { +#ifndef _WIN32 + if (GB_debugger_is_stopped(&gb)) { + pending_command = GB_SDL_QUIT_COMMAND; + console_line_ready(); // Force the debugger wait-loop to process the command + return; + } +#endif pending_command = GB_SDL_DEBUGGER_INTERRUPT_COMMAND; + } #ifndef _WIN32