Skip to content
Closed
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
62 changes: 21 additions & 41 deletions src/DebuggerForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,11 @@ void DebuggerForm::createForm()
dw->setMovable(false);
dw->setClosable(false);
connect(this, SIGNAL(settingsChanged()),
disasmView, SLOT(settingsChanged()));
disasmView, SLOT(updateLayout()));
connect(this, SIGNAL(symbolsChanged()),
disasmView, SLOT(symbolsChanged()));
disasmView, SLOT(refresh()));
connect(this, SIGNAL(breakStateEntered()),
disasmView, SLOT(refresh()));
connect(dw, SIGNAL(visibilityChanged(DockableWidget*)),
this, SLOT(dockWidgetVisibilityChanged(DockableWidget*)));

Expand All @@ -536,6 +538,8 @@ void DebuggerForm::createForm()
dw->setClosable(true);
connect(dw, SIGNAL(visibilityChanged(DockableWidget*)),
this, SLOT(dockWidgetVisibilityChanged(DockableWidget*)));
connect(this, SIGNAL(breakStateEntered()),
mainMemoryView, SLOT(refresh()));
mainMemoryView->setSymbolTable(&session.symbolTable());

// create register viewer
Expand Down Expand Up @@ -595,6 +599,8 @@ void DebuggerForm::createForm()
dw->setClosable(true);
connect(dw, SIGNAL(visibilityChanged(DockableWidget*)),
this, SLOT(dockWidgetVisibilityChanged(DockableWidget*)));
connect(this, SIGNAL(breakStateEntered()),
slotView, SLOT(refresh()));

// restore layout
restoreGeometry(Settings::get().value("Layout/WindowGeometry", saveGeometry()).toByteArray());
Expand Down Expand Up @@ -886,11 +892,9 @@ void DebuggerForm::finalizeConnection(bool halted)
// merge breakpoints on connect
mergeBreakpoints = true;
if (halted) {
setBreakMode();
breakOccured();
} else {
setRunMode();
updateData();
}

for (auto* w : dockMan.managedWidgets()) {
Expand Down Expand Up @@ -923,6 +927,7 @@ void DebuggerForm::breakOccured()
{
setBreakMode();
updateData();
emit breakStateEntered();
}

void DebuggerForm::updateData()
Expand All @@ -931,19 +936,11 @@ void DebuggerForm::updateData()
// only merge the first time after connect
mergeBreakpoints = false;

// refresh memory viewer
mainMemoryView->refresh();

// update registers
// note that a register update is processed, a signal is sent to other
// widgets as well. Any dependent updates shoud be called before this one.
auto* regs = new CPURegRequest(*this);
comm.sendCommand(regs);

// refresh slot viewer
slotView->refresh();

emit emulationChanged();
}

void DebuggerForm::setBreakMode()
Expand Down Expand Up @@ -1228,9 +1225,6 @@ void DebuggerForm::toggleSlotsDisplay()

void DebuggerForm::toggleBitMappedDisplay()
{
//toggleView(qobject_cast<DockableWidget*>(slotView->parentWidget()));
// not sure if this a good idea for a docable widget

// create new debuggable viewer window
auto* viewer = new BitMapViewer();
auto* dw = new DockableWidget(dockMan);
Expand All @@ -1241,30 +1235,16 @@ void DebuggerForm::toggleBitMappedDisplay()
dw->setDestroyable(true);
dw->setMovable(true);
dw->setClosable(true);
/*
connect(dw, SIGNAL(visibilityChanged(DockableWidget*)),
this, SLOT(dockWidgetVisibilityChanged(DockableWidget*)));
connect(this, SIGNAL(debuggablesChanged(const QMap<QString,int>&)),
viewer, SLOT(setDebuggables(const QMap<QString,int>&)));
*/

// TODO: refresh should be being hanled by VDPDataStore...
connect(this, SIGNAL(emulationChanged()), viewer, SLOT(refresh()));

/*
viewer->setDebuggables(debuggables);
viewer->setEnabled(disasmView->isEnabled());
*/
// TODO: refresh should be hanled by VDPDataStore...
connect(this, SIGNAL(breakStateEntered()), viewer,
SLOT(refresh()));
}

void DebuggerForm::toggleCharMappedDisplay()
{
//toggleView(qobject_cast<DockableWidget*>(slotView->parentWidget()));
// not sure if this a good idea for a docable widget

// create new debuggable viewer window
auto* viewer = new TileViewer();
// viewer->adjustSize();
// viewer->adjustSize();
auto* dw = new DockableWidget(dockMan);
dw->setWidget(viewer);
dw->setTitle(tr("Tile VRAM View"));
Expand All @@ -1273,10 +1253,10 @@ void DebuggerForm::toggleCharMappedDisplay()
dw->setDestroyable(true);
dw->setMovable(true);
dw->setClosable(true);
// dw->adjustSize();

// dw->adjustSize();
// TODO: refresh should be being hanled by VDPDataStore...
connect(this, SIGNAL(emulationChanged()), viewer, SLOT(refresh()));
connect(this, SIGNAL(breakStateEntered()), viewer,
SLOT(refresh()));
}

void DebuggerForm::toggleSpritesDisplay()
Expand All @@ -1296,7 +1276,7 @@ void DebuggerForm::toggleSpritesDisplay()
dw->setClosable(true);

// TODO: refresh should be being hanled by VDPDataStore...
connect(this, SIGNAL(emulationChanged()), viewer, SLOT(refresh()));
connect(this, SIGNAL(breakStateEntered()), viewer, SLOT(refresh()));
}

void DebuggerForm::toggleVDPCommandRegsDisplay()
Expand All @@ -1311,7 +1291,7 @@ void DebuggerForm::toggleVDPCommandRegsDisplay()
dw->setDestroyable(false);
dw->setMovable(true);
dw->setClosable(true);
connect(this, SIGNAL(emulationChanged()),
connect(this, SIGNAL(breakStateEntered()),
VDPCommandRegView, SLOT(refresh()));
} else {
toggleView(qobject_cast<DockableWidget*>(VDPCommandRegView->parentWidget()));
Expand All @@ -1330,7 +1310,7 @@ void DebuggerForm::toggleVDPRegsDisplay()
dw->setDestroyable(false);
dw->setMovable(true);
dw->setClosable(true);
connect(this, SIGNAL(emulationChanged()),
connect(this, SIGNAL(breakStateEntered()),
VDPRegView, SLOT(refresh()));
} else {
toggleView(qobject_cast<DockableWidget*>(VDPRegView->parentWidget()));
Expand All @@ -1349,7 +1329,7 @@ void DebuggerForm::toggleVDPStatusRegsDisplay()
dw->setDestroyable(false);
dw->setMovable(true);
dw->setClosable(true);
connect(this, SIGNAL(emulationChanged()),
connect(this, SIGNAL(breakStateEntered()),
VDPStatusRegView, SLOT(refresh()));
} else {
toggleView(qobject_cast<DockableWidget*>(VDPStatusRegView->parentWidget()));
Expand Down Expand Up @@ -1387,7 +1367,7 @@ void DebuggerForm::addDebuggableViewer()
this, SLOT(dockWidgetVisibilityChanged(DockableWidget*)));
connect(this, SIGNAL(debuggablesChanged(const QMap<QString,int>&)),
viewer, SLOT(setDebuggables(const QMap<QString,int>&)));
connect(this, SIGNAL(emulationChanged()),
connect(this, SIGNAL(breakStateEntered()),
viewer, SLOT(refresh()));
viewer->setDebuggables(debuggables);
viewer->setEnabled(disasmView->isEnabled());
Expand Down
14 changes: 7 additions & 7 deletions src/DebuggerForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public slots:
QAction* viewDebuggableViewerAction;

QAction* viewBitMappedAction;
QAction* viewCharMappedAction;
QAction* viewSpritesAction;
QAction* viewVDPStatusRegsAction;
QAction* viewCharMappedAction;
QAction* viewSpritesAction;
QAction* viewVDPStatusRegsAction;
QAction* viewVDPRegsAction;
QAction* viewVDPCommandRegsAction;

Expand Down Expand Up @@ -158,8 +158,8 @@ private slots:
void toggleSlotsDisplay();
void toggleMemoryDisplay();
void toggleBitMappedDisplay();
void toggleCharMappedDisplay();
void toggleSpritesDisplay();
void toggleCharMappedDisplay();
void toggleSpritesDisplay();
void toggleVDPRegsDisplay();
void toggleVDPStatusRegsDisplay();
void toggleVDPCommandRegsDisplay();
Expand All @@ -175,7 +175,7 @@ private slots:
void breakpointAdd();

void handleCommandReplyStatus(bool status);

void toggleView(DockableWidget* widget);
void initConnection();
void handleUpdate(const QString& type, const QString& name,
Expand All @@ -202,7 +202,7 @@ private slots:
void settingsChanged();
void symbolsChanged();
void debuggablesChanged(const QMap<QString, int>& list);
void emulationChanged();
void breakStateEntered();
};

#endif // DEBUGGERFORM_H
6 changes: 3 additions & 3 deletions src/DisasmViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ DisasmViewer::DisasmViewer(QWidget* parent)
scrollBar->setSingleStep(0);
scrollBar->setPageStep(0);

settingsChanged();
updateLayout();

// manual scrollbar handling routines (real size of the data is not known)
connect(scrollBar, SIGNAL(actionTriggered(int)),
Expand Down Expand Up @@ -104,7 +104,7 @@ void DisasmViewer::resizeEvent(QResizeEvent* e)
}
}

void DisasmViewer::settingsChanged()
void DisasmViewer::updateLayout()
{
frameL = frameT = frameB = frameWidth();
frameR = frameL + scrollBar->sizeHint().width();
Expand Down Expand Up @@ -135,7 +135,7 @@ void DisasmViewer::settingsChanged()
update();
}

void DisasmViewer::symbolsChanged()
void DisasmViewer::refresh()
{
int disasmStart = disasmLines.front().addr;
int disasmEnd = disasmLines.back().addr + disasmLines.back().numBytes;
Expand Down
4 changes: 2 additions & 2 deletions src/DisasmViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public slots:
void setProgramCounter(quint16 pc);
void scrollBarAction(int action);
void scrollBarChanged(int value);
void settingsChanged();
void symbolsChanged();
void updateLayout();
void refresh();

private:
void resizeEvent(QResizeEvent* e) override;
Expand Down
1 change: 1 addition & 0 deletions src/SlotViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void SlotViewer::refresh()
void SlotViewer::setMemoryLayout(MemoryLayout* ml)
{
memLayout = ml;
update();
}

void SlotViewer::slotsUpdated(const QString& message)
Expand Down
4 changes: 3 additions & 1 deletion src/SlotViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class SlotViewer : public QFrame
public:
SlotViewer(QWidget* parent = nullptr);

void refresh();
void setMemoryLayout(MemoryLayout* ml);
void slotsUpdated(const QString& message);

QSize sizeHint() const override;

public slots:
void refresh();

private:
void resizeEvent(QResizeEvent* e) override;
void paintEvent(QPaintEvent* e) override;
Expand Down
11 changes: 7 additions & 4 deletions src/VDPDataStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ VDPDataStore& VDPDataStore::instance()

void VDPDataStore::refresh()
{
if (!got_version) return;

refresh1();
if (!got_version) {
// No connection? Establish it first.
CommClient::instance().sendCommand(new VDPDataStoreVersionCheck(*this));
} else {
refresh1();
}
}

void VDPDataStore::refresh1()
Expand All @@ -99,6 +102,7 @@ void VDPDataStore::refresh2()
"[ debug read_block {VDP status regs} 0 16 ]"
"[ debug read_block {VDP regs} 0 64 ]"
"[ debug read_block {VRAM pointer} 0 2 ]");
// receive contents of VRAM
new SimpleHexRequest(req, MAX_TOTAL_SIZE - MAX_VRAM_SIZE + vramSize, vram, *this);
}

Expand All @@ -107,7 +111,6 @@ void VDPDataStore::DataHexRequestReceived()
emit dataRefreshed();
}


const unsigned char* VDPDataStore::getVramPointer() const
{
return vram;
Expand Down
6 changes: 4 additions & 2 deletions src/VramBitMappedView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void VramBitMappedView::decode()

printf("\n"
"screenMode: %i\n"
"vram to start decoding: %i\n",
"vram address to start decoding: %i\n",
screenMode, vramAddress);
switch (screenMode) {
case 12:
Expand All @@ -70,7 +70,7 @@ void VramBitMappedView::decode()
decodeSCR5();
break;
}
piximage = piximage.fromImage(image);
piximage = QPixmap::fromImage(image);
update();
}

Expand Down Expand Up @@ -252,6 +252,8 @@ void VramBitMappedView::refresh()

void VramBitMappedView::mouseMoveEvent(QMouseEvent* e)
{
if (!vramBase) return;

static const unsigned bytes_per_line[] = {
0, //screen 0
1, //screen 1
Expand Down