From 2524667d12627332ce4a0a758ce5f69793f5e59a Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Thu, 1 Oct 2020 06:14:35 -0400 Subject: [PATCH] Enabled trace instruction function. Still TODO, try to make it more efficient. --- src/debug.cpp | 5 ----- src/drivers/Qt/TraceLogger.cpp | 21 +++++++++++++++++++++ src/drivers/Qt/TraceLogger.h | 1 + src/drivers/sdl/debugger.cpp | 5 +++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 89bcafa8..3c9e8703 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -865,10 +865,5 @@ void DebugCycle() if(debug_loggingCD) LogCDData(opcode, A, size); -#ifdef WIN32 - //This needs to be windows only or else the linux build system will fail since logging is declared in a - //windows source file FCEUD_TraceInstruction(opcode, size); -#endif - } diff --git a/src/drivers/Qt/TraceLogger.cpp b/src/drivers/Qt/TraceLogger.cpp index 29ca18c8..bb9c0865 100644 --- a/src/drivers/Qt/TraceLogger.cpp +++ b/src/drivers/Qt/TraceLogger.cpp @@ -114,6 +114,12 @@ TraceLoggerDialog_t::TraceLoggerDialog_t(QWidget *parent) startStopButton = new QPushButton( tr("Start Logging") ); autoUpdateCbox = new QCheckBox( tr("Automatically update this window while logging") ); + if ( logging ) + { + startStopButton->setText( tr("Stop Logging") ); + } + connect( startStopButton, SIGNAL(clicked(void)), this, SLOT(toggleLoggingOnOff(void)) ); + hbox = new QHBoxLayout(); hbox->addWidget( logLastCbox ); hbox->addWidget( logMaxLinesComboBox ); @@ -194,6 +200,21 @@ void TraceLoggerDialog_t::closeWindow(void) done(0); deleteLater(); } +//---------------------------------------------------- +void TraceLoggerDialog_t::toggleLoggingOnOff(void) +{ + logging = !logging; + + if ( logging ) + { + startStopButton->setText( tr("Stop Logging") ); + } + else + { + startStopButton->setText( tr("Start Logging") ); + } +} +//---------------------------------------------------- //todo: really speed this up void FCEUD_TraceInstruction(uint8 *opcode, int size) { diff --git a/src/drivers/Qt/TraceLogger.h b/src/drivers/Qt/TraceLogger.h index dde8d2f8..e1bd1dd3 100644 --- a/src/drivers/Qt/TraceLogger.h +++ b/src/drivers/Qt/TraceLogger.h @@ -91,5 +91,6 @@ class TraceLoggerDialog_t : public QDialog public slots: void closeWindow(void); private slots: + void toggleLoggingOnOff(void); }; diff --git a/src/drivers/sdl/debugger.cpp b/src/drivers/sdl/debugger.cpp index c5982e24..ea23deea 100644 --- a/src/drivers/sdl/debugger.cpp +++ b/src/drivers/sdl/debugger.cpp @@ -1709,6 +1709,11 @@ void FCEUD_DebugBreakpoint(int bp_num) } } +void FCEUD_TraceInstruction(uint8 *opcode, int size) +{ + // Place holder to allow for compiling. GTK GUI doesn't support this. Qt Does. +} + static void closeDebuggerWindow (GtkWidget * w, GdkEvent * e, debuggerWin_t * dw) { std::list < debuggerWin_t * >::iterator it;