First cut at implementing instruction step back function using trace logger data.
This commit is contained in:
parent
09117e5286
commit
07f73c2fb9
|
@ -207,6 +207,9 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
|
||||||
pcColorAct->connectColor( &asmView->pcBgColor);
|
pcColorAct->connectColor( &asmView->pcBgColor);
|
||||||
|
|
||||||
connect( this, SIGNAL(rejected(void)), this, SLOT(deleteLater(void)));
|
connect( this, SIGNAL(rejected(void)), this, SLOT(deleteLater(void)));
|
||||||
|
|
||||||
|
// Start Trace Logger for Step Back Function
|
||||||
|
FCEUD_TraceLoggerStart();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ConsoleDebugger::~ConsoleDebugger(void)
|
ConsoleDebugger::~ConsoleDebugger(void)
|
||||||
|
@ -2750,7 +2753,10 @@ void ConsoleDebugger::debugStepBackCB(void)
|
||||||
{
|
{
|
||||||
if (FCEUI_EmulationPaused())
|
if (FCEUI_EmulationPaused())
|
||||||
{
|
{
|
||||||
|
fceuWrapperLock();
|
||||||
|
FCEUD_TraceLoggerBackUpInstruction();
|
||||||
|
updateWindowData();
|
||||||
|
fceuWrapperUnLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1191,6 +1191,19 @@ static void pushMsgToLogBuffer(const char *msg)
|
||||||
pushToLogBuffer(rec);
|
pushToLogBuffer(rec);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
int FCEUD_TraceLoggerStart(void)
|
||||||
|
{
|
||||||
|
if ( !logging )
|
||||||
|
{
|
||||||
|
if (recBufMax == 0)
|
||||||
|
{
|
||||||
|
initTraceLogBuffer(1000000);
|
||||||
|
}
|
||||||
|
logging = 1;
|
||||||
|
}
|
||||||
|
return logging;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
int FCEUD_TraceLoggerRunning(void)
|
int FCEUD_TraceLoggerRunning(void)
|
||||||
{
|
{
|
||||||
return logging;
|
return logging;
|
||||||
|
@ -2459,3 +2472,43 @@ void TraceLogDiskThread_t::run(void)
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
//--- Trace Logger BackUp (Undo) Instruction
|
||||||
|
//----------------------------------------------------
|
||||||
|
static int undoInstruction( traceRecord_t &rec )
|
||||||
|
{
|
||||||
|
// TODO Undo memory writes
|
||||||
|
//printf("BackUp (Undo) Instruction\n");
|
||||||
|
X.PC = rec.cpu.PC;
|
||||||
|
X.A = rec.cpu.A;
|
||||||
|
X.X = rec.cpu.X;
|
||||||
|
X.Y = rec.cpu.Y;
|
||||||
|
X.S = rec.cpu.S;
|
||||||
|
X.P = rec.cpu.P;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
|
int FCEUD_TraceLoggerBackUpInstruction(void)
|
||||||
|
{
|
||||||
|
int ret, idx;
|
||||||
|
|
||||||
|
if ( recBufNum <= 0 )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
idx = recBufHead - 1;
|
||||||
|
|
||||||
|
if ( idx < 0 )
|
||||||
|
{
|
||||||
|
idx += recBufMax;
|
||||||
|
}
|
||||||
|
ret = undoInstruction( recBuf[idx] );
|
||||||
|
|
||||||
|
if ( ret == 0 )
|
||||||
|
{
|
||||||
|
recBufNum--;
|
||||||
|
recBufHead = idx;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
|
@ -226,4 +226,6 @@ int initTraceLogBuffer(int maxRecs);
|
||||||
|
|
||||||
void openTraceLoggerWindow(QWidget *parent);
|
void openTraceLoggerWindow(QWidget *parent);
|
||||||
|
|
||||||
|
int FCEUD_TraceLoggerStart(void);
|
||||||
int FCEUD_TraceLoggerRunning(void);
|
int FCEUD_TraceLoggerRunning(void);
|
||||||
|
int FCEUD_TraceLoggerBackUpInstruction(void);
|
||||||
|
|
Loading…
Reference in New Issue