2019-12-19 11:58:52 +00:00
|
|
|
#include <QAction>
|
2020-01-05 21:37:00 +00:00
|
|
|
#include <QApplication>
|
2019-12-19 11:58:52 +00:00
|
|
|
#include <QInputDialog>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QFontDatabase>
|
|
|
|
#include <QFontMetrics>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
#include "string_format.h"
|
|
|
|
#include "MemoryViewMIPSWnd.h"
|
2020-01-06 12:40:18 +00:00
|
|
|
#include "ui_MemoryViewMIPSWnd.h"
|
2019-12-19 11:58:52 +00:00
|
|
|
#include "DebugExpressionEvaluator.h"
|
|
|
|
|
2020-02-05 21:17:51 +00:00
|
|
|
CMemoryViewMIPSWnd::CMemoryViewMIPSWnd(QWidget* parent, CVirtualMachine& virtualMachine, CMIPS* ctx, int size)
|
|
|
|
: QWidget(parent)
|
2020-01-06 12:40:18 +00:00
|
|
|
, ui(new Ui::CMemoryViewMIPSWnd)
|
2019-12-19 11:58:52 +00:00
|
|
|
{
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->setupUi(this);
|
2019-12-19 21:37:47 +00:00
|
|
|
|
2019-12-21 18:48:44 +00:00
|
|
|
auto getByte = [ctx](uint32 address) {
|
2019-12-21 18:05:47 +00:00
|
|
|
return ctx->m_pMemoryMap->GetByte(address);
|
|
|
|
};
|
|
|
|
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->tableView->Setup(&virtualMachine, ctx, true);
|
|
|
|
ui->tableView->SetData(getByte, size);
|
2019-12-19 11:58:52 +00:00
|
|
|
|
2020-01-05 22:46:47 +00:00
|
|
|
UpdateStatusBar(0);
|
2020-01-06 12:40:18 +00:00
|
|
|
m_OnSelectionChangeConnection = ui->tableView->OnSelectionChange.Connect(std::bind(&CMemoryViewMIPSWnd::UpdateStatusBar, this, std::placeholders::_1));
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CMemoryViewMIPSWnd::~CMemoryViewMIPSWnd()
|
|
|
|
{
|
2020-01-06 12:40:18 +00:00
|
|
|
delete ui;
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryViewMIPSWnd::showEvent(QShowEvent* evt)
|
|
|
|
{
|
2020-02-05 21:17:51 +00:00
|
|
|
QWidget::showEvent(evt);
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->tableView->ShowEvent();
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryViewMIPSWnd::resizeEvent(QResizeEvent* evt)
|
|
|
|
{
|
2020-02-05 21:17:51 +00:00
|
|
|
QWidget::resizeEvent(evt);
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->tableView->ResizeEvent();
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryViewMIPSWnd::HandleMachineStateChange()
|
|
|
|
{
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->tableView->HandleMachineStateChange();
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int CMemoryViewMIPSWnd::GetBytesPerLine()
|
|
|
|
{
|
2020-01-06 12:40:18 +00:00
|
|
|
return ui->tableView->GetBytesPerLine();
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryViewMIPSWnd::SetBytesPerLine(int bytesForLine)
|
|
|
|
{
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->tableView->SetBytesPerLine(bytesForLine);
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|
|
|
|
|
2023-08-12 10:31:28 -04:00
|
|
|
void CMemoryViewMIPSWnd::SetAddress(uint32 address)
|
|
|
|
{
|
|
|
|
ui->tableView->SetSelectionStart(address);
|
|
|
|
}
|
|
|
|
|
2020-01-05 22:46:47 +00:00
|
|
|
void CMemoryViewMIPSWnd::UpdateStatusBar(uint32 address)
|
2019-12-19 11:58:52 +00:00
|
|
|
{
|
2020-01-05 22:46:47 +00:00
|
|
|
auto caption = string_format("Address : 0x%08X", address);
|
2020-01-06 12:40:18 +00:00
|
|
|
ui->addressEdit->setText(caption.c_str());
|
2019-12-19 11:58:52 +00:00
|
|
|
}
|