From ec8d32378aacf67e5545af7ef45423a3266a9aeb Mon Sep 17 00:00:00 2001 From: Xele02 Date: Sun, 17 Feb 2013 21:42:54 +0100 Subject: [PATCH] Add possibility to modify memory values Optim time when parsing DList for debug. --- Qt/ctrlmemview.cpp | 28 ++++++++++++++++++++++++++++ Qt/ctrlmemview.h | 1 + Qt/debugger_displaylist.cpp | 15 ++++++++------- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Qt/ctrlmemview.cpp b/Qt/ctrlmemview.cpp index c7c6637436..0ebaa97775 100644 --- a/Qt/ctrlmemview.cpp +++ b/Qt/ctrlmemview.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "EmuThread.h" #include "Core/MemMap.h" @@ -221,6 +222,10 @@ void CtrlMemView::contextMenu(const QPoint &pos) connect(copyValue, SIGNAL(triggered()), this, SLOT(CopyValue())); menu.addAction(copyValue); + QAction *changeValue = new QAction(tr("C&hange value"), this); + connect(changeValue, SIGNAL(triggered()), this, SLOT(Change())); + menu.addAction(changeValue); + QAction *dump = new QAction(tr("Dump..."), this); connect(dump, SIGNAL(triggered()), this, SLOT(Dump())); menu.addAction(dump); @@ -230,7 +235,9 @@ void CtrlMemView::contextMenu(const QPoint &pos) void CtrlMemView::CopyValue() { + EmuThread_LockDraw(true); QApplication::clipboard()->setText(QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0'))); + EmuThread_LockDraw(false); } void CtrlMemView::Dump() @@ -238,6 +245,27 @@ void CtrlMemView::Dump() QMessageBox::information(this,"Sorry","This feature has not been implemented.",QMessageBox::Ok); } + +void CtrlMemView::Change() +{ + EmuThread_LockDraw(true); + QString curVal = QString("%1").arg(Memory::ReadUnchecked_U32(selection),8,16,QChar('0')); + EmuThread_LockDraw(false); + + bool ok; + QString text = QInputDialog::getText(this, tr("Set new value"), + tr("Set new value:"), QLineEdit::Normal, + curVal, &ok); + if (ok && !text.isEmpty()) + { + EmuThread_LockDraw(true); + Memory::WriteUnchecked_U32(text.toInt(0,16),selection); + EmuThread_LockDraw(false); + redraw(); + } +} + + int CtrlMemView::yToAddress(int y) { int ydiff=y-rect().bottom()/2-rowHeight/2; diff --git a/Qt/ctrlmemview.h b/Qt/ctrlmemview.h index 070b1af7f9..cc7f31c506 100644 --- a/Qt/ctrlmemview.h +++ b/Qt/ctrlmemview.h @@ -72,6 +72,7 @@ signals: public slots: void CopyValue(); void Dump(); + void Change(); private: int curAddress; int align; diff --git a/Qt/debugger_displaylist.cpp b/Qt/debugger_displaylist.cpp index 0d9771ac7c..c5103192f9 100644 --- a/Qt/debugger_displaylist.cpp +++ b/Qt/debugger_displaylist.cpp @@ -309,15 +309,16 @@ void Debugger_DisplayList::ShowDLCode() } usedIdxAddr.insert(iaddr); } - - for(int i = 0; i < ui->texturesList->columnCount(); i++) - ui->texturesList->resizeColumnToContents(i); - for(int i = 0; i < ui->vertexList->columnCount(); i++) - ui->vertexList->resizeColumnToContents(i); - for(int i = 0; i < ui->indexList->columnCount(); i++) - ui->indexList->resizeColumnToContents(i); } + + for(int i = 0; i < ui->texturesList->columnCount(); i++) + ui->texturesList->resizeColumnToContents(i); + for(int i = 0; i < ui->vertexList->columnCount(); i++) + ui->vertexList->resizeColumnToContents(i); + for(int i = 0; i < ui->indexList->columnCount(); i++) + ui->indexList->resizeColumnToContents(i); + UpdateVertexInfo(); UpdateIndexInfo(); }