diff --git a/Cocoa/Document.m b/Cocoa/Document.m index 7f5a887..e5442ee 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -153,6 +153,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b) - (void) stop { if (!running) return; + gb.debug_disable = true; if (gb.debug_stopped) { gb.debug_stopped = false; [self consoleInput:nil]; @@ -160,6 +161,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b) stopping = true; running = false; while (stopping); + gb.debug_disable = false; } - (IBAction)reset:(id)sender diff --git a/Core/debugger.c b/Core/debugger.c index 51e015d..ca0c367 100644 --- a/Core/debugger.c +++ b/Core/debugger.c @@ -1463,6 +1463,8 @@ bool GB_debugger_do_command(GB_gameboy_t *gb, char *input) void GB_debugger_run(GB_gameboy_t *gb) { + if (gb->debug_disable) return; + char *input = NULL; if (gb->debug_next_command && gb->debug_call_depth <= 0) { gb->debug_stopped = true; @@ -1482,7 +1484,7 @@ next_command: GB_log(gb, "Breakpoint: PC = %s\n", value_to_string(gb, gb->pc, true)); GB_cpu_disassemble(gb, gb->pc, 5); } - if (gb->debug_stopped) { + if (gb->debug_stopped && !gb->debug_disable) { gb->debug_next_command = false; gb->debug_fin_command = false; gb->stack_leak_detection = false; diff --git a/Core/gb.h b/Core/gb.h index dd6c7c0..a2a7d8b 100644 --- a/Core/gb.h +++ b/Core/gb.h @@ -380,7 +380,7 @@ typedef struct GB_gameboy_s { size_t ir_queue_length; /*** Debugger ***/ - volatile bool debug_stopped; + volatile bool debug_stopped, debug_disable; bool debug_fin_command, debug_next_command; /* Breakpoints */