From d7ff305c961ca8ef0a21acc7eab76fb7bf98588d Mon Sep 17 00:00:00 2001 From: OV2 Date: Thu, 31 May 2018 02:20:32 +0200 Subject: [PATCH] Expose debug command to ports --- debug.cpp | 7 +++---- debug.h | 1 + win32/wsnes9x.cpp | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/debug.cpp b/debug.cpp index 972c873e..1ad461e2 100644 --- a/debug.cpp +++ b/debug.cpp @@ -343,7 +343,6 @@ static uint8 debug_sa1_op_print (char *, uint8, uint16); static void debug_line_print (const char *); static int debug_get_number (char *, uint16 *); static short debug_get_start_address (char *, uint8 *, uint32 *); -static void debug_process_command (char *); static void debug_print_window (uint8 *); static const char * debug_clip_fn (int); static void debug_whats_used (void); @@ -1373,7 +1372,7 @@ static short debug_get_start_address (char *Line, uint8 *Bank, uint32 *Address) return (1); } -static void debug_process_command (char *Line) +void S9xDebugProcessCommand(char *Line) { uint8 Bank = Registers.PB; uint32 Address = Registers.PCw; @@ -2558,7 +2557,7 @@ void S9xDoDebug (void) S9xTextMode(); strcpy(Line, "r"); - debug_process_command(Line); + S9xDebugProcessCommand(Line); while (CPU.Flags & DEBUG_MODE_FLAG) { @@ -2572,7 +2571,7 @@ void S9xDoDebug (void) Line[strlen(Line) - 1] = 0; Cycles = CPU.Cycles; - debug_process_command(Line); + S9xDebugProcessCommand(Line); CPU.Cycles = Cycles; } diff --git a/debug.h b/debug.h index 220c2b31..1ffceeb6 100644 --- a/debug.h +++ b/debug.h @@ -220,6 +220,7 @@ void S9xSA1Trace (void); void S9xTraceMessage (const char *); void S9xTraceFormattedMessage (const char *, ...); void S9xPrintHVPosition (char *); +void S9xDebugProcessCommand(char *); #endif diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index d57ee0f1..fcf88d15 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -235,6 +235,10 @@ #include #include +#ifdef DEBUGGER +#include "../debug.h" +#endif + #if (((defined(_MSC_VER) && _MSC_VER >= 1300)) || defined(__MINGW32__)) // both MINGW and VS.NET use fstream instead of fstream.h which is deprecated #include @@ -2405,7 +2409,7 @@ LRESULT CALLBACK WinProc( break; #ifdef DEBUGGER case ID_DEBUG_TRACE: - CPU.Flags ^= TRACE_FLAG; + S9xDebugProcessCommand("T"); break; case ID_DEBUG_FRAME_ADVANCE: