For Qt debugger. Added logic to make byte code display configurable. Saved color configs to file.

This commit is contained in:
mjbudd77 2021-07-10 16:49:18 -04:00
parent 8314f7bad1
commit fcf250e350
7 changed files with 166 additions and 35 deletions

View File

@ -31,13 +31,15 @@
#include <QStyle> #include <QStyle>
#include "Qt/ColorMenu.h" #include "Qt/ColorMenu.h"
#include "Qt/fceuWrapper.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ColorMenuItem::ColorMenuItem( QString txt, QWidget *parent) ColorMenuItem::ColorMenuItem( QString txt, const char *confNameConst, QWidget *parent)
: QAction( txt, parent) : QAction( txt, parent)
{ {
title = txt; title = txt;
picker = NULL; picker = NULL;
colorPtr = &lastColor; colorPtr = &lastColor;
confName = confNameConst;
setImageColor( Qt::red ); setImageColor( Qt::red );
@ -108,6 +110,22 @@ void ColorMenuItem::pickerClosed(int ret)
picker = NULL; picker = NULL;
setImageColor( *colorPtr ); setImageColor( *colorPtr );
if ( ret )
{
if ( confName != NULL )
{
QString colorText;
colorText = colorPtr->name();
//printf("Saving '%s' = Color string '%s'\n", confName.c_str(), colorText.toStdString().c_str() );
g_config->setOption( confName, colorText.toStdString().c_str() );
g_config->save();
}
}
//printf("Picker Closed: %i\n", ret ); //printf("Picker Closed: %i\n", ret );
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -116,7 +134,7 @@ void ColorMenuItem::openColorPicker(void)
//printf("Open Color Picker\n"); //printf("Open Color Picker\n");
if ( picker == NULL ) if ( picker == NULL )
{ {
picker = new ColorMenuPickerDialog_t( colorPtr, parentWidget() ); picker = new ColorMenuPickerDialog_t( colorPtr, title.toStdString().c_str(), parentWidget() );
picker->show(); picker->show();
@ -130,7 +148,7 @@ void ColorMenuItem::openColorPicker(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
//------ Color Menu Picker //------ Color Menu Picker
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ColorMenuPickerDialog_t::ColorMenuPickerDialog_t( QColor *c, QWidget *parent ) ColorMenuPickerDialog_t::ColorMenuPickerDialog_t( QColor *c, const char *txt, QWidget *parent )
: QDialog( parent ) : QDialog( parent )
{ {
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
@ -143,7 +161,7 @@ ColorMenuPickerDialog_t::ColorMenuPickerDialog_t( QColor *c, QWidget *parent )
style = this->style(); style = this->style();
sprintf( stmp, "Pick Color"); sprintf( stmp, "Pick Color for %s", txt);
setWindowTitle( stmp ); setWindowTitle( stmp );
@ -220,7 +238,7 @@ void ColorMenuPickerDialog_t::colorChanged( const QColor &color )
void ColorMenuPickerDialog_t::colorAccepted(void) void ColorMenuPickerDialog_t::colorAccepted(void)
{ {
//printf("nesColorPicker Accepted: %zi\n", colorChangeHistory.size() ); //printf("nesColorPicker Accepted: %zi\n", colorChangeHistory.size() );
done(0); done(1);
deleteLater(); deleteLater();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -16,7 +16,7 @@ class ColorMenuPickerDialog_t : public QDialog
Q_OBJECT Q_OBJECT
public: public:
ColorMenuPickerDialog_t( QColor *c, QWidget *parent = 0); ColorMenuPickerDialog_t( QColor *c, const char *txt, QWidget *parent = 0);
~ColorMenuPickerDialog_t(void); ~ColorMenuPickerDialog_t(void);
protected: protected:
@ -41,7 +41,7 @@ class ColorMenuItem : public QAction
Q_OBJECT Q_OBJECT
public: public:
ColorMenuItem( QString txt, QWidget *parent = 0); ColorMenuItem( QString txt, const char *confName, QWidget *parent = 0);
~ColorMenuItem(void); ~ColorMenuItem(void);
void connectColor( QColor *c ); void connectColor( QColor *c );
@ -50,6 +50,7 @@ class ColorMenuItem : public QAction
QColor *colorPtr; QColor *colorPtr;
QColor lastColor; QColor lastColor;
ColorMenuPickerDialog_t *picker; ColorMenuPickerDialog_t *picker;
const char *confName;
void setImageColor( QColor c ); void setImageColor( QColor c );
public slots: public slots:

View File

@ -419,20 +419,37 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
subMenu = optMenu->addMenu(tr("&Color Selection")); subMenu = optMenu->addMenu(tr("&Color Selection"));
// Options -> Color Selection -> Opcodes // Options -> Color Selection -> Opcodes
opcodeColorAct = new ColorMenuItem( tr("&Opcodes"), this); opcodeColorAct = new ColorMenuItem( tr("&Opcodes"), "SDL.DebuggerSyntaxColorOpcode", this);
subMenu->addAction(opcodeColorAct); subMenu->addAction(opcodeColorAct);
// Options -> Color Selection -> Address Values
addressColorAct = new ColorMenuItem( tr("&Address Values"), "SDL.DebuggerSyntaxColorAddress", this);
subMenu->addAction(addressColorAct);
// Options -> Color Selection -> Immediate Values
immediateColorAct = new ColorMenuItem( tr("&Immediate Values"), "SDL.DebuggerSyntaxColorImmediate", this);
subMenu->addAction(immediateColorAct);
// Options -> Color Selection -> Labels // Options -> Color Selection -> Labels
labelColorAct = new ColorMenuItem( tr("&Labels"), this); labelColorAct = new ColorMenuItem( tr("&Labels"), "SDL.DebuggerSyntaxColorLabel", this);
subMenu->addAction(labelColorAct); subMenu->addAction(labelColorAct);
// Options -> Color Selection -> Comments // Options -> Color Selection -> Comments
commentColorAct = new ColorMenuItem( tr("&Comments"), this); commentColorAct = new ColorMenuItem( tr("&Comments"), "SDL.DebuggerSyntaxColorComment", this);
subMenu->addAction(commentColorAct); subMenu->addAction(commentColorAct);
subMenu->addSeparator();
// Options -> Color Selection -> (PC) Active Statement
pcColorAct = new ColorMenuItem( tr("(&PC) Active Statement BG"), "SDL.DebuggerSyntaxColorPC", this);
subMenu->addAction(pcColorAct);
optMenu->addSeparator(); optMenu->addSeparator();
// Symbols // Symbols
@ -450,6 +467,16 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
symMenu->addSeparator(); symMenu->addSeparator();
// Symbols -> Show Byte Codes
act = new QAction(tr("Show &Byte Codes"), this);
//act->setShortcut(QKeySequence( tr("F7") ) );
act->setStatusTip(tr("Show &Byte Codes"));
act->setCheckable(true);
act->setChecked(false);
connect( act, SIGNAL(triggered(bool)), this, SLOT(displayByteCodesCB(bool)) );
symMenu->addAction(act);
// Symbols -> Display ROM Offsets // Symbols -> Display ROM Offsets
act = new QAction(tr("Show ROM &Offsets"), this); act = new QAction(tr("Show ROM &Offsets"), this);
//act->setShortcut(QKeySequence( tr("F7") ) ); //act->setShortcut(QKeySequence( tr("F7") ) );
@ -995,9 +1022,12 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
setCpuStatusFont( cpuFont ); setCpuStatusFont( cpuFont );
opcodeColorAct->connectColor( &asmView->opcodeColor ); opcodeColorAct->connectColor( &asmView->opcodeColor );
labelColorAct->connectColor( &asmView->labelColor ); addressColorAct->connectColor( &asmView->addressColor );
commentColorAct->connectColor( &asmView->commentColor); immediateColorAct->connectColor( &asmView->immediateColor );
labelColorAct->connectColor( &asmView->labelColor );
commentColorAct->connectColor( &asmView->commentColor);
pcColorAct->connectColor( &asmView->pcBgColor);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ConsoleDebugger::~ConsoleDebugger(void) ConsoleDebugger::~ConsoleDebugger(void)
@ -1866,6 +1896,11 @@ void ConsoleDebugger::instructionsThresChanged(const QString &txt)
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::displayByteCodesCB( bool value )
{
asmView->setDisplayByteCodes(value);
}
//----------------------------------------------------------------------------
void ConsoleDebugger::displayROMoffsetCB( bool value ) void ConsoleDebugger::displayROMoffsetCB( bool value )
{ {
asmView->setDisplayROMoffsets(value); asmView->setDisplayROMoffsets(value);
@ -2796,11 +2831,11 @@ void QAsmView::updateAssemblyView(void)
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
{ {
sprintf(chr, "%02X ", opcode[j] = GetMem(addr++)); sprintf(chr, "%02X ", opcode[j] = GetMem(addr++));
line.append(chr); if ( showByteCodes ) line.append(chr);
} }
while (size < 3) while (size < 3)
{ {
line.append(" "); //pad output to align ASM if ( showByteCodes ) line.append(" "); //pad output to align ASM
size++; size++;
} }
@ -2816,7 +2851,7 @@ void QAsmView::updateAssemblyView(void)
// special case: an RTS opcode // special case: an RTS opcode
if (GetMem(instruction_addr) == 0x60) if (GetMem(instruction_addr) == 0x60)
{ {
line.append("-------------------------"); line.append(" -------------------------");
} }
if ( symbolicDebugEnable ) if ( symbolicDebugEnable )
@ -2875,6 +2910,8 @@ void QAsmView::updateAssemblyView(void)
{ {
stmp[j] = ' '; j++; stmp[j] = ' '; j++;
} }
stmp[j] = ';'; j++;
stmp[j] = ' '; j++;
} }
stmp[j] = c[i]; j++; i++; stmp[j] = c[i]; j++; i++;
} }
@ -3686,12 +3723,20 @@ QAsmView::QAsmView(QWidget *parent)
useDarkTheme = false; useDarkTheme = false;
pcBgColor.setRgb( 255, 255, 0 );
opcodeColor.setRgb( 46, 139, 87 ); opcodeColor.setRgb( 46, 139, 87 );
labelColor.setRgb( 165, 42, 42 ); labelColor.setRgb( 165, 42, 42 );
commentColor.setRgb( 0, 0, 255 ); commentColor.setRgb( 0, 0, 255 );
addressColor.setRgb( 106, 90, 205 ); addressColor.setRgb( 106, 90, 205 );
immediateColor.setRgb( 255, 1, 255 ); immediateColor.setRgb( 255, 1, 255 );
fceuLoadConfigColor( "SDL.DebuggerSyntaxColorOpcode" , &opcodeColor );
fceuLoadConfigColor( "SDL.DebuggerSyntaxColorAddress" , &addressColor );
fceuLoadConfigColor( "SDL.DebuggerSyntaxColorImmediate", &immediateColor );
fceuLoadConfigColor( "SDL.DebuggerSyntaxColorLabel" , &labelColor );
fceuLoadConfigColor( "SDL.DebuggerSyntaxColorComment" , &commentColor );
fceuLoadConfigColor( "SDL.DebuggerSyntaxColorPC" , &pcBgColor );
g_config->getOption("SDL.DebuggerAsmFont", &fontString); g_config->getOption("SDL.DebuggerAsmFont", &fontString);
if ( fontString.size() > 0 ) if ( fontString.size() > 0 )
@ -3743,14 +3788,13 @@ QAsmView::QAsmView(QWidget *parent)
calcFontData(); calcFontData();
setMinimumWidth( 50 * pxCharWidth );
vbar = NULL; vbar = NULL;
hbar = NULL; hbar = NULL;
asmPC = NULL; asmPC = NULL;
displayROMoffsets = false; displayROMoffsets = false;
symbolicDebugEnable = true; symbolicDebugEnable = true;
registerNameEnable = true; registerNameEnable = true;
showByteCodes = false;
maxLineLen = 0; maxLineLen = 0;
pxLineWidth = 0; pxLineWidth = 0;
lineOffset = 0; lineOffset = 0;
@ -3790,10 +3834,7 @@ QAsmView::QAsmView(QWidget *parent)
//printf("clipboard->supportsSelection() : '%i' \n", clipboard->supportsSelection() ); //printf("clipboard->supportsSelection() : '%i' \n", clipboard->supportsSelection() );
//printf("clipboard->supportsFindBuffer(): '%i' \n", clipboard->supportsFindBuffer() ); //printf("clipboard->supportsFindBuffer(): '%i' \n", clipboard->supportsFindBuffer() );
pcLocLinePos = 4; calcLineOffsets();
byteCodeLinePos = 12;
opcodeLinePos = 22;
operandLinePos = 25;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
QAsmView::~QAsmView(void) QAsmView::~QAsmView(void)
@ -3810,6 +3851,14 @@ void QAsmView::asmClear(void)
asmEntry.clear(); asmEntry.clear();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QAsmView::calcLineOffsets(void)
{
pcLocLinePos = 4;
byteCodeLinePos = pcLocLinePos + 8; // 12;
opcodeLinePos = byteCodeLinePos + (showByteCodes ? 10 : 1); //22;
operandLinePos = opcodeLinePos + 3; // 25;
}
//----------------------------------------------------------------------------
void QAsmView::setLine(int lineNum) void QAsmView::setLine(int lineNum)
{ {
lineOffset = lineNum; lineOffset = lineNum;
@ -3881,6 +3930,21 @@ void QAsmView::scrollToPC(void)
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QAsmView::setDisplayByteCodes( bool value )
{
if ( value != showByteCodes )
{
showByteCodes = value;
calcLineOffsets();
calcMinimumWidth();
fceuWrapperLock();
updateAssemblyView();
fceuWrapperUnLock();
}
}
//----------------------------------------------------------------------------
void QAsmView::setDisplayROMoffsets( bool value ) void QAsmView::setDisplayROMoffsets( bool value )
{ {
if ( value != displayROMoffsets ) if ( value != displayROMoffsets )
@ -3941,6 +4005,20 @@ void QAsmView::calcFontData(void)
pxCursorHeight = pxCharHeight; pxCursorHeight = pxCharHeight;
viewLines = (viewHeight / pxLineSpacing) + 1; viewLines = (viewHeight / pxLineSpacing) + 1;
calcMinimumWidth();
}
//----------------------------------------------------------------------------
void QAsmView::calcMinimumWidth(void)
{
if ( showByteCodes )
{
setMinimumWidth( 50 * pxCharWidth );
}
else
{
setMinimumWidth( 41 * pxCharWidth );
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QAsmView::setScrollBars( QScrollBar *h, QScrollBar *v ) void QAsmView::setScrollBars( QScrollBar *h, QScrollBar *v )
@ -3963,13 +4041,13 @@ bool QAsmView::event(QEvent *event)
opcodeValid = (line < asmEntry.size()) && (asmEntry[line]->size > 0) && opcodeValid = (line < asmEntry.size()) && (asmEntry[line]->size > 0) &&
(asmEntry[line]->type == dbg_asm_entry_t::ASM_TEXT); (asmEntry[line]->type == dbg_asm_entry_t::ASM_TEXT);
showOpcodeDesc = (c.x() >= 22) && (c.x() < 25) && opcodeValid; showOpcodeDesc = (c.x() >= opcodeLinePos) && (c.x() < operandLinePos) && opcodeValid;
if ( (c.x() > 25) && opcodeValid && (asmEntry[line]->sym.name.size() > 0) ) if ( (c.x() > operandLinePos) && opcodeValid && (asmEntry[line]->sym.name.size() > 0) )
{ {
size_t subStrLoc = asmEntry[line]->text.find( asmEntry[line]->sym.name, 25 ); size_t subStrLoc = asmEntry[line]->text.find( asmEntry[line]->sym.name, operandLinePos );
if ( (subStrLoc != std::string::npos) && (subStrLoc > 25) ) if ( (subStrLoc != std::string::npos) && (subStrLoc > operandLinePos) )
{ {
//printf("Line:%i asmEntry DB Sym: %zi '%s'\n", line, subStrLoc, asmEntry[line]->sym.name.c_str() ); //printf("Line:%i asmEntry DB Sym: %zi '%s'\n", line, subStrLoc, asmEntry[line]->sym.name.c_str() );
int symTextStart = subStrLoc; int symTextStart = subStrLoc;
@ -4404,9 +4482,9 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
if ( asmEntry[line]->sym.name.size() > 0 ) if ( asmEntry[line]->sym.name.size() > 0 )
{ {
size_t subStrLoc = asmEntry[line]->text.find( asmEntry[line]->sym.name, 25 ); size_t subStrLoc = asmEntry[line]->text.find( asmEntry[line]->sym.name, operandLinePos );
if ( (subStrLoc != std::string::npos) && (subStrLoc > 25) ) if ( (subStrLoc != std::string::npos) && (subStrLoc > operandLinePos) )
{ {
//printf("Line:%i asmEntry DB Sym: %zi '%s'\n", line, subStrLoc, asmEntry[line]->sym.name.c_str() ); //printf("Line:%i asmEntry DB Sym: %zi '%s'\n", line, subStrLoc, asmEntry[line]->sym.name.c_str() );
symTextStart = subStrLoc; symTextStart = subStrLoc;
@ -4839,7 +4917,11 @@ void QAsmView::paintEvent(QPaintEvent *event)
painter.fillRect( 0, 0, viewWidth, viewHeight, this->palette().color(QPalette::Window) ); painter.fillRect( 0, 0, viewWidth, viewHeight, this->palette().color(QPalette::Window) );
painter.fillRect( 0, 0, cd_boundary, viewHeight, this->palette().color(QPalette::Mid) ); painter.fillRect( 0, 0, cd_boundary, viewHeight, this->palette().color(QPalette::Mid) );
painter.fillRect( asm_start_boundary, 0, (9*pxCharWidth), viewHeight, this->palette().color(QPalette::AlternateBase) );
if ( showByteCodes )
{
painter.fillRect( asm_start_boundary, 0, (9*pxCharWidth), viewHeight, this->palette().color(QPalette::AlternateBase) );
}
y = pxLineSpacing; y = pxLineSpacing;
@ -4856,7 +4938,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
{ {
if ( l == asmPC->line ) if ( l == asmPC->line )
{ {
painter.fillRect( cd_boundary, y - pxLineSpacing + pxLineLead, viewWidth, pxLineSpacing, QColor("pink") ); painter.fillRect( cd_boundary, y - pxLineSpacing + pxLineLead, viewWidth, pxLineSpacing, pcBgColor );
forceDarkColor = true; forceDarkColor = true;
} }
} }
@ -5131,6 +5213,11 @@ DebuggerStackDisplay::DebuggerStackDisplay(QWidget *parent)
QFont font; QFont font;
std::string fontString; std::string fontString;
stackBytesPerLine = 4;
showAddrs = true;
recalcCharsPerLine();
g_config->getOption("SDL.DebuggerStackFont", &fontString); g_config->getOption("SDL.DebuggerStackFont", &fontString);
if ( fontString.size() > 0 ) if ( fontString.size() > 0 )
@ -5147,9 +5234,6 @@ DebuggerStackDisplay::DebuggerStackDisplay(QWidget *parent)
QFontMetrics fm(font); QFontMetrics fm(font);
stackBytesPerLine = 4;
showAddrs = true;
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0) #if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
pxCharWidth = fm.horizontalAdvance(QLatin1Char('2')); pxCharWidth = fm.horizontalAdvance(QLatin1Char('2'));
#else #else
@ -5157,8 +5241,6 @@ DebuggerStackDisplay::DebuggerStackDisplay(QWidget *parent)
#endif #endif
pxLineSpacing = fm.lineSpacing(); pxLineSpacing = fm.lineSpacing();
recalcCharsPerLine();
setMinimumWidth( pxCharWidth * charsPerLine ); setMinimumWidth( pxCharWidth * charsPerLine );
setMinimumHeight( pxLineSpacing * 5 ); setMinimumHeight( pxLineSpacing * 5 );
setMaximumHeight( pxLineSpacing * 20 ); setMaximumHeight( pxLineSpacing * 20 );

View File

@ -115,6 +115,7 @@ class QAsmView : public QWidget
void setDisplayROMoffsets( bool value ); void setDisplayROMoffsets( bool value );
void setSymbolDebugEnable( bool value ); void setSymbolDebugEnable( bool value );
void setRegisterNameEnable( bool value ); void setRegisterNameEnable( bool value );
void setDisplayByteCodes( bool value );
int getCtxMenuAddr(void){ return ctxMenuAddr; }; int getCtxMenuAddr(void){ return ctxMenuAddr; };
int getCursorAddr(void){ return cursorLineAddr; }; int getCursorAddr(void){ return cursorLineAddr; };
void setPC_placement( int mode, int ofs = 0 ); void setPC_placement( int mode, int ofs = 0 );
@ -129,6 +130,7 @@ class QAsmView : public QWidget
QColor immediateColor; QColor immediateColor;
QColor commentColor; QColor commentColor;
QColor labelColor; QColor labelColor;
QColor pcBgColor;
protected: protected:
bool event(QEvent *event) override; bool event(QEvent *event) override;
@ -145,6 +147,8 @@ class QAsmView : public QWidget
void toggleBreakpoint(int line); void toggleBreakpoint(int line);
void calcFontData(void); void calcFontData(void);
void calcMinimumWidth(void);
void calcLineOffsets(void);
QPoint convPixToCursor( QPoint p ); QPoint convPixToCursor( QPoint p );
bool textIsHighlighted(void); bool textIsHighlighted(void);
void setHighlightEndCoord( int x, int y ); void setHighlightEndCoord( int x, int y );
@ -208,6 +212,7 @@ class QAsmView : public QWidget
bool symbolicDebugEnable; bool symbolicDebugEnable;
bool registerNameEnable; bool registerNameEnable;
bool mouseLeftBtnDown; bool mouseLeftBtnDown;
bool showByteCodes;
}; };
@ -314,8 +319,11 @@ class ConsoleDebugger : public QDialog
QFont font; QFont font;
ColorMenuItem *opcodeColorAct; ColorMenuItem *opcodeColorAct;
ColorMenuItem *addressColorAct;
ColorMenuItem *immediateColorAct;
ColorMenuItem *commentColorAct; ColorMenuItem *commentColorAct;
ColorMenuItem *labelColorAct; ColorMenuItem *labelColorAct;
ColorMenuItem *pcColorAct;
int selBmAddrVal; int selBmAddrVal;
bool windowUpdateReq; bool windowUpdateReq;
@ -355,6 +363,7 @@ class ConsoleDebugger : public QDialog
void delete_BM_CB(void); void delete_BM_CB(void);
void resetCountersCB (void); void resetCountersCB (void);
void reloadSymbolsCB(void); void reloadSymbolsCB(void);
void displayByteCodesCB(bool value);
void displayROMoffsetCB(bool value); void displayROMoffsetCB(bool value);
void symbolDebugEnableCB(bool value); void symbolDebugEnableCB(bool value);
void registerNameEnableCB(bool value); void registerNameEnableCB(bool value);

View File

@ -38,6 +38,7 @@
#include "../../fceu.h" #include "../../fceu.h"
#include "../../x6502.h" #include "../../x6502.h"
#include "Qt/fceuWrapper.h"
#include "Qt/ConsoleUtilities.h" #include "Qt/ConsoleUtilities.h"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -290,7 +291,19 @@ int fceuExecutablePath( char *outputPath, int outputSize )
#endif #endif
return -1; return -1;
} }
//---------------------------------------------------------------------------
int fceuLoadConfigColor( const char *confName, QColor *color )
{
std::string colorString;
g_config->getOption(confName, &colorString);
if ( (color != NULL) && (colorString.size() > 0) )
{
color->setNamedColor( colorString.c_str() );
}
return 0;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// FCEU Data Entry Custom Validators // FCEU Data Entry Custom Validators
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -2,6 +2,7 @@
#pragma once #pragma once
#include <QColor>
#include <QValidator> #include <QValidator>
int getDirFromFile( const char *path, char *dir ); int getDirFromFile( const char *path, char *dir );
@ -14,6 +15,7 @@ int parseFilepath( const char *filepath, char *dir, char *base, char *suffix = N
int fceuExecutablePath( char *outputPath, int outputSize ); int fceuExecutablePath( char *outputPath, int outputSize );
int fceuLoadConfigColor( const char *confName, QColor *color );
class fceuDecIntValidtor : public QValidator class fceuDecIntValidtor : public QValidator
{ {

View File

@ -577,6 +577,12 @@ InitConfig()
config->addOption("SDL.DebuggerAsmFont" , ""); config->addOption("SDL.DebuggerAsmFont" , "");
config->addOption("SDL.DebuggerStackFont" , ""); config->addOption("SDL.DebuggerStackFont" , "");
config->addOption("SDL.DebuggerCpuStatusFont" , ""); config->addOption("SDL.DebuggerCpuStatusFont" , "");
config->addOption("SDL.DebuggerSyntaxColorOpcode", "");
config->addOption("SDL.DebuggerSyntaxColorAddress", "");
config->addOption("SDL.DebuggerSyntaxColorImmediate", "");
config->addOption("SDL.DebuggerSyntaxColorLabel", "");
config->addOption("SDL.DebuggerSyntaxColorComment", "");
config->addOption("SDL.DebuggerSyntaxColorPC", "");
// Code Data Logger Options // Code Data Logger Options
config->addOption("autoSaveCDL" , "SDL.AutoSaveCDL", 1); config->addOption("autoSaveCDL" , "SDL.AutoSaveCDL", 1);