mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-12 05:54:03 +00:00
Fixing DMA runs
This commit is contained in:
@@ -87,10 +87,10 @@ namespace ComSquare::Debugger::CPU
|
||||
unsigned CPUDebug::update()
|
||||
{
|
||||
try {
|
||||
unsigned cycles = this->_cpu.runDMA(INT_MAX);
|
||||
unsigned cycles = 0;
|
||||
|
||||
if (this->_isPaused)
|
||||
return 0xFF;
|
||||
if (this->_isPaused || this->_cpu._isStopped)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < 0xFF; i++) {
|
||||
auto breakpoint = std::find_if(this->breakpoints.begin(), this->breakpoints.end(), [this](auto &brk) {
|
||||
@@ -104,6 +104,7 @@ namespace ComSquare::Debugger::CPU
|
||||
}
|
||||
this->_logInstruction();
|
||||
cycles += this->_cpu.executeInstruction();
|
||||
cycles += this->_cpu.runDMA(INT_MAX);
|
||||
this->_updateRegistersPanel();
|
||||
if (this->_isStepping) {
|
||||
this->_isStepping = false;
|
||||
@@ -115,12 +116,12 @@ namespace ComSquare::Debugger::CPU
|
||||
} catch (const DebuggableError &e) {
|
||||
this->pause(true);
|
||||
CPUDebug::showError(e);
|
||||
return 0xFF;
|
||||
return 0;
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << "An error occurred: " << e.what() << std::endl;
|
||||
QApplication::quit();
|
||||
}
|
||||
return 0xFF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CPUDebug::_logInstruction()
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "SNES.hpp"
|
||||
#include "Utility/Utility.hpp"
|
||||
#include "Exceptions/InvalidAction.hpp"
|
||||
#include <QScrollBar>
|
||||
|
||||
namespace ComSquare::Debugger
|
||||
{
|
||||
@@ -27,6 +28,11 @@ namespace ComSquare::Debugger
|
||||
for (int i = 0; i < this->_model.column; i++)
|
||||
this->_ui.log->setColumnWidth(i, this->_ui.log->width());
|
||||
|
||||
QMainWindow::connect(&this->_model, &BusLogModel::rowsInserted, [this] {
|
||||
if (this->_autoScroll)
|
||||
this->_ui.log->scrollToBottom();
|
||||
});
|
||||
|
||||
QMainWindow::connect(this->_ui.fromAPU, &QCheckBox::toggled, [this](bool checked) {
|
||||
this->_proxy.filters[0].apu = checked;
|
||||
this->_proxy.refresh();
|
||||
@@ -108,6 +114,10 @@ namespace ComSquare::Debugger
|
||||
this->_proxy.refresh();
|
||||
});
|
||||
|
||||
QMainWindow::connect(this->_ui.autoscroll, &QPushButton::pressed, [this]() {
|
||||
this->_autoScroll = !this->_autoScroll;
|
||||
});
|
||||
|
||||
QMainWindow::connect(this->_ui.clearBtn, &QPushButton::pressed, [this]() {
|
||||
this->_model.clearLogs();
|
||||
this->_proxy.refresh();
|
||||
|
||||
@@ -118,6 +118,8 @@ namespace ComSquare::Debugger
|
||||
BusLogModel _model;
|
||||
//! @brief A QT proxy to filter the logs.
|
||||
BusLoggerProxy _proxy;
|
||||
//! @brief True if the table should autoscroll. False otherwise.
|
||||
bool _autoScroll = true;
|
||||
public:
|
||||
explicit MemoryBusDebug(SNES &snes, Memory::IMemoryBus &bus);
|
||||
MemoryBusDebug(const MemoryBusDebug &) = delete;
|
||||
|
||||
Reference in New Issue
Block a user