Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions bsnes/ui-qt/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ Configuration::Configuration() {
attach(debugger.saveSymbols = true, "debugger.saveSymbols");
attach(debugger.showHClocks = false, "debugger.showHClocks");

attach(debugger.disassembler.opColor = "#000088", "debugger.disassembler.opColor");
attach(debugger.disassembler.paramImmediateColor = "#008800", "debugger.disassembler.paramImmediatColor");
attach(debugger.disassembler.paramAddressColor = "#880000", "debugger.disassembler.paramAddressColor");
attach(debugger.disassembler.paramSymbolColor = "#ff0000", "debugger.disassembler.paramSymbolColor");

attach(debugger.console.breakpointColor = "#a000a0", "debugger.console.breakpointColor");
attach(debugger.console.cpuStepColor = "#0000a0", "debugger.console.cpuStepColor");
attach(debugger.console.smpStepColor = "#a00000", "debugger.console.smpStepColor");
attach(debugger.console.coprocessorStepColor = "#008000", "debugger.console.coprocessorStepColor");

attach(debugger.hexEditor.readUsageColor = "#0000e0", "debugger.hexEditor.readUsageColor");
attach(debugger.hexEditor.writeUsageColor = "#0000e0", "debugger.hexEditor.writeUsageColor");
attach(debugger.hexEditor.execUsageColor = "#e00000", "debugger.hexEditor.execUsageColor");
attach(debugger.hexEditor.rweUsageColor = "#e000e0", "debugger.hexEditor.rweUsageColor");

attach(geometry.mainWindow = "", "geometry.mainWindow");
attach(geometry.loaderWindow = "", "geometry.loaderWindow");
attach(geometry.stateSelectWindow = "", "geometry.stateSelectWindow");
Expand All @@ -154,6 +169,7 @@ Configuration::Configuration() {
attach(geometry.breakpointEditor = "", "geometry.breakpointEditor");
attach(geometry.memoryEditor = "", "geometry.memoryEditor");
attach(geometry.propertiesViewer = "", "geometry.propertiesViewer");
attach(geometry.debuggerColors = "", "geometry.debuggerColors");
attach(geometry.layerToggle = "", "geometry.layerToggle");
attach(geometry.tileViewer = "", "geometry.tileViewer");
attach(geometry.tilemapViewer = "", "geometry.tilemapViewer");
Expand Down
22 changes: 22 additions & 0 deletions bsnes/ui-qt/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@ class Configuration : public configuration {
bool loadDefaultSymbols;
bool saveSymbols;
bool showHClocks;

struct Disassembler {
string opColor;
string paramImmediateColor;
string paramAddressColor;
string paramSymbolColor;
} disassembler;

struct Console {
string breakpointColor;
string cpuStepColor;
string smpStepColor;
string coprocessorStepColor;
} console;

struct HexEditor {
string readUsageColor;
string writeUsageColor;
string execUsageColor;
string rweUsageColor;
} hexEditor;
} debugger;

struct Geometry {
Expand All @@ -103,6 +124,7 @@ class Configuration : public configuration {
string breakpointEditor;
string memoryEditor;
string propertiesViewer;
string debuggerColors;
string layerToggle;
string tileViewer;
string tilemapViewer;
Expand Down
84 changes: 74 additions & 10 deletions bsnes/ui-qt/debugger/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Debugger *debugger;
#include "debuggerview.cpp"

#include "tools/breakpoint.cpp"
#include "tools/debuggercolors.cpp"
#include "tools/memory.cpp"
#include "tools/properties.cpp"

Expand Down Expand Up @@ -86,13 +87,16 @@ Debugger::Debugger() {
menu_misc_showHClocks->setCheckable(true);
menu_misc_showHClocks->setChecked(config().debugger.showHClocks);

menu_misc_editColors = menu_misc->addAction("Edit c&olors ...");

tracer = new Tracer;
breakpointEditor = new BreakpointEditor;
propertiesViewer = new PropertiesViewer;
tileViewer = new TileViewer;
tilemapViewer = new TilemapViewer;
oamViewer = new OamViewer;
cgramViewer = new CgramViewer;
debuggerColors = new DebuggerColorsWindow;

registerEditCPU = new RegisterEditCPU(SNES::cpu);
registerEditSMP = new RegisterEditSMP;
Expand Down Expand Up @@ -226,6 +230,7 @@ Debugger::Debugger() {
connect(menu_misc_loadDefaultSymbols, SIGNAL(triggered()), this, SLOT(synchronize()));
connect(menu_misc_saveSymbols, SIGNAL(triggered()), this, SLOT(synchronize()));
connect(menu_misc_showHClocks, SIGNAL(triggered()), this, SLOT(synchronize()));
connect(menu_misc_editColors, SIGNAL(triggered()), debuggerColors, SLOT(show()));

connect(runBreak->defaultAction(), SIGNAL(triggered()), this, SLOT(toggleRunStatus()));

Expand All @@ -250,6 +255,9 @@ Debugger::Debugger() {
connect(debugSGB, SIGNAL(traceStateChanged(int)), tracer, SLOT(setSgbTraceState(int)));
connect(traceMask->defaultAction(), SIGNAL(toggled(bool)), tracer, SLOT(setTraceMaskState(bool)));

connect(debuggerColors, SIGNAL(disassemblerColorChanged()), this, SLOT(refreshDebuggerViews()));
connect(debuggerColors, SIGNAL(hexEditorColorChanged()), this, SLOT(refreshMemoryEditors()));

frameCounter = 0;
synchronize();
resize(855, 745);
Expand Down Expand Up @@ -588,7 +596,11 @@ void Debugger::event() {
SNES::cpu.disassemble_opcode(t, SNES::cpu.opcode_pc, config().debugger.showHClocks);
string s = t;
s.replace(" ", " ");
echo(string() << "<font color='#a000a0'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.breakpointColor());
if (!color.isValid()) {
color = QColor("#a000a0");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugCPU->refresh(SNES::cpu.opcode_pc);
registerEditCPU->setEnabled(true);
editTabs->setCurrentIndex(0);
Expand All @@ -600,7 +612,11 @@ void Debugger::event() {
SNES::sa1.disassemble_opcode(t, SNES::sa1.opcode_pc, config().debugger.showHClocks);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#a000a0'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.breakpointColor());
if (!color.isValid()) {
color = QColor("#a000a0");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSA1->refresh(SNES::sa1.opcode_pc);
registerEditSA1->setEnabled(true);
editTabs->setCurrentIndex(editTabs->indexOf(debugSA1));
Expand All @@ -613,7 +629,11 @@ void Debugger::event() {
SNES::smp.disassemble_opcode(t, SNES::smp.opcode_pc);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#a000a0'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.breakpointColor());
if (!color.isValid()) {
color = QColor("#a000a0");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSMP->refresh(SNES::smp.opcode_pc);
registerEditSMP->setEnabled(true);
editTabs->setCurrentIndex(1);
Expand All @@ -625,7 +645,11 @@ void Debugger::event() {
SNES::superfx.disassemble_opcode(t, SNES::superfx.opcode_pc);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#a000a0'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.breakpointColor());
if (!color.isValid()) {
color = QColor("#a000a0");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSFX->refresh(SNES::superfx.opcode_pc);
registerEditSFX->setEnabled(true);
editTabs->setCurrentIndex(editTabs->indexOf(debugSFX));
Expand All @@ -637,7 +661,11 @@ void Debugger::event() {
SNES::supergameboy.disassemble_opcode(t, SNES::supergameboy.opcode_pc);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#a000a0'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.breakpointColor());
if (!color.isValid()) {
color = QColor("#a000a0");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSGB->refresh(SNES::supergameboy.opcode_pc);
registerEditSGB->setEnabled(true);
editTabs->setCurrentIndex(editTabs->indexOf(debugSGB));
Expand All @@ -649,7 +677,11 @@ void Debugger::event() {
SNES::cpu.disassemble_opcode(t, SNES::cpu.opcode_pc, config().debugger.showHClocks);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#0000a0'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.cpuStepColor());
if (!color.isValid()) {
color = QColor("#0000a0");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugCPU->refresh(SNES::cpu.opcode_pc);
registerEditCPU->setEnabled(true);
} break;
Expand All @@ -658,7 +690,11 @@ void Debugger::event() {
SNES::smp.disassemble_opcode(t, SNES::smp.opcode_pc);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#a00000'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.smpStepColor());
if (!color.isValid()) {
color = QColor("#a00000");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSMP->refresh(SNES::smp.opcode_pc);
registerEditSMP->setEnabled(true);
} break;
Expand All @@ -667,7 +703,11 @@ void Debugger::event() {
SNES::sa1.disassemble_opcode(t, SNES::sa1.opcode_pc, config().debugger.showHClocks);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#008000'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.coprocessorStepColor());
if (!color.isValid()) {
color = QColor("#008000");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSA1->refresh(SNES::sa1.opcode_pc);
registerEditSA1->setEnabled(true);
} break;
Expand All @@ -676,7 +716,11 @@ void Debugger::event() {
SNES::superfx.disassemble_opcode(t, SNES::superfx.opcode_pc, true);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#008000'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.coprocessorStepColor());
if (!color.isValid()) {
color = QColor("#008000");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSFX->refresh(SNES::superfx.opcode_pc);
registerEditSFX->setEnabled(true);
} break;
Expand All @@ -685,7 +729,11 @@ void Debugger::event() {
SNES::supergameboy.disassemble_opcode(t, SNES::supergameboy.opcode_pc);
string s = t;
s.replace(" ", "&nbsp;");
echo(string() << "<font color='#008000'>" << s << "</font><br>");
QColor color = QColor(config().debugger.console.coprocessorStepColor());
if (!color.isValid()) {
color = QColor("#008000");
}
echo(string() << "<font color='" << color.name() << "'>" << s << "</font><br>");
debugSGB->refresh(SNES::supergameboy.opcode_pc);
registerEditSGB->setEnabled(true);
} break;
Expand Down Expand Up @@ -738,4 +786,20 @@ void Debugger::autoUpdate() {
}
}

void Debugger::refreshDebuggerViews() {
registerEditCPU->setEnabled(false);
registerEditSMP->setEnabled(false);
debugCPU->refresh(SNES::cpu.opcode_pc);
debugSMP->refresh(SNES::smp.opcode_pc);
registerEditCPU->setEnabled(true);
registerEditSMP->setEnabled(true);
}

void Debugger::refreshMemoryEditors() {
QVectorIterator<MemoryEditor*> i(memoryEditors);
while (i.hasNext()) {
i.next()->refresh();
}
}

#endif
7 changes: 5 additions & 2 deletions bsnes/ui-qt/debugger/debugger.moc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Debugger : public Window {
QAction *menu_misc_saveSymbols;
QAction *menu_misc_showHClocks;
QAction *menu_misc_options;
QAction *menu_misc_editColors;

QVBoxLayout *layout;
QSplitter *consoleLayout;
Expand Down Expand Up @@ -61,7 +62,7 @@ public slots:
void clear();
void synchronize();
void frameTick();

void toggleRunStatus();
void stepAction();
void stepOverAction();
Expand All @@ -71,7 +72,9 @@ public slots:
void stepToNMIAction();
void stepToIRQAction();
void createMemoryEditor();

void refreshDebuggerViews();
void refreshMemoryEditors();

protected:
void closeEvent(QCloseEvent *event);

Expand Down
Loading