Merge pull request #177 from mjbudd77/master

Added Qt GUI Trace Logger Feature
This commit is contained in:
mjbudd77 2020-10-02 22:39:54 -04:00 committed by GitHub
commit 33a961d0e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1385 additions and 7 deletions

View File

@ -46,8 +46,8 @@ TAS Editor | NO | NO
PPU Viewer | NO | NO | PPU Viewer | NO | NO |
Name Table Viewer | NO | NO | Name Table Viewer | NO | NO |
Memory Hex Editor | YES | YES | Memory Hex Editor | YES | YES |
Trace Logger | NO | NO | Trace Logger | YES | NO |
Code/Data Logger | NO | NO | Code/Data Logger | YES | NO |
Game Genie Encoder/Decoder | NO | NO | Game Genie Encoder/Decoder | NO | NO |
iNES Header Editor | NO | NO | iNES Header Editor | NO | NO |
Built in help pages | NO | NO | Built in help pages | NO | NO |

View File

@ -438,6 +438,7 @@ set(SRC_DRIVERS_SDL
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleUtilities.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleUtilities.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.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/AboutWindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp

View File

@ -865,10 +865,5 @@ void DebugCycle()
if(debug_loggingCD) if(debug_loggingCD)
LogCDData(opcode, A, size); 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); FCEUD_TraceInstruction(opcode, size);
#endif
} }

View File

@ -25,6 +25,7 @@
#include "Qt/LuaControl.h" #include "Qt/LuaControl.h"
#include "Qt/CheatsConf.h" #include "Qt/CheatsConf.h"
#include "Qt/HexEditor.h" #include "Qt/HexEditor.h"
#include "Qt/TraceLogger.h"
#include "Qt/CodeDataLogger.h" #include "Qt/CodeDataLogger.h"
#include "Qt/ConsoleDebugger.h" #include "Qt/ConsoleDebugger.h"
#include "Qt/ConsoleUtilities.h" #include "Qt/ConsoleUtilities.h"
@ -500,6 +501,14 @@ void consoleWin_t::createMainMenu(void)
debugMenu->addAction(hexEditAct); debugMenu->addAction(hexEditAct);
// 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);
// Debug -> Code/Data Logger // Debug -> Code/Data Logger
codeDataLogAct = new QAction(tr("Code/Data Logger..."), this); codeDataLogAct = new QAction(tr("Code/Data Logger..."), this);
//codeDataLogAct->setShortcut( QKeySequence(tr("Shift+F7"))); //codeDataLogAct->setShortcut( QKeySequence(tr("Shift+F7")));
@ -1023,6 +1032,11 @@ void consoleWin_t::openCodeDataLogger(void)
cdlWin->show(); cdlWin->show();
} }
void consoleWin_t::openTraceLogger(void)
{
openTraceLoggerWindow(this);
}
void consoleWin_t::toggleAutoResume(void) void consoleWin_t::toggleAutoResume(void)
{ {
//printf("Auto Resume: %i\n", autoResume->isChecked() ); //printf("Auto Resume: %i\n", autoResume->isChecked() );

View File

@ -91,6 +91,7 @@ class consoleWin_t : public QMainWindow
QAction *cheatsAct; QAction *cheatsAct;
QAction *debuggerAct; QAction *debuggerAct;
QAction *codeDataLogAct; QAction *codeDataLogAct;
QAction *traceLogAct;
QAction *hexEditAct; QAction *hexEditAct;
QAction *openMovAct; QAction *openMovAct;
QAction *stopMovAct; QAction *stopMovAct;
@ -135,6 +136,7 @@ class consoleWin_t : public QMainWindow
void openPaletteConfWin(void); void openPaletteConfWin(void);
void openGuiConfWin(void); void openGuiConfWin(void);
void openCodeDataLogger(void); void openCodeDataLogger(void);
void openTraceLogger(void);
void toggleAutoResume(void); void toggleAutoResume(void);
void toggleFullscreen(void); void toggleFullscreen(void);
void updatePeriodic(void); void updatePeriodic(void);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,153 @@
// TraceLogger.h
//
#pragma once
#include <QWidget>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QCheckBox>
#include <QPushButton>
#include <QLabel>
#include <QFrame>
#include <QTimer>
#include <QGroupBox>
#include <QScrollBar>
#include <QCloseEvent>
struct traceRecord_t
{
struct {
uint16_t PC;
uint8_t A;
uint8_t X;
uint8_t Y;
uint8_t S;
uint8_t P;
} cpu;
uint8_t opCode[3];
uint8_t opSize;
uint8_t asmTxtSize;
char asmTxt[64];
uint64_t frameCount;
uint64_t cycleCount;
uint64_t instrCount;
uint64_t flags;
int32_t callAddr;
int32_t romAddr;
int32_t bank;
int32_t skippedLines;
traceRecord_t(void);
int appendAsmText( const char *txt );
int convToText( char *line );
};
class QTraceLogView : public QWidget
{
Q_OBJECT
public:
QTraceLogView(QWidget *parent = 0);
~QTraceLogView(void);
void setScrollBars( QScrollBar *h, QScrollBar *v );
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
void calcFontData(void);
protected:
QFont font;
QScrollBar *vbar;
QScrollBar *hbar;
int pxCharWidth;
int pxCharHeight;
int pxLineSpacing;
int pxLineLead;
int pxCursorHeight;
int pxLineXScroll;
int pxLineWidth;
int viewLines;
int viewWidth;
int viewHeight;
};
class TraceLoggerDialog_t : public QDialog
{
Q_OBJECT
public:
TraceLoggerDialog_t(QWidget *parent = 0);
~TraceLoggerDialog_t(void);
protected:
QTimer *updateTimer;
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;
QTraceLogView *traceView;
QScrollBar *hbar;
QScrollBar *vbar;
int traceViewCounter;
void closeEvent(QCloseEvent *bar);
private:
public slots:
void closeWindow(void);
private slots:
void updatePeriodic(void);
void toggleLoggingOnOff(void);
void logRegStateChanged(int state);
void logFrameStateChanged(int state);
void logEmuMsgStateChanged(int state);
void symTraceEnaStateChanged(int state);
void logProcStatFlagStateChanged(int state);
void logCyclesCountStateChanged(int state);
void logBreakpointStateChanged(int state);
void useStackPointerStateChanged(int state);
void toLeftDisassemblyStateChanged(int state);
void logInstrCountStateChanged(int state);
void logBankNumStateChanged(int state);
void logNewMapCodeChanged(int state);
void logNewMapDataChanged(int state);
void logMaxLinesChanged(int index);
void hbarChanged(int value);
void vbarChanged(int value);
void openLogFile(void);
};
int initTraceLogBuffer( int maxRecs );
void openTraceLoggerWindow( QWidget *parent );

View File

@ -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) static void closeDebuggerWindow (GtkWidget * w, GdkEvent * e, debuggerWin_t * dw)
{ {
std::list < debuggerWin_t * >::iterator it; std::list < debuggerWin_t * >::iterator it;