diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 04c266e1..41036c60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -438,6 +438,7 @@ set(SRC_DRIVERS_SDL ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleUtilities.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/TraceLogger.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AboutWindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index 44e701e1..b3599e38 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -25,6 +25,7 @@ #include "Qt/LuaControl.h" #include "Qt/CheatsConf.h" #include "Qt/HexEditor.h" +#include "Qt/TraceLogger.h" #include "Qt/CodeDataLogger.h" #include "Qt/ConsoleDebugger.h" #include "Qt/ConsoleUtilities.h" @@ -508,6 +509,14 @@ void consoleWin_t::createMainMenu(void) debugMenu->addAction(codeDataLogAct); + // Debug -> Trace Logger + traceLogAct = new QAction(tr("Trace Logger..."), this); + //traceLogAct->setShortcut( QKeySequence(tr("Shift+F7"))); + traceLogAct->setStatusTip(tr("Open Trace Logger")); + connect(traceLogAct, SIGNAL(triggered()), this, SLOT(openTraceLogger(void)) ); + + debugMenu->addAction(traceLogAct); + //----------------------------------------------------------------------- // Movie movieMenu = menuBar()->addMenu(tr("Movie")); @@ -1023,6 +1032,17 @@ void consoleWin_t::openCodeDataLogger(void) cdlWin->show(); } +void consoleWin_t::openTraceLogger(void) +{ + TraceLoggerDialog_t *tlWin; + + //printf("Open Trace Logger Window\n"); + + tlWin = new TraceLoggerDialog_t(this); + + tlWin->show(); +} + void consoleWin_t::toggleAutoResume(void) { //printf("Auto Resume: %i\n", autoResume->isChecked() ); diff --git a/src/drivers/Qt/ConsoleWindow.h b/src/drivers/Qt/ConsoleWindow.h index 501c018a..a8d74264 100644 --- a/src/drivers/Qt/ConsoleWindow.h +++ b/src/drivers/Qt/ConsoleWindow.h @@ -91,6 +91,7 @@ class consoleWin_t : public QMainWindow QAction *cheatsAct; QAction *debuggerAct; QAction *codeDataLogAct; + QAction *traceLogAct; QAction *hexEditAct; QAction *openMovAct; QAction *stopMovAct; @@ -135,6 +136,7 @@ class consoleWin_t : public QMainWindow void openPaletteConfWin(void); void openGuiConfWin(void); void openCodeDataLogger(void); + void openTraceLogger(void); void toggleAutoResume(void); void toggleFullscreen(void); void updatePeriodic(void); diff --git a/src/drivers/Qt/TraceLogger.cpp b/src/drivers/Qt/TraceLogger.cpp new file mode 100644 index 00000000..4c921e3f --- /dev/null +++ b/src/drivers/Qt/TraceLogger.cpp @@ -0,0 +1,131 @@ +// CodeDataLogger.cpp +// +#include +#include +#include +#include + +#include "../../types.h" +#include "../../fceu.h" +#include "../../cart.h" +#include "../../x6502.h" +#include "../../debug.h" +#include "../../ppu.h" +#include "../../ines.h" +#include "../../nsf.h" + +#include "Qt/ConsoleUtilities.h" +#include "Qt/TraceLogger.h" +#include "Qt/main.h" +#include "Qt/dface.h" +#include "Qt/input.h" +#include "Qt/config.h" +#include "Qt/fceuWrapper.h" + +//---------------------------------------------------- +TraceLoggerDialog_t::TraceLoggerDialog_t(QWidget *parent) + : QDialog( parent ) +{ + QVBoxLayout *mainLayout; + QHBoxLayout *hbox; + QGridLayout *grid; + QGroupBox *frame; + QLabel *lbl; + + setWindowTitle( tr("Trace Logger") ); + + mainLayout = new QVBoxLayout(); + grid = new QGridLayout(); + + mainLayout->addLayout( grid ); + + lbl = new QLabel( tr("Lines") ); + logLastCbox = new QCheckBox( tr("Log Last") ); + logMaxLinesComboBox = new QComboBox(); + + logFileCbox = new QCheckBox( tr("Log to File") ); + selLogFileButton = new QPushButton( tr("Browse...") ); + startStopButton = new QPushButton( tr("Start Logging") ); + autoUpdateCbox = new QCheckBox( tr("Automatically update this window while logging") ); + + hbox = new QHBoxLayout(); + hbox->addWidget( logLastCbox ); + hbox->addWidget( logMaxLinesComboBox ); + hbox->addWidget( lbl ); + + grid->addLayout( hbox, 0, 0, Qt::AlignLeft ); + grid->addWidget( startStopButton, 0, 1, Qt::AlignCenter ); + + hbox = new QHBoxLayout(); + hbox->addWidget( logFileCbox ); + hbox->addWidget( selLogFileButton ); + + grid->addLayout( hbox, 1, 0, Qt::AlignLeft ); + grid->addWidget( autoUpdateCbox, 1, 1, Qt::AlignCenter ); + + grid = new QGridLayout(); + frame = new QGroupBox(tr("Log Options")); + frame->setLayout( grid ); + + logRegCbox = new QCheckBox( tr("Log State of Registers") ); + logFrameCbox = new QCheckBox( tr("Log Frames Count") ); + logEmuMsgCbox = new QCheckBox( tr("Log Emulator Messages") ); + symTraceEnaCbox = new QCheckBox( tr("Symbolic Trace") ); + logProcStatFlagCbox = new QCheckBox( tr("Log Processor Status Flags") ); + logCyclesCountCbox = new QCheckBox( tr("Log Cycles Count") ); + logBreakpointCbox = new QCheckBox( tr("Log Breakpoint Hits") ); + useStackPointerCbox = new QCheckBox( tr("Use Stack Pointer for Code Tabbing (Nesting Visualization)") ); + toLeftDisassemblyCbox = new QCheckBox( tr("To the Left from Disassembly") ); + logInstrCountCbox = new QCheckBox( tr("Log Instructions Count") ); + logBankNumCbox = new QCheckBox( tr("Log Bank Number") ); + + grid->addWidget( logRegCbox , 0, 0, Qt::AlignLeft ); + grid->addWidget( logFrameCbox , 1, 0, Qt::AlignLeft ); + grid->addWidget( logEmuMsgCbox , 2, 0, Qt::AlignLeft ); + grid->addWidget( symTraceEnaCbox, 3, 0, Qt::AlignLeft ); + grid->addWidget( logProcStatFlagCbox, 0, 1, Qt::AlignLeft ); + grid->addWidget( logCyclesCountCbox , 1, 1, Qt::AlignLeft ); + grid->addWidget( logBreakpointCbox , 2, 1, Qt::AlignLeft ); + grid->addWidget( useStackPointerCbox, 3, 1, 1, 2, Qt::AlignLeft ); + grid->addWidget( toLeftDisassemblyCbox, 0, 2, Qt::AlignLeft ); + grid->addWidget( logInstrCountCbox , 1, 2, Qt::AlignLeft ); + grid->addWidget( logBankNumCbox , 2, 2, Qt::AlignLeft ); + + mainLayout->addWidget( frame ); + + grid = new QGridLayout(); + frame = new QGroupBox(tr("Extra Log Options that work with the Code/Data Logger")); + frame->setLayout( grid ); + + logNewMapCodeCbox = new QCheckBox( tr("Only Log Newly Mapped Code") ); + logNewMapDataCbox = new QCheckBox( tr("Only Log that Accesses Newly Mapped Data") ); + + grid->addWidget( logNewMapCodeCbox, 0, 0, Qt::AlignLeft ); + grid->addWidget( logNewMapDataCbox, 0, 1, Qt::AlignLeft ); + + mainLayout->addWidget( frame ); + + setLayout( mainLayout ); + +} +//---------------------------------------------------- +TraceLoggerDialog_t::~TraceLoggerDialog_t(void) +{ + printf("Trace Logger Window Deleted\n"); +} +//---------------------------------------------------- +void TraceLoggerDialog_t::closeEvent(QCloseEvent *event) +{ + printf("Trace Logger Close Window Event\n"); + done(0); + deleteLater(); + event->accept(); +} +//---------------------------------------------------- +void TraceLoggerDialog_t::closeWindow(void) +{ + printf("Trace Logger Close Window\n"); + done(0); + deleteLater(); +} +//---------------------------------------------------- diff --git a/src/drivers/Qt/TraceLogger.h b/src/drivers/Qt/TraceLogger.h new file mode 100644 index 00000000..f27ea065 --- /dev/null +++ b/src/drivers/Qt/TraceLogger.h @@ -0,0 +1,58 @@ +// CodeDataLogger.h +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TraceLoggerDialog_t : public QDialog +{ + Q_OBJECT + + public: + TraceLoggerDialog_t(QWidget *parent = 0); + ~TraceLoggerDialog_t(void); + + protected: + QCheckBox *logLastCbox; + QCheckBox *logFileCbox; + QComboBox *logMaxLinesComboBox; + + QCheckBox *autoUpdateCbox; + QCheckBox *logRegCbox; + QCheckBox *logFrameCbox; + QCheckBox *logEmuMsgCbox; + QCheckBox *logProcStatFlagCbox; + QCheckBox *logCyclesCountCbox; + QCheckBox *logBreakpointCbox; + QCheckBox *useStackPointerCbox; + QCheckBox *toLeftDisassemblyCbox; + QCheckBox *logInstrCountCbox; + QCheckBox *logBankNumCbox; + QCheckBox *symTraceEnaCbox; + QCheckBox *logNewMapCodeCbox; + QCheckBox *logNewMapDataCbox; + + QPushButton *selLogFileButton; + QPushButton *startStopButton; + + void closeEvent(QCloseEvent *bar); + + private: + + public slots: + void closeWindow(void); + private slots: +}; +